@@ -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)
@@ -16686,14 +16686,17 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP) const
1668616686{
1668716687 uint32 questId = quest->GetQuestId();
1668816688 sGameEventMgr->HandleQuestComplete(questId);
16689- WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16690- data << uint32(questId) ;
16689+
16690+ uint32 xp ;
1669116691
1669216692 if (!IsMaxLevel())
16693- data << uint32(XP) ;
16693+ xp = XP ;
1669416694 else
16695- data << uint32(0) ;
16695+ xp = 0 ;
1669616696
16697+ WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16698+ data << uint32(questId);
16699+ data << uint32(xp);
1669716700 data << uint32(quest->GetRewOrReqMoney(this));
1669816701 data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
1669916702 data << uint32(quest->GetBonusTalents()); // bonus talents
@@ -18930,8 +18933,8 @@ void Player::SendSavedInstances()
1893018933 }
1893118934 }
1893218935
18933- //Send opcode 811 . true or false means, whether you have current raid/heroic instances
18934- data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP);
18936+ //Send opcode SMSG_UPDATE_INSTANCE_OWNERSHIP . true or false means, whether you have current raid/heroic instances
18937+ data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP, 4 );
1893518938 data << uint32(hasBeenSaved);
1893618939 SendDirectMessage(&data);
1893718940
@@ -18944,7 +18947,7 @@ void Player::SendSavedInstances()
1894418947 {
1894518948 if (itr->second.perm)
1894618949 {
18947- data.Initialize(SMSG_UPDATE_LAST_INSTANCE);
18950+ data.Initialize(SMSG_UPDATE_LAST_INSTANCE, 4 );
1894818951 data << uint32(itr->second.save->GetMapId());
1894918952 SendDirectMessage(&data);
1895018953 }
@@ -19711,7 +19714,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans)
1971119714 // save all changes to the item...
1971219715 if (item->GetState() != ITEM_NEW) // only for existing items, no duplicates
1971319716 item->SaveToDB(trans);
19714- // ...but do not save position in invntory
19717+ // ...but do not save position in inventory
1971519718 continue;
1971619719 }
1971719720 }
@@ -20377,7 +20380,7 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) const
2037720380 // 1: There are players offline in your party.
2037820381 // 2>: There are players in your party attempting to zone into an instance.
2037920382 */
20380- WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4 );
20383+ WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 8 );
2038120384 data << uint32(reason);
2038220385 data << uint32(MapId);
2038320386 SendDirectMessage(&data);
@@ -20687,6 +20690,16 @@ void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/,
2068720690 SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT), true);
2068820691}
2068920692
20693+ void Player::WhisperAddon(std::string const& text, Player* receiver)
20694+ {
20695+ std::string _text(text);
20696+ sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, uint32(LANG_ADDON), _text, receiver);
20697+
20698+ WorldPacket data;
20699+ ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_ADDON, this, this, _text);
20700+ receiver->SendDirectMessage(&data);
20701+ }
20702+
2069020703void Player::TextEmote(uint32 textId, WorldObject const* target /*= nullptr*/, bool /*isBossEmote = false*/)
2069120704{
2069220705 Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
@@ -26116,14 +26129,15 @@ void Player::SetReputation(uint32 factionentry, uint32 value)
2611626129{
2611726130 GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
2611826131}
26132+
2611926133uint32 Player::GetReputation(uint32 factionentry) const
2612026134{
2612126135 return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
2612226136}
2612326137
26124- std::string const& Player::GetGuildName() const
26138+ std::string Player::GetGuildName() const
2612526139{
26126- return sGuildMgr->GetGuildById(GetGuildId())->GetName();
26140+ return GetGuildId() ? sGuildMgr->GetGuildById(GetGuildId())->GetName() : "" ;
2612726141}
2612826142
2612926143void Player::SendDuelCountdown(uint32 counter)
@@ -26216,6 +26230,26 @@ PetStable& Player::GetOrInitPetStable()
2621626230 return *m_petStable;
2621726231}
2621826232
26233+ void Player::SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const
26234+ {
26235+ WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4 + 4 + 4 + 4 + 4 * 4 + 4 * 4);
26236+ data << uint64(item->GetGUID()); // item guid
26237+ data << uint32(error); // 0, or error code
26238+ if (!error)
26239+ {
26240+ data << uint32(item->GetPaidMoney()); // money cost
26241+ data << uint32(iece->HonorPoints); // honor point cost
26242+ data << uint32(iece->ArenaPoints); // arena point cost
26243+ for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26244+ {
26245+ data << uint32(iece->ItemID[i]);
26246+ data << uint32(iece->ItemCount[i]);
26247+ }
26248+ }
26249+
26250+ SendDirectMessage(&data);
26251+ }
26252+
2621926253void Player::RefundItem(Item* item)
2622026254{
2622126255 if (!item->IsRefundable())
@@ -26227,10 +26261,7 @@ void Player::RefundItem(Item* item)
2622726261 if (item->IsRefundExpired()) // item refund has expired
2622826262 {
2622926263 item->SetNotRefundable(this);
26230- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26231- data << uint64(item->GetGUID()); // Guid
26232- data << uint32(10); // Error!
26233- SendDirectMessage(&data);
26264+ SendItemRefundResult(item, nullptr, 10);
2623426265 return;
2623526266 }
2623626267
@@ -26268,25 +26299,11 @@ void Player::RefundItem(Item* item)
2626826299
2626926300 if (store_error)
2627026301 {
26271- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26272- data << uint64(item->GetGUID()); // Guid
26273- data << uint32(10); // Error!
26274- SendDirectMessage(&data);
26302+ SendItemRefundResult(item, iece, 10);
2627526303 return;
2627626304 }
2627726305
26278- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4+4+4+4+4*4+4*4);
26279- data << uint64(item->GetGUID()); // item guid
26280- data << uint32(0); // 0, or error code
26281- data << uint32(item->GetPaidMoney()); // money cost
26282- data << uint32(iece->HonorPoints); // honor point cost
26283- data << uint32(iece->ArenaPoints); // arena point cost
26284- for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26285- {
26286- data << uint32(iece->ItemID[i]);
26287- data << uint32(iece->ItemCount[i]);
26288- }
26289- SendDirectMessage(&data);
26306+ SendItemRefundResult(item, iece, 0);
2629026307
2629126308 uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem
2629226309
0 commit comments