@@ -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;
@@ -512,7 +512,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
512512 SetArenaFaction(0);
513513
514514 SetUInt32Value(PLAYER_GUILDID, 0);
515- SetRank (0);
515+ SetGuildRank (0);
516516 SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0);
517517
518518 for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
@@ -16674,14 +16674,17 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP) const
1667416674{
1667516675 uint32 questId = quest->GetQuestId();
1667616676 sGameEventMgr->HandleQuestComplete(questId);
16677- WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16678- data << uint32(questId) ;
16677+
16678+ uint32 xp ;
1667916679
1668016680 if (!IsMaxLevel())
16681- data << uint32(XP) ;
16681+ xp = XP ;
1668216682 else
16683- data << uint32(0) ;
16683+ xp = 0 ;
1668416684
16685+ WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
16686+ data << uint32(questId);
16687+ data << uint32(xp);
1668516688 data << uint32(quest->GetRewOrReqMoney(this));
1668616689 data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
1668716690 data << uint32(quest->GetBonusTalents()); // bonus talents
@@ -18918,8 +18921,8 @@ void Player::SendSavedInstances()
1891818921 }
1891918922 }
1892018923
18921- //Send opcode 811 . true or false means, whether you have current raid/heroic instances
18922- data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP);
18924+ //Send opcode SMSG_UPDATE_INSTANCE_OWNERSHIP . true or false means, whether you have current raid/heroic instances
18925+ data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP, 4 );
1892318926 data << uint32(hasBeenSaved);
1892418927 SendDirectMessage(&data);
1892518928
@@ -18932,7 +18935,7 @@ void Player::SendSavedInstances()
1893218935 {
1893318936 if (itr->second.perm)
1893418937 {
18935- data.Initialize(SMSG_UPDATE_LAST_INSTANCE);
18938+ data.Initialize(SMSG_UPDATE_LAST_INSTANCE, 4 );
1893618939 data << uint32(itr->second.save->GetMapId());
1893718940 SendDirectMessage(&data);
1893818941 }
@@ -19699,7 +19702,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans)
1969919702 // save all changes to the item...
1970019703 if (item->GetState() != ITEM_NEW) // only for existing items, no duplicates
1970119704 item->SaveToDB(trans);
19702- // ...but do not save position in invntory
19705+ // ...but do not save position in inventory
1970319706 continue;
1970419707 }
1970519708 }
@@ -20365,7 +20368,7 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) const
2036520368 // 1: There are players offline in your party.
2036620369 // 2>: There are players in your party attempting to zone into an instance.
2036720370 */
20368- WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4 );
20371+ WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 8 );
2036920372 data << uint32(reason);
2037020373 data << uint32(MapId);
2037120374 SendDirectMessage(&data);
@@ -20675,6 +20678,16 @@ void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/,
2067520678 SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT), true);
2067620679}
2067720680
20681+ void Player::WhisperAddon(std::string const& text, Player* receiver)
20682+ {
20683+ std::string _text(text);
20684+ sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, uint32(LANG_ADDON), _text, receiver);
20685+
20686+ WorldPacket data;
20687+ ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_ADDON, this, this, _text);
20688+ receiver->SendDirectMessage(&data);
20689+ }
20690+
2067820691void Player::TextEmote(uint32 textId, WorldObject const* target /*= nullptr*/, bool /*isBossEmote = false*/)
2067920692{
2068020693 Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
@@ -26104,14 +26117,15 @@ void Player::SetReputation(uint32 factionentry, uint32 value)
2610426117{
2610526118 GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
2610626119}
26120+
2610726121uint32 Player::GetReputation(uint32 factionentry) const
2610826122{
2610926123 return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
2611026124}
2611126125
26112- std::string const& Player::GetGuildName() const
26126+ std::string Player::GetGuildName() const
2611326127{
26114- return sGuildMgr->GetGuildById(GetGuildId())->GetName();
26128+ return GetGuildId() ? sGuildMgr->GetGuildById(GetGuildId())->GetName() : "" ;
2611526129}
2611626130
2611726131void Player::SendDuelCountdown(uint32 counter)
@@ -26204,6 +26218,26 @@ PetStable& Player::GetOrInitPetStable()
2620426218 return *m_petStable;
2620526219}
2620626220
26221+ void Player::SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const
26222+ {
26223+ WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4 + 4 + 4 + 4 + 4 * 4 + 4 * 4);
26224+ data << uint64(item->GetGUID()); // item guid
26225+ data << uint32(error); // 0, or error code
26226+ if (!error)
26227+ {
26228+ data << uint32(item->GetPaidMoney()); // money cost
26229+ data << uint32(iece->HonorPoints); // honor point cost
26230+ data << uint32(iece->ArenaPoints); // arena point cost
26231+ for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26232+ {
26233+ data << uint32(iece->ItemID[i]);
26234+ data << uint32(iece->ItemCount[i]);
26235+ }
26236+ }
26237+
26238+ SendDirectMessage(&data);
26239+ }
26240+
2620726241void Player::RefundItem(Item* item)
2620826242{
2620926243 if (!item->IsRefundable())
@@ -26215,10 +26249,7 @@ void Player::RefundItem(Item* item)
2621526249 if (item->IsRefundExpired()) // item refund has expired
2621626250 {
2621726251 item->SetNotRefundable(this);
26218- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26219- data << uint64(item->GetGUID()); // Guid
26220- data << uint32(10); // Error!
26221- SendDirectMessage(&data);
26252+ SendItemRefundResult(item, nullptr, 10);
2622226253 return;
2622326254 }
2622426255
@@ -26256,25 +26287,11 @@ void Player::RefundItem(Item* item)
2625626287
2625726288 if (store_error)
2625826289 {
26259- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
26260- data << uint64(item->GetGUID()); // Guid
26261- data << uint32(10); // Error!
26262- SendDirectMessage(&data);
26290+ SendItemRefundResult(item, iece, 10);
2626326291 return;
2626426292 }
2626526293
26266- WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4+4+4+4+4*4+4*4);
26267- data << uint64(item->GetGUID()); // item guid
26268- data << uint32(0); // 0, or error code
26269- data << uint32(item->GetPaidMoney()); // money cost
26270- data << uint32(iece->HonorPoints); // honor point cost
26271- data << uint32(iece->ArenaPoints); // arena point cost
26272- for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
26273- {
26274- data << uint32(iece->ItemID[i]);
26275- data << uint32(iece->ItemCount[i]);
26276- }
26277- SendDirectMessage(&data);
26294+ SendItemRefundResult(item, iece, 0);
2627826295
2627926296 uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem
2628026297
0 commit comments