void Container::LoadFromDB(Field* fields) { uint32 itemid = fields[2].GetUInt32(); m_itemProto = ItemPrototypeStorage.LookupEntry(itemid); ARCEMU_ASSERT(m_itemProto != NULL); SetEntry(itemid); SetCreatorGUID(fields[5].GetUInt32()); SetStackCount(1); SetUInt32Value(ITEM_FIELD_FLAGS, fields[8].GetUInt32()); SetItemRandomPropertyId(fields[9].GetUInt32()); SetDurabilityMax(m_itemProto->MaxDurability); SetDurability(fields[12].GetUInt32()); SetNumSlots(m_itemProto->ContainerSlots); m_Slot = new Item*[m_itemProto->ContainerSlots]; memset(m_Slot, 0, sizeof(Item*) * (m_itemProto->ContainerSlots)); }
void Item::Create(uint32 itemid, Player* owner) { SetEntry(itemid); if (owner) { uint64 OwnerGUID = owner->GetGUID(); SetOwnerGUID(OwnerGUID); SetContainerGUID(OwnerGUID); } SetStackCount(1); m_itemProto = ItemPrototypeStorage.LookupEntry(itemid); ARCEMU_ASSERT(m_itemProto != NULL); SetCharges(0, m_itemProto->Spells[0].Charges); SetCharges(1, m_itemProto->Spells[1].Charges); SetCharges(2, m_itemProto->Spells[2].Charges); SetCharges(3, m_itemProto->Spells[3].Charges); SetCharges(4, m_itemProto->Spells[4].Charges); SetDurability(m_itemProto->MaxDurability); SetDurabilityMax(m_itemProto->MaxDurability); m_owner = owner; locked = m_itemProto->LockId ? true : false; }
void CExchangeItem::InitItem( CItem* pItem, POSTYPE Pos, LONG id ) { cImage tmpImage; Init( 0, 0, DEFAULT_ICONSIZE, DEFAULT_ICONSIZE, ITEMMGR->GetIconImage( pItem->GetItemIdx(), &tmpImage ), id ); m_pLinkItem = pItem; m_Position = Pos; m_LinkPos = pItem->GetPosition(); SetIconType( eIconType_LinkedItem ); SetData( pItem->GetItemIdx() ); SetDurability( pItem->GetDurability() ); ITEMMGR->AddToolTip( this ); }
void Item::LoadFromDB(Field* fields, Player* plr, bool light) { uint32 itemid = fields[2].GetUInt32(); uint32 random_prop, random_suffix; uint32 count; m_itemProto = ItemPrototypeStorage.LookupEntry(itemid); ARCEMU_ASSERT(m_itemProto != NULL); locked = m_itemProto->LockId ? true : false; SetEntry(itemid); m_owner = plr; wrapped_item_id = fields[3].GetUInt32(); SetGiftCreatorGUID(fields[4].GetUInt32()); SetCreatorGUID(fields[5].GetUInt32()); count = fields[6].GetUInt32(); if (count > m_itemProto->MaxCount && (m_owner && !m_owner->ItemStackCheat)) count = m_itemProto->MaxCount; SetStackCount(count); SetChargesLeft(fields[7].GetUInt32()); SetUInt32Value(ITEM_FIELD_FLAGS, fields[8].GetUInt32()); random_prop = fields[9].GetUInt32(); random_suffix = fields[10].GetUInt32(); SetItemRandomPropertyId(random_prop); int32 rprop = int32(random_prop); // If random properties point is negative that means the item uses random suffix as random enchantment if (rprop < 0) SetItemRandomSuffixFactor(random_suffix); else SetItemRandomSuffixFactor(0); //SetTextId( fields[11].GetUInt32() ); SetDurabilityMax(m_itemProto->MaxDurability); SetDurability(fields[12].GetUInt32()); if (light) return; string enchant_field = fields[15].GetString(); vector< string > enchants = StrSplit(enchant_field, ";"); uint32 enchant_id; EnchantEntry* entry; uint32 time_left; uint32 enchslot; for (vector<string>::iterator itr = enchants.begin(); itr != enchants.end(); ++itr) { if (sscanf((*itr).c_str(), "%u,%u,%u", (unsigned int*)&enchant_id, (unsigned int*)&time_left, (unsigned int*)&enchslot) == 3) { entry = dbcEnchant.LookupEntryForced(enchant_id); if (entry && entry->Id == enchant_id && m_itemProto->SubClass != ITEM_SUBCLASS_WEAPON_THROWN) { AddEnchantment(entry, time_left, (time_left == 0), false, false, enchslot); //(enchslot != 2) ? false : true, false); } else { /* EnchantEntry *pEnchant = new EnchantEntry; memset(pEnchant,0,sizeof(EnchantEntry)); pEnchant->Id = enchant_id; if(enchslot != 2) AddEnchantment(pEnchant,0,true, false); else AddEnchantment(pEnchant,0,false,false); */ } } } ItemExpiresOn = fields[16].GetUInt32(); ///////////////////////////////////////////////////// Refund stuff //////////////////////// std::pair< time_t, uint32 > refundentry; refundentry.first = fields[17].GetUInt32(); refundentry.second = fields[18].GetUInt32(); if (refundentry.first != 0 && refundentry.second != 0 && GetOwner() != NULL) { uint32* played = GetOwner()->GetPlayedtime(); if (played[1] < uint32(refundentry.first + 60 * 60 * 2)) m_owner->GetItemInterface()->AddRefundable(this, refundentry.second, refundentry.first); } /////////////////////////////////////////////////////////////////////////////////////////// text = fields[19].GetString(); ApplyRandomProperties(false); // Charter stuff if (GetEntry() == ITEM_ENTRY_GUILD_CHARTER) { SoulBind(); SetStackCount(1); SetItemRandomSuffixFactor(57813883); if (plr != NULL && plr->m_charters[CHARTER_TYPE_GUILD]) SetEnchantmentId(0, plr->m_charters[CHARTER_TYPE_GUILD]->GetID()); } if (GetEntry() == ARENA_TEAM_CHARTER_2v2) { SoulBind(); SetStackCount(1); SetItemRandomSuffixFactor(57813883); if (plr != NULL && plr->m_charters[CHARTER_TYPE_ARENA_2V2]) SetEnchantmentId(0, plr->m_charters[CHARTER_TYPE_ARENA_2V2]->GetID()); } if (GetEntry() == ARENA_TEAM_CHARTER_3v3) { SoulBind(); SetStackCount(1); SetItemRandomSuffixFactor(57813883); if (plr != NULL && plr->m_charters[CHARTER_TYPE_ARENA_3V3]) SetEnchantmentId(0, plr->m_charters[CHARTER_TYPE_ARENA_3V3]->GetID()); } if (GetEntry() == ARENA_TEAM_CHARTER_5v5) { SoulBind(); SetStackCount(1); SetItemRandomSuffixFactor(57813883); if (plr != NULL && plr->m_charters[CHARTER_TYPE_ARENA_5V5]) SetEnchantmentId(0, plr->m_charters[CHARTER_TYPE_ARENA_5V5]->GetID()); } }