@@ -263,7 +263,7 @@ Player::Player(WorldSession* session): Unit(true)
263263 SetLastRuneGraceTimer(i, 0);
264264 }
265265
266- for (uint8 i= 0; i < MAX_TIMERS; i++)
266+ for (uint8 i = 0; i < MAX_TIMERS; i++)
267267 m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
268268
269269 m_MirrorTimerFlags = UNDERWATER_NONE;
@@ -524,7 +524,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
524524 SetArenaFaction(0);
525525
526526 SetUInt32Value(PLAYER_GUILDID, 0);
527- SetRank (0);
527+ SetGuildRank (0);
528528 SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0);
529529
530530 for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
@@ -16746,14 +16746,17 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP) const
1674616746{
1674716747 uint32 questId = quest->GetQuestId();
1674816748 sGameEventMgr->HandleQuestComplete(questId);
16749- WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16750- data << uint32(questId) ;
16749+
16750+ uint32 xp ;
1675116751
1675216752 if (!IsMaxLevel())
16753- data << uint32(XP) ;
16753+ xp = XP ;
1675416754 else
16755- data << uint32(0) ;
16755+ xp = 0 ;
1675616756
16757+ WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16758+ data << uint32(questId);
16759+ data << uint32(xp);
1675716760 data << uint32(quest->GetRewOrReqMoney(this));
1675816761 data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
1675916762 data << uint32(quest->GetBonusTalents()); // bonus talents
@@ -18990,8 +18993,8 @@ void Player::SendSavedInstances()
1899018993 }
1899118994 }
1899218995
18993- //Send opcode 811 . true or false means, whether you have current raid/heroic instances
18994- data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP);
18996+ //Send opcode SMSG_UPDATE_INSTANCE_OWNERSHIP . true or false means, whether you have current raid/heroic instances
18997+ data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP, 4 );
1899518998 data << uint32(hasBeenSaved);
1899618999 SendDirectMessage(&data);
1899719000
@@ -19004,7 +19007,7 @@ void Player::SendSavedInstances()
1900419007 {
1900519008 if (itr->second.perm)
1900619009 {
19007- data.Initialize(SMSG_UPDATE_LAST_INSTANCE);
19010+ data.Initialize(SMSG_UPDATE_LAST_INSTANCE, 4 );
1900819011 data << uint32(itr->second.save->GetMapId());
1900919012 SendDirectMessage(&data);
1901019013 }
@@ -19771,7 +19774,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans)
1977119774 // save all changes to the item...
1977219775 if (item->GetState() != ITEM_NEW) // only for existing items, no duplicates
1977319776 item->SaveToDB(trans);
19774- // ...but do not save position in invntory
19777+ // ...but do not save position in inventory
1977519778 continue;
1977619779 }
1977719780 }
@@ -20437,7 +20440,7 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) const
2043720440 // 1: There are players offline in your party.
2043820441 // 2>: There are players in your party attempting to zone into an instance.
2043920442 */
20440- WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4 );
20443+ WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 8 );
2044120444 data << uint32(reason);
2044220445 data << uint32(MapId);
2044320446 SendDirectMessage(&data);
@@ -20747,6 +20750,16 @@ void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/,
2074720750 SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT), true);
2074820751}
2074920752
20753+ void Player::WhisperAddon(std::string const& text, Player* receiver)
20754+ {
20755+ std::string _text(text);
20756+ sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, uint32(LANG_ADDON), _text, receiver);
20757+
20758+ WorldPacket data;
20759+ ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_ADDON, this, this, _text);
20760+ receiver->SendDirectMessage(&data);
20761+ }
20762+
2075020763void Player::TextEmote(uint32 textId, WorldObject const* target /*= nullptr*/, bool /*isBossEmote = false*/)
2075120764{
2075220765 Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
@@ -26176,14 +26189,15 @@ void Player::SetReputation(uint32 factionentry, uint32 value)
2617626189{
2617726190 GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
2617826191}
26192+
2617926193uint32 Player::GetReputation(uint32 factionentry) const
2618026194{
2618126195 return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
2618226196}
2618326197
26184- std::string const& Player::GetGuildName() const
26198+ std::string Player::GetGuildName() const
2618526199{
26186- return sGuildMgr->GetGuildById(GetGuildId())->GetName();
26200+ return GetGuildId() ? sGuildMgr->GetGuildById(GetGuildId())->GetName() : "" ;
2618726201}
2618826202
2618926203void Player::SendDuelCountdown(uint32 counter)
@@ -26276,6 +26290,26 @@ PetStable& Player::GetOrInitPetStable()
2627626290 return *m_petStable;
2627726291}
2627826292
26293+ void Player::SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const
26294+ {
26295+ WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4 + 4 + 4 + 4 + 4 * 4 + 4 * 4);
26296+ data << uint64(item->GetGUID()); // item guid
26297+ data << uint32(error); // 0, or error code
26298+ if (!error)
26299+ {
26300+ data << uint32(item->GetPaidMoney()); // money cost
26301+ data << uint32(iece->HonorPoints); // honor point cost
26302+ data << uint32(iece->ArenaPoints); // arena point cost
26303+ for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26304+ {
26305+ data << uint32(iece->ItemID[i]);
26306+ data << uint32(iece->ItemCount[i]);
26307+ }
26308+ }
26309+
26310+ SendDirectMessage(&data);
26311+ }
26312+
2627926313void Player::RefundItem(Item* item)
2628026314{
2628126315 if (!item->IsRefundable())
@@ -26287,10 +26321,7 @@ void Player::RefundItem(Item* item)
2628726321 if (item->IsRefundExpired()) // item refund has expired
2628826322 {
2628926323 item->SetNotRefundable(this);
26290- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26291- data << uint64(item->GetGUID()); // Guid
26292- data << uint32(10); // Error!
26293- SendDirectMessage(&data);
26324+ SendItemRefundResult(item, nullptr, 10);
2629426325 return;
2629526326 }
2629626327
@@ -26328,25 +26359,11 @@ void Player::RefundItem(Item* item)
2632826359
2632926360 if (store_error)
2633026361 {
26331- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26332- data << uint64(item->GetGUID()); // Guid
26333- data << uint32(10); // Error!
26334- SendDirectMessage(&data);
26362+ SendItemRefundResult(item, iece, 10);
2633526363 return;
2633626364 }
2633726365
26338- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4+4+4+4+4*4+4*4);
26339- data << uint64(item->GetGUID()); // item guid
26340- data << uint32(0); // 0, or error code
26341- data << uint32(item->GetPaidMoney()); // money cost
26342- data << uint32(iece->HonorPoints); // honor point cost
26343- data << uint32(iece->ArenaPoints); // arena point cost
26344- for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26345- {
26346- data << uint32(iece->ItemID[i]);
26347- data << uint32(iece->ItemCount[i]);
26348- }
26349- SendDirectMessage(&data);
26366+ SendItemRefundResult(item, iece, 0);
2635026367
2635126368 uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem
2635226369
0 commit comments