@@ -251,7 +251,7 @@ Player::Player(WorldSession* session): Unit(true)
251251 SetLastRuneGraceTimer(i, 0);
252252 }
253253
254- for (uint8 i= 0; i < MAX_TIMERS; i++)
254+ for (uint8 i = 0; i < MAX_TIMERS; i++)
255255 m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
256256
257257 m_MirrorTimerFlags = UNDERWATER_NONE;
@@ -514,7 +514,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
514514 SetArenaFaction(0);
515515
516516 SetUInt32Value(PLAYER_GUILDID, 0);
517- SetRank (0);
517+ SetGuildRank (0);
518518 SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0);
519519
520520 for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
@@ -16684,14 +16684,17 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP) const
1668416684{
1668516685 uint32 questId = quest->GetQuestId();
1668616686 sGameEventMgr->HandleQuestComplete(questId);
16687- WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16688- data << uint32(questId) ;
16687+
16688+ uint32 xp ;
1668916689
1669016690 if (!IsMaxLevel())
16691- data << uint32(XP) ;
16691+ xp = XP ;
1669216692 else
16693- data << uint32(0) ;
16693+ xp = 0 ;
1669416694
16695+ WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16696+ data << uint32(questId);
16697+ data << uint32(xp);
1669516698 data << uint32(quest->GetRewOrReqMoney(this));
1669616699 data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
1669716700 data << uint32(quest->GetBonusTalents()); // bonus talents
@@ -18928,8 +18931,8 @@ void Player::SendSavedInstances()
1892818931 }
1892918932 }
1893018933
18931- //Send opcode 811 . true or false means, whether you have current raid/heroic instances
18932- data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP);
18934+ //Send opcode SMSG_UPDATE_INSTANCE_OWNERSHIP . true or false means, whether you have current raid/heroic instances
18935+ data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP, 4 );
1893318936 data << uint32(hasBeenSaved);
1893418937 SendDirectMessage(&data);
1893518938
@@ -18942,7 +18945,7 @@ void Player::SendSavedInstances()
1894218945 {
1894318946 if (itr->second.perm)
1894418947 {
18945- data.Initialize(SMSG_UPDATE_LAST_INSTANCE);
18948+ data.Initialize(SMSG_UPDATE_LAST_INSTANCE, 4 );
1894618949 data << uint32(itr->second.save->GetMapId());
1894718950 SendDirectMessage(&data);
1894818951 }
@@ -19709,7 +19712,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans)
1970919712 // save all changes to the item...
1971019713 if (item->GetState() != ITEM_NEW) // only for existing items, no duplicates
1971119714 item->SaveToDB(trans);
19712- // ...but do not save position in invntory
19715+ // ...but do not save position in inventory
1971319716 continue;
1971419717 }
1971519718 }
@@ -20375,7 +20378,7 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) const
2037520378 // 1: There are players offline in your party.
2037620379 // 2>: There are players in your party attempting to zone into an instance.
2037720380 */
20378- WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4 );
20381+ WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 8 );
2037920382 data << uint32(reason);
2038020383 data << uint32(MapId);
2038120384 SendDirectMessage(&data);
@@ -20685,6 +20688,16 @@ void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/,
2068520688 SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT), true);
2068620689}
2068720690
20691+ void Player::WhisperAddon(std::string const& text, Player* receiver)
20692+ {
20693+ std::string _text(text);
20694+ sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, uint32(LANG_ADDON), _text, receiver);
20695+
20696+ WorldPacket data;
20697+ ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_ADDON, this, this, _text);
20698+ receiver->SendDirectMessage(&data);
20699+ }
20700+
2068820701void Player::TextEmote(uint32 textId, WorldObject const* target /*= nullptr*/, bool /*isBossEmote = false*/)
2068920702{
2069020703 Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
@@ -26114,14 +26127,15 @@ void Player::SetReputation(uint32 factionentry, uint32 value)
2611426127{
2611526128 GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
2611626129}
26130+
2611726131uint32 Player::GetReputation(uint32 factionentry) const
2611826132{
2611926133 return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
2612026134}
2612126135
26122- std::string const& Player::GetGuildName() const
26136+ std::string Player::GetGuildName() const
2612326137{
26124- return sGuildMgr->GetGuildById(GetGuildId())->GetName();
26138+ return GetGuildId() ? sGuildMgr->GetGuildById(GetGuildId())->GetName() : "" ;
2612526139}
2612626140
2612726141void Player::SendDuelCountdown(uint32 counter)
@@ -26214,6 +26228,26 @@ PetStable& Player::GetOrInitPetStable()
2621426228 return *m_petStable;
2621526229}
2621626230
26231+ void Player::SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const
26232+ {
26233+ WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4 + 4 + 4 + 4 + 4 * 4 + 4 * 4);
26234+ data << uint64(item->GetGUID()); // item guid
26235+ data << uint32(error); // 0, or error code
26236+ if (!error)
26237+ {
26238+ data << uint32(item->GetPaidMoney()); // money cost
26239+ data << uint32(iece->HonorPoints); // honor point cost
26240+ data << uint32(iece->ArenaPoints); // arena point cost
26241+ for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26242+ {
26243+ data << uint32(iece->ItemID[i]);
26244+ data << uint32(iece->ItemCount[i]);
26245+ }
26246+ }
26247+
26248+ SendDirectMessage(&data);
26249+ }
26250+
2621726251void Player::RefundItem(Item* item)
2621826252{
2621926253 if (!item->IsRefundable())
@@ -26225,10 +26259,7 @@ void Player::RefundItem(Item* item)
2622526259 if (item->IsRefundExpired()) // item refund has expired
2622626260 {
2622726261 item->SetNotRefundable(this);
26228- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26229- data << uint64(item->GetGUID()); // Guid
26230- data << uint32(10); // Error!
26231- SendDirectMessage(&data);
26262+ SendItemRefundResult(item, nullptr, 10);
2623226263 return;
2623326264 }
2623426265
@@ -26266,25 +26297,11 @@ void Player::RefundItem(Item* item)
2626626297
2626726298 if (store_error)
2626826299 {
26269- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26270- data << uint64(item->GetGUID()); // Guid
26271- data << uint32(10); // Error!
26272- SendDirectMessage(&data);
26300+ SendItemRefundResult(item, iece, 10);
2627326301 return;
2627426302 }
2627526303
26276- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4+4+4+4+4*4+4*4);
26277- data << uint64(item->GetGUID()); // item guid
26278- data << uint32(0); // 0, or error code
26279- data << uint32(item->GetPaidMoney()); // money cost
26280- data << uint32(iece->HonorPoints); // honor point cost
26281- data << uint32(iece->ArenaPoints); // arena point cost
26282- for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26283- {
26284- data << uint32(iece->ItemID[i]);
26285- data << uint32(iece->ItemCount[i]);
26286- }
26287- SendDirectMessage(&data);
26304+ SendItemRefundResult(item, iece, 0);
2628826305
2628926306 uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem
2629026307
0 commit comments