Jump to content

Newpet system after relog - bonus problem


Recommended Posts

Hi. I have

bool CNewPetActor::Update(DWORD deltaTime)
{
	bool bResult = true;

	// Ćę ÁÖŔÎŔĚ Á׾ú°ĹłŞ, ĽŇČŻµČ ĆęŔÇ »óĹ°ˇ ŔĚ»óÇϴٸé ĆęŔ» ľřľÚ. (NOTE: °ˇ˛ű°ˇ´Ů ŔĚ·± Ŕú·± ŔĚŔŻ·Î ĽŇČŻµČ ĆęŔĚ DEAD »óĹÂżˇ şüÁö´Â °ćżě°ˇ ŔÖŔ˝-_-;)
	// ĆęŔ» ĽŇČŻÇŃ ľĆŔĚĹŰŔĚ ľř°ĹłŞ, ł»°ˇ °ˇÁř »óĹ°ˇ ľĆ´Ď¶ó¸é ĆęŔ» ľřľÚ.
	if (IsSummoned()) {
		if (m_pkOwner->IsImmortal() && Pet_Skill_Table[16][2 + m_dwskill[m_dwslotimm]] <= (get_global_time() - m_dwImmTime)*10) {
			//m_pkOwner->ChatPacket(CHAT_TYPE_INFO, "%d - %d  diff %d  Skilltable %d", get_global_time(), m_dwImmTime, (get_global_time() - m_dwImmTime) * 10, Pet_Skill_Table[16][2 + m_dwskill[m_dwslotimm]]);
			m_dwImmTime = 0;
			m_pkOwner->SetImmortal(0);
		}
	}
	// if (m_pkOwner->IsDead() || (IsSummoned() && m_pkChar->IsDead()) || (IsSummoned() && (m_pkOwner->GetExchange() || m_pkOwner->GetMyShop() || m_pkOwner->GetShopOwner() || m_pkOwner->IsOpenSafebox() || m_pkOwner->IsCubeOpen() || m_dwduration <= 0))
		// || NULL == ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())
		// || ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())->GetOwner() != this->GetOwner()
		// )
	if((this->GetSummonItemVID() != 0 && (NULL == ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID()) || ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())->GetOwner() != this->GetOwner())))
	{
		m_pkOwner->SetQuestFlag("PetSystems.pet_vnum", 0);
		m_pkOwner->SetQuestFlag("pet_item_id.pet_vnum", 0);
		this->Unsummon();
		return true;
	}

	if(this->IsSummoned() && HasOption(EPetOption_Followable))
	{
		bResult = bResult && this->_UpdateFollowAI();
	}

	return bResult;
}

and quest

quest PetSystems begin
	state start begin
		function get_pet_info(itemVnum)
			pet_info_map = {
			--  [ITEM VNUM] MOB_VNUM, DEFAULT NAME, buff_idx, spawn_effect_idx
				[55701]     = { 34041, "'s Kleiner Affe", 0},
				[55702]     = { 34045, "'s Kleine Spinne", 0},
				[55703]     = { 34049, "'s Kleiner Razador", 0},
				[55704]     = { 34053, "'s Kleiner Nemere", 0},
				
			}
			itemVnum = tonumber(itemVnum)
			return pet_info_map[itemVnum]
		end
		when login with pc.getqf("pet_vnum") != 0 begin
			item.select(pc.getqf("pet_item_id"))
			newpet.summon(pc.getqf("pet_vnum"), petName, false)
		end	
		when 55701.use or 55702.use or 55703.use or 55704.use begin
			local pet_info = PetSystems.get_pet_info(item.vnum)
			pc.setqf("pet_item_id", item.get_id())
			if null != pet_info then

				local mobVnum = pet_info[1]
				local petName = pet_info[2]
				

				if true == newpet.is_summon(mobVnum) then					
					newpet.unsummon(mobVnum)
					pc.setqf("pet_vnum", 0)
				else
					if newpet.count_summoned() < 1 then
						newpet.summon(mobVnum, petName, false)
						pc.setqf("pet_vnum", mobVnum)
					else
						syschat("You already summoned a pet.")
					end					
				end -- if pet.is_summon
			end  -- if null != pet_info
		end -- when
	end
end

Pet summons after relog but he doesn't give real bonuses. For example without pet: 103014 with pet: 104971, after relog 103166. Any ideas? 

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

  • Premium

Shitty c++ at least remove useless comments...

You're using "null" key to check in LUA?

You're passing deltaTime var without use it?

Pet bonus are from SQL, item_proto on the call item, you know?

 

https://stackoverflow.com/questions/31323443/lua-whats-the-difference-between-null-and-nil

Link to comment
Share on other sites

2 godziny temu, WeedHex napisał:

Shitty c++ at least remove useless comments...

You're using "null" key to check in LUA?

You're passing deltaTime var without use it?

Pet bonus are from SQL, item_proto on the call item, you know?

 

https://stackoverflow.com/questions/31323443/lua-whats-the-difference-between-null-and-nil

I used that "system" with old pet system and it works well so idk. So how i can make it? I know that bonuses are from mysql. Any tips?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.