NPC/Objective

* must test for KillCredit as there are cases where reqNpcOrGo is 0,
   but its required count is > 0
 * amends d34765eed5
 * fixes #475
This commit is contained in:
Sarjuuk 2025-12-28 19:59:53 +01:00
parent 4e848e29a7
commit 289d5062bd

View file

@ -718,11 +718,15 @@ class NpcBaseResponse extends TemplateResponse implements ICache
// tab: objective of quest
$conditions = array(
'OR',
['AND', ['reqNpcOrGo1', [$this->typeId, $this->subject->getField('KillCredit1'), $this->subject->getField('KillCredit2')]], ['reqNpcOrGoCount1', 0, '>']],
['AND', ['reqNpcOrGo2', [$this->typeId, $this->subject->getField('KillCredit1'), $this->subject->getField('KillCredit2')]], ['reqNpcOrGoCount2', 0, '>']],
['AND', ['reqNpcOrGo3', [$this->typeId, $this->subject->getField('KillCredit1'), $this->subject->getField('KillCredit2')]], ['reqNpcOrGoCount3', 0, '>']],
['AND', ['reqNpcOrGo4', [$this->typeId, $this->subject->getField('KillCredit1'), $this->subject->getField('KillCredit2')]], ['reqNpcOrGoCount4', 0, '>']]
['AND', ['reqNpcOrGo1', [$this->typeId]], ['reqNpcOrGoCount1', 0, '>']],
['AND', ['reqNpcOrGo2', [$this->typeId]], ['reqNpcOrGoCount2', 0, '>']],
['AND', ['reqNpcOrGo3', [$this->typeId]], ['reqNpcOrGoCount3', 0, '>']],
['AND', ['reqNpcOrGo4', [$this->typeId]], ['reqNpcOrGoCount4', 0, '>']]
);
foreach ([1, 2] as $i)
if (($_ = $this->subject->getField('KillCredit'.$i)) > 0)
for ($j = 1; $j < 5; $j++)
$conditions[$j][1][1][] = $_;
$objectiveOf = new QuestList($conditions);
if (!$objectiveOf->error)