[9702] Drop now redundent item_text table.

* In beggining bad news: at 3.3.3 switch has been forgoted item_instance.data field chnage.
  In result items with texts (mail copy in to inventory, some other) lost text content.
* That why in current commit item_text droped without convertion. In result all itesm with texts
  will lost text. Sorry for this as i think small porblem :(
* Now text stored in item itself.
This commit is contained in:
VladimirMangos 2010-04-09 01:50:18 +04:00
parent 53486545b5
commit 24f2d03485
17 changed files with 85 additions and 152 deletions

View file

@ -4080,15 +4080,16 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
if(has_items)
{
// data needs to be at first place for Item::LoadFromDB
QueryResult *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);
// 0 1 2 3
QueryResult *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 = ObjectMgr::GetItemPrototype(item_template);
if(!itemProto)
@ -15542,7 +15543,7 @@ void Player::LoadCorpse()
void Player::_LoadInventory(QueryResult *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
@ -15560,10 +15561,10 @@ void Player::_LoadInventory(QueryResult *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 = ObjectMgr::GetItemPrototype(item_id);
@ -15709,17 +15710,17 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
void Player::_LoadMailedItems(QueryResult *result)
{
// data needs to be at first place for Item::LoadFromDB
// 0 1 2 3
// "SELECT data, mail_id, item_guid, item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE receiver = '%u'", GUID_LOPART(m_guid)
// 0 1 2 3 4
// "SELECT data, text, mail_id, item_guid, item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE receiver = '%u'", GUID_LOPART(m_guid)
if(!result)
return;
do
{
Field *fields = result->Fetch();
uint32 mail_id = fields[1].GetUInt32();
uint32 item_guid_low = fields[2].GetUInt32();
uint32 item_template = fields[3].GetUInt32();
uint32 mail_id = fields[2].GetUInt32();
uint32 item_guid_low = fields[3].GetUInt32();
uint32 item_template = fields[4].GetUInt32();
Mail* mail = GetMail(mail_id);
if(!mail)