Revert "Core: more more cleanup" - Build test anyone?
This reverts commit 20cd4c71ee.
This commit is contained in:
@@ -64,9 +64,9 @@ AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId)
|
||||
return &mNeutralAuctions;
|
||||
}
|
||||
|
||||
uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* item, uint32 count)
|
||||
uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count)
|
||||
{
|
||||
uint32 MSV = item->GetTemplate()->SellPrice;
|
||||
uint32 MSV = pItem->GetTemplate()->SellPrice;
|
||||
|
||||
if (MSV <= 0)
|
||||
return AH_MINIMUM_DEPOSIT;
|
||||
@@ -89,8 +89,8 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
||||
//does not clear ram
|
||||
void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans)
|
||||
{
|
||||
Item* item = GetAItem(auction->item_guidlow);
|
||||
if (!item)
|
||||
Item* pItem = GetAItem(auction->item_guidlow);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
uint32 bidder_accId = 0;
|
||||
@@ -127,7 +127,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
||||
uint32 owner_accid = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner);
|
||||
|
||||
sLog->outCommand(bidder_accId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
|
||||
bidder_name.c_str(), bidder_accId, item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), auction->bid, owner_name.c_str(), owner_accid);
|
||||
bidder_name.c_str(), bidder_accId, pItem->GetTemplate()->Name1.c_str(), pItem->GetEntry(), pItem->GetCount(), auction->bid, owner_name.c_str(), owner_accid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
||||
// owner in `data` will set at mail receive and item extracting
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
|
||||
stmt->setUInt32(0, auction->bidder);
|
||||
stmt->setUInt32(1, item->GetGUIDLow());
|
||||
stmt->setUInt32(1, pItem->GetGUIDLow());
|
||||
trans->Append(stmt);
|
||||
|
||||
if (bidder)
|
||||
@@ -158,7 +158,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
||||
}
|
||||
|
||||
MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str())
|
||||
.AddItem(item)
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
@@ -234,8 +234,8 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
|
||||
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans)
|
||||
{
|
||||
//return an item in auction to its owner by mail
|
||||
Item* item = GetAItem(auction->item_guidlow);
|
||||
if (!item)
|
||||
Item* pItem = GetAItem(auction->item_guidlow);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
|
||||
@@ -251,7 +251,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
|
||||
owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||
|
||||
MailDraft(subject.str(), "") // TODO: fix body
|
||||
.AddItem(item)
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ class AuctionHouseMgr
|
||||
void SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans);
|
||||
void SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans);
|
||||
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* item, uint32 count);
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
|
||||
public:
|
||||
|
||||
@@ -153,18 +153,18 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/)
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0);
|
||||
}
|
||||
|
||||
void Bag::StoreItem(uint8 slot, Item* item, bool /*update*/)
|
||||
void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
|
||||
{
|
||||
ASSERT(slot < MAX_BAG_SIZE);
|
||||
|
||||
if (item && item->GetGUID() != this->GetGUID())
|
||||
if (pItem && pItem->GetGUID() != this->GetGUID())
|
||||
{
|
||||
m_bagslot[slot] = item;
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), item->GetGUID());
|
||||
item->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID());
|
||||
item->SetUInt64Value(ITEM_FIELD_OWNER, GetOwnerGUID());
|
||||
item->SetContainer(this);
|
||||
item->SetSlot(slot);
|
||||
m_bagslot[slot] = pItem;
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
|
||||
pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID());
|
||||
pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetOwnerGUID());
|
||||
pItem->SetContainer(this);
|
||||
pItem->SetSlot(slot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,22 +189,22 @@ bool Bag::IsEmpty() const
|
||||
|
||||
uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
|
||||
{
|
||||
Item* item;
|
||||
Item* pItem;
|
||||
uint32 count = 0;
|
||||
for (uint32 i=0; i < GetBagSize(); ++i)
|
||||
{
|
||||
item = m_bagslot[i];
|
||||
if (item && item != eItem && item->GetEntry() == item)
|
||||
count += item->GetCount();
|
||||
pItem = m_bagslot[i];
|
||||
if (pItem && pItem != eItem && pItem->GetEntry() == item)
|
||||
count += pItem->GetCount();
|
||||
}
|
||||
|
||||
if (eItem && eItem->GetTemplate()->GemProperties)
|
||||
{
|
||||
for (uint32 i=0; i < GetBagSize(); ++i)
|
||||
{
|
||||
item = m_bagslot[i];
|
||||
if (item && item != eItem && item->GetTemplate()->Socket[0].Color)
|
||||
count += item->GetGemCountWithID(item);
|
||||
pItem = m_bagslot[i];
|
||||
if (pItem && pItem != eItem && pItem->GetTemplate()->Socket[0].Color)
|
||||
count += pItem->GetGemCountWithID(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,9 +215,9 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem)
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (Item* item = m_bagslot[i])
|
||||
if (item != skipItem)
|
||||
if (ItemTemplate const* pProto = item->GetTemplate())
|
||||
if (Item* pItem = m_bagslot[i])
|
||||
if (pItem != skipItem)
|
||||
if (ItemTemplate const* pProto = pItem->GetTemplate())
|
||||
if (pProto->ItemLimitCategory == limitCategory)
|
||||
count += m_bagslot[i]->GetCount();
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class Bag : public Item
|
||||
bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
|
||||
|
||||
void Clear();
|
||||
void StoreItem(uint8 slot, Item* item, bool update);
|
||||
void StoreItem(uint8 slot, Item* pItem, bool update);
|
||||
void RemoveItem(uint8 slot, bool update);
|
||||
|
||||
Item* GetItemByPos(uint8 slot) const;
|
||||
|
||||
@@ -1021,14 +1021,14 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
|
||||
|
||||
ASSERT(count !=0 && "pProto->Stackable == 0 but checked at loading already");
|
||||
|
||||
Item* item = NewItemOrBag(pProto);
|
||||
if (item->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
|
||||
Item* pItem = NewItemOrBag(pProto);
|
||||
if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
|
||||
{
|
||||
item->SetCount(count);
|
||||
return item;
|
||||
pItem->SetCount(count);
|
||||
return pItem;
|
||||
}
|
||||
else
|
||||
delete item;
|
||||
delete pItem;
|
||||
}
|
||||
else
|
||||
ASSERT(false);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1233,70 +1233,70 @@ class Player : public Unit, public GridObject<Player>
|
||||
bool CanNoReagentCast(SpellInfo const* spellInfo) const;
|
||||
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
|
||||
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
|
||||
InventoryResult CanTakeMoreSimilarItems(Item* item) const { return CanTakeMoreSimilarItems(item->GetEntry(), item->GetCount(), item); }
|
||||
InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); }
|
||||
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return CanTakeMoreSimilarItems(entry, count, NULL); }
|
||||
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL) const
|
||||
{
|
||||
return CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count);
|
||||
}
|
||||
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* item, bool swap = false) const
|
||||
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const
|
||||
{
|
||||
if (!item)
|
||||
if (!pItem)
|
||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||
uint32 count = item->GetCount();
|
||||
return CanStoreItem(bag, slot, dest, item->GetEntry(), count, item, swap, NULL);
|
||||
uint32 count = pItem->GetCount();
|
||||
return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL);
|
||||
|
||||
}
|
||||
InventoryResult CanStoreItems(Item** item, int count) const;
|
||||
InventoryResult CanStoreItems(Item** pItem, int count) const;
|
||||
InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
|
||||
InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* item, bool swap, bool not_loading = true) const;
|
||||
InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const;
|
||||
|
||||
InventoryResult CanEquipUniqueItem(Item* item, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
|
||||
InventoryResult CanEquipUniqueItem(Item* pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
|
||||
InventoryResult CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
|
||||
InventoryResult CanUnequipItems(uint32 item, uint32 count) const;
|
||||
InventoryResult CanUnequipItem(uint16 src, bool swap) const;
|
||||
InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* item, bool swap, bool not_loading = true) const;
|
||||
InventoryResult CanUseItem(Item* item, bool not_loading = true) const;
|
||||
InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true) const;
|
||||
InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const;
|
||||
bool HasItemTotemCategory(uint32 TotemCategory) const;
|
||||
InventoryResult CanUseItem(ItemTemplate const* item) const;
|
||||
InventoryResult CanUseItem(ItemTemplate const* pItem) const;
|
||||
InventoryResult CanUseAmmo(uint32 item) const;
|
||||
InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
|
||||
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0);
|
||||
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet &allowedLooters);
|
||||
Item* StoreItem(ItemPosCountVec const& pos, Item* item, bool update);
|
||||
Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
|
||||
Item* EquipNewItem(uint16 pos, uint32 item, bool update);
|
||||
Item* EquipItem(uint16 pos, Item* item, bool update);
|
||||
Item* EquipItem(uint16 pos, Item* pItem, bool update);
|
||||
void AutoUnequipOffhandIfNeed(bool force = false);
|
||||
bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
|
||||
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false);
|
||||
void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); }
|
||||
void StoreLootItem(uint8 lootSlot, Loot* loot);
|
||||
|
||||
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* item, uint32* no_space_count = NULL) const;
|
||||
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* item = NULL, bool swap = false, uint32* no_space_count = NULL) const;
|
||||
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
|
||||
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
|
||||
|
||||
void AddRefundReference(uint32 it);
|
||||
void DeleteRefundReference(uint32 it);
|
||||
|
||||
void ApplyEquipCooldown(Item* item);
|
||||
void ApplyEquipCooldown(Item* pItem);
|
||||
void SetAmmo(uint32 item);
|
||||
void RemoveAmmo();
|
||||
float GetAmmoDPS() const { return m_ammoDPS; }
|
||||
bool CheckAmmoCompatibility(const ItemTemplate* ammo_proto) const;
|
||||
void QuickEquipItem(uint16 pos, Item* item);
|
||||
void VisualizeItem(uint8 slot, Item* item);
|
||||
void SetVisibleItemSlot(uint8 slot, Item* item);
|
||||
Item* BankItem(ItemPosCountVec const& dest, Item* item, bool update)
|
||||
void QuickEquipItem(uint16 pos, Item* pItem);
|
||||
void VisualizeItem(uint8 slot, Item* pItem);
|
||||
void SetVisibleItemSlot(uint8 slot, Item* pItem);
|
||||
Item* BankItem(ItemPosCountVec const& dest, Item* pItem, bool update)
|
||||
{
|
||||
return StoreItem(dest, item, update);
|
||||
return StoreItem(dest, pItem, update);
|
||||
}
|
||||
Item* BankItem(uint16 pos, Item* item, bool update);
|
||||
Item* BankItem(uint16 pos, Item* pItem, bool update);
|
||||
void RemoveItem(uint8 bag, uint8 slot, bool update);
|
||||
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update);
|
||||
// in trade, auction, guild bank, mail....
|
||||
void MoveItemToInventory(ItemPosCountVec const& dest, Item* item, bool update, bool in_characterInventoryDB = false);
|
||||
void MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB = false);
|
||||
// in trade, guild bank, mail....
|
||||
void RemoveItemDependentAurasAndCasts(Item* item);
|
||||
void RemoveItemDependentAurasAndCasts(Item* pItem);
|
||||
void DestroyItem(uint8 bag, uint8 slot, bool update);
|
||||
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check = false);
|
||||
void DestroyItemCount(Item* item, uint32& count, bool update);
|
||||
@@ -1304,11 +1304,11 @@ class Player : public Unit, public GridObject<Player>
|
||||
void DestroyZoneLimitedItem(bool update, uint32 new_zone);
|
||||
void SplitItem(uint16 src, uint16 dst, uint32 count);
|
||||
void SwapItem(uint16 src, uint16 dst);
|
||||
void AddItemToBuyBackSlot(Item* item);
|
||||
void AddItemToBuyBackSlot(Item* pItem);
|
||||
Item* GetItemFromBuyBackSlot(uint32 slot);
|
||||
void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
|
||||
uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; }
|
||||
void SendEquipError(InventoryResult msg, Item* item, Item* pItem2 = NULL, uint32 itemid = 0);
|
||||
void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0);
|
||||
void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param);
|
||||
void SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param);
|
||||
void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
|
||||
@@ -2789,7 +2789,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
|
||||
InventoryResult CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
||||
InventoryResult CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
||||
Item* _StoreItem(uint16 pos, Item* item, uint32 count, bool clone, bool update);
|
||||
Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
|
||||
Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields);
|
||||
|
||||
std::set<uint32> m_refundableItems;
|
||||
|
||||
@@ -1927,12 +1927,12 @@ void Group::BroadcastGroupUpdate(void)
|
||||
void Group::ResetMaxEnchantingLevel()
|
||||
{
|
||||
m_maxEnchantingLevel = 0;
|
||||
Player* member = NULL;
|
||||
Player* pMember = NULL;
|
||||
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||
{
|
||||
member = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (member && m_maxEnchantingLevel < member->GetSkillValue(SKILL_ENCHANTING))
|
||||
m_maxEnchantingLevel = member->GetSkillValue(SKILL_ENCHANTING);
|
||||
pMember = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (pMember && m_maxEnchantingLevel < pMember->GetSkillValue(SKILL_ENCHANTING))
|
||||
m_maxEnchantingLevel = pMember->GetSkillValue(SKILL_ENCHANTING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -348,8 +348,8 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields)
|
||||
return false;
|
||||
}
|
||||
|
||||
Item* item = NewItemOrBag(proto);
|
||||
if (!item->LoadFromDB(itemGuid, 0, fields, itemEntry))
|
||||
Item* pItem = NewItemOrBag(proto);
|
||||
if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry))
|
||||
{
|
||||
sLog->outError("Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry);
|
||||
|
||||
@@ -359,12 +359,12 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields)
|
||||
stmt->setUInt8 (2, slotId);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
delete item;
|
||||
delete pItem;
|
||||
return false;
|
||||
}
|
||||
|
||||
item->AddToWorld();
|
||||
m_items[slotId] = item;
|
||||
pItem->AddToWorld();
|
||||
m_items[slotId] = pItem;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -372,13 +372,13 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields)
|
||||
void Guild::BankTab::Delete(SQLTransaction& trans, bool removeItemsFromDB)
|
||||
{
|
||||
for (uint8 slotId = 0; slotId < GUILD_BANK_MAX_SLOTS; ++slotId)
|
||||
if (Item* item = m_items[slotId])
|
||||
if (Item* pItem = m_items[slotId])
|
||||
{
|
||||
item->RemoveFromWorld();
|
||||
pItem->RemoveFromWorld();
|
||||
if (removeItemsFromDB)
|
||||
item->DeleteFromDB(trans);
|
||||
delete item;
|
||||
item = NULL;
|
||||
pItem->DeleteFromDB(trans);
|
||||
delete pItem;
|
||||
pItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,29 +392,29 @@ inline void Guild::BankTab::WritePacket(WorldPacket& data) const
|
||||
// Writes information about contents of specified slot into packet.
|
||||
void Guild::BankTab::WriteSlotPacket(WorldPacket& data, uint8 slotId) const
|
||||
{
|
||||
Item* item = GetItem(slotId);
|
||||
uint32 itemEntry = item ? item->GetEntry() : 0;
|
||||
Item* pItem = GetItem(slotId);
|
||||
uint32 itemEntry = pItem ? pItem->GetEntry() : 0;
|
||||
|
||||
data << uint8(slotId);
|
||||
data << uint32(itemEntry);
|
||||
if (itemEntry)
|
||||
{
|
||||
data << uint32(0); // 3.3.0 (0x00018020, 0x00018000)
|
||||
data << uint32(item->GetItemRandomPropertyId()); // Random item property id
|
||||
data << uint32(pItem->GetItemRandomPropertyId()); // Random item property id
|
||||
|
||||
if (item->GetItemRandomPropertyId())
|
||||
data << uint32(item->GetItemSuffixFactor()); // SuffixFactor
|
||||
if (pItem->GetItemRandomPropertyId())
|
||||
data << uint32(pItem->GetItemSuffixFactor()); // SuffixFactor
|
||||
|
||||
data << uint32(item->GetCount()); // ITEM_FIELD_STACK_COUNT
|
||||
data << uint32(pItem->GetCount()); // ITEM_FIELD_STACK_COUNT
|
||||
data << uint32(0);
|
||||
data << uint8(abs(item->GetSpellCharges())); // Spell charges
|
||||
data << uint8(abs(pItem->GetSpellCharges())); // Spell charges
|
||||
|
||||
uint8 enchCount = 0;
|
||||
size_t enchCountPos = data.wpos();
|
||||
|
||||
data << uint8(enchCount); // Number of enchantments
|
||||
for (uint32 i = PERM_ENCHANTMENT_SLOT; i < MAX_ENCHANTMENT_SLOT; ++i)
|
||||
if (uint32 enchId = item->GetEnchantmentId(EnchantmentSlot(i)))
|
||||
if (uint32 enchId = pItem->GetEnchantmentId(EnchantmentSlot(i)))
|
||||
{
|
||||
data << uint8(i);
|
||||
data << uint32(enchId);
|
||||
@@ -456,13 +456,13 @@ void Guild::BankTab::SetText(const std::string& text)
|
||||
}
|
||||
|
||||
// Sets/removes contents of specified slot.
|
||||
// If item == NULL contents are removed.
|
||||
bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* item)
|
||||
// If pItem == NULL contents are removed.
|
||||
bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* pItem)
|
||||
{
|
||||
if (slotId >= GUILD_BANK_MAX_SLOTS)
|
||||
return false;
|
||||
|
||||
m_items[slotId] = item;
|
||||
m_items[slotId] = pItem;
|
||||
|
||||
PreparedStatement* stmt = NULL;
|
||||
|
||||
@@ -472,19 +472,19 @@ bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* item)
|
||||
stmt->setUInt8 (2, slotId);
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
|
||||
if (item)
|
||||
if (pItem)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_ITEM);
|
||||
stmt->setUInt32(0, m_guildId);
|
||||
stmt->setUInt8 (1, m_tabId);
|
||||
stmt->setUInt8 (2, slotId);
|
||||
stmt->setUInt32(3, item->GetGUIDLow());
|
||||
stmt->setUInt32(3, pItem->GetGUIDLow());
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
|
||||
item->SetUInt64Value(ITEM_FIELD_CONTAINED, 0);
|
||||
item->SetUInt64Value(ITEM_FIELD_OWNER, 0);
|
||||
item->FSetState(ITEM_NEW);
|
||||
item->SaveToDB(trans); // Not in inventory and can be saved standalone
|
||||
pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, 0);
|
||||
pItem->SetUInt64Value(ITEM_FIELD_OWNER, 0);
|
||||
pItem->FSetState(ITEM_NEW);
|
||||
pItem->SaveToDB(trans); // Not in inventory and can be saved standalone
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -759,12 +759,12 @@ bool Guild::MoveItemData::CheckItem(uint32& splitedAmount)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Guild::MoveItemData::CanStore(Item* item, bool swap, bool sendError)
|
||||
bool Guild::MoveItemData::CanStore(Item* pItem, bool swap, bool sendError)
|
||||
{
|
||||
m_vec.clear();
|
||||
InventoryResult msg = CanStore(item, swap);
|
||||
InventoryResult msg = CanStore(pItem, swap);
|
||||
if (sendError && msg != EQUIP_ERR_OK)
|
||||
m_pPlayer->SendEquipError(msg, item);
|
||||
m_pPlayer->SendEquipError(msg, pItem);
|
||||
return (msg == EQUIP_ERR_OK);
|
||||
}
|
||||
|
||||
@@ -834,12 +834,12 @@ void Guild::PlayerMoveItemData::RemoveItem(SQLTransaction& trans, MoveItemData*
|
||||
}
|
||||
}
|
||||
|
||||
Item* Guild::PlayerMoveItemData::StoreItem(SQLTransaction& trans, Item* item)
|
||||
Item* Guild::PlayerMoveItemData::StoreItem(SQLTransaction& trans, Item* pItem)
|
||||
{
|
||||
ASSERT(item);
|
||||
m_pPlayer->MoveItemToInventory(m_vec, item, true);
|
||||
ASSERT(pItem);
|
||||
m_pPlayer->MoveItemToInventory(m_vec, pItem, true);
|
||||
m_pPlayer->SaveInventoryAndGoldToDB(trans);
|
||||
return item;
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void Guild::PlayerMoveItemData::LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const
|
||||
@@ -850,9 +850,9 @@ void Guild::PlayerMoveItemData::LogBankEvent(SQLTransaction& trans, MoveItemData
|
||||
pFrom->GetItem()->GetEntry(), count);
|
||||
}
|
||||
|
||||
inline InventoryResult Guild::PlayerMoveItemData::CanStore(Item* item, bool swap)
|
||||
inline InventoryResult Guild::PlayerMoveItemData::CanStore(Item* pItem, bool swap)
|
||||
{
|
||||
return m_pPlayer->CanStoreItem(m_container, m_slotId, m_vec, item, swap);
|
||||
return m_pPlayer->CanStoreItem(m_container, m_slotId, m_vec, pItem, swap);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -900,24 +900,24 @@ void Guild::BankMoveItemData::RemoveItem(SQLTransaction& trans, MoveItemData* pO
|
||||
m_pGuild->_DecreaseMemberRemainingSlots(trans, m_pPlayer->GetGUID(), m_container);
|
||||
}
|
||||
|
||||
Item* Guild::BankMoveItemData::StoreItem(SQLTransaction& trans, Item* item)
|
||||
Item* Guild::BankMoveItemData::StoreItem(SQLTransaction& trans, Item* pItem)
|
||||
{
|
||||
if (!item)
|
||||
if (!pItem)
|
||||
return NULL;
|
||||
|
||||
BankTab* pTab = m_pGuild->GetBankTab(m_container);
|
||||
if (!pTab)
|
||||
return NULL;
|
||||
|
||||
Item* pLastItem = item;
|
||||
Item* pLastItem = pItem;
|
||||
for (ItemPosCountVec::const_iterator itr = m_vec.begin(); itr != m_vec.end(); )
|
||||
{
|
||||
ItemPosCount pos(*itr);
|
||||
++itr;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u",
|
||||
m_container, m_slotId, item->GetEntry(), item->GetCount());
|
||||
pLastItem = _StoreItem(trans, pTab, item, pos, itr != m_vec.end());
|
||||
m_container, m_slotId, pItem->GetEntry(), pItem->GetCount());
|
||||
pLastItem = _StoreItem(trans, pTab, pItem, pos, itr != m_vec.end());
|
||||
}
|
||||
return pLastItem;
|
||||
}
|
||||
@@ -946,7 +946,7 @@ void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const
|
||||
m_pGuild->GetId());
|
||||
}
|
||||
|
||||
Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab, Item* item, ItemPosCount& pos, bool clone) const
|
||||
Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const
|
||||
{
|
||||
uint8 slotId = uint8(pos.pos);
|
||||
uint32 count = pos.count;
|
||||
@@ -957,20 +957,20 @@ Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab,
|
||||
pItemDest->SaveToDB(trans);
|
||||
if (!clone)
|
||||
{
|
||||
item->RemoveFromWorld();
|
||||
item->DeleteFromDB(trans);
|
||||
delete item;
|
||||
pItem->RemoveFromWorld();
|
||||
pItem->DeleteFromDB(trans);
|
||||
delete pItem;
|
||||
}
|
||||
return pItemDest;
|
||||
}
|
||||
|
||||
if (clone)
|
||||
item = item->CloneItem(count);
|
||||
pItem = pItem->CloneItem(count);
|
||||
else
|
||||
item->SetCount(count);
|
||||
pItem->SetCount(count);
|
||||
|
||||
if (item && pTab->SetItem(trans, slotId, item))
|
||||
return item;
|
||||
if (pItem && pTab->SetItem(trans, slotId, pItem))
|
||||
return pItem;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -979,13 +979,13 @@ Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab,
|
||||
// If item in destination slot exists it must be the item of the same entry
|
||||
// and stack must have enough space to take at least one item.
|
||||
// Returns false if destination item specified and it cannot be used to reserve space.
|
||||
bool Guild::BankMoveItemData::_ReserveSpace(uint8 slotId, Item* item, Item* pItemDest, uint32& count)
|
||||
bool Guild::BankMoveItemData::_ReserveSpace(uint8 slotId, Item* pItem, Item* pItemDest, uint32& count)
|
||||
{
|
||||
uint32 requiredSpace = item->GetMaxStackCount();
|
||||
uint32 requiredSpace = pItem->GetMaxStackCount();
|
||||
if (pItemDest)
|
||||
{
|
||||
// Make sure source and destination items match and destination item has space for more stacks.
|
||||
if (pItemDest->GetEntry() != item->GetEntry() || pItemDest->GetCount() >= item->GetMaxStackCount())
|
||||
if (pItemDest->GetEntry() != pItem->GetEntry() || pItemDest->GetCount() >= pItem->GetMaxStackCount())
|
||||
return false;
|
||||
requiredSpace -= pItemDest->GetCount();
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ bool Guild::BankMoveItemData::_ReserveSpace(uint8 slotId, Item* item, Item* pIte
|
||||
return true;
|
||||
}
|
||||
|
||||
void Guild::BankMoveItemData::CanStoreItemInTab(Item* item, uint8 skipSlotId, bool merge, uint32& count)
|
||||
void Guild::BankMoveItemData::CanStoreItemInTab(Item* pItem, uint8 skipSlotId, bool merge, uint32& count)
|
||||
{
|
||||
for (uint8 slotId = 0; (slotId < GUILD_BANK_MAX_SLOTS) && (count > 0); ++slotId)
|
||||
{
|
||||
@@ -1011,25 +1011,25 @@ void Guild::BankMoveItemData::CanStoreItemInTab(Item* item, uint8 skipSlotId, bo
|
||||
continue;
|
||||
|
||||
Item* pItemDest = m_pGuild->_GetItem(m_container, slotId);
|
||||
if (pItemDest == item)
|
||||
if (pItemDest == pItem)
|
||||
pItemDest = NULL;
|
||||
|
||||
// If merge skip empty, if not merge skip non-empty
|
||||
if ((pItemDest != NULL) != merge)
|
||||
continue;
|
||||
|
||||
_ReserveSpace(slotId, item, pItemDest, count);
|
||||
_ReserveSpace(slotId, pItem, pItemDest, count);
|
||||
}
|
||||
}
|
||||
|
||||
InventoryResult Guild::BankMoveItemData::CanStore(Item* item, bool swap)
|
||||
InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "GUILD STORAGE: CanStore() tab = %u, slot = %u, item = %u, count = %u",
|
||||
m_container, m_slotId, item->GetEntry(), item->GetCount());
|
||||
m_container, m_slotId, pItem->GetEntry(), pItem->GetCount());
|
||||
|
||||
uint32 count = item->GetCount();
|
||||
uint32 count = pItem->GetCount();
|
||||
// Soulbound items cannot be moved
|
||||
if (item->IsSoulBound())
|
||||
if (pItem->IsSoulBound())
|
||||
return EQUIP_ERR_CANT_DROP_SOULBOUND;
|
||||
|
||||
// Make sure destination bank tab exists
|
||||
@@ -1041,10 +1041,10 @@ InventoryResult Guild::BankMoveItemData::CanStore(Item* item, bool swap)
|
||||
{
|
||||
Item* pItemDest = m_pGuild->_GetItem(m_container, m_slotId);
|
||||
// Ignore swapped item (this slot will be empty after move)
|
||||
if ((pItemDest == item) || swap)
|
||||
if ((pItemDest == pItem) || swap)
|
||||
pItemDest = NULL;
|
||||
|
||||
if (!_ReserveSpace(m_slotId, item, pItemDest, count))
|
||||
if (!_ReserveSpace(m_slotId, pItem, pItemDest, count))
|
||||
return EQUIP_ERR_ITEM_CANT_STACK;
|
||||
|
||||
if (count == 0)
|
||||
@@ -1053,15 +1053,15 @@ InventoryResult Guild::BankMoveItemData::CanStore(Item* item, bool swap)
|
||||
|
||||
// Slot was not specified or it has not enough space for all the items in stack
|
||||
// Search for stacks to merge with
|
||||
if (item->GetMaxStackCount() > 1)
|
||||
if (pItem->GetMaxStackCount() > 1)
|
||||
{
|
||||
CanStoreItemInTab(item, m_slotId, true, count);
|
||||
CanStoreItemInTab(pItem, m_slotId, true, count);
|
||||
if (count == 0)
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
// Search free slot for item
|
||||
CanStoreItemInTab(item, m_slotId, false, count);
|
||||
CanStoreItemInTab(pItem, m_slotId, false, count);
|
||||
if (count == 0)
|
||||
return EQUIP_ERR_OK;
|
||||
|
||||
|
||||
@@ -476,7 +476,7 @@ private:
|
||||
void SendText(const Guild* guild, WorldSession* session) const;
|
||||
|
||||
inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : NULL; }
|
||||
bool SetItem(SQLTransaction& trans, uint8 slotId, Item* item);
|
||||
bool SetItem(SQLTransaction& trans, uint8 slotId, Item* pItem);
|
||||
|
||||
private:
|
||||
uint32 m_guildId;
|
||||
@@ -506,13 +506,13 @@ private:
|
||||
// Defines if player has rights to withdraw item from container
|
||||
virtual bool HasWithdrawRights(MoveItemData* /*pOther*/) const { return true; }
|
||||
// Checks if container can store specified item
|
||||
bool CanStore(Item* item, bool swap, bool sendError);
|
||||
bool CanStore(Item* pItem, bool swap, bool sendError);
|
||||
// Clones stored item
|
||||
bool CloneItem(uint32 count);
|
||||
// Remove item from container (if splited update items fields)
|
||||
virtual void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount = 0) = 0;
|
||||
// Saves item to container
|
||||
virtual Item* StoreItem(SQLTransaction& trans, Item* item) = 0;
|
||||
virtual Item* StoreItem(SQLTransaction& trans, Item* pItem) = 0;
|
||||
// Log bank event
|
||||
virtual void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const = 0;
|
||||
// Log GM action
|
||||
@@ -524,7 +524,7 @@ private:
|
||||
uint8 GetContainer() const { return m_container; }
|
||||
uint8 GetSlotId() const { return m_slotId; }
|
||||
protected:
|
||||
virtual InventoryResult CanStore(Item* item, bool swap) = 0;
|
||||
virtual InventoryResult CanStore(Item* pItem, bool swap) = 0;
|
||||
|
||||
Guild* m_pGuild;
|
||||
Player* m_pPlayer;
|
||||
@@ -544,10 +544,10 @@ private:
|
||||
bool IsBank() const { return false; }
|
||||
bool InitItem();
|
||||
void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount = 0);
|
||||
Item* StoreItem(SQLTransaction& trans, Item* item);
|
||||
Item* StoreItem(SQLTransaction& trans, Item* pItem);
|
||||
void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const;
|
||||
protected:
|
||||
InventoryResult CanStore(Item* item, bool swap);
|
||||
InventoryResult CanStore(Item* pItem, bool swap);
|
||||
};
|
||||
|
||||
class BankMoveItemData : public MoveItemData
|
||||
@@ -561,17 +561,17 @@ private:
|
||||
bool HasStoreRights(MoveItemData* pOther) const;
|
||||
bool HasWithdrawRights(MoveItemData* pOther) const;
|
||||
void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount);
|
||||
Item* StoreItem(SQLTransaction& trans, Item* item);
|
||||
Item* StoreItem(SQLTransaction& trans, Item* pItem);
|
||||
void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const;
|
||||
void LogAction(MoveItemData* pFrom) const;
|
||||
|
||||
protected:
|
||||
InventoryResult CanStore(Item* item, bool swap);
|
||||
InventoryResult CanStore(Item* pItem, bool swap);
|
||||
|
||||
private:
|
||||
Item* _StoreItem(SQLTransaction& trans, BankTab* pTab, Item* item, ItemPosCount& pos, bool clone) const;
|
||||
bool _ReserveSpace(uint8 slotId, Item* item, Item* pItemDest, uint32& count);
|
||||
void CanStoreItemInTab(Item* item, uint8 skipSlotId, bool merge, uint32& count);
|
||||
Item* _StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const;
|
||||
bool _ReserveSpace(uint8 slotId, Item* pItem, Item* pItemDest, uint32& count);
|
||||
void CanStoreItemInTab(Item* pItem, uint8 skipSlotId, bool merge, uint32& count);
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Member*> Members;
|
||||
|
||||
@@ -504,8 +504,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
if (auction && auction->owner == player->GetGUIDLow())
|
||||
{
|
||||
Item* item = sAuctionMgr->GetAItem(auction->item_guidlow);
|
||||
if (item)
|
||||
Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
|
||||
if (pItem)
|
||||
{
|
||||
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
|
||||
{
|
||||
@@ -522,7 +522,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
|
||||
// item will deleted or added to received mail list
|
||||
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
||||
.AddItem(item)
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -255,14 +255,14 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
Item* item = _player->GetItemByPos(bag, slot);
|
||||
if (!item)
|
||||
Item* pItem = _player->GetItemByPos(bag, slot);
|
||||
if (!pItem)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_INDESTRUCTIBLE)
|
||||
if (pItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_INDESTRUCTIBLE)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, NULL, NULL);
|
||||
return;
|
||||
@@ -271,7 +271,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data)
|
||||
if (count)
|
||||
{
|
||||
uint32 i_count = count;
|
||||
_player->DestroyItemCount(item, i_count, true);
|
||||
_player->DestroyItemCount(pItem, i_count, true);
|
||||
}
|
||||
else
|
||||
_player->DestroyItem(bag, slot, true);
|
||||
@@ -445,13 +445,13 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data)
|
||||
recv_data >> bag >> slot;
|
||||
|
||||
//sLog->outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
|
||||
Item* item = _player->GetItemByPos(bag, slot);
|
||||
Item* pItem = _player->GetItemByPos(bag, slot);
|
||||
|
||||
if (item && item->GetTemplate()->PageText)
|
||||
if (pItem && pItem->GetTemplate()->PageText)
|
||||
{
|
||||
WorldPacket data;
|
||||
|
||||
InventoryResult msg = _player->CanUseItem(item);
|
||||
InventoryResult msg = _player->CanUseItem(pItem);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
data.Initialize (SMSG_READ_ITEM_OK, 8);
|
||||
@@ -461,9 +461,9 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data)
|
||||
{
|
||||
data.Initialize(SMSG_READ_ITEM_FAILED, 8);
|
||||
sLog->outDetail("STORAGE: Unable to read item");
|
||||
_player->SendEquipError(msg, item, NULL);
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
}
|
||||
data << item->GetGUID();
|
||||
data << pItem->GetGUID();
|
||||
SendPacket(&data);
|
||||
}
|
||||
else
|
||||
@@ -506,25 +506,25 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
|
||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
Item* item = _player->GetItemByGuid(itemguid);
|
||||
if (item)
|
||||
Item* pItem = _player->GetItemByGuid(itemguid);
|
||||
if (pItem)
|
||||
{
|
||||
// prevent sell not owner item
|
||||
if (_player->GetGUID() != item->GetOwnerGUID())
|
||||
if (_player->GetGUID() != pItem->GetOwnerGUID())
|
||||
{
|
||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent sell non empty bag by drag-and-drop at vendor's item list
|
||||
if (item->IsNotEmptyBag())
|
||||
if (pItem->IsNotEmptyBag())
|
||||
{
|
||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent sell currently looted item
|
||||
if (_player->GetLootGUID() == item->GetGUID())
|
||||
if (_player->GetLootGUID() == pItem->GetGUID())
|
||||
{
|
||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
||||
return;
|
||||
@@ -533,44 +533,44 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
|
||||
// prevent selling item for sellprice when the item is still refundable
|
||||
// this probably happens when right clicking a refundable item, the client sends both
|
||||
// CMSG_SELL_ITEM and CMSG_REFUND_ITEM (unverified)
|
||||
if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||
return; // Therefore, no feedback to client
|
||||
|
||||
// special case at auto sell (sell all)
|
||||
if (count == 0)
|
||||
{
|
||||
count = item->GetCount();
|
||||
count = pItem->GetCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
// prevent sell more items that exist in stack (possible only not from client)
|
||||
if (count > item->GetCount())
|
||||
if (count > pItem->GetCount())
|
||||
{
|
||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ItemTemplate const* pProto = item->GetTemplate();
|
||||
ItemTemplate const* pProto = pItem->GetTemplate();
|
||||
if (pProto)
|
||||
{
|
||||
if (pProto->SellPrice > 0)
|
||||
{
|
||||
if (count < item->GetCount()) // need split items
|
||||
if (count < pItem->GetCount()) // need split items
|
||||
{
|
||||
Item* pNewItem = item->CloneItem(count, _player);
|
||||
Item* pNewItem = pItem->CloneItem(count, _player);
|
||||
if (!pNewItem)
|
||||
{
|
||||
sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", item->GetEntry(), count);
|
||||
sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count);
|
||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
item->SetCount(item->GetCount() - count);
|
||||
_player->ItemRemovedQuestCheck(item->GetEntry(), count);
|
||||
pItem->SetCount(pItem->GetCount() - count);
|
||||
_player->ItemRemovedQuestCheck(pItem->GetEntry(), count);
|
||||
if (_player->IsInWorld())
|
||||
item->SendUpdateToPlayer(_player);
|
||||
item->SetState(ITEM_CHANGED, _player);
|
||||
pItem->SendUpdateToPlayer(_player);
|
||||
pItem->SetState(ITEM_CHANGED, _player);
|
||||
|
||||
_player->AddItemToBuyBackSlot(pNewItem);
|
||||
if (_player->IsInWorld())
|
||||
@@ -578,10 +578,10 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
else
|
||||
{
|
||||
_player->ItemRemovedQuestCheck(item->GetEntry(), item->GetCount());
|
||||
_player->RemoveItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||
item->RemoveFromUpdateQueueOf(_player);
|
||||
_player->AddItemToBuyBackSlot(item);
|
||||
_player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
|
||||
_player->RemoveItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
|
||||
pItem->RemoveFromUpdateQueueOf(_player);
|
||||
_player->AddItemToBuyBackSlot(pItem);
|
||||
}
|
||||
|
||||
uint32 money = pProto->SellPrice * count;
|
||||
@@ -617,28 +617,28 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
|
||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
Item* item = _player->GetItemFromBuyBackSlot(slot);
|
||||
if (item)
|
||||
Item* pItem = _player->GetItemFromBuyBackSlot(slot);
|
||||
if (pItem)
|
||||
{
|
||||
uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START);
|
||||
if (!_player->HasEnoughMoney(price))
|
||||
{
|
||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item->GetEntry(), 0);
|
||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, pItem->GetEntry(), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, item, false);
|
||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
_player->ModifyMoney(-(int32)price);
|
||||
_player->RemoveItemFromBuyBackSlot(slot, false);
|
||||
_player->ItemAddedQuestCheck(item->GetEntry(), item->GetCount());
|
||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item->GetEntry(), item->GetCount());
|
||||
_player->StoreItem(dest, item, true);
|
||||
_player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
|
||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
|
||||
_player->StoreItem(dest, pItem, true);
|
||||
}
|
||||
else
|
||||
_player->SendEquipError(msg, item, NULL);
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -815,8 +815,8 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
|
||||
recv_data >> srcbag >> srcslot >> dstbag;
|
||||
//sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag);
|
||||
|
||||
Item* item = _player->GetItemByPos(srcbag, srcslot);
|
||||
if (!item)
|
||||
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
if (!_player->IsValidPos(dstbag, NULL_SLOT, false)) // can be autostore pos
|
||||
@@ -825,7 +825,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
uint16 src = item->GetPos();
|
||||
uint16 src = pItem->GetPos();
|
||||
|
||||
// check unequip potability for equipped items and bank bags
|
||||
if (_player->IsEquipmentPos (src) || _player->IsBagPos (src))
|
||||
@@ -833,16 +833,16 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
|
||||
InventoryResult msg = _player->CanUnequipItem(src, !_player->IsBagPos (src));
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, item, NULL);
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, item, false);
|
||||
InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, item, NULL);
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -850,12 +850,12 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
|
||||
if (dest.size() == 1 && dest[0].pos == src)
|
||||
{
|
||||
// just remove grey item state
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
_player->RemoveItem(srcbag, srcslot, true);
|
||||
_player->StoreItem(dest, item, true);
|
||||
_player->StoreItem(dest, pItem, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
|
||||
@@ -919,27 +919,27 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
|
||||
recvPacket >> srcbag >> srcslot;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
|
||||
|
||||
Item* item = _player->GetItemByPos(srcbag, srcslot);
|
||||
if (!item)
|
||||
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false);
|
||||
InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, item, NULL);
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dest.size() == 1 && dest[0].pos == item->GetPos())
|
||||
if (dest.size() == 1 && dest[0].pos == pItem->GetPos())
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
_player->RemoveItem(srcbag, srcslot, true);
|
||||
_player->ItemRemovedQuestCheck(item->GetEntry(), item->GetCount());
|
||||
_player->BankItem(dest, item, true);
|
||||
_player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
|
||||
_player->BankItem(dest, pItem, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
||||
@@ -950,36 +950,36 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
||||
recvPacket >> srcbag >> srcslot;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
|
||||
|
||||
Item* item = _player->GetItemByPos(srcbag, srcslot);
|
||||
if (!item)
|
||||
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
if (_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, item, false);
|
||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, item, NULL);
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
_player->RemoveItem(srcbag, srcslot, true);
|
||||
_player->StoreItem(dest, item, true);
|
||||
_player->ItemAddedQuestCheck(item->GetEntry(), item->GetCount());
|
||||
_player->StoreItem(dest, pItem, true);
|
||||
_player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
|
||||
}
|
||||
else // moving from inventory to bank
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false);
|
||||
InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, item, NULL);
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
_player->RemoveItem(srcbag, srcslot, true);
|
||||
_player->BankItem(dest, item, true);
|
||||
_player->BankItem(dest, pItem, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,15 +55,15 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
else if (IS_ITEM_GUID(lguid))
|
||||
{
|
||||
Item* item = player->GetItemByGuid(lguid);
|
||||
Item* pItem = player->GetItemByGuid(lguid);
|
||||
|
||||
if (!item)
|
||||
if (!pItem)
|
||||
{
|
||||
player->SendLootRelease(lguid);
|
||||
return;
|
||||
}
|
||||
|
||||
loot = &item->loot;
|
||||
loot = &pItem->loot;
|
||||
}
|
||||
else if (IS_CORPSE_GUID(lguid))
|
||||
{
|
||||
@@ -357,29 +357,29 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
}
|
||||
else if (IS_ITEM_GUID(lguid))
|
||||
{
|
||||
Item* item = player->GetItemByGuid(lguid);
|
||||
if (!item)
|
||||
Item* pItem = player->GetItemByGuid(lguid);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
ItemTemplate const* proto = pItem->GetTemplate();
|
||||
|
||||
// destroy only 5 items from stack in case prospecting and milling
|
||||
if (proto->Flags & (ITEM_PROTO_FLAG_PROSPECTABLE | ITEM_PROTO_FLAG_MILLABLE))
|
||||
{
|
||||
item->m_lootGenerated = false;
|
||||
item->loot.clear();
|
||||
pItem->m_lootGenerated = false;
|
||||
pItem->loot.clear();
|
||||
|
||||
uint32 count = item->GetCount();
|
||||
uint32 count = pItem->GetCount();
|
||||
|
||||
// >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
|
||||
if (count > 5)
|
||||
count = 5;
|
||||
|
||||
player->DestroyItemCount(item, count, true);
|
||||
player->DestroyItemCount(pItem, count, true);
|
||||
}
|
||||
else
|
||||
// FIXME: item must not be deleted in case not fully looted state. But this pre-request implement loot saving in DB at item save. Or cheating possible.
|
||||
player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||
player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
|
||||
return; // item can be looted only single player
|
||||
}
|
||||
else
|
||||
|
||||
@@ -86,53 +86,53 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
Item* item = pUser->GetUseableItemByPos(bagIndex, slot);
|
||||
if (!item)
|
||||
Item* pItem = pUser->GetUseableItemByPos(bagIndex, slot);
|
||||
if (!pItem)
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetGUID() != itemGUID)
|
||||
if (pItem->GetGUID() != itemGUID)
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
sLog->outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, item->GetEntry(), glyphIndex, (uint32)recvPacket.size());
|
||||
sLog->outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size());
|
||||
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
ItemTemplate const* proto = pItem->GetTemplate();
|
||||
if (!proto)
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// some item classes can be used only in equipped state
|
||||
if (proto->InventoryType != INVTYPE_NON_EQUIP && !item->IsEquipped())
|
||||
if (proto->InventoryType != INVTYPE_NON_EQUIP && !pItem->IsEquipped())
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
InventoryResult msg = pUser->CanUseItem(item);
|
||||
InventoryResult msg = pUser->CanUseItem(pItem);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pUser->SendEquipError(msg, item, NULL);
|
||||
pUser->SendEquipError(msg, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// only allow conjured consumable, bandage, poisons (all should have the 2^21 item flag set in DB)
|
||||
if (proto->Class == ITEM_CLASS_CONSUMABLE && !(proto->Flags & ITEM_PROTO_FLAG_USEABLE_IN_ARENA) && pUser->InArena())
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// don't allow items banned in arena
|
||||
if (proto->Flags & ITEM_PROTO_FLAG_NOT_USEABLE_IN_ARENA && pUser->InArena())
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
if (!spellInfo->CanBeUsedInCombat())
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -152,12 +152,12 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
|
||||
// check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
|
||||
if (item->GetTemplate()->Bonding == BIND_WHEN_USE || item->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || item->GetTemplate()->Bonding == BIND_QUEST_ITEM)
|
||||
if (pItem->GetTemplate()->Bonding == BIND_WHEN_USE || pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM)
|
||||
{
|
||||
if (!item->IsSoulBound())
|
||||
if (!pItem->IsSoulBound())
|
||||
{
|
||||
item->SetState(ITEM_CHANGED, pUser);
|
||||
item->SetBinding(true);
|
||||
pItem->SetState(ITEM_CHANGED, pUser);
|
||||
pItem->SetBinding(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,10 +166,10 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
HandleClientCastFlags(recvPacket, castFlags, targets);
|
||||
|
||||
// Note: If script stop casting it must send appropriate data to client to prevent stuck item in gray state.
|
||||
if (!sScriptMgr->OnItemUse(pUser, item, targets))
|
||||
if (!sScriptMgr->OnItemUse(pUser, pItem, targets))
|
||||
{
|
||||
// no script or script not process request by self
|
||||
pUser->CastItemUseSpell(item, targets, castCount, glyphIndex);
|
||||
pUser->CastItemUseSpell(pItem, targets, castCount, glyphIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,10 +219,10 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
|
||||
|
||||
for (MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
{
|
||||
Item* item = mailItemIter->second;
|
||||
Item* pItem = mailItemIter->second;
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_MAIL_ITEM);
|
||||
stmt->setUInt32(0, mailId);
|
||||
stmt->setUInt32(1, item->GetGUIDLow());
|
||||
stmt->setUInt32(1, pItem->GetGUIDLow());
|
||||
stmt->setUInt32(2, receiver.GetPlayerGUIDLow());
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
@@ -1341,10 +1341,10 @@ void ScriptMgr::OnGuildMemberDepositMoney(Guild* guild, Player* player, uint32 &
|
||||
FOREACH_SCRIPT(GuildScript)->OnMemberDepositMoney(guild, player, amount);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGuildItemMove(Guild* guild, Player* player, Item* item, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
|
||||
void ScriptMgr::OnGuildItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
|
||||
bool isDestBank, uint8 destContainer, uint8 destSlotId)
|
||||
{
|
||||
FOREACH_SCRIPT(GuildScript)->OnItemMove(guild, player, item, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId);
|
||||
FOREACH_SCRIPT(GuildScript)->OnItemMove(guild, player, pItem, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGuildEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank)
|
||||
|
||||
@@ -764,7 +764,7 @@ class GuildScript : public ScriptObject
|
||||
virtual void OnMemberDepositMoney(Guild* /*guild*/, Player* /*player*/, uint32& /*amount*/) { }
|
||||
|
||||
// Called when a guild member moves an item in a guild bank.
|
||||
virtual void OnItemMove(Guild* /*guild*/, Player* /*player*/, Item* /*item*/, bool /*isSrcBank*/, uint8 /*srcContainer*/, uint8 /*srcSlotId*/,
|
||||
virtual void OnItemMove(Guild* /*guild*/, Player* /*player*/, Item* /*pItem*/, bool /*isSrcBank*/, uint8 /*srcContainer*/, uint8 /*srcSlotId*/,
|
||||
bool /*isDestBank*/, uint8 /*destContainer*/, uint8 /*destSlotId*/) { }
|
||||
|
||||
virtual void OnEvent(Guild* /*guild*/, uint8 /*eventType*/, uint32 /*playerGuid1*/, uint32 /*playerGuid2*/, uint8 /*newRank*/) { }
|
||||
@@ -1008,7 +1008,7 @@ class ScriptMgr
|
||||
void OnGuildDisband(Guild* guild);
|
||||
void OnGuildMemberWitdrawMoney(Guild* guild, Player* player, uint32 &amount, bool isRepair);
|
||||
void OnGuildMemberDepositMoney(Guild* guild, Player* player, uint32 &amount);
|
||||
void OnGuildItemMove(Guild* guild, Player* player, Item* item, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
|
||||
void OnGuildItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
|
||||
bool isDestBank, uint8 destContainer, uint8 destSlotId);
|
||||
void OnGuildEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank);
|
||||
void OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId);
|
||||
|
||||
@@ -2102,9 +2102,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
|
||||
// and also HandleAuraModDisarm is not triggered
|
||||
if (!target->CanUseAttackType(BASE_ATTACK))
|
||||
{
|
||||
if (Item* item = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||
if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||
{
|
||||
target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, item->GetTemplate(), NULL, apply);
|
||||
target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), NULL, apply);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2536,14 +2536,14 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
|
||||
// Handle damage modification, shapeshifted druids are not affected
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
|
||||
{
|
||||
if (Item* item = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
{
|
||||
uint8 attacktype = Player::GetAttackBySlot(slot);
|
||||
|
||||
if (attacktype < MAX_ATTACK)
|
||||
{
|
||||
target->ToPlayer()->_ApplyWeaponDamage(slot, item->GetTemplate(), NULL, !apply);
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), !apply);
|
||||
target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), NULL, !apply);
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4082,8 +4082,8 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, u
|
||||
return;
|
||||
|
||||
for (int i = 0; i < MAX_ATTACK; ++i)
|
||||
if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(item, WeaponAttackType(i), this, apply);
|
||||
if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply);
|
||||
|
||||
// mods must be applied base at equipped weapon class and subclass comparison
|
||||
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
|
||||
@@ -4395,8 +4395,8 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode,
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
for (int i = 0; i < MAX_ATTACK; ++i)
|
||||
if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
|
||||
if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply);
|
||||
}
|
||||
|
||||
// GetMiscValue() is bitmask of spell schools
|
||||
|
||||
@@ -530,8 +530,8 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
|
||||
if (m_attackType == RANGED_ATTACK)
|
||||
// wand case
|
||||
if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
|
||||
m_spellSchoolMask = SpellSchoolMask(1 << item->GetTemplate()->Damage[0].DamageType);
|
||||
if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
|
||||
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType);
|
||||
|
||||
if (originalCasterGUID)
|
||||
m_originalCasterGUID = originalCasterGUID;
|
||||
@@ -3952,12 +3952,12 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
|
||||
if (item)
|
||||
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
|
||||
if (pItem)
|
||||
{
|
||||
ammoInventoryType = item->GetTemplate()->InventoryType;
|
||||
ammoInventoryType = pItem->GetTemplate()->InventoryType;
|
||||
if (ammoInventoryType == INVTYPE_THROWN)
|
||||
ammoDisplayID = item->GetTemplate()->DisplayInfoID;
|
||||
ammoDisplayID = pItem->GetTemplate()->DisplayInfoID;
|
||||
else
|
||||
{
|
||||
uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
|
||||
@@ -4361,15 +4361,15 @@ void Spell::TakeAmmo()
|
||||
{
|
||||
if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
|
||||
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
|
||||
|
||||
// wands don't have ammo
|
||||
if (!item || item->IsBroken() || item->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
|
||||
if (!pItem || pItem->IsBroken() || pItem->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
|
||||
return;
|
||||
|
||||
if (item->GetTemplate()->InventoryType == INVTYPE_THROWN)
|
||||
if (pItem->GetTemplate()->InventoryType == INVTYPE_THROWN)
|
||||
{
|
||||
if (item->GetMaxStackCount() == 1)
|
||||
if (pItem->GetMaxStackCount() == 1)
|
||||
{
|
||||
// decrease durability for non-stackable throw weapon
|
||||
m_caster->ToPlayer()->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED);
|
||||
@@ -4378,7 +4378,7 @@ void Spell::TakeAmmo()
|
||||
{
|
||||
// decrease items amount for stackable throw weapon
|
||||
uint32 count = 1;
|
||||
m_caster->ToPlayer()->DestroyItemCount(item, count, true);
|
||||
m_caster->ToPlayer()->DestroyItemCount(pItem, count, true);
|
||||
}
|
||||
}
|
||||
else if (uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID))
|
||||
@@ -6216,15 +6216,15 @@ SpellCastResult Spell::CheckItems()
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER;
|
||||
if (m_attackType != RANGED_ATTACK)
|
||||
break;
|
||||
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
|
||||
if (!item || item->IsBroken())
|
||||
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
|
||||
if (!pItem || pItem->IsBroken())
|
||||
return SPELL_FAILED_EQUIPPED_ITEM;
|
||||
|
||||
switch (item->GetTemplate()->SubClass)
|
||||
switch (pItem->GetTemplate()->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_WEAPON_THROWN:
|
||||
{
|
||||
uint32 ammo = item->GetEntry();
|
||||
uint32 ammo = pItem->GetEntry();
|
||||
if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
|
||||
return SPELL_FAILED_NO_AMMO;
|
||||
}; break;
|
||||
@@ -6250,7 +6250,7 @@ SpellCastResult Spell::CheckItems()
|
||||
return SPELL_FAILED_NO_AMMO;
|
||||
|
||||
// check ammo ws. weapon compatibility
|
||||
switch (item->GetTemplate()->SubClass)
|
||||
switch (pItem->GetTemplate()->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_WEAPON_BOW:
|
||||
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
|
||||
@@ -6286,10 +6286,10 @@ SpellCastResult Spell::CheckItems()
|
||||
if (!pProto)
|
||||
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;
|
||||
|
||||
if (Item* item = p_caster->GetItemByEntry(item_id))
|
||||
if (Item* pitem = p_caster->GetItemByEntry(item_id))
|
||||
{
|
||||
for (int x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
|
||||
if (pProto->Spells[x].SpellCharges != 0 && item->GetSpellCharges(x) == pProto->Spells[x].SpellCharges)
|
||||
if (pProto->Spells[x].SpellCharges != 0 && pitem->GetSpellCharges(x) == pProto->Spells[x].SpellCharges)
|
||||
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1777,22 +1777,22 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
|
||||
if (num_to_add)
|
||||
{
|
||||
// create the new item and store it
|
||||
Item* item = player->StoreNewItem(dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid));
|
||||
Item* pItem = player->StoreNewItem(dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid));
|
||||
|
||||
// was it successful? return error if not
|
||||
if (!item)
|
||||
if (!pItem)
|
||||
{
|
||||
player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// set the "Crafted by ..." property of the item
|
||||
if (item->GetTemplate()->Class != ITEM_CLASS_CONSUMABLE && item->GetTemplate()->Class != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948)
|
||||
item->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
|
||||
if (pItem->GetTemplate()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetTemplate()->Class != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948)
|
||||
pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
|
||||
|
||||
// send info to the client
|
||||
if (item)
|
||||
player->SendNewItem(item, num_to_add, true, bgType == 0);
|
||||
if (pItem)
|
||||
player->SendNewItem(pItem, num_to_add, true, bgType == 0);
|
||||
|
||||
// we succeeded in creating at least one item, so a levelup is possible
|
||||
if (bgType == 0)
|
||||
@@ -6672,11 +6672,11 @@ void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Item* item = player->GetItemByEntry(item_id))
|
||||
if (Item* pItem = player->GetItemByEntry(item_id))
|
||||
{
|
||||
for (int x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
|
||||
item->SetSpellCharges(x, pProto->Spells[x].SpellCharges);
|
||||
item->SetState(ITEM_CHANGED, player);
|
||||
pItem->SetSpellCharges(x, pProto->Spells[x].SpellCharges);
|
||||
pItem->SetState(ITEM_CHANGED, player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,15 +163,15 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* item = handler->extractKeyFromLink((char*)args, "Hitem");
|
||||
if (!item)
|
||||
char* pitem = handler->extractKeyFromLink((char*)args, "Hitem");
|
||||
if (!pitem)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NEEDITEMSEND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 item_int = atol(item);
|
||||
int32 item_int = atol(pitem);
|
||||
if (item_int <= 0)
|
||||
return false;
|
||||
|
||||
@@ -411,14 +411,14 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
char* item = handler->extractKeyFromLink((char*)args, "Hitem");
|
||||
if (!item)
|
||||
char* pitem = handler->extractKeyFromLink((char*)args, "Hitem");
|
||||
if (!pitem)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NEEDITEMSEND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
uint32 itemId = atol(item);
|
||||
uint32 itemId = atol(pitem);
|
||||
|
||||
if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), itemId))
|
||||
{
|
||||
|
||||
+3
-3
@@ -267,11 +267,11 @@ public:
|
||||
//dosen't work at all
|
||||
if (uiShieldBreakerTimer <= uiDiff)
|
||||
{
|
||||
Vehicle* vehicle = me->GetVehicleKit();
|
||||
if (!vehicle)
|
||||
Vehicle* pVehicle = me->GetVehicleKit();
|
||||
if (!pVehicle)
|
||||
return;
|
||||
|
||||
if (Unit* pPassenger = vehicle->GetPassenger(SEAT_ID_0))
|
||||
if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0))
|
||||
{
|
||||
Map::PlayerList const& players = me->GetMap()->GetPlayers();
|
||||
if (me->GetMap()->IsDungeon() && !players.isEmpty())
|
||||
|
||||
+6
-6
@@ -221,8 +221,8 @@ public:
|
||||
{
|
||||
uiVehicle1GUID = pBoss->GetGUID();
|
||||
uint64 uiGrandChampionBoss1 = 0;
|
||||
if (Vehicle* vehicle = pBoss->GetVehicleKit())
|
||||
if (Unit* unit = vehicle->GetPassenger(0))
|
||||
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
|
||||
if (Unit* unit = pVehicle->GetPassenger(0))
|
||||
uiGrandChampionBoss1 = unit->GetGUID();
|
||||
if (instance)
|
||||
{
|
||||
@@ -236,8 +236,8 @@ public:
|
||||
{
|
||||
uiVehicle2GUID = pBoss->GetGUID();
|
||||
uint64 uiGrandChampionBoss2 = 0;
|
||||
if (Vehicle* vehicle = pBoss->GetVehicleKit())
|
||||
if (Unit* unit = vehicle->GetPassenger(0))
|
||||
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
|
||||
if (Unit* unit = pVehicle->GetPassenger(0))
|
||||
uiGrandChampionBoss2 = unit->GetGUID();
|
||||
if (instance)
|
||||
{
|
||||
@@ -251,8 +251,8 @@ public:
|
||||
{
|
||||
uiVehicle3GUID = pBoss->GetGUID();
|
||||
uint64 uiGrandChampionBoss3 = 0;
|
||||
if (Vehicle* vehicle = pBoss->GetVehicleKit())
|
||||
if (Unit* unit = vehicle->GetPassenger(0))
|
||||
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
|
||||
if (Unit* unit = pVehicle->GetPassenger(0))
|
||||
uiGrandChampionBoss3 = unit->GetGUID();
|
||||
if (instance)
|
||||
{
|
||||
|
||||
@@ -176,9 +176,9 @@ public:
|
||||
{
|
||||
if (AggroYellTimer <= diff)
|
||||
{
|
||||
if (Unit* member = Unit::GetUnit(*me, Council[YellCounter]))
|
||||
if (Unit* pMember = Unit::GetUnit(*me, Council[YellCounter]))
|
||||
{
|
||||
DoScriptText(CouncilAggro[YellCounter].entry, member);
|
||||
DoScriptText(CouncilAggro[YellCounter].entry, pMember);
|
||||
AggroYellTimer = CouncilAggro[YellCounter].timer;
|
||||
}
|
||||
++YellCounter;
|
||||
@@ -191,10 +191,10 @@ public:
|
||||
{
|
||||
if (EnrageTimer <= diff)
|
||||
{
|
||||
if (Unit* member = Unit::GetUnit(*me, Council[YellCounter]))
|
||||
if (Unit* pMember = Unit::GetUnit(*me, Council[YellCounter]))
|
||||
{
|
||||
member->CastSpell(member, SPELL_BERSERK, true);
|
||||
DoScriptText(CouncilEnrage[YellCounter].entry, member);
|
||||
pMember->CastSpell(pMember, SPELL_BERSERK, true);
|
||||
DoScriptText(CouncilEnrage[YellCounter].entry, pMember);
|
||||
EnrageTimer = CouncilEnrage[YellCounter].timer;
|
||||
}
|
||||
++YellCounter;
|
||||
@@ -242,19 +242,19 @@ public:
|
||||
|
||||
DeathCount = 0;
|
||||
|
||||
Creature* member = NULL;
|
||||
Creature* pMember = NULL;
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
{
|
||||
member = Unit::GetCreature((*me), Council[i]);
|
||||
if (!member)
|
||||
pMember = Unit::GetCreature((*me), Council[i]);
|
||||
if (!pMember)
|
||||
continue;
|
||||
|
||||
if (!member->isAlive())
|
||||
if (!pMember->isAlive())
|
||||
{
|
||||
member->RemoveCorpse();
|
||||
member->Respawn();
|
||||
pMember->RemoveCorpse();
|
||||
pMember->Respawn();
|
||||
}
|
||||
member->AI()->EnterEvadeMode();
|
||||
pMember->AI()->EnterEvadeMode();
|
||||
}
|
||||
|
||||
if (instance)
|
||||
@@ -332,9 +332,9 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
Creature* member = (Unit::GetCreature(*me, Council[DeathCount]));
|
||||
if (member && member->isAlive())
|
||||
member->DealDamage(member, member->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
Creature* pMember = (Unit::GetCreature(*me, Council[DeathCount]));
|
||||
if (pMember && pMember->isAlive())
|
||||
pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
++DeathCount;
|
||||
EndEventTimer = 1500;
|
||||
} else EndEventTimer -= diff;
|
||||
|
||||
@@ -55,8 +55,8 @@ class spell_item_trigger_spell : public SpellScriptLoader
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Item* item = GetCastItem())
|
||||
caster->CastSpell(caster, _triggeredSpellId, true, item);
|
||||
if (Item* pItem = GetCastItem())
|
||||
caster->CastSpell(caster, _triggeredSpellId, true, pItem);
|
||||
}
|
||||
|
||||
void Register()
|
||||
|
||||
@@ -47,9 +47,9 @@ class item_only_for_flight : public ItemScript
|
||||
public:
|
||||
item_only_for_flight() : ItemScript("item_only_for_flight") { }
|
||||
|
||||
bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
|
||||
bool OnUse(Player* player, Item* pItem, SpellCastTargets const& /*targets*/)
|
||||
{
|
||||
uint32 itemId = item->GetEntry();
|
||||
uint32 itemId = pItem->GetEntry();
|
||||
bool disabled = false;
|
||||
|
||||
//for special scripts
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
return false;
|
||||
|
||||
// error
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -110,13 +110,13 @@ class item_gor_dreks_ointment : public ItemScript
|
||||
public:
|
||||
item_gor_dreks_ointment() : ItemScript("item_gor_dreks_ointment") { }
|
||||
|
||||
bool OnUse(Player* player, Item* item, SpellCastTargets const& targets)
|
||||
bool OnUse(Player* player, Item* pItem, SpellCastTargets const& targets)
|
||||
{
|
||||
if (targets.GetUnitTarget() && targets.GetUnitTarget()->GetTypeId() == TYPEID_UNIT &&
|
||||
targets.GetUnitTarget()->GetEntry() == 20748 && !targets.GetUnitTarget()->HasAura(32578))
|
||||
return false;
|
||||
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -130,13 +130,13 @@ class item_incendiary_explosives : public ItemScript
|
||||
public:
|
||||
item_incendiary_explosives() : ItemScript("item_incendiary_explosives") { }
|
||||
|
||||
bool OnUse(Player* player, Item* item, SpellCastTargets const & /*targets*/)
|
||||
bool OnUse(Player* player, Item* pItem, SpellCastTargets const & /*targets*/)
|
||||
{
|
||||
if (player->FindNearestCreature(26248, 15) || player->FindNearestCreature(26249, 15))
|
||||
return false;
|
||||
else
|
||||
{
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -219,7 +219,7 @@ class item_pile_fake_furs : public ItemScript
|
||||
public:
|
||||
item_pile_fake_furs() : ItemScript("item_pile_fake_furs") { }
|
||||
|
||||
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/)
|
||||
bool OnUse(Player* player, Item* /*pItem*/, SpellCastTargets const & /*targets*/)
|
||||
{
|
||||
GameObject* go = NULL;
|
||||
for (uint8 i = 0; i < CaribouTrapsNum; ++i)
|
||||
@@ -264,14 +264,14 @@ class item_petrov_cluster_bombs : public ItemScript
|
||||
public:
|
||||
item_petrov_cluster_bombs() : ItemScript("item_petrov_cluster_bombs") { }
|
||||
|
||||
bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/)
|
||||
bool OnUse(Player* player, Item* pItem, const SpellCastTargets & /*targets*/)
|
||||
{
|
||||
if (player->GetZoneId() != ZONE_ID_HOWLING)
|
||||
return false;
|
||||
|
||||
if (!player->GetTransport() || player->GetAreaId() != AREA_ID_SHATTERED_STRAITS)
|
||||
{
|
||||
player->SendEquipError(EQUIP_ERR_NONE, item, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
|
||||
|
||||
if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB))
|
||||
Spell::SendCastResult(player, spellInfo, 1, SPELL_FAILED_NOT_HERE);
|
||||
@@ -330,7 +330,7 @@ class item_dehta_trap_smasher : public ItemScript
|
||||
public:
|
||||
item_dehta_trap_smasher() : ItemScript("item_dehta_trap_smasher") { }
|
||||
|
||||
bool OnUse(Player* player, Item* /*item*/, const SpellCastTargets & /*targets*/)
|
||||
bool OnUse(Player* player, Item* /*pItem*/, const SpellCastTargets & /*targets*/)
|
||||
{
|
||||
if (player->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) != QUEST_STATUS_INCOMPLETE)
|
||||
return false;
|
||||
@@ -367,7 +367,7 @@ class item_trident_of_nazjan : public ItemScript
|
||||
public:
|
||||
item_trident_of_nazjan() : ItemScript("item_Trident_of_Nazjan") { }
|
||||
|
||||
bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/)
|
||||
bool OnUse(Player* player, Item* pItem, const SpellCastTargets & /*targets*/)
|
||||
{
|
||||
if (player->GetQuestStatus(QUEST_THE_EMISSARY) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
@@ -376,9 +376,9 @@ public:
|
||||
pLeviroth->AI()->AttackStart(player);
|
||||
return false;
|
||||
} else
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL);
|
||||
} else
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -394,17 +394,17 @@ class item_captured_frog : public ItemScript
|
||||
public:
|
||||
item_captured_frog() : ItemScript("item_captured_frog") { }
|
||||
|
||||
bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
|
||||
bool OnUse(Player* player, Item* pItem, SpellCastTargets const& /*targets*/)
|
||||
{
|
||||
if (player->GetQuestStatus(QUEST_THE_PERFECT_SPIES) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
if (player->FindNearestCreature(NPC_VANIRAS_SENTRY_TOTEM, 10.0f))
|
||||
return false;
|
||||
else
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL);
|
||||
}
|
||||
else
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -241,14 +241,14 @@ bool EquippedOk(Player* player, uint32 spellId)
|
||||
if (!reqSpell)
|
||||
continue;
|
||||
|
||||
Item* item;
|
||||
Item* pItem;
|
||||
for (uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; ++j)
|
||||
{
|
||||
item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j);
|
||||
if (item && item->GetTemplate()->RequiredSpell == reqSpell)
|
||||
pItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j);
|
||||
if (pItem && pItem->GetTemplate()->RequiredSpell == reqSpell)
|
||||
{
|
||||
//player has item equipped that require specialty. Not allow to unlearn, player has to unequip first
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, pItem->GetEntry());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user