* apply table quest_mail_sender to display correct mail source
 * fixed mails from mailtemplate.dbc for achievement rewards
This commit is contained in:
Sarjuuk
2018-12-14 23:59:50 +01:00
parent 34fe4c2654
commit 7f36dc87cf
2 changed files with 12 additions and 11 deletions

View File

@@ -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']];

View File

@@ -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();