mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[8769] Implement mails sending at player levelup.
This commit is contained in:
parent
d009994f59
commit
e078d0dd03
12 changed files with 149 additions and 3 deletions
|
|
@ -7518,6 +7518,72 @@ bool ObjectMgr::DeleteGameTele(const std::string& name)
|
|||
return false;
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadMailLevelRewards()
|
||||
{
|
||||
m_mailLevelRewardMap.clear(); // for reload case
|
||||
|
||||
uint32 count = 0;
|
||||
QueryResult *result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward");
|
||||
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar( 1 );
|
||||
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outErrorDb(">> Loaded `mail_level_reward`, table is empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
barGoLink bar( result->GetRowCount() );
|
||||
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
uint8 level = fields[0].GetUInt8();
|
||||
uint32 raceMask = fields[1].GetUInt32();
|
||||
uint32 mailTemplateId = fields[2].GetUInt32();
|
||||
uint32 senderEntry = fields[3].GetUInt32();
|
||||
|
||||
if(level > MAX_LEVEL)
|
||||
{
|
||||
sLog.outErrorDb("Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.",level,MAX_LEVEL);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!(raceMask & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
sLog.outErrorDb("Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.",raceMask,level);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!sMailTemplateStore.LookupEntry(mailTemplateId))
|
||||
{
|
||||
sLog.outErrorDb("Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.",mailTemplateId,level);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!GetCreatureTemplateStore(senderEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.",senderEntry,level);
|
||||
continue;
|
||||
}
|
||||
|
||||
m_mailLevelRewardMap[level].push_back(MailLevelReward(raceMask,mailTemplateId,senderEntry));
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u level dependent mail rewards,", count );
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadTrainerSpell()
|
||||
{
|
||||
// For reload case
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue