aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <none@none>2010-07-30 17:36:28 +0200
committerShauren <none@none>2010-07-30 17:36:28 +0200
commitab95e5a6dcf233677057e77017fe90869182c272 (patch)
tree7339fdafd1c64131ace75d8998808cc18b969a3c /src
parent350864de80dadf0d5dabe201138bc6e9416c80af (diff)
Fixed remaining bank/bag issues added in r9090
Added temporary hack to item creation to prevent new items from bugging (heroic+sockets issue), this will be removed after my work on item flags is done --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Item/Container/Bag.cpp4
-rw-r--r--src/server/game/Entities/Item/Item.cpp24
2 files changed, 13 insertions, 15 deletions
diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp
index 9774c46c011..dffb1881ff6 100644
--- a/src/server/game/Entities/Item/Container/Bag.cpp
+++ b/src/server/game/Entities/Item/Container/Bag.cpp
@@ -87,7 +87,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability);
- SetUInt32Value(ITEM_FIELD_FLAGS, itemProto->Flags);
+ SetUInt32Value(ITEM_FIELD_FLAGS, itemProto->Flags & 0xFFFFFFF7); // TEMP HACK, DONT REMOVE - Shauren
SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);
// Setting the number of Slots the Container has
@@ -113,6 +113,8 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result,
if (!Item::LoadFromDB(guid, owner_guid, result, entry))
return false;
+ ItemPrototype const* itemProto = GetProto(); // checked in Item::LoadFromDB
+ SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->ContainerSlots);
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 2d0120522b8..28a91e46b02 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -278,7 +278,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
SetSpellCharges(i,itemProto->Spells[i].SpellCharges);
- SetUInt32Value(ITEM_FIELD_FLAGS, itemProto->Flags);
+ SetUInt32Value(ITEM_FIELD_FLAGS, itemProto->Flags & 0xFFFFFFF7); // TEMP HACK, DONT REMOVE - Shauren
SetUInt32Value(ITEM_FIELD_DURATION, abs(itemProto->Duration));
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0);
@@ -388,24 +388,28 @@ void Item::SaveToDB()
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result, uint32 entry)
{
+ // 0 1 2 3 4 5 6 7 8 9 10
+ //result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid);
+
// create item before any checks for store correct guid
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
Object::_Create(guid, 0, HIGHGUID_ITEM);
-
- SetEntry(entry);
ItemPrototype const* proto = GetProto();
if (!proto)
return false;
- //if (!result) // 0 1 2 3 4 5 6 7 8 9 10
- // result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid);
-
if (!result)
{
sLog.outError("Item (GUID: %u owner: %u) not found in table `item_instance`, can't load. ", guid, GUID_LOPART(owner_guid));
return false;
}
+ SetEntry(entry);
+ SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
+ // set owner (not if item is only loaded for gbank/auction/mail
+ if (owner_guid != 0)
+ SetOwnerGUID(owner_guid);
+
Field *fields = result->Fetch();
bool need_save = false; // need explicit save data at load fixes
SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
@@ -453,20 +457,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, fields[9].GetUInt32());
SetText(fields[10].GetCppString());
- // set correct owner
- if (owner_guid != 0 && GetOwnerGUID() != owner_guid)
- {
- SetOwnerGUID(owner_guid);
- need_save = true;
- }
-
if (need_save) // normal item changed state set not work at loading
{
std::ostringstream ss;
ss << "UPDATE item_instance SET duration = " << GetUInt32Value(ITEM_FIELD_DURABILITY)
<< ", flags = " << GetUInt32Value(ITEM_FIELD_FLAGS)
<< ", durability = " << GetUInt32Value(ITEM_FIELD_DURABILITY)
- << ", owner_guid = " << GUID_LOPART(GetOwnerGUID())
<< " WHERE guid = " << guid;
CharacterDatabase.Execute(ss.str().c_str());