mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Dropped itemtextid field from mail table.
This commit is contained in:
parent
50c96da112
commit
d4647bbeaa
10 changed files with 142 additions and 177 deletions
|
|
@ -4859,8 +4859,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|||
//delete all old mails without item and without body immediately, if starting server
|
||||
if (!serverUp)
|
||||
CharacterDatabase.PExecute("DELETE FROM mail WHERE expire_time < '" UI64FMTD "' AND has_items = '0' AND itemTextId = 0", (uint64)basetime);
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" UI64FMTD "'", (uint64)basetime);
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" UI64FMTD "'", (uint64)basetime);
|
||||
if ( !result )
|
||||
{
|
||||
barGoLink bar(1);
|
||||
|
|
@ -4889,13 +4889,12 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|||
m->messageType = fields[1].GetUInt8();
|
||||
m->sender = fields[2].GetUInt32();
|
||||
m->receiver = fields[3].GetUInt32();
|
||||
m->itemTextId = fields[4].GetUInt32();
|
||||
bool has_items = fields[5].GetBool();
|
||||
m->expire_time = (time_t)fields[6].GetUInt64();
|
||||
bool has_items = fields[4].GetBool();
|
||||
m->expire_time = (time_t)fields[5].GetUInt64();
|
||||
m->deliver_time = 0;
|
||||
m->COD = fields[7].GetUInt32();
|
||||
m->checked = fields[8].GetUInt32();
|
||||
m->mailTemplateId = fields[9].GetInt16();
|
||||
m->COD = fields[6].GetUInt32();
|
||||
m->checked = fields[7].GetUInt32();
|
||||
m->mailTemplateId = fields[8].GetInt16();
|
||||
|
||||
Player *pl = 0;
|
||||
if (serverUp)
|
||||
|
|
@ -4941,9 +4940,6 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|||
}
|
||||
}
|
||||
|
||||
if (m->itemTextId)
|
||||
CharacterDatabase.PExecute("DELETE FROM item_text WHERE id = '%u'", m->itemTextId);
|
||||
|
||||
//deletemail = true;
|
||||
//delmails << m->messageID << ", ";
|
||||
CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", m->messageID);
|
||||
|
|
@ -5789,18 +5785,17 @@ void ObjectMgr::SetHighestGuids()
|
|||
}
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::CreateItemText(std::string text)
|
||||
void ObjectMgr::CreateItemText(uint32 guid, std::string text)
|
||||
{
|
||||
uint32 newItemTextId = GenerateItemTextID();
|
||||
//insert new itempage to container
|
||||
mItemTexts[ newItemTextId ] = text;
|
||||
//save new itempage
|
||||
// insert new item text to container
|
||||
mItemTexts[ guid ] = text;
|
||||
|
||||
// save new item text
|
||||
CharacterDatabase.escape_string(text);
|
||||
//any Delete query needed, itemTextId is maximum of all ids
|
||||
|
||||
std::ostringstream query;
|
||||
query << "INSERT INTO item_text (id,text) VALUES ( '" << newItemTextId << "', '" << text << "')";
|
||||
CharacterDatabase.Execute(query.str().c_str()); //needs to be run this way, because mail body may be more than 1024 characters
|
||||
return newItemTextId;
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue