DB Schema/Characters: removed columns auctionhouse.item_template, character_inventory.item_template, guild_bank_item.item_entry and mail_items.item_template and created item_instance.itemEntry column instead of them.
As a side effect moved related queries to prepared statements. As one more side effect fixed not shown and lost mail items in returned expired mail (patch by Quriq14). --HG-- branch : trunk
This commit is contained in:
@@ -1430,6 +1430,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
||||
|
||||
void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
{
|
||||
// TODO: Move queries to prepared statements
|
||||
uint64 guid;
|
||||
std::string newname;
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
|
||||
@@ -1714,7 +1715,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 item_alliance = it->first;
|
||||
uint32 item_horde = it->second;
|
||||
trans->PAppend("UPDATE `character_inventory` SET item_template = '%u' where item_template = '%u' AND guid = '%u'",
|
||||
trans->PAppend("UPDATE `item_instance` ii, `character_inventory` ci SET ii.itemEntry = '%u' WHERE ii.itemEntry = '%u' AND ci.guid = '%u' AND ci.item = ii.guid",
|
||||
team == BG_TEAM_ALLIANCE ? item_alliance : item_horde, team == BG_TEAM_ALLIANCE ? item_horde : item_alliance, guid);
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,11 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
item->DeleteFromInventoryDB(trans); // deletes item from character's inventory
|
||||
item->SaveToDB(trans); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
|
||||
// owner in data will set at mail receive and item extracting
|
||||
trans->PAppend("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", GUID_LOPART(rc), item->GetGUIDLow());
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_ITEM_OWNER);
|
||||
stmt->setUInt32(0, GUID_LOPART(rc));
|
||||
stmt->setUInt32(1, item->GetGUIDLow());
|
||||
trans->Append(stmt);
|
||||
|
||||
draft.AddItem(item);
|
||||
}
|
||||
|
||||
@@ -373,7 +377,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
||||
|
||||
if (m->HasItems())
|
||||
{
|
||||
for (std::vector<MailItemInfo>::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||
{
|
||||
Item *item = pl->GetMItem(itr2->item_guid);
|
||||
if (item)
|
||||
|
||||
Reference in New Issue
Block a user