mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
@@ -55,7 +55,7 @@ void AddItemsSetItem(Player* player, Item* item)
|
||||
break;
|
||||
|
||||
if (x < player->ItemSetEff.size())
|
||||
player->ItemSetEff[x]=eff;
|
||||
player->ItemSetEff[x] = eff;
|
||||
else
|
||||
player->ItemSetEff.push_back(eff);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void AddItemsSetItem(Player* player, Item* item)
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveItemsSetItem(Player*player, ItemTemplate const* proto)
|
||||
void RemoveItemsSetItem(Player* player, ItemTemplate const* proto)
|
||||
{
|
||||
uint32 setid = proto->ItemSet;
|
||||
|
||||
@@ -143,7 +143,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto)
|
||||
{
|
||||
// spell can be not active if not fit form requirement
|
||||
player->ApplyEquipSpell(eff->spells[z], NULL, false);
|
||||
eff->spells[z]=NULL;
|
||||
eff->spells[z] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -309,68 +309,68 @@ void Item::SaveToDB(SQLTransaction& trans)
|
||||
{
|
||||
case ITEM_NEW:
|
||||
case ITEM_CHANGED:
|
||||
{
|
||||
uint8 index = 0;
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE);
|
||||
stmt->setUInt32( index, GetEntry());
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetOwnerGUID()));
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_CREATOR)));
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_GIFTCREATOR)));
|
||||
stmt->setUInt32(++index, GetCount());
|
||||
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION));
|
||||
|
||||
std::ostringstream ssSpells;
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
ssSpells << GetSpellCharges(i) << ' ';
|
||||
stmt->setString(++index, ssSpells.str());
|
||||
|
||||
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_FLAGS));
|
||||
|
||||
std::ostringstream ssEnchants;
|
||||
for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
|
||||
{
|
||||
ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << ' ';
|
||||
ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' ';
|
||||
ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' ';
|
||||
}
|
||||
stmt->setString(++index, ssEnchants.str());
|
||||
uint8 index = 0;
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE);
|
||||
stmt->setUInt32( index, GetEntry());
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetOwnerGUID()));
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_CREATOR)));
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_GIFTCREATOR)));
|
||||
stmt->setUInt32(++index, GetCount());
|
||||
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION));
|
||||
|
||||
stmt->setInt16 (++index, GetItemRandomPropertyId());
|
||||
stmt->setUInt16(++index, GetUInt32Value(ITEM_FIELD_DURABILITY));
|
||||
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME));
|
||||
stmt->setString(++index, m_text);
|
||||
stmt->setUInt32(++index, guid);
|
||||
std::ostringstream ssSpells;
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
ssSpells << GetSpellCharges(i) << ' ';
|
||||
stmt->setString(++index, ssSpells.str());
|
||||
|
||||
trans->Append(stmt);
|
||||
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_FLAGS));
|
||||
|
||||
std::ostringstream ssEnchants;
|
||||
for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
|
||||
{
|
||||
ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << ' ';
|
||||
ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' ';
|
||||
ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' ';
|
||||
}
|
||||
stmt->setString(++index, ssEnchants.str());
|
||||
|
||||
stmt->setInt16 (++index, GetItemRandomPropertyId());
|
||||
stmt->setUInt16(++index, GetUInt32Value(ITEM_FIELD_DURABILITY));
|
||||
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME));
|
||||
stmt->setString(++index, m_text);
|
||||
stmt->setUInt32(++index, guid);
|
||||
|
||||
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
|
||||
stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
|
||||
stmt->setUInt32(1, guid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITEM_REMOVED:
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
||||
stmt->setUInt32(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
|
||||
stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
|
||||
stmt->setUInt32(1, guid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITEM_REMOVED:
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
||||
stmt->setUInt32(0, guid);
|
||||
trans->Append(stmt);
|
||||
|
||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
|
||||
stmt->setUInt32(0, guid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
if (!isInTransaction)
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isInTransaction)
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
case ITEM_UNCHANGED:
|
||||
break;
|
||||
}
|
||||
@@ -467,7 +467,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
||||
/*static*/
|
||||
void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid)
|
||||
{
|
||||
sScriptMgr->OnGlobalItemDelFromDB(trans,itemGuid);
|
||||
sScriptMgr->OnGlobalItemDelFromDB(trans, itemGuid);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
||||
stmt->setUInt32(0, itemGuid);
|
||||
trans->Append(stmt);
|
||||
@@ -516,32 +516,54 @@ uint32 Item::GetSpell()
|
||||
case ITEM_CLASS_WEAPON:
|
||||
switch (proto->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_WEAPON_AXE: return 196;
|
||||
case ITEM_SUBCLASS_WEAPON_AXE2: return 197;
|
||||
case ITEM_SUBCLASS_WEAPON_BOW: return 264;
|
||||
case ITEM_SUBCLASS_WEAPON_GUN: return 266;
|
||||
case ITEM_SUBCLASS_WEAPON_MACE: return 198;
|
||||
case ITEM_SUBCLASS_WEAPON_MACE2: return 199;
|
||||
case ITEM_SUBCLASS_WEAPON_POLEARM: return 200;
|
||||
case ITEM_SUBCLASS_WEAPON_SWORD: return 201;
|
||||
case ITEM_SUBCLASS_WEAPON_SWORD2: return 202;
|
||||
case ITEM_SUBCLASS_WEAPON_STAFF: return 227;
|
||||
case ITEM_SUBCLASS_WEAPON_DAGGER: return 1180;
|
||||
case ITEM_SUBCLASS_WEAPON_THROWN: return 2567;
|
||||
case ITEM_SUBCLASS_WEAPON_SPEAR: return 3386;
|
||||
case ITEM_SUBCLASS_WEAPON_CROSSBOW:return 5011;
|
||||
case ITEM_SUBCLASS_WEAPON_WAND: return 5009;
|
||||
default: return 0;
|
||||
case ITEM_SUBCLASS_WEAPON_AXE:
|
||||
return 196;
|
||||
case ITEM_SUBCLASS_WEAPON_AXE2:
|
||||
return 197;
|
||||
case ITEM_SUBCLASS_WEAPON_BOW:
|
||||
return 264;
|
||||
case ITEM_SUBCLASS_WEAPON_GUN:
|
||||
return 266;
|
||||
case ITEM_SUBCLASS_WEAPON_MACE:
|
||||
return 198;
|
||||
case ITEM_SUBCLASS_WEAPON_MACE2:
|
||||
return 199;
|
||||
case ITEM_SUBCLASS_WEAPON_POLEARM:
|
||||
return 200;
|
||||
case ITEM_SUBCLASS_WEAPON_SWORD:
|
||||
return 201;
|
||||
case ITEM_SUBCLASS_WEAPON_SWORD2:
|
||||
return 202;
|
||||
case ITEM_SUBCLASS_WEAPON_STAFF:
|
||||
return 227;
|
||||
case ITEM_SUBCLASS_WEAPON_DAGGER:
|
||||
return 1180;
|
||||
case ITEM_SUBCLASS_WEAPON_THROWN:
|
||||
return 2567;
|
||||
case ITEM_SUBCLASS_WEAPON_SPEAR:
|
||||
return 3386;
|
||||
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
|
||||
return 5011;
|
||||
case ITEM_SUBCLASS_WEAPON_WAND:
|
||||
return 5009;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
case ITEM_CLASS_ARMOR:
|
||||
switch (proto->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_ARMOR_CLOTH: return 9078;
|
||||
case ITEM_SUBCLASS_ARMOR_LEATHER: return 9077;
|
||||
case ITEM_SUBCLASS_ARMOR_MAIL: return 8737;
|
||||
case ITEM_SUBCLASS_ARMOR_PLATE: return 750;
|
||||
case ITEM_SUBCLASS_ARMOR_SHIELD: return 9116;
|
||||
default: return 0;
|
||||
case ITEM_SUBCLASS_ARMOR_CLOTH:
|
||||
return 9078;
|
||||
case ITEM_SUBCLASS_ARMOR_LEATHER:
|
||||
return 9077;
|
||||
case ITEM_SUBCLASS_ARMOR_MAIL:
|
||||
return 8737;
|
||||
case ITEM_SUBCLASS_ARMOR_PLATE:
|
||||
return 750;
|
||||
case ITEM_SUBCLASS_ARMOR_SHIELD:
|
||||
return 9116;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -618,7 +640,7 @@ void Item::SetItemRandomProperties(int32 randomPropId)
|
||||
if (item_rand)
|
||||
{
|
||||
if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) ||
|
||||
!GetItemSuffixFactor())
|
||||
!GetItemSuffixFactor())
|
||||
{
|
||||
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, -int32(item_rand->ID));
|
||||
UpdateItemSuffixFactor();
|
||||
@@ -688,7 +710,7 @@ void Item::AddToUpdateQueueOf(Player* player)
|
||||
return;
|
||||
|
||||
player->m_itemUpdateQueue.push_back(this);
|
||||
uQueuePos = player->m_itemUpdateQueue.size()-1;
|
||||
uQueuePos = player->m_itemUpdateQueue.size() - 1;
|
||||
}
|
||||
|
||||
void Item::RemoveFromUpdateQueueOf(Player* player)
|
||||
@@ -763,7 +785,7 @@ bool Item::HasEnchantRequiredSkill(const Player* player) const
|
||||
if (enchantEntry->requiredSkill && player->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 Item::GetEnchantRequiredLevel() const
|
||||
@@ -825,7 +847,7 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
|
||||
{
|
||||
// Special case - accept vellum for armor/weapon requirements
|
||||
if ((spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && proto->IsArmorVellum())
|
||||
||(spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && proto->IsWeaponVellum()))
|
||||
|| (spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && proto->IsWeaponVellum()))
|
||||
if (spellInfo->IsAbilityOfSkillType(SKILL_ENCHANTING)) // only for enchanting spells
|
||||
return true;
|
||||
|
||||
@@ -843,8 +865,8 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
|
||||
{
|
||||
// Special case - accept weapon type for main and offhand requirements
|
||||
if (proto->InventoryType == INVTYPE_WEAPON &&
|
||||
(spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONMAINHAND) ||
|
||||
spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND)))
|
||||
(spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONMAINHAND) ||
|
||||
spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND)))
|
||||
return true;
|
||||
else if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
|
||||
return false; // inventory type not present in mask
|
||||
@@ -869,9 +891,9 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
|
||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetEntry(), id);
|
||||
}
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET, id);
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges);
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET, id);
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges);
|
||||
SetState(ITEM_CHANGED, owner);
|
||||
}
|
||||
void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner)
|
||||
@@ -879,7 +901,7 @@ void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player*
|
||||
if (GetEnchantmentDuration(slot) == duration)
|
||||
return;
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
||||
SetState(ITEM_CHANGED, owner);
|
||||
// Cannot use GetOwner() here, has to be passed as an argument to avoid freeze due to hashtable locking
|
||||
}
|
||||
@@ -889,7 +911,7 @@ void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
|
||||
if (GetEnchantmentCharges(slot) == charges)
|
||||
return;
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges);
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges);
|
||||
SetState(ITEM_CHANGED, GetOwner());
|
||||
}
|
||||
|
||||
@@ -899,15 +921,15 @@ void Item::ClearEnchantment(EnchantmentSlot slot)
|
||||
return;
|
||||
|
||||
for (uint8 x = 0; x < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++x)
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + x, 0);
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + x, 0);
|
||||
SetState(ITEM_CHANGED, GetOwner());
|
||||
}
|
||||
|
||||
bool Item::GemsFitSockets() const
|
||||
{
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
{
|
||||
uint8 SocketColor = GetTemplate()->Socket[enchant_slot-SOCK_ENCHANTMENT_SLOT].Color;
|
||||
uint8 SocketColor = GetTemplate()->Socket[enchant_slot - SOCK_ENCHANTMENT_SLOT].Color;
|
||||
|
||||
if (!SocketColor) // no socket slot
|
||||
continue;
|
||||
@@ -943,7 +965,7 @@ bool Item::GemsFitSockets() const
|
||||
uint8 Item::GetGemCountWithID(uint32 GemID) const
|
||||
{
|
||||
uint8 count = 0;
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
{
|
||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||
if (!enchant_id)
|
||||
@@ -962,7 +984,7 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const
|
||||
uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
|
||||
{
|
||||
uint8 count = 0;
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
{
|
||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||
if (!enchant_id)
|
||||
@@ -990,7 +1012,7 @@ bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) cons
|
||||
|
||||
void Item::SendUpdateSockets()
|
||||
{
|
||||
WorldPacket data(SMSG_SOCKET_GEMS_RESULT, 8+4+4+4+4);
|
||||
WorldPacket data(SMSG_SOCKET_GEMS_RESULT, 8 + 4 + 4 + 4 + 4);
|
||||
data << uint64(GetGUID());
|
||||
for (uint32 i = SOCK_ENCHANTMENT_SLOT; i <= BONUS_ENCHANTMENT_SLOT; ++i)
|
||||
data << uint32(GetEnchantmentId(EnchantmentSlot(i)));
|
||||
@@ -1007,7 +1029,7 @@ void Item::SendTimeUpdate(Player* owner)
|
||||
if (!duration)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8+4));
|
||||
WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8 + 4));
|
||||
data << uint64(GetGUID());
|
||||
data << uint32(duration);
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
@@ -1024,7 +1046,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clo
|
||||
if (count > pProto->GetMaxStackSize())
|
||||
count = pProto->GetMaxStackSize();
|
||||
|
||||
ASSERT(count !=0 && "pProto->Stackable == 0 but checked at loading already");
|
||||
ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
|
||||
|
||||
Item* pItem = NewItemOrBag(pProto);
|
||||
if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
|
||||
@@ -1032,9 +1054,8 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clo
|
||||
pItem->SetCount(count);
|
||||
if (!clone)
|
||||
pItem->SetItemRandomProperties(randomPropertyId ? randomPropertyId : Item::GenerateItemRandomPropertyId(item));
|
||||
else
|
||||
if (randomPropertyId)
|
||||
pItem->SetItemRandomProperties(randomPropertyId);
|
||||
else if (randomPropertyId)
|
||||
pItem->SetItemRandomProperties(randomPropertyId);
|
||||
return pItem;
|
||||
}
|
||||
else
|
||||
@@ -1048,7 +1069,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clo
|
||||
Item* Item::CloneItem(uint32 count, Player const* player) const
|
||||
{
|
||||
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
|
||||
Item * newItem = CreateItem(GetEntry(), count, player, true, player ? GetItemRandomPropertyId() : 0);
|
||||
Item* newItem = CreateItem(GetEntry(), count, player, true, player ? GetItemRandomPropertyId() : 0);
|
||||
if (!newItem)
|
||||
return nullptr;
|
||||
|
||||
@@ -1147,7 +1168,7 @@ void Item::UpdatePlayedTime(Player* owner)
|
||||
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
|
||||
uint32 new_playtime = current_playtime + elapsed;
|
||||
// Check if the refund timer has expired yet
|
||||
if (new_playtime <= 2*HOUR)
|
||||
if (new_playtime <= 2 * HOUR)
|
||||
{
|
||||
// No? Proceed.
|
||||
// Update the data field
|
||||
@@ -1171,7 +1192,7 @@ uint32 Item::GetPlayedTime()
|
||||
|
||||
bool Item::IsRefundExpired()
|
||||
{
|
||||
return (GetPlayedTime() > 2*HOUR);
|
||||
return (GetPlayedTime() > 2 * HOUR);
|
||||
}
|
||||
|
||||
void Item::SetSoulboundTradeable(AllowedLooterSet& allowedLooters)
|
||||
@@ -1196,7 +1217,7 @@ void Item::ClearSoulboundTradeable(Player* currentOwner)
|
||||
bool Item::CheckSoulboundTradeExpire()
|
||||
{
|
||||
// called from owner's update - GetOwner() MUST be valid
|
||||
if (GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + 2*HOUR < GetOwner()->GetTotalPlayedTime())
|
||||
if (GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + 2 * HOUR < GetOwner()->GetTotalPlayedTime())
|
||||
{
|
||||
ClearSoulboundTradeable(GetOwner());
|
||||
return true; // remove from tradeable list
|
||||
|
||||
Reference in New Issue
Block a user