[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

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`; DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` ( CREATE TABLE `character_db_version` (
`required_9692_02_characters_mail` bit(1) default NULL `required_9702_01_characters_item` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
-- --
@ -1368,6 +1368,7 @@ CREATE TABLE `item_instance` (
`guid` int(11) unsigned NOT NULL default '0', `guid` int(11) unsigned NOT NULL default '0',
`owner_guid` int(11) unsigned NOT NULL default '0', `owner_guid` int(11) unsigned NOT NULL default '0',
`data` longtext, `data` longtext,
`text` longtext,
PRIMARY KEY (`guid`), PRIMARY KEY (`guid`),
KEY `idx_owner_guid` (`owner_guid`) KEY `idx_owner_guid` (`owner_guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Item System'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Item System';
@ -1381,26 +1382,6 @@ LOCK TABLES `item_instance` WRITE;
/*!40000 ALTER TABLE `item_instance` ENABLE KEYS */; /*!40000 ALTER TABLE `item_instance` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `item_text`
--
DROP TABLE IF EXISTS `item_text`;
CREATE TABLE `item_text` (
`id` int(11) unsigned NOT NULL default '0',
`text` longtext,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Item System';
--
-- Dumping data for table `item_text`
--
LOCK TABLES `item_text` WRITE;
/*!40000 ALTER TABLE `item_text` DISABLE KEYS */;
/*!40000 ALTER TABLE `item_text` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `mail` -- Table structure for table `mail`
-- --

View file

@ -0,0 +1,9 @@
ALTER TABLE character_db_version CHANGE COLUMN required_9692_02_characters_mail required_9702_01_characters_item bit;
ALTER TABLE `item_instance`
ADD COLUMN `text` longtext AFTER `data`;
-- indexes in any case broken and lost after 3.3.3 switch.
DROP TABLE IF EXISTS `item_text`;

View file

@ -109,6 +109,7 @@ pkgdata_DATA = \
9692_01_characters_mail.sql \ 9692_01_characters_mail.sql \
9692_02_characters_mail.sql \ 9692_02_characters_mail.sql \
9692_03_mangos_spell_proc_event.sql \ 9692_03_mangos_spell_proc_event.sql \
9702_01_characters_item.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -198,4 +199,5 @@ EXTRA_DIST = \
9692_01_characters_mail.sql \ 9692_01_characters_mail.sql \
9692_02_characters_mail.sql \ 9692_02_characters_mail.sql \
9692_03_mangos_spell_proc_event.sql \ 9692_03_mangos_spell_proc_event.sql \
9702_01_characters_item.sql \
README README

View file

@ -279,8 +279,8 @@ void AuctionHouseMgr::SendAuctionExpiredMail( AuctionEntry * auction )
void AuctionHouseMgr::LoadAuctionItems() void AuctionHouseMgr::LoadAuctionItems()
{ {
// data needs to be at first place for Item::LoadFromDB // data needs to be at first place for Item::LoadFromDB 0 1 2 3
QueryResult *result = CharacterDatabase.Query( "SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid" ); QueryResult *result = CharacterDatabase.Query( "SELECT data,text,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid" );
if( !result ) if( !result )
{ {
@ -301,8 +301,8 @@ void AuctionHouseMgr::LoadAuctionItems()
bar.step(); bar.step();
fields = result->Fetch(); fields = result->Fetch();
uint32 item_guid = fields[1].GetUInt32(); uint32 item_guid = fields[2].GetUInt32();
uint32 item_template = fields[2].GetUInt32(); uint32 item_template = fields[3].GetUInt32();
ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template); ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template);

View file

@ -56,7 +56,7 @@ class Bag : public Item
// overwrite virtual Item::SaveToDB // overwrite virtual Item::SaveToDB
void SaveToDB(); void SaveToDB();
// overwrite virtual Item::LoadFromDB // overwrite virtual Item::LoadFromDB
bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result = NULL); bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result);
// overwrite virtual Item::DeleteFromDB // overwrite virtual Item::DeleteFromDB
void DeleteFromDB(); void DeleteFromDB();

View file

@ -81,7 +81,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS,"SELECT quest FROM character_queststatus_weekly WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS,"SELECT quest FROM character_queststatus_weekly WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "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", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "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", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT spec,button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT spec,button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid));
@ -100,7 +100,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, "SELECT spec, slot, glyph FROM character_glyphs WHERE guid='%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, "SELECT spec, slot, glyph FROM character_glyphs WHERE guid='%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILS, "SELECT id,messageType,sender,receiver,subject,body,has_items,expire_time,deliver_time,money,cod,checked,stationery,mailTemplateId FROM mail WHERE receiver = '%u' ORDER BY id DESC", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILS, "SELECT id,messageType,sender,receiver,subject,body,has_items,expire_time,deliver_time,money,cod,checked,stationery,mailTemplateId FROM mail WHERE receiver = '%u' ORDER BY id DESC", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILEDITEMS, "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)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILEDITEMS, "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));
return res; return res;
} }

View file

@ -1120,18 +1120,18 @@ void Guild::LoadGuildBankFromDB()
delete result; delete result;
// data needs to be at first place for Item::LoadFromDB // data needs to be at first place for Item::LoadFromDB
// 0 1 2 3 4 // 0 1 2 3 4 5
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", m_Id); result = CharacterDatabase.PQuery("SELECT data, text, TabId, SlotId, item_guid, item_entry FROM guild_bank_item JOIN item_instance ON item_guid = guid WHERE guildid='%u' ORDER BY TabId", m_Id);
if (!result) if (!result)
return; return;
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint8 TabId = fields[1].GetUInt8(); uint8 TabId = fields[2].GetUInt8();
uint8 SlotId = fields[2].GetUInt8(); uint8 SlotId = fields[3].GetUInt8();
uint32 ItemGuid = fields[3].GetUInt32(); uint32 ItemGuid = fields[4].GetUInt32();
uint32 ItemEntry = fields[4].GetUInt32(); uint32 ItemEntry = fields[5].GetUInt32();
if (TabId >= m_PurchasedTabs || TabId >= GUILD_BANK_MAX_TABS) if (TabId >= m_PurchasedTabs || TabId >= GUILD_BANK_MAX_TABS)
{ {

View file

@ -297,21 +297,26 @@ void Item::SaveToDB()
{ {
case ITEM_NEW: case ITEM_NEW:
{ {
std::string text = m_text;
CharacterDatabase.escape_string(text);
CharacterDatabase.PExecute( "DELETE FROM item_instance WHERE guid = '%u'", guid ); CharacterDatabase.PExecute( "DELETE FROM item_instance WHERE guid = '%u'", guid );
std::ostringstream ss; std::ostringstream ss;
ss << "INSERT INTO item_instance (guid,owner_guid,data) VALUES (" << guid << "," << GUID_LOPART(GetOwnerGUID()) << ",'"; ss << "INSERT INTO item_instance (guid,owner_guid,data,text) VALUES (" << guid << "," << GUID_LOPART(GetOwnerGUID()) << ",'";
for(uint16 i = 0; i < m_valuesCount; ++i ) for(uint16 i = 0; i < m_valuesCount; ++i )
ss << GetUInt32Value(i) << " "; ss << GetUInt32Value(i) << " ";
ss << "' )"; ss << "', '" << text << "')";
CharacterDatabase.Execute( ss.str().c_str() ); CharacterDatabase.Execute( ss.str().c_str() );
} break; } break;
case ITEM_CHANGED: case ITEM_CHANGED:
{ {
std::string text = m_text;
CharacterDatabase.escape_string(text);
std::ostringstream ss; std::ostringstream ss;
ss << "UPDATE item_instance SET data = '"; ss << "UPDATE item_instance SET data = '";
for(uint16 i = 0; i < m_valuesCount; ++i ) for(uint16 i = 0; i < m_valuesCount; ++i )
ss << GetUInt32Value(i) << " "; ss << GetUInt32Value(i) << " ";
ss << "', owner_guid = '" << GUID_LOPART(GetOwnerGUID()) << "' WHERE guid = '" << guid << "'"; ss << "', owner_guid = '" << GUID_LOPART(GetOwnerGUID());
ss << "', text = '" << text << "' WHERE guid = '" << guid << "'";
CharacterDatabase.Execute( ss.str().c_str() ); CharacterDatabase.Execute( ss.str().c_str() );
@ -320,8 +325,6 @@ void Item::SaveToDB()
} break; } break;
case ITEM_REMOVED: case ITEM_REMOVED:
{ {
//if (GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID) > 0 )
// CharacterDatabase.PExecute("DELETE FROM item_text WHERE id = '%u'", GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID));
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", guid); CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", guid);
if(HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) if(HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))
CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", GetGUIDLow()); CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", GetGUIDLow());

View file

@ -244,7 +244,7 @@ class MANGOS_DLL_SPEC Item : public Object
bool IsBindedNotWith(Player const* player) const; bool IsBindedNotWith(Player const* player) const;
bool IsBoundByEnchant() const; bool IsBoundByEnchant() const;
virtual void SaveToDB(); virtual void SaveToDB();
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result = NULL); virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result);
virtual void DeleteFromDB(); virtual void DeleteFromDB();
void DeleteFromInventoryDB(); void DeleteFromInventoryDB();
@ -293,6 +293,9 @@ class MANGOS_DLL_SPEC Item : public Object
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);} uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);}
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);} uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);}
std::string const& GetText() const { return m_text; }
void SetText(std::string const& text) { m_text = text; }
void SendTimeUpdate(Player* owner); void SendTimeUpdate(Player* owner);
void UpdateDuration(Player* owner, uint32 diff); void UpdateDuration(Player* owner, uint32 diff);
@ -326,6 +329,7 @@ class MANGOS_DLL_SPEC Item : public Object
void RemoveFromClientUpdateList(); void RemoveFromClientUpdateList();
void BuildUpdateData(UpdateDataMapType& update_players); void BuildUpdateData(UpdateDataMapType& update_players);
private: private:
std::string m_text;
uint8 m_slot; uint8 m_slot;
Bag *m_container; Bag *m_container;
ItemUpdateState uState; ItemUpdateState uState;

View file

@ -1371,3 +1371,30 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data)
// item refund system not implemented yet // item refund system not implemented yet
} }
/**
* Handles the packet sent by the client when requesting information about item text.
*
* This function is called when player clicks on item which has some flag set
*/
void WorldSession::HandleItemTextQuery(WorldPacket & recv_data )
{
uint64 itemGuid;
recv_data >> itemGuid;
sLog.outDebug("CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size
if(Item *item = _player->GetItemByGuid(itemGuid))
{
data << uint8(0); // has text
data << uint64(itemGuid); // item guid
data << item->GetText();
}
else
{
data << uint8(1); // no text
}
SendPacket(&data);
}

View file

@ -666,34 +666,6 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
_player->UpdateNextMailTimeAndUnreads(); _player->UpdateNextMailTimeAndUnreads();
} }
/**
* Handles the packet sent by the client when requesting information about the body of a mail.
*
* This function is called when client needs mail message body,
* or when player clicks on item which has some flag set
*/
void WorldSession::HandleItemTextQuery(WorldPacket & recv_data )
{
uint64 itemGuid;
recv_data >> itemGuid;
sLog.outDebug("CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size
if(Item *item = _player->GetItemByGuid(itemGuid))
{
data << uint8(0); // has text
data << uint64(itemGuid); // item guid
data << sObjectMgr.GetItemText(item->GetGUIDLow()); // max 8000
}
else
{
data << uint8(1); // no text
}
SendPacket(&data);
}
/** /**
* Handles the packet sent by the client when he copies the body a mail to his inventory. * Handles the packet sent by the client when he copies the body a mail to his inventory.
* *
@ -738,14 +710,15 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
return; return;
} }
sObjectMgr.CreateItemText(bodyItem->GetGUIDLow(), mailTemplateEntry->content[GetSessionDbcLocale()]); bodyItem->SetText(mailTemplateEntry->content[GetSessionDbcLocale()]);
} }
else else
sObjectMgr.CreateItemText(bodyItem->GetGUIDLow(), m->body); bodyItem->SetText(m->body);
bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender); bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender);
bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER | ITEM_FLAGS_REFUNDABLE_2 | ITEM_FLAGS_UNK1); bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER | ITEM_FLAGS_REFUNDABLE_2 | ITEM_FLAGS_UNK1);
sLog.outDetail("HandleMailCreateTextItem mailid=%u", mailId); sLog.outDetail("HandleMailCreateTextItem mailid=%u", mailId);
ItemPosCountVec dest; ItemPosCountVec dest;

View file

@ -4564,43 +4564,6 @@ void ObjectMgr::LoadGossipScripts()
// checks are done in LoadGossipMenuItems // checks are done in LoadGossipMenuItems
} }
void ObjectMgr::LoadItemTexts()
{
QueryResult *result = CharacterDatabase.Query("SELECT id, text FROM item_text");
uint32 count = 0;
if( !result )
{
barGoLink bar( 1 );
bar.step();
sLog.outString();
sLog.outString( ">> Loaded %u item pages", count );
return;
}
barGoLink bar( (int)result->GetRowCount() );
Field* fields;
do
{
bar.step();
fields = result->Fetch();
mItemTexts[ fields[0].GetUInt32() ] = fields[1].GetCppString();
++count;
} while ( result->NextRow() );
delete result;
sLog.outString();
sLog.outString( ">> Loaded %u item texts", count );
}
void ObjectMgr::LoadPageTexts() void ObjectMgr::LoadPageTexts()
{ {
sPageTextStore.Free(); // for reload case sPageTextStore.Free(); // for reload case
@ -5800,19 +5763,6 @@ void ObjectMgr::SetHighestGuids()
} }
} }
void ObjectMgr::CreateItemText(uint32 guid, std::string text)
{
// insert new item text to container
mItemTexts[ guid ] = text;
// save new item text
CharacterDatabase.escape_string(text);
std::ostringstream query;
query << "INSERT INTO item_text (id,text) VALUES ( '" << guid << "', '" << text << "')";
CharacterDatabase.Execute(query.str().c_str()); // needs to be run this way, because mail body may be more than 1024 characters
}
uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
{ {
switch(guidhigh) switch(guidhigh)

View file

@ -628,7 +628,6 @@ class ObjectMgr
void LoadTavernAreaTriggers(); void LoadTavernAreaTriggers();
void LoadGameObjectForQuests(); void LoadGameObjectForQuests();
void LoadItemTexts();
void LoadPageTexts(); void LoadPageTexts();
void LoadPlayerInfo(); void LoadPlayerInfo();
@ -680,16 +679,6 @@ class ObjectMgr
uint32 GenerateMailID() { return m_MailIds.Generate(); } uint32 GenerateMailID() { return m_MailIds.Generate(); }
uint32 GeneratePetNumber() { return m_PetNumbers.Generate(); } uint32 GeneratePetNumber() { return m_PetNumbers.Generate(); }
void CreateItemText(uint32 guid, std::string text);
std::string GetItemText( uint32 id )
{
ItemTextMap::const_iterator itr = mItemTexts.find( id );
if ( itr != mItemTexts.end() )
return itr->second;
else
return "There is no info for this item";
}
typedef std::multimap<int32, uint32> ExclusiveQuestGroups; typedef std::multimap<int32, uint32> ExclusiveQuestGroups;
ExclusiveQuestGroups mExclusiveQuestGroups; ExclusiveQuestGroups mExclusiveQuestGroups;
@ -925,7 +914,6 @@ class ObjectMgr
typedef UNORDERED_MAP<uint32, GossipText> GossipTextMap; typedef UNORDERED_MAP<uint32, GossipText> GossipTextMap;
typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerMap; typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerMap;
typedef UNORDERED_MAP<uint32, std::string> ItemTextMap;
typedef std::set<uint32> TavernAreaTriggerSet; typedef std::set<uint32> TavernAreaTriggerSet;
typedef std::set<uint32> GameObjectForQuestSet; typedef std::set<uint32> GameObjectForQuestSet;
@ -933,8 +921,6 @@ class ObjectMgr
GuildMap mGuildMap; GuildMap mGuildMap;
ArenaTeamMap mArenaTeamMap; ArenaTeamMap mArenaTeamMap;
ItemTextMap mItemTexts;
QuestAreaTriggerMap mQuestAreaTriggerMap; QuestAreaTriggerMap mQuestAreaTriggerMap;
TavernAreaTriggerSet mTavernAreaTriggerSet; TavernAreaTriggerSet mTavernAreaTriggerSet;
GameObjectForQuestSet mGameObjectForQuestSet; GameObjectForQuestSet mGameObjectForQuestSet;

View file

@ -4080,15 +4080,16 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
if(has_items) if(has_items)
{ {
// data needs to be at first place for Item::LoadFromDB // 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) if(resultItems)
{ {
do do
{ {
Field *fields2 = resultItems->Fetch(); Field *fields2 = resultItems->Fetch();
uint32 item_guidlow = fields2[1].GetUInt32(); uint32 item_guidlow = fields2[2].GetUInt32();
uint32 item_template = fields2[2].GetUInt32(); uint32 item_template = fields2[3].GetUInt32();
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_template); ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_template);
if(!itemProto) if(!itemProto)
@ -15542,7 +15543,7 @@ void Player::LoadCorpse()
void Player::_LoadInventory(QueryResult *result, uint32 timediff) 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 std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
//NOTE: the "order by `bag`" is important because it makes sure //NOTE: the "order by `bag`" is important because it makes sure
//the bagMap is filled before items in the bags are loaded //the bagMap is filled before items in the bags are loaded
@ -15560,10 +15561,10 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint32 bag_guid = fields[1].GetUInt32(); uint32 bag_guid = fields[2].GetUInt32();
uint8 slot = fields[2].GetUInt8(); uint8 slot = fields[3].GetUInt8();
uint32 item_guid = fields[3].GetUInt32(); uint32 item_guid = fields[4].GetUInt32();
uint32 item_id = fields[4].GetUInt32(); uint32 item_id = fields[5].GetUInt32();
ItemPrototype const * proto = ObjectMgr::GetItemPrototype(item_id); ItemPrototype const * proto = ObjectMgr::GetItemPrototype(item_id);
@ -15709,17 +15710,17 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
void Player::_LoadMailedItems(QueryResult *result) void Player::_LoadMailedItems(QueryResult *result)
{ {
// data needs to be at first place for Item::LoadFromDB // data needs to be at first place for Item::LoadFromDB
// 0 1 2 3 // 0 1 2 3 4
// "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) // "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) if(!result)
return; return;
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint32 mail_id = fields[1].GetUInt32(); uint32 mail_id = fields[2].GetUInt32();
uint32 item_guid_low = fields[2].GetUInt32(); uint32 item_guid_low = fields[3].GetUInt32();
uint32 item_template = fields[3].GetUInt32(); uint32 item_template = fields[4].GetUInt32();
Mail* mail = GetMail(mail_id); Mail* mail = GetMail(mail_id);
if(!mail) if(!mail)

View file

@ -980,9 +980,6 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Items..." ); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sLog.outString( "Loading Items..." ); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
sObjectMgr.LoadItemPrototypes(); sObjectMgr.LoadItemPrototypes();
sLog.outString( "Loading Item Texts..." );
sObjectMgr.LoadItemTexts();
sLog.outString( "Loading Creature Model Based Info Data..." ); sLog.outString( "Loading Creature Model Based Info Data..." );
sObjectMgr.LoadCreatureModelInfo(); sObjectMgr.LoadCreatureModelInfo();

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 "9701" #define REVISION_NR "9702"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9692_02_characters_mail" #define REVISION_DB_CHARACTERS "required_9702_01_characters_item"
#define REVISION_DB_MANGOS "required_9692_03_mangos_spell_proc_event" #define REVISION_DB_MANGOS "required_9692_03_mangos_spell_proc_event"
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__