79 data <<
uint8(trader_data);
92 data <<
uint32(item->GetTemplate()->ItemId);
93 data <<
uint32(item->GetTemplate()->DisplayInfoID);
94 data <<
uint32(item->GetCount());
96 data <<
uint32(item->IsWrapped() ? 1 : 0);
104 data <<
uint32(item->GetSpellCharges());
105 data <<
uint32(item->GetItemSuffixFactor());
106 data <<
uint32(item->GetItemRandomPropertyId());
107 data <<
uint32(item->GetTemplate()->LockID);
115 for (
uint8 j = 0; j < 18; ++j)
137 if (traderCanTrade && playerCanTrade)
145 TC_LOG_DEBUG(
"network",
"partner storing: {}", myItems[i]->GetGUID().ToString());
155 if (myItems[i]->IsBOPTradeable())
163 TC_LOG_DEBUG(
"network",
"player storing: {}", hisItems[i]->GetGUID().ToString());
166 sLog->OutCommand(trader->
GetSession()->
GetAccountId(),
"GM {} (Account: {}) trade: {} (Entry: {} Count: {}) to player: {} (Account: {})",
173 if (hisItems[i]->IsBOPTradeable())
186 TC_LOG_ERROR(
"network",
"trader can't store item: {}", myItems[i]->GetGUID().ToString());
190 TC_LOG_ERROR(
"network",
"player can't take item back: {}", myItems[i]->GetGUID().ToString());
196 TC_LOG_ERROR(
"network",
"player can't store item: {}", hisItems[i]->GetGUID().ToString());
200 TC_LOG_ERROR(
"network",
"trader can't take item back: {}", hisItems[i]->GetGUID().ToString());
218 TC_LOG_DEBUG(
"network",
"player trade item {} bag: {} slot: {}", item->GetGUID().ToString(), item->GetBagSlot(), item->GetSlot());
226 TC_LOG_DEBUG(
"network",
"partner trade item {} bag: {} slot: {}", item->GetGUID().ToString(), item->GetBagSlot(), item->GetSlot());
321 if (!item->CanBeTraded(
false,
true))
328 if (item->IsBindedNotWith(trader))
339 if (!item->CanBeTraded(
false,
true))
358 Spell* my_spell =
nullptr;
361 Spell* his_spell =
nullptr;
508 sLog->OutCommand(trader->
GetSession()->
GetAccountId(),
"GM {} (Account: {}) give money (Amount: {}) to player: {} (Account: {})",
525 his_spell->
prepare(his_targets);
722 recvPacket >> tradeSlot;
762 info.
Slot = tradeSlot;
773 recvPacket >> tradeSlot;
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
@ EQUIP_ERR_TOO_MUCH_GOLD
@ EQUIP_ERR_NOT_ENOUGH_MONEY
@ EQUIP_ERR_TRADE_BOUND_ITEM
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
uint32 const MAX_MONEY_AMOUNT
std::vector< ItemPosCount > ItemPosCountVec
@ TRADE_STATUS_YOU_STUNNED
@ TRADE_STATUS_IGNORE_YOU
@ TRADE_STATUS_TRADE_COMPLETE
@ TRADE_STATUS_NOT_ON_TAPLIST
@ TRADE_STATUS_YOU_LOGOUT
@ TRADE_STATUS_TARGET_DEAD
@ TRADE_STATUS_TRADE_ACCEPT
@ TRADE_STATUS_WRONG_REALM
@ TRADE_STATUS_BEGIN_TRADE
@ TRADE_STATUS_TARGET_LOGOUT
@ TRADE_STATUS_TARGET_STUNNED
@ TRADE_STATUS_TRADE_CANCELED
@ TRADE_STATUS_TARGET_TO_FAR
@ TRADE_STATUS_OPEN_WINDOW
@ TRADE_STATUS_WRONG_FACTION
@ TRADE_STATUS_CLOSE_WINDOW
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ TRADE_SLOT_TRADED_COUNT
static void setAcceptTradeMode(TradeData *myTrade, TradeData *hisTrade, Item **myItems, Item **hisItems)
static void clearAcceptTradeMode(TradeData *myTrade, TradeData *hisTrade)
@ ITEM_FIELD_MAXDURABILITY
@ ITEM_FIELD_CREATE_PLAYED_TIME
bool CanBeTraded(bool mail=false, bool trade=false) const
ItemTemplate const * GetTemplate() const
bool IsBindedNotWith(Player const *player) const
void SetInTrade(bool b=true)
uint32 GetUInt32Value(uint16 index) const
void SetGuidValue(uint16 index, ObjectGuid value)
static ObjectGuid GetGUID(Object const *o)
void SetUInt32Value(uint16 index, uint32 value)
uint32 GetTotalPlayedTime() const
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
InventoryResult CanStoreItems(Item **items, int count, uint32 *itemLimitCategory) const
bool ModifyMoney(int32 amount, bool sendError=true)
WorldSession * GetSession() const
Item * GetItemByPos(uint16 pos) const
void TradeCancel(bool sendback, TradeStatus status=TRADE_STATUS_TRADE_CANCELED)
bool HasEnoughMoney(uint32 amount) const
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
void MoveItemToInventory(ItemPosCountVec const &dest, Item *pItem, bool update, bool in_characterInventoryDB=false)
Player * GetTrader() const
TradeData * GetTradeData() const
void SetTradeItemTarget(Player *caster)
SpellCastTargets m_targets
SpellCastResult prepare(SpellCastTargets const &targets, AuraEffect const *triggeredByAura=nullptr)
SpellCastResult CheckCast(bool strict, uint32 *param1=nullptr, uint32 *param2=nullptr)
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, uint32 *param1=nullptr, uint32 *param2=nullptr)
Item * GetSpellCastItem() const
void SetMoney(uint32 money)
bool HasSpellCastItem() const
void SetSpell(uint32 spell_id, Item *castItem=nullptr)
Player * GetTrader() const
bool HasItem(ObjectGuid itemGuid) const
void SetItem(TradeSlots slot, Item *item, bool update=false)
void SetInAcceptProcess(bool state)
void SetAccepted(bool state, bool forTrader=false)
Item * GetItem(TradeSlots slot) const
TradeData * GetTraderData() const
bool HasUnitState(const uint32 f) const
std::string const & GetName() const
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
char const * GetTrinityString(uint32 entry) const
void moveItems(Item *myItems[], Item *hisItems[])
void SendTradeStatus(TradeStatusInfo const &status)
void HandleIgnoreTradeOpcode(WorldPacket &recvPacket)
bool isLogingOut() const
Is the user engaged in a log out process?
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
void SendNotification(const char *format,...) ATTR_PRINTF(2
void HandleClearTradeItemOpcode(WorldPacket &recvPacket)
void HandleSetTradeItemOpcode(WorldPacket &recvPacket)
void HandleUnacceptTradeOpcode(WorldPacket &recvPacket)
bool PlayerRecentlyLoggedOut() const
bool PlayerLogout() const
void HandleSetTradeGoldOpcode(WorldPacket &recvPacket)
Player * GetPlayer() const
void HandleBusyTradeOpcode(WorldPacket &recvPacket)
void SendCancelTrade(TradeStatus status)
void HandleBeginTradeOpcode(WorldPacket &recvPacket)
void HandleCancelTradeOpcode(WorldPackets::Trade::CancelTrade &cancelTrade)
bool HasPermission(uint32 permissionId)
void HandleAcceptTradeOpcode(WorldPacket &recvPacket)
uint32 GetAccountId() const
void HandleInitiateTradeOpcode(WorldPacket &recvPacket)
void SendUpdateTrade(bool trader_data=true)
@ SMSG_TRADE_STATUS_EXTENDED
@ CONFIG_ALLOW_TWO_SIDE_TRADE
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
@ RBAC_PERM_ALLOW_TWO_SIDE_TRADE
uint32 ItemLimitCategoryId