*Update to Mangos 6963.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-28 12:10:31 -06:00
parent 3bbf8d6be8
commit e2ee47fb35
21 changed files with 2042 additions and 2351 deletions

View File

@@ -1213,18 +1213,19 @@ void Guild::LoadGuildBankFromDB()
delete result;
// 0 1 2 3
result = CharacterDatabase.PQuery("SELECT TabId, SlotId, item_guid, item_entry FROM guild_bank_item WHERE guildid='%u' ORDER BY TabId", Id);
// data needs to be at first place for Item::LoadFromDB
// 0 1 2 3 4
result = CharacterDatabase.PQuery("SELECT data, TabId, SlotId, item_guid, item_entry FROM guild_bank_item JOIN item_instance ON item_guid = guid WHERE guildid='%u' ORDER BY TabId", Id);
if(!result)
return;
do
{
Field *fields = result->Fetch();
uint8 TabId = fields[0].GetUInt8();
uint8 SlotId = fields[1].GetUInt8();
uint32 ItemGuid = fields[2].GetUInt32();
uint32 ItemEntry = fields[3].GetUInt32();
uint8 TabId = fields[1].GetUInt8();
uint8 SlotId = fields[2].GetUInt8();
uint32 ItemGuid = fields[3].GetUInt32();
uint32 ItemEntry = fields[4].GetUInt32();
if (TabId >= purchased_tabs || TabId >= GUILD_BANK_MAX_TABS)
{
@@ -1247,7 +1248,7 @@ void Guild::LoadGuildBankFromDB()
}
Item *pItem = NewItemOrBag(proto);
if(!pItem->LoadFromDB(ItemGuid, 0))
if(!pItem->LoadFromDB(ItemGuid, 0, result))
{
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE guildid='%u' AND TabId='%u' AND SlotId='%u'", Id, uint32(TabId), uint32(SlotId));
sLog.outError("Item GUID %u not found in item_instance, deleting from Guild Bank!", ItemGuid);