MaNGOS merge: Mail System.

* Store loot in mail_loot_template indexed by mail template ids.
* Implement proper creating mail text copy item from mail template based mail.
* Move send functions to new MailDraft class from WorldSession.
* Implement mails sending at player levelup.
* Autor VladimirMangos, converted by me.

--HG--
branch : trunk
This commit is contained in:
win32
2009-12-16 18:58:36 +02:00
parent dc53b4a9de
commit bf2c3fd8cf
25 changed files with 779 additions and 571 deletions
+16 -22
View File
@@ -42,10 +42,10 @@ LootStore LootTemplates_Disenchant( "disenchant_loot_template", "item disenc
LootStore LootTemplates_Fishing( "fishing_loot_template", "area id", true);
LootStore LootTemplates_Gameobject( "gameobject_loot_template", "gameobject entry", true);
LootStore LootTemplates_Item( "item_loot_template", "item entry", true);
LootStore LootTemplates_Mail( "mail_loot_template", "mail template id", false);
LootStore LootTemplates_Milling( "milling_loot_template", "item entry (herb)", true);
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid", true);
LootStore LootTemplates_Prospecting( "prospecting_loot_template", "item entry (ore)", true);
LootStore LootTemplates_QuestMail( "quest_mail_loot_template", "quest id (with mail template)",false);
LootStore LootTemplates_Reference( "reference_loot_template", "reference id", false);
LootStore LootTemplates_Skinning( "skinning_loot_template", "creature skinning id", true);
LootStore LootTemplates_Spell( "spell_loot_template", "spell id (random item creating)",false);
@@ -388,18 +388,19 @@ void Loot::AddItem(LootStoreItem const & item)
}
// Calls processor of corresponding LootTemplate (which handles everything including references)
void Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, uint16 lootMode /*= DEFAULT_LOOT_MODE*/)
bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError, uint16 lootMode /*= DEFAULT_LOOT_MODE*/)
{
// Must be provided
if (!loot_owner)
return;
return false;
LootTemplate const* tab = store.GetLootFor(loot_id);
if (!tab)
{
sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.",store.GetName(),loot_id);
return;
if (!noEmptyError)
sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.",store.GetName(),loot_id);
return false;
}
items.reserve(MAX_NR_LOOT_ITEMS);
@@ -418,6 +419,8 @@ void Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
// ... for personal loot
else
FillNotNormalLootFor(loot_owner);
return true;
}
void Loot::FillNotNormalLootFor(Player* pl)
@@ -1351,28 +1354,19 @@ void LoadLootTemplates_Prospecting()
LootTemplates_Prospecting.ReportUnusedIds(ids_set);
}
void LoadLootTemplates_QuestMail()
void LoadLootTemplates_Mail()
{
LootIdSet ids_set;
LootTemplates_QuestMail.LoadAndCollectLootIds(ids_set);
LootTemplates_Mail.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
ObjectMgr::QuestMap const& questMap = objmgr.GetQuestTemplates();
for (ObjectMgr::QuestMap::const_iterator itr = questMap.begin(); itr != questMap.end(); ++itr)
{
if (!itr->second->GetRewMailTemplateId())
continue;
if (ids_set.count(itr->first))
ids_set.erase(itr->first);
/* disabled reporting: some quest mails not include items
else
LootTemplates_QuestMail.ReportNotExistedId(itr->first);
*/
}
for(uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
if(sMailTemplateStore.LookupEntry(i))
if(ids_set.count(i))
ids_set.erase(i);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_QuestMail.ReportUnusedIds(ids_set);
LootTemplates_Mail.ReportUnusedIds(ids_set);
}
void LoadLootTemplates_Skinning()
@@ -1449,7 +1443,7 @@ void LoadLootTemplates_Reference()
LootTemplates_Skinning.CheckLootRefs(&ids_set);
LootTemplates_Disenchant.CheckLootRefs(&ids_set);
LootTemplates_Prospecting.CheckLootRefs(&ids_set);
LootTemplates_QuestMail.CheckLootRefs(&ids_set);
LootTemplates_Mail.CheckLootRefs(&ids_set);
LootTemplates_Reference.CheckLootRefs(&ids_set);
// output error for any still listed ids (not referenced from any loot table)