mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Misc/Fixup
* make time formatting js compatible * add auto-discovery for rss feeds * fix typos * define more magic numbers
This commit is contained in:
@@ -55,10 +55,10 @@ class AjaxData extends AjaxHandler
|
||||
$result .= $this->loadProfilerData($set);
|
||||
break;
|
||||
case 'companions':
|
||||
$result .= $this->loadProfilerData($set, '778');
|
||||
$result .= $this->loadProfilerData($set, SKILL_COMPANIONS);
|
||||
break;
|
||||
case 'mounts':
|
||||
$result .= $this->loadProfilerData($set, '777');
|
||||
$result .= $this->loadProfilerData($set, SKILL_MOUNTS);
|
||||
break;
|
||||
case 'quests':
|
||||
$catg = isset($this->_get['catg']) ? $this->_get['catg'] : 'null';
|
||||
@@ -81,7 +81,7 @@ class AjaxData extends AjaxHandler
|
||||
$result .= "\n\$WowheadProfiler.loadOnDemand('recipes', null);\n";
|
||||
|
||||
break;
|
||||
// locale independant
|
||||
// locale independent
|
||||
case 'quick-excludes':
|
||||
case 'weight-presets':
|
||||
case 'item-scaling':
|
||||
|
||||
@@ -846,16 +846,16 @@ define('ITEM_CLASS_CONTAINER', 1);
|
||||
define('ITEM_CLASS_WEAPON', 2);
|
||||
define('ITEM_CLASS_GEM', 3);
|
||||
define('ITEM_CLASS_ARMOR', 4);
|
||||
define('ITEM_CLASS_REAGENT', 5);
|
||||
define('ITEM_CLASS_REAGENT', 5); // OBSOLETE (reagents are in Class:Misc; SubClass:Reagent)
|
||||
define('ITEM_CLASS_AMMUNITION', 6);
|
||||
define('ITEM_CLASS_TRADEGOOD', 7);
|
||||
define('ITEM_CLASS_GENERIC', 8);
|
||||
define('ITEM_CLASS_GENERIC', 8); // OBSOLETE
|
||||
define('ITEM_CLASS_RECIPE', 9);
|
||||
define('ITEM_CLASS_MONEY', 10);
|
||||
define('ITEM_CLASS_QUIVER', 11);
|
||||
define('ITEM_CLASS_QUEST', 12);
|
||||
define('ITEM_CLASS_KEY', 13);
|
||||
define('ITEM_CLASS_PERMANENT', 14);
|
||||
define('ITEM_CLASS_PERMANENT', 14); // OBSOLETE
|
||||
define('ITEM_CLASS_MISC', 15);
|
||||
define('ITEM_CLASS_GLYPH', 16);
|
||||
|
||||
@@ -918,7 +918,7 @@ define('ITEM_SUBCLASS_PRISMATIC_GEM', 8);
|
||||
// ItemSubClass - Armor (4)
|
||||
define('ITEM_SUBCLASS_MISC_ARMOR', 0);
|
||||
define('ITEM_SUBCLASS_CLOTH_ARMOR', 1);
|
||||
define('ITEM_SUBCLASS_LETHER_ARMOR', 2);
|
||||
define('ITEM_SUBCLASS_LEATHER_ARMOR', 2);
|
||||
define('ITEM_SUBCLASS_MAIL_ARMOR', 3);
|
||||
define('ITEM_SUBCLASS_PLATE_ARMOR', 4);
|
||||
define('ITEM_SUBCLASS_BUCKLER', 5);
|
||||
@@ -1735,6 +1735,8 @@ define('SKILL_LOCKPICKING', 633);
|
||||
define('SKILL_JEWELCRAFTING', 755);
|
||||
define('SKILL_RIDING', 762);
|
||||
define('SKILL_INSCRIPTION', 773);
|
||||
define('SKILL_MOUNTS', 777);
|
||||
define('SKILL_COMPANIONS', 778);
|
||||
|
||||
define('SKILLS_TRADE_PRIMARY', [SKILL_BLACKSMITHING, SKILL_LEATHERWORKING, SKILL_ALCHEMY, SKILL_HERBALISM, SKILL_MINING, SKILL_TAILORING, SKILL_ENGINEERING, SKILL_ENCHANTING, SKILL_SKINNING, SKILL_JEWELCRAFTING, SKILL_INSCRIPTION]);
|
||||
define('SKILLS_TRADE_SECONDARY', [SKILL_FIRST_AID, SKILL_COOKING, SKILL_FISHING, SKILL_RIDING]);
|
||||
|
||||
@@ -28,7 +28,7 @@ enum Locale : int
|
||||
return match ($this)
|
||||
{
|
||||
self::EN => 'en',
|
||||
self::KR => 'kt',
|
||||
self::KR => 'ko',
|
||||
self::FR => 'fr',
|
||||
self::DE => 'de',
|
||||
self::CN => 'cn',
|
||||
|
||||
@@ -205,7 +205,7 @@ abstract class CLI
|
||||
|
||||
$path .= ($path ? DIRECTORY_SEPARATOR : '').trim($fileOrPath);
|
||||
|
||||
// remove double quotes (from erronous user input), single quotes are
|
||||
// remove double quotes (from erroneous user input), single quotes are
|
||||
// valid chars for filenames and removing those mutilates several wow icons
|
||||
$path = str_replace('"', '', $path);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ abstract class BaseType
|
||||
* ['flags2', 0xF, '&'],
|
||||
* ]
|
||||
* [['mask', 0x3, '&'], 0],
|
||||
* ['joinedTbl.field', NULL] // NULL must be explicitly specified "['joinedTbl.field']" would be skipped as erronous definition (only really usefull when left-joining)
|
||||
* ['joinedTbl.field', NULL] // NULL must be explicitly specified "['joinedTbl.field']" would be skipped as erroneous definition (only really usefull when left-joining)
|
||||
* 'OR',
|
||||
* 5
|
||||
* )
|
||||
@@ -1002,7 +1002,7 @@ abstract class Filter
|
||||
protected const ENUM_RACE = array( null, 1, 2, 3, 4, 5, 6, 7, 8, null, 10, 11, true, false);
|
||||
protected const ENUM_PROFESSION = array( null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, true, false, 356, 182, 773);
|
||||
|
||||
public $error = false; // erronous search fields
|
||||
public $error = false; // erroneous search fields
|
||||
|
||||
private $cndSet = [];
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class EnchantmentList extends BaseType
|
||||
// issue with scaling stats enchantments
|
||||
// stats are stored as NOT NULL to be usable by the search filters and such become indistinguishable from scaling enchantments that _actually_ use the value 0
|
||||
// so filter the stats container and if it is empty, rebuild from self. .. there are no mixed scaling/static enchantments, right!?
|
||||
$this->jsonStats[$this->id] = (new StatsContainer)->fromJson($curTpl, true)->filter();
|
||||
$this->jsonStats[$this->id] = (new StatsContainer())->fromJson($curTpl, true)->filter();
|
||||
if (!count($this->jsonStats[$this->id]))
|
||||
$this->jsonStats[$this->id]->fromEnchantment($curTpl);
|
||||
}
|
||||
|
||||
@@ -2673,7 +2673,7 @@ class ItemListFilter extends Filter
|
||||
return in_array($v, $sl);
|
||||
|
||||
// armor - any; any armor
|
||||
else if ($c[0] == ITEM_CLASS_ARMOR && (!isset($c[1]) || in_array($c[1], [ITEM_SUBCLASS_CLOTH_ARMOR, ITEM_SUBCLASS_LETHER_ARMOR, ITEM_SUBCLASS_MAIL_ARMOR, ITEM_SUBCLASS_PLATE_ARMOR])))
|
||||
else if ($c[0] == ITEM_CLASS_ARMOR && (!isset($c[1]) || in_array($c[1], [ITEM_SUBCLASS_CLOTH_ARMOR, ITEM_SUBCLASS_LEATHER_ARMOR, ITEM_SUBCLASS_MAIL_ARMOR, ITEM_SUBCLASS_PLATE_ARMOR])))
|
||||
return in_array($v, $sl);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -288,45 +288,46 @@ abstract class Util
|
||||
public static function formatTime(int $msec, bool $short = false) : string
|
||||
{
|
||||
[$ms, $s, $m, $h, $d] = self::parseTime(abs($msec));
|
||||
// \u00A0 is  , but also usable by js
|
||||
|
||||
if ($short)
|
||||
{
|
||||
if ($_ = round($d / 364))
|
||||
return $_." ".Lang::timeUnits('ab', 0);
|
||||
if ($_ = round($d / 365))
|
||||
return $_."\u{00A0}".Lang::timeUnits('ab', 0);
|
||||
if ($_ = round($d / 30))
|
||||
return $_." ".Lang::timeUnits('ab', 1);
|
||||
return $_."\u{00A0}".Lang::timeUnits('ab', 1);
|
||||
if ($_ = round($d / 7))
|
||||
return $_." ".Lang::timeUnits('ab', 2);
|
||||
return $_."\u{00A0}".Lang::timeUnits('ab', 2);
|
||||
if ($_ = round($d))
|
||||
return $_." ".Lang::timeUnits('ab', 3);
|
||||
return $_."\u{00A0}".Lang::timeUnits('ab', 3);
|
||||
if ($_ = round($h))
|
||||
return $_." ".Lang::timeUnits('ab', 4);
|
||||
return $_."\u{00A0}".Lang::timeUnits('ab', 4);
|
||||
if ($_ = round($m))
|
||||
return $_." ".Lang::timeUnits('ab', 5);
|
||||
return $_."\u{00A0}".Lang::timeUnits('ab', 5);
|
||||
if ($_ = round($s + $ms / 1000, 2))
|
||||
return $_." ".Lang::timeUnits('ab', 6);
|
||||
return $_."\u{00A0}".Lang::timeUnits('ab', 6);
|
||||
if ($ms)
|
||||
return $ms." ".Lang::timeUnits('ab', 7);
|
||||
return $ms."\u{00A0}".Lang::timeUnits('ab', 7);
|
||||
|
||||
return '0 '.Lang::timeUnits('ab', 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_ = $d + $h / 24;
|
||||
if ($_ > 1 && !($_ % 364)) // whole years
|
||||
return round(($d + $h / 24) / 364, 2)." ".Lang::timeUnits($d / 364 == 1 && !$h ? 'sg' : 'pl', 0);
|
||||
if ($_ > 1 && !($_ % 365)) // whole years
|
||||
return round(($d + $h / 24) / 364, 2)."\u{00A0}".Lang::timeUnits($d / 364 == 1 && !$h ? 'sg' : 'pl', 0);
|
||||
if ($_ > 1 && !($_ % 30)) // whole month
|
||||
return round(($d + $h / 24) / 30, 2)." ".Lang::timeUnits($d / 30 == 1 && !$h ? 'sg' : 'pl', 1);
|
||||
return round(($d + $h / 24) / 30, 2)."\u{00A0}".Lang::timeUnits($d / 30 == 1 && !$h ? 'sg' : 'pl', 1);
|
||||
if ($_ > 1 && !($_ % 7)) // whole weeks
|
||||
return round(($d + $h / 24) / 7, 2)." ".Lang::timeUnits($d / 7 == 1 && !$h ? 'sg' : 'pl', 2);
|
||||
return round(($d + $h / 24) / 7, 2)."\u{00A0}".Lang::timeUnits($d / 7 == 1 && !$h ? 'sg' : 'pl', 2);
|
||||
if ($d)
|
||||
return round($d + $h / 24, 2)." ".Lang::timeUnits($d == 1 && !$h ? 'sg' : 'pl', 3);
|
||||
return round($d + $h / 24, 2)."\u{00A0}".Lang::timeUnits($d == 1 && !$h ? 'sg' : 'pl', 3);
|
||||
if ($h)
|
||||
return round($h + $m / 60, 2)." ".Lang::timeUnits($h == 1 && !$m ? 'sg' : 'pl', 4);
|
||||
return round($h + $m / 60, 2)."\u{00A0}".Lang::timeUnits($h == 1 && !$m ? 'sg' : 'pl', 4);
|
||||
if ($m)
|
||||
return round($m + $s / 60, 2)." ".Lang::timeUnits($m == 1 && !$s ? 'sg' : 'pl', 5);
|
||||
return round($m + $s / 60, 2)."\u{00A0}".Lang::timeUnits($m == 1 && !$s ? 'sg' : 'pl', 5);
|
||||
if ($s)
|
||||
return round($s + $ms / 1000, 2)." ".Lang::timeUnits($s == 1 && !$ms ? 'sg' : 'pl', 6);
|
||||
return round($s + $ms / 1000, 2)."\u{00A0}".Lang::timeUnits($s == 1 && !$ms ? 'sg' : 'pl', 6);
|
||||
if ($ms)
|
||||
return $ms." ".Lang::timeUnits($ms == 1 ? 'sg' : 'pl', 7);
|
||||
|
||||
|
||||
@@ -625,9 +625,9 @@ class Lang
|
||||
{
|
||||
case -1: // default Lang::vspf case
|
||||
case self::FMT_HTML:
|
||||
return sprintf('<span style="color: #%1s%2s;">%3s</span>', $rgb, $a, $text);
|
||||
return sprintf('<span style="color: #%1$s%2$s;">%3$s</span>', $rgb, $a, $text);
|
||||
case self::FMT_MARKUP:
|
||||
return sprintf('[span color=#%1s]%3s[/span]', $rgb, $text); // doesn't support alpha
|
||||
return sprintf('[span color=#%1$s]%3$s[/span]', $rgb, $a, $text); // doesn't support alpha
|
||||
case self::FMT_RAW:
|
||||
default:
|
||||
return $text;
|
||||
|
||||
@@ -53,7 +53,7 @@ $lang = array(
|
||||
'or' => " или ",
|
||||
'back' => "Назад",
|
||||
'reputationTip' => "Очки репутации",
|
||||
'byUser' => 'От <a href="HOST_URL/?user=%1$s"%2$s>%1s</a> ',
|
||||
'byUser' => 'От <a href="HOST_URL/?user=%1$s"%2$s>%1$s</a> ',
|
||||
'help' => "Справка",
|
||||
'status' => "Статус",
|
||||
'yes' => "Да",
|
||||
|
||||
@@ -17,7 +17,7 @@ class AdminPage extends GenericPage
|
||||
protected $extraHTML = '';
|
||||
|
||||
protected $tpl = null; // depends on the subject
|
||||
protected $reqUGroup = U_GROUP_NONE; // actual group dependant on the subPage
|
||||
protected $reqUGroup = U_GROUP_NONE; // actual group dependent on the subPage
|
||||
protected $reqAuth = true;
|
||||
protected $path = [4];
|
||||
protected $tabId = 4;
|
||||
|
||||
@@ -258,7 +258,7 @@ class NpcPage extends GenericPage
|
||||
// > Stats
|
||||
$stats = [];
|
||||
$modes = []; // get difficulty versions if set
|
||||
$hint = '[tooltip name=%3$s][table cellspacing=10][tr]%1s[/tr][/table][/tooltip][span class=tip tooltip=%3$s]%2s[/span]';
|
||||
$hint = '[tooltip name=%3$s][table cellspacing=10][tr]%1$s[/tr][/table][/tooltip][span class=tip tooltip=%3$s]%2$s[/span]';
|
||||
$modeRow = '[tr][td]%s [/td][td]%s[/td][/tr]';
|
||||
// Health
|
||||
$health = $this->subject->getBaseStats('health');
|
||||
@@ -438,7 +438,7 @@ class NpcPage extends GenericPage
|
||||
|
||||
if ($auras = DB::World()->selectCell('SELECT auras FROM creature_template_addon WHERE entry = ?d', $this->typeId))
|
||||
{
|
||||
$auras = preg_replace('/[^\d ]/', ' ', $auras); // remove erronous chars from string
|
||||
$auras = preg_replace('/[^\d ]/', ' ', $auras); // remove erroneous chars from string
|
||||
$genSpells = array_merge($genSpells, array_filter(explode(' ', $auras)));
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class ProfilePage extends GenericPage
|
||||
|
||||
if ($char['guildGUID'])
|
||||
{
|
||||
// create empty guild if nessecary to satisfy foreign keys
|
||||
// create empty guild if necessary to satisfy foreign keys
|
||||
$char['guild'] = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_guild WHERE realm = ?d AND realmGUID = ?d', $this->realmId, $char['guildGUID']);
|
||||
if (!$char['guild'])
|
||||
$char['guild'] = DB::Aowow()->query('INSERT INTO ?_profiler_guild (realm, realmGUID, cuFlags, name) VALUES (?d, ?d, ?d, ?)', $this->realmId, $char['guildGUID'], PROFILER_CU_NEEDS_RESYNC, $char['guildName']);
|
||||
|
||||
@@ -59,35 +59,35 @@ class SpellsPage extends GenericPage
|
||||
9 => [355, 354, 593],
|
||||
11 => [574, 134, 573]
|
||||
),
|
||||
9 => [129, 185, 356, 762], // Secondary Skills
|
||||
9 => SKILLS_TRADE_SECONDARY, // Secondary Skills
|
||||
11 => array( // Professions: Skill => Spell
|
||||
171 => true,
|
||||
164 => [9788, 9787, 17041, 17040, 17039],
|
||||
333 => true,
|
||||
202 => [20219, 20222],
|
||||
182 => true,
|
||||
773 => true,
|
||||
755 => true,
|
||||
165 => [10656, 10658, 10660],
|
||||
186 => true,
|
||||
393 => true,
|
||||
197 => [26798, 26801, 26797],
|
||||
SKILL_ALCHEMY => true,
|
||||
SKILL_BLACKSMITHING => [9788, 9787, 17041, 17040, 17039],
|
||||
SKILL_ENCHANTING => true,
|
||||
SKILL_ENGINEERING => [20219, 20222],
|
||||
SKILL_HERBALISM => true,
|
||||
SKILL_INSCRIPTION => true,
|
||||
SKILL_JEWELCRAFTING => true,
|
||||
SKILL_LEATHERWORKING => [10656, 10658, 10660],
|
||||
SKILL_MINING => true,
|
||||
SKILL_SKINNING => true,
|
||||
SKILL_TAILORING => [26798, 26801, 26797],
|
||||
)
|
||||
);
|
||||
|
||||
private $shortFilter = array(
|
||||
129 => [ 6, 7], // First Aid
|
||||
164 => [ 2, 4], // Blacksmithing
|
||||
165 => [ 8, 1], // Leatherworking
|
||||
171 => [ 1, 6], // Alchemy
|
||||
185 => [ 3, 5], // Cooking
|
||||
186 => [ 9, 0], // Mining
|
||||
197 => [10, 2], // Tailoring
|
||||
202 => [ 5, 3], // Engineering
|
||||
333 => [ 4, 8], // Enchanting
|
||||
356 => [ 0, 9], // Fishing
|
||||
755 => [ 7, 10], // Jewelcrafting
|
||||
773 => [15, 0], // Inscription
|
||||
SKILL_FIRST_AID => [ 6, 7],
|
||||
SKILL_BLACKSMITHING => [ 2, 4],
|
||||
SKILL_LEATHERWORKING => [ 8, 1],
|
||||
SKILL_ALCHEMY => [ 1, 6],
|
||||
SKILL_COOKING => [ 3, 5],
|
||||
SKILL_MINING => [ 9, 0],
|
||||
SKILL_TAILORING => [10, 2],
|
||||
SKILL_ENGINEERING => [ 5, 3],
|
||||
SKILL_ENCHANTING => [ 4, 8],
|
||||
SKILL_FISHING => [ 0, 9],
|
||||
SKILL_JEWELCRAFTING => [ 7, 10],
|
||||
SKILL_INSCRIPTION => [15, 0],
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ CLISetup::registerSetup("build", new class extends SetupScript
|
||||
$_spells[] = $set['spell'.$i];
|
||||
}
|
||||
|
||||
// costy and locale-independant -> cache
|
||||
// costy and locale-independent -> cache
|
||||
if ($_spells)
|
||||
$jsonBonus += (new SpellList(array(['s.id', $_spells])))->getStatGain();
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ abstract class SetupScript
|
||||
protected $worldDependency = []; // query when this table changed (--sync command)
|
||||
|
||||
protected $info = []; // arr: 0 => self, n => genSteps cmd => [[arr<str>:optionalArgs], int:argFlags, str:description]
|
||||
protected $setupAfter = [[], []]; // [[sqlgen], [filegen]] used to sort scripts that rely on each other being executed in the right order (script names are not nessecarily the same as their table names)
|
||||
protected $setupAfter = [[], []]; // [[sqlgen], [filegen]] used to sort scripts that rely on each other being executed in the right order (script names are not necessarily the same as their table names)
|
||||
|
||||
protected $success = true;
|
||||
protected $localized = false; // push locale directories onto $requiredDirs?
|
||||
|
||||
@@ -592,7 +592,7 @@ var PageTemplate = new function()
|
||||
{
|
||||
className: (character.pinned ? 'icon-star-right ' : '') + 'c' + character.classs,
|
||||
// tinyIcon: $WH.g_getProfileIcon(character.race, character.classs, character.gender, character.level, character.id, 'tiny')
|
||||
// aowow: profileId should not be nessecary here
|
||||
// aowow: profileId should not be necessary here
|
||||
tinyIcon: $WH.g_getProfileIcon(character.race, character.classs, character.gender, character.level, 0, 'tiny')
|
||||
}];
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="SHORTCUT ICON" href="<?=Cfg::get('STATIC_URL'); ?>/images/logos/favicon.ico" />
|
||||
<link rel="search" type="application/opensearchdescription+xml" href="<?=Cfg::get('STATIC_URL'); ?>/download/searchplugins/aowow.xml" title="Aowow" />
|
||||
<?php
|
||||
<?php if (isset($this->rss)): ?>
|
||||
<link rel="alternate" type="application/rss+xml" title="<?=Util::htmlEscape(implode(' - ', $this->title)); ?>" href="<?=$this->rss; ?>"/>
|
||||
<?php endif;
|
||||
foreach ($this->css as [$type, $css]):
|
||||
if ($type == SC_CSS_FILE):
|
||||
echo ' <link rel="stylesheet" type="text/css" href="'.$css."\" />\n";
|
||||
|
||||
Reference in New Issue
Block a user