diff --git a/includes/types/quest.class.php b/includes/types/quest.class.php index 266c1c8f..5f24d740 100644 --- a/includes/types/quest.class.php +++ b/includes/types/quest.class.php @@ -122,12 +122,18 @@ class QuestList extends BaseType return $this->curTpl['flags'] & QUEST_FLAG_REPEATABLE || $this->curTpl['specialFlags'] & QUEST_FLAG_SPECIAL_REPEATABLE; } - public function isDaily($strict = false) + public function isDaily() { - if ($strict) - return $this->curTpl['flags'] & QUEST_FLAG_DAILY; - else - return $this->curTpl['flags'] & (QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY) || $this->curTpl['specialFlags'] & QUEST_FLAG_SPECIAL_MONTHLY; + if ($this->curTpl['flags'] & QUEST_FLAG_DAILY) + return 1; + + if ($this->curTpl['flags'] & QUEST_FLAG_WEEKLY) + return 2; + + if ($this->curTpl['specialFlags'] & QUEST_FLAG_SPECIAL_MONTHLY) + return 3; + + return 0; } // using reqPlayerKills and rewardHonor as a crutch .. has TC this even implemented..? diff --git a/includes/utilities.php b/includes/utilities.php index 8954aec7..973ccc9f 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -1464,12 +1464,12 @@ class Util switch ($c['ConditionTypeOrReference']) { case CND_AURA: // 1 - $c['ConditionValue2'] = NULL; // do not use his param + $c['ConditionValue2'] = null; // do not use his param case CND_SPELL: // 25 $jsGlobals[TYPE_SPELL][] = $c['ConditionValue1']; break; case CND_ITEM: // 2 - $c['ConditionValue3'] = NULL; // do not use his param + $c['ConditionValue3'] = null; // do not use his param case CND_ITEM_EQUIPPED: // 3 $jsGlobals[TYPE_ITEM][] = $c['ConditionValue1']; break; diff --git a/pages/faction.php b/pages/faction.php index 43f0fbaf..d52cf613 100644 --- a/pages/faction.php +++ b/pages/faction.php @@ -134,12 +134,15 @@ class FactionPage extends GenericPage switch ($k) { - case 'quest_rate': $buff .= '[tr][td]'.Lang::game('quests') .Lang::main('colon').'[/td]'; break; - case 'quest_daily_rate': $buff .= '[tr][td]'.Lang::game('quests').' ('.Lang::quest('daily').')' .Lang::main('colon').'[/td]'; break; - case 'quest_weekly_rate': $buff .= '[tr][td]'.Lang::game('quests').' ('.Lang::quest('weekly').')' .Lang::main('colon').'[/td]'; break; - case 'quest_monthly_rate': $buff .= '[tr][td]'.Lang::game('quests').' ('.Lang::quest('monthly').')'.Lang::main('colon').'[/td]'; break; - case 'creature_rate': $buff .= '[tr][td]'.Lang::game('npcs') .Lang::main('colon').'[/td]'; break; - case 'spell_rate': $buff .= '[tr][td]'.Lang::game('spells') .Lang::main('colon').'[/td]'; break; + case 'quest_rate': $buff .= '[tr][td]'.Lang::game('quests') .Lang::main('colon').'[/td]'; break; + case 'quest_daily_rate': $buff .= '[tr][td]'.Lang::game('quests').' ('.Lang::quest('daily').')' .Lang::main('colon').'[/td]'; break; + case 'quest_weekly_rate': $buff .= '[tr][td]'.Lang::game('quests').' ('.Lang::quest('weekly').')' .Lang::main('colon').'[/td]'; break; + case 'quest_monthly_rate': $buff .= '[tr][td]'.Lang::game('quests').' ('.Lang::quest('monthly').')' .Lang::main('colon').'[/td]'; break; + case 'quest_repeatable_rate': $buff .= '[tr][td]'.Lang::game('quests').' ('.Lang::quest('repeatable').')'.Lang::main('colon').'[/td]'; break; + case 'creature_rate': $buff .= '[tr][td]'.Lang::game('npcs') .Lang::main('colon').'[/td]'; break; + case 'spell_rate': $buff .= '[tr][td]'.Lang::game('spells') .Lang::main('colon').'[/td]'; break; + default: + continue; } $buff .= '[td width=35px align=right][span class=q'.($v < 1 ? '10]' : '2]+').intVal(($v - 1) * 100).'%[/span][/td][/tr]'; diff --git a/pages/npc.php b/pages/npc.php index 8e12bd2d..f563a0b3 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -869,15 +869,19 @@ class NpcPage extends GenericPage $set = array( 'id' => $row['faction'], - 'qty' => $row['qty'], + 'qty' => [$row['qty'], 0], 'name' => $factions->getField('name', true), 'npc' => $row['npc'], 'cap' => $row['maxRank'] && $row['maxRank'] < REP_EXALTED ? Lang::game('rep', $row['maxRank']) : null ); + $cuRate = DB::World()->selectCell('SELECT creature_rate FROM reputation_reward_rate WHERE creature_rate <> 1 AND faction = ?d', $row['faction']); + if ($cuRate !== null) + $set['qty'][1] = $set['qty'][0] * ($cuRate - 1); + if ($row['spillover']) { - $spillover[$factions->getField('cat')] = [intVal($row['qty'] / 2), $row['maxRank']]; + $spillover[$factions->getField('cat')] = [intVal(array_sum($row['qty']) / 2), $row['maxRank']]; $set['spillover'] = $factions->getField('cat'); } diff --git a/pages/quest.php b/pages/quest.php index a12f0079..b7b5ef75 100644 --- a/pages/quest.php +++ b/pages/quest.php @@ -170,7 +170,7 @@ class QuestPage extends GenericPage $startEnd = DB::Aowow()->select('SELECT * FROM ?_quests_startend WHERE questId = ?d', $this->typeId); // start - $start = '[icon name=quest_start'.($this->subject->isDaily() ? '_daily' : '').']'.Lang::event('start').Lang::main('colon').'[/icon]'; + $start = '[icon name=quest_start'.($this->subject->isRepeatable() ? '_daily' : '').']'.Lang::event('start').Lang::main('colon').'[/icon]'; $s = []; foreach ($startEnd as $se) { @@ -185,7 +185,7 @@ class QuestPage extends GenericPage $infobox[] = implode('[br]', $s); // end - $end = '[icon name=quest_end'.($this->subject->isDaily() ? '_daily' : '').']'.Lang::event('end').Lang::main('colon').'[/icon]'; + $end = '[icon name=quest_end'.($this->subject->isRepeatable() ? '_daily' : '').']'.Lang::event('end').Lang::main('colon').'[/icon]'; $e = []; foreach ($startEnd as $se) { @@ -200,7 +200,7 @@ class QuestPage extends GenericPage $infobox[] = implode('[br]', $e); // Repeatable - if ($_flags & QUEST_FLAG_REPEATABLE || $_specialFlags & QUEST_FLAG_SPECIAL_REPEATABLE) + if ($this->subject->isRepeatable()) $infobox[] = Lang::quest('repeatable'); // sharable | not sharable @@ -1259,11 +1259,30 @@ class QuestPage extends GenericPage if (!$fac || !$qty) continue; - $gains['rep'][] = array( - 'qty' => $qty, + $rep = array( + 'qty' => [$qty, 0], 'id' => $fac, 'name' => FactionList::getName($fac) ); + + if ($cuRates = DB::World()->selectRow('SELECT * FROM reputation_reward_rate WHERE faction = ?d', $fac)) + { + if ($dailyType = $this->subject->isDaily()) + { + if ($dailyType == 1 && $cuRates['quest_daily_rate'] != 1.0) + $rep['qty'][1] = $rep['qty'][0] * ($cuRates['quest_daily_rate'] - 1); + else if ($dailyType == 2 && $cuRates['quest_weekly_rate'] != 1.0) + $rep['qty'][1] = $rep['qty'][0] * ($cuRates['quest_weekly_rate'] - 1); + else if ($dailyType == 3 && $cuRates['quest_monthly_rate'] != 1.0) + $rep['qty'][1] = $rep['qty'][0] * ($cuRates['quest_monthly_rate'] - 1); + } + else if ($this->subject->isRepeatable() && $cuRates['quest_repeatable_rate'] != 1.0) + $rep['qty'][1] = $rep['qty'][0] * ($cuRates['quest_repeatable_rate'] - 1); + else if ($cuRates['quest_rate'] != 1.0) + $rep['qty'][1] = $rep['qty'][0] * ($cuRates['quest_rate'] - 1); + } + + $gains['rep'][] = $rep; } // title diff --git a/pages/spell.php b/pages/spell.php index 1cd2e3ce..cb5d5fe9 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -985,7 +985,7 @@ class SpellPage extends GenericPage if ($list) { - $tbTrainer = new CreatureList(array(CFG_SQL_LIMIT_NONE, ['ct.id', $list], ['s.guid', NULL, '!'], ['ct.npcflag', 0x10, '&'])); + $tbTrainer = new CreatureList(array(CFG_SQL_LIMIT_NONE, ['ct.id', $list], ['s.guid', null, '!'], ['ct.npcflag', 0x10, '&'])); if (!$tbTrainer->error) { $this->extendGlobalData($tbTrainer->getJSGlobals()); @@ -1758,9 +1758,8 @@ class SpellPage extends GenericPage $_ = ' ('.$n.')'; // apply custom reward rated - if ($cuRate = DB::World()->selectCell('SELECT spell_rate FROM reputation_reward_rate WHERE faction = ?d', $effMV)) - if ($cuRate != 1.0) - $foo['value'] .= sprintf(Util::$dfnString, Lang::faction('customRewRate'), ' ('.(($cuRate < 1 ? '-' : '+').intVal(($cuRate - 1) * $foo['value'])).')'); + if ($cuRate = DB::World()->selectCell('SELECT spell_rate FROM reputation_reward_rate WHERE spell_rate <> 1 && faction = ?d', $effMV)) + $foo['value'] .= sprintf(Util::$dfnString, Lang::faction('customRewRate'), ' ('.(($cuRate < 1 ? '-' : '+').intVal(($cuRate - 1) * $foo['value'])).')'); $foo['name'] .= $_; @@ -1940,8 +1939,8 @@ class SpellPage extends GenericPage break; case 30: // Mod Skill case 98: // Mod Skill Value - if ($_ = SkillList::getName($effMV)) - $bar = ' ('.SkillList::getName($effMV).')'; + if ($n = SkillList::getName($effMV)) + $bar = ' ('.$n.')'; else $bar = Lang::main('colon').Util::ucFirst(Lang::game('skill')).' #'.$effMV;; @@ -1998,7 +1997,8 @@ class SpellPage extends GenericPage $foo['value'] = sprintf(Util::$dfnString, $foo['value'], Lang::game('rep', $foo['value'])); // DO NOT BREAK case 190: // Mod Faction Reputation Gain - $bar = ' ('.FactionList::getName($effMV).')'; + $n = FactionList::getName($effMV); + $bar = ' ('.($n ? ''.$n.'' : Util::ucFirst(Lang::game('faction')).' #'.$effMV).')'; break; // also breaks for 139 } $foo['name'] .= strstr($bar, 'href') || strstr($bar, '#') ? $bar : ($bar ? ' ('.$bar.')' : null); diff --git a/template/pages/npc.tpl.php b/template/pages/npc.tpl.php index 112896dd..e73c5b16 100644 --- a/template/pages/npc.tpl.php +++ b/template/pages/npc.tpl.php @@ -91,8 +91,13 @@ if ($this->reputation): echo '