[c12635] Fix saving and loading currency loot to/from db

This commit is contained in:
Dramacydal 2013-06-17 09:29:55 +01:00 committed by Antz
parent b7a01a632c
commit 905815feb9
3 changed files with 5 additions and 5 deletions

View file

@ -527,7 +527,7 @@ void Item::SaveToDB()
stmt.addUInt32(GetGUIDLow()); stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(owner->GetGUIDLow()); stmt.addUInt32(owner->GetGUIDLow());
stmt.addUInt32(item->itemid); stmt.addInt32(item->currency ? -int32(item->itemid) : item->itemid);
stmt.addUInt8(item->count); stmt.addUInt8(item->count);
stmt.addUInt32(item->randomSuffix); stmt.addUInt32(item->randomSuffix);
stmt.addInt32(item->randomPropertyId); stmt.addInt32(item->randomPropertyId);
@ -649,7 +649,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
void Item::LoadLootFromDB(Field* fields) void Item::LoadLootFromDB(Field* fields)
{ {
uint32 item_id = abs(fields[1].GetInt32()); uint32 item_id = abs(fields[1].GetInt32());
uint8 type = fields[1].GetInt32() > 0 ? LOOT_ITEM_TYPE_ITEM : LOOT_ITEM_TYPE_CURRENCY; uint8 type = fields[1].GetInt32() >= 0 ? LOOT_ITEM_TYPE_ITEM : LOOT_ITEM_TYPE_CURRENCY;
uint32 item_amount = fields[2].GetUInt32(); uint32 item_amount = fields[2].GetUInt32();
uint32 item_suffix = fields[3].GetUInt32(); uint32 item_suffix = fields[3].GetUInt32();
int32 item_propid = fields[4].GetInt32(); int32 item_propid = fields[4].GetInt32();

View file

@ -114,7 +114,7 @@ void LootStore::LoadLootTable()
uint32 entry = fields[0].GetUInt32(); uint32 entry = fields[0].GetUInt32();
uint32 item = abs(fields[1].GetInt32()); uint32 item = abs(fields[1].GetInt32());
uint8 type = fields[1].GetInt32() > 0 ? LOOT_ITEM_TYPE_ITEM : LOOT_ITEM_TYPE_CURRENCY; uint8 type = fields[1].GetInt32() >= 0 ? LOOT_ITEM_TYPE_ITEM : LOOT_ITEM_TYPE_CURRENCY;
float chanceOrQuestChance = fields[2].GetFloat(); float chanceOrQuestChance = fields[2].GetFloat();
uint8 group = fields[3].GetUInt8(); uint8 group = fields[3].GetUInt8();
int32 mincountOrRef = fields[4].GetInt32(); int32 mincountOrRef = fields[4].GetInt32();
@ -359,7 +359,7 @@ LootItem::LootItem(LootStoreItem const& li)
itemid = li.itemid; itemid = li.itemid;
type = li.type; type = li.type;
conditionId = li.conditionId; conditionId = li.conditionId;
currency = type == LOOT_ITEM_TYPE_CURRENCY; currency = type == LOOT_ITEM_TYPE_CURRENCY;
count = urand(li.mincountOrRef, li.maxcount); // constructor called for mincountOrRef > 0 only count = urand(li.mincountOrRef, li.maxcount); // constructor called for mincountOrRef > 0 only
is_looted = 0; is_looted = 0;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12634" #define REVISION_NR "12635"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__