Jump to content

Cripplez

Member
  • Posts

    118
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Cripplez

  1. Hello, I'm tryong to understand how the Party Heal should work, I think I have everything in the server side and client side but the button doesn't show up.

    When should it be ready for use the first time?

    Does this works normally for you?

     

    	// Party Heal Update
    	if (!m_bPartyHealReady)
    	{
    		if (!m_bCanUsePartyHeal && m_iLeadership >= 18)
    			m_dwPartyHealTime = get_dword_time();
    
    		m_bCanUsePartyHeal = m_iLeadership >= 18;
    
    		
    		DWORD PartyHealCoolTime = (m_iLeadership >= 40) ? PARTY_HEAL_COOLTIME_SHORT * 60 * 1000 : PARTY_HEAL_COOLTIME_LONG * 60 * 1;
    
    		if (m_bCanUsePartyHeal)
    		{
    			if (get_dword_time() > m_dwPartyHealTime + PartyHealCoolTime)
    			{
    				m_bPartyHealReady = true;
    
    				// send heal ready
    				if (0) 
    					if (GetLeaderCharacter())
    						GetLeaderCharacter()->ChatPacket(CHAT_TYPE_COMMAND, "PartyHealReady");
    			}
    		}
    	}

    EDIT:

    I removed the" if (0) " and it works fine, thank you :)

  2. Hello, I would like to remove the dialog page that ask you if you are sure to attach the metin stone to the armor/weapon, I'd like that the stone is immediatly added to the item when you place the stone on the item.

    I tried to make some changes in uiattachmetin.py but I couldn't do it, it should immetiadly do this part when you place the stone:

    def Accept(self):
            net.SendItemUseToItemPacket(self.metinItemPos, self.targetItemPos)
            snd.PlaySound("sound/ui/metinstone_insert.wav")
            self.Close()

    import dbg
    import player
    import item
    import net
    import snd
    import ui
    import uiToolTip
    import localeInfo
    
    class AttachMetinDialog(ui.ScriptWindow):
    	def __init__(self):
    		ui.ScriptWindow.__init__(self)
    		self.__LoadScript()
    
    		self.metinItemPos = 0
    		self.targetItemPos = 0
    
    	def __LoadScript(self):
    		try:
    			pyScrLoader = ui.PythonScriptLoader()
    			pyScrLoader.LoadScriptFile(self, "uiscript/attachstonedialog.py")
    
    		except:
    			import exception
    			exception.Abort("AttachStoneDialog.__LoadScript.LoadObject")
    
    		try:
    			self.board = self.GetChild("Board")
    			self.titleBar = self.GetChild("TitleBar")
    			self.metinImage = self.GetChild("MetinImage")
    			self.GetChild("AcceptButton").SetEvent(ui.__mem_func__(self.Accept))
    			self.GetChild("CancelButton").SetEvent(ui.__mem_func__(self.Close))
    		except:
    			import exception
    			exception.Abort("AttachStoneDialog.__LoadScript.BindObject")
    		
    		oldToolTip = uiToolTip.ItemToolTip()
    		oldToolTip.SetParent(self)
    		oldToolTip.SetPosition(15, 38)
    		oldToolTip.SetFollow(False)
    		oldToolTip.Show()
    		self.oldToolTip = oldToolTip
    
    		newToolTip = uiToolTip.ItemToolTip()
    		newToolTip.SetParent(self)
    		newToolTip.SetPosition(230 + 20, 38)
    		newToolTip.SetFollow(False)
    		newToolTip.Show()
    		self.newToolTip = newToolTip
    
    		self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
    
    	def __del__(self):
    		ui.ScriptWindow.__del__(self)
    
    	def Destroy(self):
    		self.ClearDictionary()
    		self.board = 0
    		self.titleBar = 0
    		self.metinImage = 0
    		self.toolTip = 0
    
    	def CanAttachMetin(self, slot, metin):
    		if item.METIN_NORMAL == metin:
    			if player.METIN_SOCKET_TYPE_SILVER == slot or player.METIN_SOCKET_TYPE_GOLD == slot:
    				return True
    
    		elif item.METIN_GOLD == metin:
    			if player.METIN_SOCKET_TYPE_GOLD == slot:
    				return True
    
    	def Open(self, metinItemPos, targetItemPos):
    		self.metinItemPos = metinItemPos
    		self.targetItemPos = targetItemPos
    
    		metinIndex = player.GetItemIndex(metinItemPos)
    		itemIndex = player.GetItemIndex(targetItemPos)
    		self.oldToolTip.ClearToolTip()
    		self.newToolTip.ClearToolTip()
    
    		item.SelectItem(metinIndex)
    
    		## Metin Image
    		try:
    			self.metinImage.LoadImage(item.GetIconImageFileName())
    		except:
    			dbg.TraceError("AttachMetinDialog.Open.LoadImage - Failed to find item data")
    
    		## Old Item ToolTip
    		metinSlot = []
    		for i in xrange(player.METIN_SOCKET_MAX_NUM):
    			metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
    		self.oldToolTip.AddItemData(itemIndex, metinSlot)
    
    		## New Item ToolTip
    		item.SelectItem(metinIndex)
    		metinSubType = item.GetItemSubType()
    
    		metinSlot = []
    		for i in xrange(player.METIN_SOCKET_MAX_NUM):
    			metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
    		for i in xrange(player.METIN_SOCKET_MAX_NUM):
    			slotData = metinSlot[i]
    			if self.CanAttachMetin(slotData, metinSubType):
    				metinSlot[i] = metinIndex
    				break
    		self.newToolTip.AddItemData(itemIndex, metinSlot)
    
    		self.UpdateDialog()
    		self.SetTop()
    		self.Show()
    
    	def UpdateDialog(self):
    		newWidth = self.newToolTip.GetWidth() + 230 + 15 + 20
    		newHeight = self.newToolTip.GetHeight() + 98
    
    		if localeInfo.IsARABIC():
    			self.board.SetPosition( newWidth, 0 )
    
    			(x,y) = self.titleBar.GetLocalPosition()
    			self.titleBar.SetPosition( newWidth - 15, y )
    
    		self.board.SetSize(newWidth, newHeight)
    		self.titleBar.SetWidth(newWidth-15)
    		self.SetSize(newWidth, newHeight)
    
    		(x, y) = self.GetLocalPosition()
    		self.SetPosition(x, y)
    
    	def Accept(self):
    		net.SendItemUseToItemPacket(self.metinItemPos, self.targetItemPos)
    		snd.PlaySound("sound/ui/metinstone_insert.wav")
    		self.Close()
    
    	def Close(self):
    		self.Hide()

     

  3. 1 hour ago, Vanilla said:

     

     Thank you very much!!! :)

     

    I did like this and it seems it is works perfectly, with full inventory i receive the item with drop owership, otherwise it goes to a new slot

     

    	if (prob <= prt->prob)
    	{
    		
    		LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_vnum, 1, 0, false);
    		int pos = GetEmptyInventory(item->GetSize());
    
    		if (pkNewItem)
    		{
    			ITEM_MANAGER::CopyAllAttrTo(item, pkNewItem);
    			LogManager::instance().ItemLog(this, pkNewItem, "REFINE SUCCESS", pkNewItem->GetName());
    
    			//BYTE bCell = item->GetCell();
    
    			// DETAIL_REFINE_LOG
    			NotifyRefineSuccess(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER");
    			DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, item->GetVnum(), -cost);
    			item->SetCount(item->GetCount() - 1);
    			//ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE SUCCESS)");
    			// END_OF_DETAIL_REFINE_LOG
    
    			//pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell));
    			if ((pos = GetEmptyInventory(item->GetSize())) != -1)
    			{
    				pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, pos));
    				ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem);
    
    			}
    			else
    			{
    				PIXEL_POSITION pos = GetXYZ();
    				LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_vnum, 1, 0, false);
    				ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem);
    				pkNewItem->AddToGround(GetMapIndex(), pos);
    				pkNewItem->SetOwnership(this);
    
    				pkNewItem->StartDestroyEvent();
    
    				pos.x += number(-7, 7) * 20;
    				pos.y += number(-7, 7) * 20;
    			}
    			
    			sys_log(0, "Refine Success %d", cost);
    			pkNewItem->AttrLog();
    			//PointChange(POINT_GOLD, -cost);
    			sys_log(0, "PayPee %d", cost);
    			PayRefineFee(cost);
    			sys_log(0, "PayPee End %d", cost);
    			
    		}
    	}

     

     

    • Love 2
  4. I made some changes and now when the refine fails it correcly remove only one stone instead of all the stack.

    But when I succesfully refine the stone it remove all the stack of stones and give me the new stone.

     

    The problem should be here, because I think the new stone replace the position of the old item instead of going in another free space of my inventory, understand what I mean?

    this is the code from char_item.cpp

     

    if (prob <= prt->prob)
    	{
    		
    		LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_vnum, 1, 0, false);
    
    		if (pkNewItem)
    		{
    			ITEM_MANAGER::CopyAllAttrTo(item, pkNewItem);
    			LogManager::instance().ItemLog(this, pkNewItem, "REFINE SUCCESS", pkNewItem->GetName());
    
    			BYTE bCell = item->GetCell();
    
    			// DETAIL_REFINE_LOG
    			NotifyRefineSuccess(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER");
    			DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, item->GetVnum(), -cost);
    			item->SetCount(item->GetCount() - 1);
    			//ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE SUCCESS)");
    			// END_OF_DETAIL_REFINE_LOG
    			
            	// ***** I THINK THE PROBLEM COULD BE HERE *****
    			pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell));
    			ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem);
    
    			sys_log(0, "Refine Success %d", cost);
    			pkNewItem->AttrLog();
    			//PointChange(POINT_GOLD, -cost);
    			sys_log(0, "PayPee %d", cost);
    			PayRefineFee(cost);
    			sys_log(0, "PayPee End %d", cost);
    		}
    		else
    		{
    			// DETAIL_REFINE_LOG
    			
    			sys_err("cannot create item %u", result_vnum);
    			NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER");
    			// END_OF_DETAIL_REFINE_LOG
    		}
    	}
    	else
    	{
    		
    		DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, item->GetVnum(), -cost);
    		NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER");
    		item->AttrLog();
        	 // ***** THIS CORRECLY REMOVE ONLY ONE STONE WHEN REFINE FAIL *****
    		item->SetCount(item->GetCount() - 1);
    		//ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE FAIL)");
    
    		//PointChange(POINT_GOLD, -cost);
    		PayRefineFee(cost);
    	}

     

    I think I should change this part so instead of going the the same inventory space of the refined item it should go to a new inventory free space

    Do you know how this part should be coded? Thank you :)

     

    pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell));

     

    46 minutes ago, Vanilla said:

    With upgrade you mean refining them?

    If that's the case than look at the way metin2 handles refining. If I'm not mistaken the item gets removed and then a new, refined one, is given to the player with same attributes/etc.. But it's just from my memory. That'd explain why your stone stack is missing because the refinement shouldn't check for a higher quantity, usually it was just meant for single equipment to be used with.

     

  5. Thank you guys! :)

     

    I found this too on char_affect.cpp

     

    	if (GetPoint(POINT_HP_RECOVERY) > 0)
    	{
    		if (GetMaxHP() <= GetHP())
    		{
    			PointChange(POINT_HP_RECOVERY, -GetPoint(POINT_HP_RECOVERY));
    		}
    		else
    		{
    			int iVal = MIN(GetPoint(POINT_HP_RECOVERY), GetMaxHP() * 7 / 100);
    
    			PointChange(POINT_HP, iVal);
    			PointChange(POINT_HP_RECOVERY, -iVal);
    		}
    	}

     

    I changed the  " * 7 / 100 " part with 2 / 100 so now i should get 2% of hp with automatic potion with each tick of heal

     

    • Love 1
  6. Hi, I would need a quest that start when you kill mobs, and based on your level, drop different item.

    But i don't know if something like this may cause too much lag and should be better doing it ina  different way

    This is an example of what i would need to do:

    quest test_drop begin
    	state start begin
    		when kill with not npc.is_pc() begin
    			-- not sure how to do this part, if mob is 10 level > or < than pc_leven then return
    				return
    				
    			else
    				local drop math.random(1, 10000)
    				local items1 = {101, 102, 103, 104, 105, 106} 
    				local items2 = {201, 202, 203, 204, 205, 206} 
    				local items3 = {301, 302, 303, 304, 305, 306} 
    				local items4 = {401, 402, 43, 404, 405, 406} 
    				local items5 = {501, 502, 503, 504, 505, 506} 
    				if drop <= 100 then
    					if pc.get_level() > 19 and pc.get_level() < 40 then
    						game.drop_item_with_ownership(items1[number(1, table.getn(items1))])
    					elseif pc.get_level() > 39 and pc.get_level() < 60 then
    						game.drop_item_with_ownership(items2[number(1, table.getn(items2))])
    					elseif pc.get_level() > 59 and pc.get_level() < 80 then
    						game.drop_item_with_ownership(items3[number(1, table.getn(items3))])
    					elseif pc.get_level() > 79 and pc.get_level() < 99 then
    						game.drop_item_with_ownership(items4[number(1, table.getn(items4))])
    					elseif pc.get_level() > 99 then
    						game.drop_item_with_ownership(items5[number(1, table.getn(items5))])
    				else
    					return
    				end
    			end
    		end
    	end
    end

     

  7. 5 hours ago, VegaS™ said:

    You added it wrong, not inside of GetHorseLevel > 0, outside of condition. 

      Reveal hidden contents
    
    
    	if (ch->GetHorseLevel() > 0)
    	{
    		DWORD pid = ch->GetPlayerID();
    
    		if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL)
    			db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD));
    		//@fix horse_level update at login
    		ch->SetHorseLevel(ch->GetHorseLevel());
    		ch->SkillLevelPacket();
    	}
    #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON
    	if (ch && ch->GetDungeon())
    	{
    		if (ch->IsHorseRiding())
    		{
    			ch->StopRiding();
    			ch->HorseSummon(false);
    		}
    
    		if (ch->FindAffect(AFFECT_MOUNT))
    		{
    			ch->RemoveAffect(AFFECT_MOUNT);
    			ch->RemoveAffect(AFFECT_MOUNT_BONUS);
    		}
    	}
    #endif

     

     

    Okay

    I tried like this but when i'm riding a mount it still doesn't make me unmount it :( with the horse it is perfect

  8. Hi,

    I'd like to make that with a specific vnum (like 299, 399, 499 ecc) the   

     int iSkillBonus = 
    int iNormalHitBonus =

    will be different, I don't think this is the right way to do it, it is just an example to explain how i'd like to do it

    Thank you

     

    void CItemAddonManager::ApplyAddonTo(int iAddonType, LPITEM pItem)
    {
    	if (!pItem)
    	{
    		sys_err("ITEM pointer null");
    		return;
    	}
    
    	//FOR EXAMPLE SOMETHING LIKE THIS:
      
      	    switch (item->GetVnum())
    	    {
    		case 299:	
    		case 399:	
    		case 499:	
    		case 599:	
    	
            int iSkillBonus = MINMAX(-40, (int) (gauss_random(0, 5) + 0.5f), 40);
    		int iNormalHitBonus = 0;
    		if (abs(iSkillBonus) <= 30)
    			iNormalHitBonus = -2 * iSkillBonus + abs(number(-8, 8) + number(-8, 8)) + number(1, 4);
    		else
    			iNormalHitBonus = -2 * iSkillBonus + number(1, 5);
    
    		pItem->RemoveAttributeType(APPLY_SKILL_DAMAGE_BONUS);
    		pItem->RemoveAttributeType(APPLY_NORMAL_HIT_DAMAGE_BONUS);
    		pItem->AddAttribute(APPLY_NORMAL_HIT_DAMAGE_BONUS, iNormalHitBonus);
    		pItem->AddAttribute(APPLY_SKILL_DAMAGE_BONUS, iSkillBonus);
    		}
      		//ELSE IF THE VNUM ISN'T ABOVE, DO THIS ATTRIBUTE
      
    	int iSkillBonus = MINMAX(-30, (int) (gauss_random(0, 5) + 0.5f), 30);
    	int iNormalHitBonus = 0;
    	if (abs(iSkillBonus) <= 20)
    		iNormalHitBonus = -2 * iSkillBonus + abs(number(-8, 8) + number(-8, 8)) + number(1, 4);
    	else
    		iNormalHitBonus = -2 * iSkillBonus + number(1, 5);
    
    	pItem->RemoveAttributeType(APPLY_SKILL_DAMAGE_BONUS);
    	pItem->RemoveAttributeType(APPLY_NORMAL_HIT_DAMAGE_BONUS);
    	pItem->AddAttribute(APPLY_NORMAL_HIT_DAMAGE_BONUS, iNormalHitBonus);
    	pItem->AddAttribute(APPLY_SKILL_DAMAGE_BONUS, iSkillBonus);
    }

     

  9. 11 hours ago, VegaS™ said:

    Not tested, but you can try to do something like:

    • Srcs/Server/game/src/questlua_horse.cpp
      Hide contents
    
    
    // Search in horse_summon function:
    		bool bFromFar = lua_isboolean(L, 1) ? lua_toboolean(L, 1) : false;
    // Add before:
    #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON
    		if (ch && ch->GetDungeon() && ch->IsHorseRiding())
    		{
    			ch->StopRiding();
    			ch->HorseSummon(false);
    			return 0;
    		}
    #endif
    • Srcs/Server/game/src/questlua_pc.cpp
      Hide contents
    
    
    // Search in pc_mount_bonus function:
    		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
    // Add after:
    #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON
    		if (ch && ch->GetDungeon() && ch->FindAffect(AFFECT_MOUNT))
    		{
    			ch->RemoveAffect(AFFECT_MOUNT);
    			ch->RemoveAffect(AFFECT_MOUNT_BONUS);
    			return 0;
    		}
    #endif
    • Srcs/Server/game/src/input_login.cpp
      Hide contents
    
    
    // Search in CInputLogin::Entergame(LPDESC d, const char * data) for:
    	if (ch->GetHorseLevel() > 0)
    	{
    		DWORD pid = ch->GetPlayerID();
    
    		if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL)
    			db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD));
    	}
    // Add after:
    #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON
    		if (ch && ch->GetDungeon())
    		{
    			if (ch->IsHorseRiding())
    			{
    				ch->StopRiding();
    				ch->HorseSummon(false);
    			}
    
    			if (ch->FindAffect(AFFECT_MOUNT))
    			{
    				ch->RemoveAffect(AFFECT_MOUNT);
    				ch->RemoveAffect(AFFECT_MOUNT_BONUS);
    			}
    		}
    #endif
    • Srcs/Server/game/service.h
      Hide contents
    
    
    #define ENABLE_BLOCK_RIDING_IN_DUNGEON

    Thank you, it is working for horse, but not for the mount :(

    Maybe is because first the game read if i'm riding and make me StopRiding, but if I login in a map while i was riding a mount, the game doesn't immediatly know I'm riding and update my character riding 1 second later? Sometimes when i login with a mount i see my character standing and 1 second later i am riding again my mount

    I'm not sure if i did this part as you write in your message, maybe the problem is here?

    Spoiler
    
    	if (ch->GetHorseLevel() > 0)
    	{
    		DWORD pid = ch->GetPlayerID();
    
    		if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL)
    			db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD));
    		//@fix horse_level update at login
    		ch->SetHorseLevel(ch->GetHorseLevel());
    		ch->SkillLevelPacket();
    #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON
    		if (ch && ch->GetDungeon())
    		{
    			if (ch->IsHorseRiding())
    			{
    				ch->StopRiding();
    				ch->HorseSummon(false);
    			}
    
    			if (ch->FindAffect(AFFECT_MOUNT))
    			{
    				ch->RemoveAffect(AFFECT_MOUNT);
    				ch->RemoveAffect(AFFECT_MOUNT_BONUS);
    			}
    		}
    #endif
    	}

     

     

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.