Page 1 of 1

No message when mobs drop gil

Posted: Wed Jan 23, 2013 3:29 pm
by anglos
I've noticed lately that when mobs drop gil, there's no message stating that a player has received gil. It's not a showstopper but was definitely confusing. Any thoughts on where to look?

Re: No message when mobs drop gil

Posted: Wed Jan 23, 2013 5:02 pm
by anglos

Code: Select all

PChar->pushPacket(new CMessageDebugPacket(PChar, PChar, [b]VARIABLE HERE[/b], 0, 565));
Putting the above in the DistributeGil function seems to be the fix. Not sure if that's retail-correct though.

Re: No message when mobs drop gil

Posted: Wed Jan 23, 2013 5:46 pm
by kjLotus
anglos wrote:

Code: Select all

PChar->pushPacket(new CMessageDebugPacket(PChar, PChar, [b]VARIABLE HERE[/b], 0, 565));
Putting the above in the DistributeGil function seems to be the fix. Not sure if that's retail-correct though.
probably not a debug packet would be more correct

(i think, i'm no master of packets by any means)

Re: No message when mobs drop gil

Posted: Wed Jan 23, 2013 5:49 pm
by anglos
kjLotus wrote:
anglos wrote:

Code: Select all

PChar->pushPacket(new CMessageDebugPacket(PChar, PChar, [b]VARIABLE HERE[/b], 0, 565));
Putting the above in the DistributeGil function seems to be the fix. Not sure if that's retail-correct though.
probably not a debug packet would be more correct

(i think, i'm no master of packets by any means)
What would be the alternative to the DebugPacket? I just figured this out hunting through stuff. Also, I made a mistake above.

Solo:

Code: Select all

else if (distance(PChar->loc.p, PMob->loc.p) < 100)
    {
        UpdateItem(PChar, LOC_INVENTORY, 0, gil);
		PChar->pushPacket(new CMessageDebugPacket(PChar, PChar, gil, 0, 565));
	}
Party:

Code: Select all

for (uint8 i = 0; i < PChar->PParty->members.size(); i++)
		{
            CCharEntity* PMember = (CCharEntity*)PChar->PParty->members[i];
			if (PMember->getZone() == PMob->getZone() && distance(PMember->loc.p, PMob->loc.p) < 100)
			{
                UpdateItem(PMember, LOC_INVENTORY, 0, gilperperson);
				PMember->pushPacket(new CMessageDebugPacket(PMember, PMember, gilperperson, 0, 565));
			}
		}

Re: No message when mobs drop gil

Posted: Wed Jan 23, 2013 5:55 pm
by twistedvengeance
party:

Code: Select all

if (PMember->getZone() == PMob->getZone() && distance(PMember->loc.p, PMob->loc.p) < 100)
{
	UpdateItem(PMember, LOC_INVENTORY, 0, gilperperson);
	PChar->pushPacket(new CMessageDebugPacket(PChar, PChar, gilperperson, 0, 565));
}
alone:

Code: Select all

else if (distance(PChar->loc.p, PMob->loc.p) < 100)
{
	UpdateItem(PChar, LOC_INVENTORY, 0, gil);
	PChar->pushPacket(new CMessageDebugPacket(PChar, PChar, gil, 0, 565));
}
Also! If you want everything to drop gil,
(ai/ai_mob_dummy.cpp)
Original:

Code: Select all

if(m_PMob->m_EcoSystem == SYSTEM_BEASTMEN || m_PMob->m_Type & MOBTYPE_NOTORIOUS)
{
	charutils::DistributeGil(PChar, m_PMob); // TODO: REALISATION MUST BE IN TREASUREPOOL
}
To make everything drop gil:

Code: Select all

//if(m_PMob->m_EcoSystem == SYSTEM_BEASTMEN || m_PMob->m_Type & MOBTYPE_NOTORIOUS)
//{
	charutils::DistributeGil(PChar, m_PMob); // TODO: REALISATION MUST BE IN TREASUREPOOL
//}
Or you can just remove the commented lines.

Re: No message when mobs drop gil

Posted: Wed Jan 23, 2013 6:00 pm
by anglos
twistedvengeance,

That's what I've got so far except for party, I used pmember within the party loop as pchar was causing only one person to get the message instead of all members of the party.

By the way, thank you all for your assistance.

Re: No message when mobs drop gil

Posted: Wed Jan 23, 2013 7:04 pm
by kjLotus
anglos wrote:What would be the alternative to the DebugPacket? I just figured this out hunting through stuff. Also, I made a mistake above.
probably CMessageBasicPacket(sender, target, param, value, 565)

not sure which (param or value) is the gil amount, it'll be one of em

Re: No message when mobs drop gil

Posted: Wed Jan 23, 2013 8:29 pm
by lautan
Just added this to main repository.

Re: No message when mobs drop gil

Posted: Wed Jan 23, 2013 10:04 pm
by anglos
lautan wrote:Just added this to main repository.
Hi Luatan,

I found that if you use PChar in the party loop for the gil message, the person that lands the killing blow gets the gil message x the number of party members while no one else gets the message. Everyone gets gil though.

This was my solution:

Code: Select all

        uint32 gilperperson = count == 0 ? gil : (gil / count);

		for (uint8 i = 0; i < PChar->PParty->members.size(); i++)
		{
            CCharEntity* PMember = (CCharEntity*)PChar->PParty->members[i];
			if (PMember->getZone() == PMob->getZone() && distance(PMember->loc.p, PMob->loc.p) < 100)
			{
                UpdateItem(PMember, LOC_INVENTORY, 0, gilperperson);
				PMember->pushPacket(new CMessageDebugPacket(PMember, PMember, gilperperson, 0, 565));
			}
		}