[8157] Fixes and some tables support finish for pleays pdumps.

* Restore mark character with duplicate for rename at login
* Restore save mail item_text data
* Finish implementaion for propertly load item_text data.
This commit is contained in:
VladimirMangos 2009-07-10 00:31:57 +04:00
parent 1b8ad033c5
commit 104158d93d
3 changed files with 37 additions and 18 deletions

View file

@ -572,6 +572,7 @@ class ObjectMgr
uint32 GeneratePetNumber(); uint32 GeneratePetNumber();
uint32 CreateItemText(std::string text); uint32 CreateItemText(std::string text);
void AddItemText(uint32 itemTextId, std::string text) { mItemTexts[itemTextId] = text; }
std::string GetItemText( uint32 id ) std::string GetItemText( uint32 id )
{ {
ItemTextMap::const_iterator itr = mItemTexts.find( id ); ItemTextMap::const_iterator itr = mItemTexts.find( id );

View file

@ -311,7 +311,7 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
StoreGUID(result,0,pets); break; // pet guid collection StoreGUID(result,0,pets); break; // pet guid collection
case DTT_MAIL: case DTT_MAIL:
StoreGUID(result,0,mails); // mail id collection StoreGUID(result,0,mails); // mail id collection
StoreGUID(result,6,texts); break; // item text id collection StoreGUID(result,7,texts); break; // item text id collection
case DTT_MAIL_ITEM: case DTT_MAIL_ITEM:
StoreGUID(result,1,items); break; // item guid collection StoreGUID(result,1,items); break; // item guid collection
default: break; default: break;
@ -452,6 +452,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
std::map<uint32,uint32> items; std::map<uint32,uint32> items;
std::map<uint32,uint32> mails; std::map<uint32,uint32> mails;
std::map<uint32,uint32> itemTexts;
char buf[32000] = ""; char buf[32000] = "";
typedef std::map<uint32, uint32> PetIds; // old->new petid relation typedef std::map<uint32, uint32> PetIds; // old->new petid relation
@ -546,8 +547,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
if (result) if (result)
{ {
delete result; delete result;
// rename on login: `at_login` field 30 in raw field list
if(!changenth(line, 30, "1")) if(!changenth(line, 37, "1")) // rename on login: `at_login` field 37 in raw field list
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
} }
} }
@ -580,6 +581,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid)) if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid))
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
if(!changetokGuid(vals, ITEM_FIELD_ITEM_TEXT_ID+1, itemTexts, objmgr.m_ItemTextId))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changenth(line, 3, vals.c_str())) if(!changenth(line, 3, vals.c_str()))
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
break; break;
@ -637,10 +640,12 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
} }
case DTT_MAIL: // mail case DTT_MAIL: // mail
{ {
// id,messageType,stationery,sender,receiver // id,messageType,stationery,mailtemplate,sender,receiver,subject,itemText
if(!changeGuid(line, 1, mails, objmgr.m_mailid)) if(!changeGuid(line, 1, mails, objmgr.m_mailid))
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
if(!changenth(line, 5, newguid)) if(!changenth(line, 6, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changeGuid(line, 8, itemTexts, objmgr.m_ItemTextId))
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
break; break;
} }
@ -655,6 +660,18 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
break; break;
} }
case DTT_ITEM_TEXT: // item_text
{
// id
if(!changeGuid(line, 1, itemTexts, objmgr.m_ItemTextId))
ROLLBACK(DUMP_FILE_BROKEN);
// add it to cache
uint32 id= atoi(getnth(line,1).c_str());
std::string text = getnth(line,2);
objmgr.AddItemText(id,text);
break;
}
default: default:
sLog.outError("Unknown dump table type: %u",type); sLog.outError("Unknown dump table type: %u",type);
break; break;
@ -668,6 +685,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
objmgr.m_hiItemGuid += items.size(); objmgr.m_hiItemGuid += items.size();
objmgr.m_mailid += mails.size(); objmgr.m_mailid += mails.size();
objmgr.m_ItemTextId += itemTexts.size();
if(incHighest) if(incHighest)
++objmgr.m_hiCharGuid; ++objmgr.m_hiCharGuid;

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 "8156" #define REVISION_NR "8157"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__