diff --git a/includes/types/achievement.class.php b/includes/types/achievement.class.php index eef0b95c..88e51726 100644 --- a/includes/types/achievement.class.php +++ b/includes/types/achievement.class.php @@ -63,11 +63,13 @@ class AchievementList extends BaseType { $_curTpl = array_merge($rewards[$_id], $_curTpl); + $_curTpl['mailTemplate'] = $rewards[$_id]['MailTemplateID']; + if ($rewards[$_id]['MailTemplateID']) { // using class Loot creates an inifinite loop cirling between Loot, ItemList and SpellList or something // $mailSrc = new Loot(); - // $mailSrc->getByContainer(LOOT_MAIL, $rewards[$_id]['mailTemplate']); + // $mailSrc->getByContainer(LOOT_MAIL, $rewards[$_id]['MailTemplateID']); // foreach ($mailSrc->iterate() as $loot) // $_curTpl['rewards'][] = [TYPE_ITEM, $loot['id']]; diff --git a/pages/quest.php b/pages/quest.php index feeb6f9c..b7b5e2c4 100644 --- a/pages/quest.php +++ b/pages/quest.php @@ -1236,17 +1236,16 @@ class QuestPage extends GenericPage 'subject' => Util::parseHtmlText(Util::localizedString($letter, 'subject')) ); - foreach ($startEnd as $se) - { - if (!($se['method'] & 0x2) || $se['type'] != TYPE_NPC) - continue; + $senderTypeId = 0; + if ($_= DB::World()->selectCell('SELECT RewardMailSenderEntry FROM quest_mail_sender WHERE QuestId = ?d', $this->typeId)) + $senderTypeId = $_; + else + foreach ($startEnd as $se) + if (($se['method'] & 0x2) && $se['type'] == TYPE_NPC) + $senderTypeId = $se['typeId']; - if ($ti = CreatureList::getName($se['typeId'])) - { - $mail['sender'] = sprintf(Lang::quest('mailBy'), $se['typeId'], $ti); - break; - } - } + if ($ti = CreatureList::getName($senderTypeId)) + $mail['sender'] = sprintf(Lang::quest('mailBy'), $senderTypeId, $ti); // while mail attachemnts are handled as loot, it has no variance. Always 100% chance, always one item. $mailLoot = new Loot();