Target not required for newer clients in QuestReward

This commit is contained in:
Michael Cook (mackal) 2020-02-02 16:39:46 -05:00
parent f195820854
commit 424b669cbb

View File

@ -8533,7 +8533,7 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold,
memset(outapp->pBuffer, 0, sizeof(QuestReward_Struct)); memset(outapp->pBuffer, 0, sizeof(QuestReward_Struct));
QuestReward_Struct* qr = (QuestReward_Struct*)outapp->pBuffer; QuestReward_Struct* qr = (QuestReward_Struct*)outapp->pBuffer;
qr->mob_id = target->GetID(); // Entity ID for the from mob name qr->mob_id = target ? target->GetID() : 0; // Entity ID for the from mob name
qr->target_id = GetID(); // The Client ID (this) qr->target_id = GetID(); // The Client ID (this)
qr->copper = copper; qr->copper = copper;
qr->silver = silver; qr->silver = silver;
@ -8550,7 +8550,7 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold,
if (faction) if (faction)
{ {
if (target->IsNPC()) if (target && target->IsNPC())
{ {
int32 nfl_id = target->CastToNPC()->GetNPCFactionID(); int32 nfl_id = target->CastToNPC()->GetNPCFactionID();
SetFactionLevel(CharacterID(), nfl_id, GetBaseClass(), GetBaseRace(), GetDeity(), true); SetFactionLevel(CharacterID(), nfl_id, GetBaseClass(), GetBaseRace(), GetDeity(), true);
@ -8575,7 +8575,7 @@ void Client::QuestReward(Mob* target, const QuestReward_Struct &reward, bool fac
memcpy(qr, &reward, sizeof(QuestReward_Struct)); memcpy(qr, &reward, sizeof(QuestReward_Struct));
// not set in caller because reasons // not set in caller because reasons
qr->mob_id = target->GetID(); // Entity ID for the from mob name qr->mob_id = target ? target->GetID() : 0; // Entity ID for the from mob name
if (reward.copper > 0 || reward.silver > 0 || reward.gold > 0 || reward.platinum > 0) if (reward.copper > 0 || reward.silver > 0 || reward.gold > 0 || reward.platinum > 0)
AddMoneyToPP(reward.copper, reward.silver, reward.gold, reward.platinum, false); AddMoneyToPP(reward.copper, reward.silver, reward.gold, reward.platinum, false);
@ -8586,7 +8586,7 @@ void Client::QuestReward(Mob* target, const QuestReward_Struct &reward, bool fac
if (faction) if (faction)
{ {
if (target->IsNPC()) if (target && target->IsNPC())
{ {
int32 nfl_id = target->CastToNPC()->GetNPCFactionID(); int32 nfl_id = target->CastToNPC()->GetNPCFactionID();
SetFactionLevel(CharacterID(), nfl_id, GetBaseClass(), GetBaseRace(), GetDeity(), true); SetFactionLevel(CharacterID(), nfl_id, GetBaseClass(), GetBaseRace(), GetDeity(), true);