mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[8749] Rename quest_mail_loot_template to mail_loot_template.
Store loot in mail_loot_template indexed by mail template ids. Provide new SendMail functions for send mail base at mail template.
This commit is contained in:
parent
aa4524852e
commit
3c53dded97
14 changed files with 128 additions and 116 deletions
|
|
@ -12714,56 +12714,8 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
}
|
||||
|
||||
// Send reward mail
|
||||
if (pQuest->GetRewMailTemplateId())
|
||||
{
|
||||
MailMessageType mailType;
|
||||
uint32 senderGuidOrEntry;
|
||||
switch(questGiver->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
mailType = MAIL_CREATURE;
|
||||
senderGuidOrEntry = questGiver->GetEntry();
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
mailType = MAIL_GAMEOBJECT;
|
||||
senderGuidOrEntry = questGiver->GetEntry();
|
||||
break;
|
||||
case TYPEID_ITEM:
|
||||
mailType = MAIL_ITEM;
|
||||
senderGuidOrEntry = questGiver->GetEntry();
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
mailType = MAIL_NORMAL;
|
||||
senderGuidOrEntry = questGiver->GetGUIDLow();
|
||||
break;
|
||||
default:
|
||||
mailType = MAIL_NORMAL;
|
||||
senderGuidOrEntry = GetGUIDLow();
|
||||
break;
|
||||
}
|
||||
|
||||
Loot questMailLoot;
|
||||
|
||||
questMailLoot.FillLoot(pQuest->GetQuestId(), LootTemplates_QuestMail, this,true);
|
||||
|
||||
// fill mail
|
||||
MailItemsInfo mi; // item list preparing
|
||||
|
||||
uint32 max_slot = questMailLoot.GetMaxSlotInLootFor(this);
|
||||
for(uint32 i = 0; mi.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
||||
{
|
||||
if (LootItem* lootitem = questMailLoot.LootItemInSlot(i,this))
|
||||
{
|
||||
if (Item* item = Item::CreateItem(lootitem->itemid,lootitem->count,this))
|
||||
{
|
||||
item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
|
||||
mi.AddItem(item->GetGUIDLow(), item->GetEntry(), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WorldSession::SendMailTo(this, mailType, MAIL_STATIONERY_NORMAL, senderGuidOrEntry, GetGUIDLow(), "", 0, &mi, 0, 0, MAIL_CHECK_MASK_NONE,pQuest->GetRewMailDelaySecs(),pQuest->GetRewMailTemplateId());
|
||||
}
|
||||
if (uint32 mail_template_id = pQuest->GetRewMailTemplateId())
|
||||
WorldSession::SendMailTemplateTo(this, questGiver, MAIL_STATIONERY_NORMAL, mail_template_id, 0, 0, MAIL_CHECK_MASK_NONE, pQuest->GetRewMailDelaySecs());
|
||||
|
||||
if (pQuest->IsDaily())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue