@@ -265,7 +265,7 @@ Player::Player(WorldSession* session): Unit(true)
265265 SetLastRuneGraceTimer(i, 0);
266266 }
267267
268- for (uint8 i= 0; i < MAX_TIMERS; i++)
268+ for (uint8 i = 0; i < MAX_TIMERS; i++)
269269 m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
270270
271271 m_MirrorTimerFlags = UNDERWATER_NONE;
@@ -526,7 +526,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
526526 SetArenaFaction(0);
527527
528528 SetUInt32Value(PLAYER_GUILDID, 0);
529- SetRank (0);
529+ SetGuildRank (0);
530530 SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0);
531531
532532 for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
@@ -16694,14 +16694,17 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP) const
1669416694{
1669516695 uint32 questId = quest->GetQuestId();
1669616696 sGameEventMgr->HandleQuestComplete(questId);
16697- WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16698- data << uint32(questId) ;
16697+
16698+ uint32 xp ;
1669916699
1670016700 if (!IsMaxLevel())
16701- data << uint32(XP) ;
16701+ xp = XP ;
1670216702 else
16703- data << uint32(0) ;
16703+ xp = 0 ;
1670416704
16705+ WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16706+ data << uint32(questId);
16707+ data << uint32(xp);
1670516708 data << uint32(quest->GetRewOrReqMoney(this));
1670616709 data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
1670716710 data << uint32(quest->GetBonusTalents()); // bonus talents
@@ -18938,8 +18941,8 @@ void Player::SendSavedInstances()
1893818941 }
1893918942 }
1894018943
18941- //Send opcode 811 . true or false means, whether you have current raid/heroic instances
18942- data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP);
18944+ //Send opcode SMSG_UPDATE_INSTANCE_OWNERSHIP . true or false means, whether you have current raid/heroic instances
18945+ data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP, 4 );
1894318946 data << uint32(hasBeenSaved);
1894418947 SendDirectMessage(&data);
1894518948
@@ -18952,7 +18955,7 @@ void Player::SendSavedInstances()
1895218955 {
1895318956 if (itr->second.perm)
1895418957 {
18955- data.Initialize(SMSG_UPDATE_LAST_INSTANCE);
18958+ data.Initialize(SMSG_UPDATE_LAST_INSTANCE, 4 );
1895618959 data << uint32(itr->second.save->GetMapId());
1895718960 SendDirectMessage(&data);
1895818961 }
@@ -19725,7 +19728,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans)
1972519728 // save all changes to the item...
1972619729 if (item->GetState() != ITEM_NEW) // only for existing items, no duplicates
1972719730 item->SaveToDB(trans);
19728- // ...but do not save position in invntory
19731+ // ...but do not save position in inventory
1972919732 continue;
1973019733 }
1973119734 }
@@ -20391,7 +20394,7 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) const
2039120394 // 1: There are players offline in your party.
2039220395 // 2>: There are players in your party attempting to zone into an instance.
2039320396 */
20394- WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4 );
20397+ WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 8 );
2039520398 data << uint32(reason);
2039620399 data << uint32(MapId);
2039720400 SendDirectMessage(&data);
@@ -20701,6 +20704,16 @@ void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/,
2070120704 SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT), true);
2070220705}
2070320706
20707+ void Player::WhisperAddon(std::string const& text, Player* receiver)
20708+ {
20709+ std::string _text(text);
20710+ sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, uint32(LANG_ADDON), _text, receiver);
20711+
20712+ WorldPacket data;
20713+ ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_ADDON, this, this, _text);
20714+ receiver->SendDirectMessage(&data);
20715+ }
20716+
2070420717void Player::TextEmote(uint32 textId, WorldObject const* target /*= nullptr*/, bool /*isBossEmote = false*/)
2070520718{
2070620719 Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
@@ -26130,14 +26143,15 @@ void Player::SetReputation(uint32 factionentry, uint32 value)
2613026143{
2613126144 GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
2613226145}
26146+
2613326147uint32 Player::GetReputation(uint32 factionentry) const
2613426148{
2613526149 return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
2613626150}
2613726151
26138- std::string const& Player::GetGuildName() const
26152+ std::string Player::GetGuildName() const
2613926153{
26140- return sGuildMgr->GetGuildById(GetGuildId())->GetName();
26154+ return GetGuildId() ? sGuildMgr->GetGuildById(GetGuildId())->GetName() : "" ;
2614126155}
2614226156
2614326157void Player::SendDuelCountdown(uint32 counter)
@@ -26230,6 +26244,26 @@ PetStable& Player::GetOrInitPetStable()
2623026244 return *m_petStable;
2623126245}
2623226246
26247+ void Player::SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const
26248+ {
26249+ WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4 + 4 + 4 + 4 + 4 * 4 + 4 * 4);
26250+ data << uint64(item->GetGUID()); // item guid
26251+ data << uint32(error); // 0, or error code
26252+ if (!error)
26253+ {
26254+ data << uint32(item->GetPaidMoney()); // money cost
26255+ data << uint32(iece->HonorPoints); // honor point cost
26256+ data << uint32(iece->ArenaPoints); // arena point cost
26257+ for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26258+ {
26259+ data << uint32(iece->ItemID[i]);
26260+ data << uint32(iece->ItemCount[i]);
26261+ }
26262+ }
26263+
26264+ SendDirectMessage(&data);
26265+ }
26266+
2623326267void Player::RefundItem(Item* item)
2623426268{
2623526269 if (!item->IsRefundable())
@@ -26241,10 +26275,7 @@ void Player::RefundItem(Item* item)
2624126275 if (item->IsRefundExpired()) // item refund has expired
2624226276 {
2624326277 item->SetNotRefundable(this);
26244- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26245- data << uint64(item->GetGUID()); // Guid
26246- data << uint32(10); // Error!
26247- SendDirectMessage(&data);
26278+ SendItemRefundResult(item, nullptr, 10);
2624826279 return;
2624926280 }
2625026281
@@ -26282,25 +26313,11 @@ void Player::RefundItem(Item* item)
2628226313
2628326314 if (store_error)
2628426315 {
26285- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26286- data << uint64(item->GetGUID()); // Guid
26287- data << uint32(10); // Error!
26288- SendDirectMessage(&data);
26316+ SendItemRefundResult(item, iece, 10);
2628926317 return;
2629026318 }
2629126319
26292- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4+4+4+4+4*4+4*4);
26293- data << uint64(item->GetGUID()); // item guid
26294- data << uint32(0); // 0, or error code
26295- data << uint32(item->GetPaidMoney()); // money cost
26296- data << uint32(iece->HonorPoints); // honor point cost
26297- data << uint32(iece->ArenaPoints); // arena point cost
26298- for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26299- {
26300- data << uint32(iece->ItemID[i]);
26301- data << uint32(iece->ItemCount[i]);
26302- }
26303- SendDirectMessage(&data);
26320+ SendItemRefundResult(item, iece, 0);
2630426321
2630526322 uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem
2630626323
0 commit comments