Skip to content

Commit

Permalink
[c12632] Fix saving and loading currency loot to/from db
Browse files Browse the repository at this point in the history
  • Loading branch information
Dramacydal committed Jun 10, 2013
1 parent 8a0ee64 commit 3483e47
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/game/Item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ void Item::SaveToDB()

stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(owner->GetGUIDLow());
stmt.addUInt32(item->itemid);
stmt.addInt32(item->currency ? -int32(item->itemid) : item->itemid);
stmt.addUInt8(item->count);
stmt.addUInt32(item->randomSuffix);
stmt.addInt32(item->randomPropertyId);
Expand Down Expand Up @@ -649,7 +649,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
void Item::LoadLootFromDB(Field* fields)
{
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_suffix = fields[3].GetUInt32();
int32 item_propid = fields[4].GetInt32();
Expand Down
4 changes: 2 additions & 2 deletions src/game/LootMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void LootStore::LoadLootTable()

uint32 entry = fields[0].GetUInt32();
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();
uint8 group = fields[3].GetUInt8();
int32 mincountOrRef = fields[4].GetInt32();
Expand Down Expand Up @@ -358,7 +358,7 @@ LootItem::LootItem(LootStoreItem const& li)
itemid = li.itemid;
type = li.type;
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

is_looted = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12631"
#define REVISION_NR "12632"
#endif // __REVISION_NR_H__

0 comments on commit 3483e47

Please sign in to comment.