No message when mobs drop gil

Forum rules
NO LONGER BEING MAINTAINED!
Post Reply
anglos
Posts: 29
Joined: Wed Jul 25, 2012 12:38 pm

No message when mobs drop gil

Post by anglos » Wed Jan 23, 2013 3:29 pm

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?

anglos
Posts: 29
Joined: Wed Jul 25, 2012 12:38 pm

Re: No message when mobs drop gil

Post by anglos » Wed Jan 23, 2013 5:02 pm

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.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: No message when mobs drop gil

Post by kjLotus » Wed Jan 23, 2013 5:46 pm

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)

anglos
Posts: 29
Joined: Wed Jul 25, 2012 12:38 pm

Re: No message when mobs drop gil

Post by anglos » Wed Jan 23, 2013 5:49 pm

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));
			}
		}

twistedvengeance
Posts: 16
Joined: Tue Jan 22, 2013 12:10 pm

Re: No message when mobs drop gil

Post by twistedvengeance » Wed Jan 23, 2013 5:55 pm

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.

anglos
Posts: 29
Joined: Wed Jul 25, 2012 12:38 pm

Re: No message when mobs drop gil

Post by anglos » Wed Jan 23, 2013 6:00 pm

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.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: No message when mobs drop gil

Post by kjLotus » Wed Jan 23, 2013 7:04 pm

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

lautan
Developer
Posts: 164
Joined: Mon Jul 30, 2012 6:17 pm

Re: No message when mobs drop gil

Post by lautan » Wed Jan 23, 2013 8:29 pm

Just added this to main repository.

anglos
Posts: 29
Joined: Wed Jul 25, 2012 12:38 pm

Re: No message when mobs drop gil

Post by anglos » Wed Jan 23, 2013 10:04 pm

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));
			}
		}

Post Reply