void TradeData::SetItem(TradeSlots slot, Item* item, bool update /*= false*/) { ObjectGuid itemGuid; if (item) itemGuid = item->GetGUID(); if (_items[slot] == itemGuid && !update) return; _items[slot] = itemGuid; SetAccepted(false); GetTraderData()->SetAccepted(false); UpdateServerStateIndex(); Update(); // need remove possible trader spell applied to changed item if (slot == TRADE_SLOT_NONTRADED) GetTraderData()->SetSpell(0); // need remove possible player spell applied (possible move reagent) SetSpell(0); }
void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= nullptr*/) { ObjectGuid itemGuid = castItem ? castItem->GetGUID() : ObjectGuid::Empty; if (_spell == spell_id && _spellCastItem == itemGuid) return; _spell = spell_id; _spellCastItem = itemGuid; SetAccepted(false); GetTraderData()->SetAccepted(false); Update(true); // send spell info to item owner Update(false); // send spell info to caster self }
void TradeData::SetMoney(uint32 money) { if (_money == money) return; if (!_player->HasEnoughMoney(money)) { TradeStatusInfo info; info.Status = TRADE_STATUS_CLOSE_WINDOW; info.Result = EQUIP_ERR_NOT_ENOUGH_MONEY; _player->GetSession()->SendTradeStatus(info); return; } _money = money; SetAccepted(false); GetTraderData()->SetAccepted(false); Update(true); }
void TradeData::SetMoney(uint64 money) { if (_money == money) return; if (!_player->HasEnoughMoney(money)) { WorldPackets::Trade::TradeStatus info; info.Status = TRADE_STATUS_FAILED; info.BagResult = EQUIP_ERR_NOT_ENOUGH_MONEY; _player->GetSession()->SendTradeStatus(info); return; } _money = money; SetAccepted(false); GetTraderData()->SetAccepted(false); UpdateServerStateIndex(); Update(true); }