Drop not needed table 'item_text', add new column 'text' in table 'item_instance'. Original patch by Vladimir.

--HG--
branch : trunk
This commit is contained in:
n0n4m3
2010-04-14 12:43:42 +04:00
parent 61e71986f0
commit e3e5ca6227
16 changed files with 67 additions and 158 deletions
+11 -11
View File
@@ -4260,15 +4260,15 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
if (has_items)
{
// data needs to be at first place for Item::LoadFromDB
QueryResult_AutoPtr resultItems = CharacterDatabase.PQuery("SELECT data,item_guid,item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail_id);
QueryResult_AutoPtr resultItems = CharacterDatabase.PQuery("SELECT data,text,item_guid,item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail_id);
if (resultItems)
{
do
{
Field *fields2 = resultItems->Fetch();
uint32 item_guidlow = fields2[1].GetUInt32();
uint32 item_template = fields2[2].GetUInt32();
uint32 item_guidlow = fields2[2].GetUInt32();
uint32 item_template = fields2[3].GetUInt32();
ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_template);
if (!itemProto)
@@ -16366,7 +16366,7 @@ void Player::LoadCorpse()
void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff)
{
//QueryResult *result = CharacterDatabase.PQuery("SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GetGUIDLow());
//QueryResult *result = CharacterDatabase.PQuery("SELECT data,text,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GetGUIDLow());
std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
//NOTE: the "order by `bag`" is important because it makes sure
//the bagMap is filled before items in the bags are loaded
@@ -16384,10 +16384,10 @@ void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff)
do
{
Field *fields = result->Fetch();
uint32 bag_guid = fields[1].GetUInt32();
uint8 slot = fields[2].GetUInt8();
uint32 item_guid = fields[3].GetUInt32();
uint32 item_id = fields[4].GetUInt32();
uint32 bag_guid = fields[2].GetUInt32();
uint8 slot = fields[3].GetUInt8();
uint32 item_guid = fields[4].GetUInt32();
uint32 item_id = fields[5].GetUInt32();
ItemPrototype const * proto = objmgr.GetItemPrototype(item_id);
@@ -16560,15 +16560,15 @@ void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff)
void Player::_LoadMailedItems(Mail *mail)
{
// data needs to be at first place for Item::LoadFromDB
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT data, item_guid, item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail->messageID);
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT data, text, item_guid, item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail->messageID);
if (!result)
return;
do
{
Field *fields = result->Fetch();
uint32 item_guid_low = fields[1].GetUInt32();
uint32 item_template = fields[2].GetUInt32();
uint32 item_guid_low = fields[2].GetUInt32();
uint32 item_template = fields[3].GetUInt32();
mail->AddItem(item_guid_low, item_template);