本文整理汇总了PHP中Util::localizedString方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::localizedString方法的具体用法?PHP Util::localizedString怎么用?PHP Util::localizedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util::localizedString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getName
public static function getName($id)
{
if ($id > 0) {
$row = DB::Aowow()->SelectRow('SELECT * FROM ?_holidays WHERE Id = ?d', intVal($id));
} else {
$row = DB::Aowow()->SelectRow('SELECT description as name FROM ?_events WHERE Id = ?d', intVal(-$id));
}
return Util::localizedString($row, 'name');
}
示例2: gems
function gems()
{
// sketchy, but should work
// Id < 36'000 || ilevel < 70 ? BC : WOTLK
$gems = DB::Aowow()->Select('SELECT i.id AS itemId,
i.name_loc0, i.name_loc2, i.name_loc3, i.name_loc4, i.name_loc6, i.name_loc8,
IF (i.id < 36000 OR i.itemLevel < 70, 1 , 2) AS expansion,
i.quality,
ic.iconString AS icon,
i.gemEnchantmentId AS enchId,
i.gemColorMask AS colors
FROM ?_items i
JOIN ?_icons ic ON ic.id = -i.displayId
WHERE i.gemEnchantmentId <> 0
ORDER BY i.id DESC');
$success = true;
// check directory-structure
foreach (Util::$localeStrings as $dir) {
if (!CLISetup::writeDir('datasets/' . $dir)) {
$success = false;
}
}
$enchIds = [];
foreach ($gems as $pop) {
$enchIds[] = $pop['enchId'];
}
$enchantments = new EnchantmentList(array(['id', $enchIds], CFG_SQL_LIMIT_NONE));
if ($enchantments->error) {
CLISetup::log('Required table ?_itemenchantment seems to be empty! Leaving gems()...', CLISetup::LOG_ERROR);
CLISetup::log();
return false;
}
foreach (CLISetup::$localeIds as $lId) {
set_time_limit(5);
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$gemsOut = [];
foreach ($gems as $pop) {
if (!$enchantments->getEntry($pop['enchId'])) {
CLISetup::log(' * could not find enchantment #' . $pop['enchId'] . ' referenced by item #' . $gem['itemId'], CLISetup::LOG_WARN);
continue;
}
$gemsOut[$pop['itemId']] = array('name' => Util::localizedString($pop, 'name'), 'quality' => $pop['quality'], 'icon' => strToLower($pop['icon']), 'enchantment' => $enchantments->getField('name', true), 'jsonequip' => $enchantments->getStatGain(), 'colors' => $pop['colors'], 'expansion' => $pop['expansion']);
}
$toFile = "var g_gems = " . Util::toJSON($gemsOut) . ";";
$file = 'datasets/' . User::$localeString . '/gems';
if (!CLISetup::writeFile($file, $toFile)) {
$success = false;
}
}
return $success;
}
示例3: glyphs
function glyphs()
{
$success = true;
$glyphList = DB::Aowow()->Select('SELECT i.id AS itemId,
i.*,
IF (g.typeFlags & 0x1, 2, 1) AS type,
i.subclass AS classs,
i.requiredLevel AS level,
s1.Id AS glyphSpell,
ic.iconString AS icon,
s1.skillLine1 AS skillId,
s2.Id AS glyphEffect,
s2.Id AS ARRAY_KEY
FROM ?_items i
JOIN ?_spell s1 ON s1.Id = i.spellid1
JOIN ?_glyphproperties g ON g.Id = s1.effect1MiscValue
JOIN ?_spell s2 ON s2.Id = g.spellId
JOIN ?_icons ic ON ic.Id = s1.iconIdAlt
WHERE i.classBak = 16');
// check directory-structure
foreach (Util::$localeStrings as $dir) {
if (!CLISetup::writeDir('datasets/' . $dir)) {
$success = false;
}
}
$glyphSpells = new SpellList(array(['s.id', array_keys($glyphList)], CFG_SQL_LIMIT_NONE));
foreach (CLISetup::$localeIds as $lId) {
set_time_limit(30);
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$glyphsOut = [];
foreach ($glyphSpells->iterate() as $__) {
$pop = $glyphList[$glyphSpells->id];
if (!$pop['glyphEffect']) {
continue;
}
if ($glyphSpells->getField('effect1Id') != 6 && $glyphSpells->getField('effect2Id') != 6 && $glyphSpells->getField('effect3Id') != 6) {
continue;
}
$glyphsOut[$pop['itemId']] = array('name' => Util::localizedString($pop, 'name'), 'description' => $glyphSpells->parseText()[0], 'icon' => $pop['icon'], 'type' => $pop['type'], 'classs' => $pop['classs'], 'skill' => $pop['skillId'], 'level' => $pop['level']);
}
$toFile = "var g_glyphs = " . Util::toJSON($glyphsOut) . ";";
$file = 'datasets/' . User::$localeString . '/glyphs';
if (!CLISetup::writeFile($file, $toFile)) {
$success = false;
}
}
return $success;
}
示例4: pets
function pets()
{
$success = true;
$locations = [];
$petList = DB::Aowow()->Select('SELECT cr. id,
cr.name_loc0, cr.name_loc2, cr.name_loc3, cr.name_loc6, cr.name_loc8,
cr.minLevel,
cr.maxLevel,
ft.A,
ft.H,
cr.rank AS classification,
cr.family,
cr.displayId1 AS displayId,
cr.textureString AS skin,
LOWER(SUBSTRING_INDEX(cf.iconString, "\\\\", -1)) AS icon,
cf.petTalentType AS type
FROM ?_creature cr
JOIN ?_factiontemplate ft ON ft.Id = cr.faction
JOIN dbc_creaturefamily cf ON cf.id = cr.family
WHERE cr.typeFlags & 0x1 AND (cr.cuFlags & 0x2) = 0
ORDER BY cr.id ASC');
// check directory-structure
foreach (Util::$localeStrings as $dir) {
if (!CLISetup::writeDir('datasets/' . $dir)) {
$success = false;
}
}
foreach (CLISetup::$localeIds as $lId) {
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$petsOut = [];
foreach ($petList as $pet) {
// get locations
// again: caching will save you time and nerves
if (!isset($locations[$pet['id']])) {
$locations[$pet['id']] = DB::Aowow()->SelectCol('SELECT DISTINCT areaId FROM ?_spawns WHERE type = ?d AND typeId = ?d', TYPE_NPC, $pet['id']);
}
$petsOut[$pet['id']] = array('id' => $pet['id'], 'name' => Util::localizedString($pet, 'name'), 'minlevel' => $pet['minLevel'], 'maxlevel' => $pet['maxLevel'], 'location' => $locations[$pet['id']], 'react' => [$pet['A'], $pet['H']], 'classification' => $pet['classification'], 'family' => $pet['family'], 'displayId' => $pet['displayId'], 'skin' => $pet['skin'], 'icon' => $pet['icon'], 'type' => $pet['type']);
}
$toFile = "var g_pets = " . Util::toJSON($petsOut) . ";";
$file = 'datasets/' . User::$localeString . '/pets';
if (!CLISetup::writeFile($file, $toFile)) {
$success = false;
}
}
return $success;
}
示例5: getName
public static function getName($id)
{
$row = DB::Aowow()->SelectRow('
SELECT
IFNULL(h.name_loc0, e.description) AS name_loc0,
h.name_loc2,
h.name_loc3,
h.name_loc6,
h.name_loc8
FROM
?_events e
LEFT JOIN
?_holidays h ON e.holidayId = h.id
WHERE
e.id = ?d', $id);
return Util::localizedString($row, 'name');
}
示例6: gems
function gems()
{
// sketchy, but should work
// Id < 36'000 || ilevel < 70 ? BC : WOTLK
$gems = DB::Aowow()->Select('SELECT i.id AS itemId,
i.name_loc0, i.name_loc2, i.name_loc3, i.name_loc6, i.name_loc8,
IF (i.id < 36000 OR i.itemLevel < 70, 1 , 2) AS expansion,
i.quality,
ic.iconString AS icon,
i.gemEnchantmentId AS enchId,
i.gemColorMask AS colors
FROM ?_items i
JOIN ?_icons ic ON ic.id = -i.displayId
WHERE i.gemEnchantmentId <> 0
ORDER BY i.id DESC');
$success = true;
// check directory-structure
foreach (Util::$localeStrings as $dir) {
if (!CLISetup::writeDir('datasets/' . $dir)) {
$success = false;
}
}
$enchIds = [];
foreach ($gems as $pop) {
$enchIds[] = $pop['enchId'];
}
$enchMisc = [];
$enchJSON = Util::parseItemEnchantment($enchIds, false, $enchMisc);
foreach (CLISetup::$localeIds as $lId) {
set_time_limit(5);
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$gemsOut = [];
foreach ($gems as $pop) {
$gemsOut[$pop['itemId']] = array('name' => Util::localizedString($pop, 'name'), 'quality' => $pop['quality'], 'icon' => strToLower($pop['icon']), 'enchantment' => Util::localizedString(@$enchMisc[$pop['enchId']]['text'] ?: [], 'text'), 'jsonequip' => @$enchJSON[$pop['enchId']] ?: [], 'colors' => $pop['colors'], 'expansion' => $pop['expansion']);
}
$toFile = "var g_gems = " . Util::toJSON($gemsOut) . ";";
$file = 'datasets/' . User::$localeString . '/gems';
if (!CLISetup::writeFile($file, $toFile)) {
$success = false;
}
}
return $success;
}
示例7: generateContent
protected function generateContent()
{
$this->addCSS(['string' => '.announcement { margin: auto; max-width: 1200px; padding: 0px 15px 15px 15px }']);
// load news
$this->news = DB::Aowow()->selectRow('SELECT id as ARRAY_KEY, n.* FROM ?_news n WHERE active = 1 ORDER BY id DESC LIMIT 1');
if (!$this->news) {
return;
}
$this->news['text'] = Util::localizedString($this->news, 'text', true);
if ($_ = (new Markup($this->news['text']))->parseGlobalsFromText()) {
$this->extendGlobalData($_);
}
if (empty($this->news['bgImgUrl'])) {
$this->news['bgImgUrl'] = STATIC_URL . '/images/' . User::$localeString . '/mainpage-bg-news.jpg';
} else {
$this->news['bgImgUrl'] = strtr($this->news['bgImgUrl'], ['HOST_URL' => HOST_URL, 'STATIC_URL' => STATIC_URL]);
}
// load overlay links
$this->news['overlays'] = DB::Aowow()->select('SELECT * FROM ?_news_overlay WHERE newsId = ?d', $this->news['id']);
foreach ($this->news['overlays'] as &$o) {
$o['title'] = Util::localizedString($o, 'title', true);
$o['title'] = strtr($o['title'], ['HOST_URL' => HOST_URL, 'STATIC_URL' => STATIC_URL]);
}
}
示例8: createEffects
//.........这里部分代码省略.........
case 134:
// Kill Credit2
$_ = Lang::game('npc') . ' #' . $effMV;
if ($summon = $this->subject->getModelInfo($this->typeId, $i)) {
$_ = $summon['typeId'] ? ' (<a href="?npc=' . $summon['typeId'] . '">' . $summon['displayName'] . '</a>)' : ' (#0)';
$redButtons[BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $summon['displayId']];
}
$foo['name'] .= $_;
break;
case 33:
// Open Lock
$_ = $effMV ? Lang::spell('lockType', $effMV) : $effMV;
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
$_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
} else {
if (!$_) {
$_ = $effMV;
}
}
$foo['name'] .= ' (' . $_ . ')';
break;
case 53:
// Enchant Item Perm
// Enchant Item Perm
case 54:
// Enchant Item Temp
// Enchant Item Temp
case 92:
// Enchant Held Item
// Enchant Held Item
case 156:
// Enchant Item Prismatic
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE id = ?d', $effMV)) {
$foo['name'] .= ' (<a href="?enchantment=' . $effMV . '" class="q2">' . Util::localizedString($_, 'name') . '</a>)';
} else {
$foo['name'] .= ' #' . $effMV;
}
break;
case 38:
// Dispel [miscValue => Types]
// Dispel [miscValue => Types]
case 126:
// Steal Aura
$_ = Lang::game('dt', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
$_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
} else {
if (!$_) {
$_ = $effMV;
}
}
$foo['name'] .= ' (' . $_ . ')';
break;
case 39:
// Learn Language
$_ = Lang::game('languages', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
$_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
} else {
if (!$_) {
$_ = $effMV;
}
}
$foo['name'] .= ' (' . $_ . ')';
break;
case 50:
示例9: generateContent
protected function generateContent()
{
$conditions = [CFG_SQL_LIMIT_NONE];
$visibleCols = [];
$hiddenCols = [];
$mapFile = 0;
$spawnMap = -1;
if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
// sub-areas and unused zones
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
}
if ($this->category) {
$conditions[] = ['z.category', $this->category[0]];
$hiddenCols[] = 'category';
if (isset($this->category[1]) && in_array($this->category[0], [2, 3])) {
$conditions[] = ['z.expansion', $this->category[1]];
}
if (empty($this->category[1])) {
switch ($this->category[0]) {
case 0:
$mapFile = -3;
$spawnMap = 0;
break;
case 1:
$mapFile = -6;
$spawnMap = 1;
break;
case 8:
$mapFile = -2;
$spawnMap = 530;
break;
case 10:
$mapFile = -5;
$spawnMap = 571;
break;
}
}
switch ($this->category[0]) {
case 6:
case 2:
case 3:
array_push($visibleCols, 'level', 'players');
case 9:
$hiddenCols[] = 'territory';
break;
}
}
$zones = new ZoneList($conditions);
if (!$zones->hasSetFields(['type'])) {
$hiddenCols[] = 'instancetype';
}
$tabData = ['data' => array_values($zones->getListviewData())];
if ($visibleCols) {
$tabData['visibleCols'] = $visibleCols;
}
if ($hiddenCols) {
$tabData['hiddenCols'] = $hiddenCols;
}
$this->map = null;
$this->lvTabs[] = ['zone', $tabData];
// create flight map
if ($mapFile) {
$somData = ['flightmaster' => []];
$nodes = DB::Aowow()->select('SELECT id AS ARRAY_KEY, tn.* FROM ?_taxinodes tn WHERE mapId = ?d ', $spawnMap);
$paths = DB::Aowow()->select('
SELECT IF(tn1.reactA = tn1.reactH AND tn2.reactA = tn2.reactH, 1, 0) AS neutral,
tp.startNodeId AS startId,
tn1.posX AS startPosX,
tn1.posY AS startPosY,
tp.endNodeId AS endId,
tn2.posX AS endPosX,
tn2.posY AS endPosY
FROM ?_taxipath tp,
?_taxinodes tn1,
?_taxinodes tn2
WHERE tn1.Id = tp.endNodeId AND
tn2.Id = tp.startNodeId AND
(tp.startNodeId IN (?a) OR tp.EndNodeId IN (?a))
', array_keys($nodes), array_keys($nodes));
foreach ($nodes as $i => $n) {
$neutral = $n['reactH'] == $n['reactA'];
$data = array('coords' => [[$n['posX'], $n['posY']]], 'level' => 0, 'name' => Util::localizedString($n, 'name'), 'type' => $n['type'], 'id' => $n['typeId'], 'reacthorde' => $n['reactH'], 'reactalliance' => $n['reactA'], 'paths' => []);
foreach ($paths as $j => $p) {
if ($i != $p['startId'] && $i != $p['endId']) {
continue;
}
if ($i == $p['startId'] && (!$neutral || $p['neutral'])) {
$data['paths'][] = [$p['startPosX'], $p['startPosY']];
unset($paths[$j]);
} else {
if ($i == $p['endId'] && (!$neutral || $p['neutral'])) {
$data['paths'][] = [$p['endPosX'], $p['endPosY']];
unset($paths[$j]);
}
}
}
if (empty($data['paths'])) {
unset($data['paths']);
}
$somData['flightmaster'][] = $data;
//.........这里部分代码省略.........
示例10: generateContent
protected function generateContent()
{
$this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// Event (ignore events, where the object only gets removed)
if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId)) {
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
$ev = [];
foreach ($_ as $i => $e) {
$ev[] = ($i % 2 ? '[br]' : ' ') . '[event=' . $e . ']';
}
$infobox[] = Util::ucFirst(Lang::game('eventShort')) . Lang::main('colon') . implode(',', $ev);
}
// Reaction
$_ = function ($r) {
if ($r == 1) {
return 2;
}
if ($r == -1) {
return 10;
}
return;
};
$infobox[] = Lang::npc('react') . Lang::main('colon') . '[color=q' . $_($this->subject->getField('A')) . ']A[/color] [color=q' . $_($this->subject->getField('H')) . ']H[/color]';
// reqSkill
switch ($this->subject->getField('typeCat')) {
case -3:
// Herbalism
$infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 2) . ' (' . $this->subject->getField('reqSkill') . ')');
break;
case -4:
// Mining
$infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 3) . ' (' . $this->subject->getField('reqSkill') . ')');
break;
case -5:
// Lockpicking
$infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 1) . ' (' . $this->subject->getField('reqSkill') . ')');
break;
default:
$locks = Lang::getLocks($this->subject->getField('lockId'));
$l = '';
foreach ($locks as $idx => $_) {
if ($idx < 0) {
continue;
}
$this->extendGlobalIds(TYPE_ITEM, $idx);
$l = Lang::gameObject('key') . Lang::main('colon') . '[item=' . $idx . ']';
}
// if no propper item is found use a skill
if ($locks) {
$infobox[] = $l ? $l : array_pop($locks);
}
}
// linked trap
if ($_ = $this->subject->getField('linkedTrap')) {
$this->extendGlobalIds(TYPE_OBJECT, $_);
$infobox[] = Lang::gameObject('trap') . Lang::main('colon') . '[object=' . $_ . ']';
}
// trap for
$trigger = new GameObjectList(array(['linkedTrap', $this->typeId]));
if (!$trigger->error) {
$this->extendGlobalData($trigger->getJSGlobals());
$infobox[] = Lang::gameObject('triggeredBy') . Lang::main('colon') . '[object=' . $trigger->id . ']';
}
// SpellFocus
if ($_ = $this->subject->getField('spellFocusId')) {
if ($sfo = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE id = ?d', $_)) {
$infobox[] = '[tooltip name=focus]' . Lang::gameObject('focusDesc') . '[/tooltip][span class=tip tooltip=focus]' . Lang::gameObject('focus') . Lang::main('colon') . Util::localizedString($sfo, 'name') . '[/span]';
}
}
// lootinfo: [min, max, restock]
if (($_ = $this->subject->getField('lootStack')) && $_[0]) {
$buff = Lang::item('charges') . Lang::main('colon') . $_[0];
if ($_[0] < $_[1]) {
$buff .= Lang::game('valueDelim') . $_[1];
}
// since Veins don't have charges anymore, the timer is questionable
$infobox[] = $_[2] > 1 ? '[tooltip name=restock]' . sprintf(Lang::gameObject('restock'), Util::formatTime($_[2] * 1000)) . '[/tooltip][span class=tip tooltip=restock]' . $buff . '[/span]' : $buff;
}
// meeting stone [minLevel, maxLevel, zone]
if ($this->subject->getField('type') == OBJECT_MEETINGSTONE) {
if ($_ = $this->subject->getField('mStone')) {
$this->extendGlobalIds(TYPE_ZONE, $_[2]);
$m = Lang::game('meetingStone') . Lang::main('colon') . '[zone=' . $_[2] . ']';
$l = $_[0];
if ($_[0] > 1 && $_[1] > $_[0]) {
$l .= Lang::game('valueDelim') . min($_[1], MAX_LEVEL);
}
$infobox[] = $l ? '[tooltip name=meetingstone]' . sprintf(Lang::game('reqLevel'), $l) . '[/tooltip][span class=tip tooltip=meetingstone]' . $m . '[/span]' : $m;
}
}
// capture area [minPlayer, maxPlayer, minTime, maxTime, radius]
if ($this->subject->getField('type') == OBJECT_CAPTURE_POINT) {
if ($_ = $this->subject->getField('capture')) {
$buff = Lang::gameObject('capturePoint');
if ($_[2] > 1 || $_[0]) {
$buff .= Lang::main('colon') . '[ul]';
//.........这里部分代码省略.........
示例11: getModelInfo
public function getModelInfo($spellId = 0, $effIdx = 0)
{
$displays = [0 => []];
foreach ($this->iterate() as $id => $__) {
if ($spellId && $spellId != $id) {
continue;
}
for ($i = 1; $i < 4; $i++) {
$effMV = $this->curTpl['effect' . $i . 'MiscValue'];
if (!$effMV) {
continue;
}
// GO Model from MiscVal
if (in_array($this->curTpl['effect' . $i . 'Id'], [50, 76, 104, 105, 106, 107])) {
if (isset($displays[TYPE_OBJECT][$id])) {
$displays[TYPE_OBJECT][$id][0][] = $i;
} else {
$displays[TYPE_OBJECT][$id] = [[$i], $effMV];
}
} else {
if (in_array($this->curTpl['effect' . $i . 'Id'], [28, 90, 134]) || in_array($this->curTpl['effect' . $i . 'AuraId'], [56, 78])) {
if (isset($displays[TYPE_NPC][$id])) {
$displays[TYPE_NPC][$id][0][] = $i;
} else {
$displays[TYPE_NPC][$id] = [[$i], $effMV];
}
} else {
if ($this->curTpl['effect' . $i . 'AuraId'] == 36) {
$subForms = array(892 => [892, 29407, 29406, 29408, 29405], 8571 => [8571, 29410, 29411, 29412], 2281 => [2281, 29413, 29414, 29416, 29417], 2289 => [2289, 29415, 29418, 29419, 29420, 29421]);
if ($st = DB::Aowow()->selectRow('SELECT *, displayIdA as model1, displayIdH as model2 FROM ?_shapeshiftforms WHERE id = ?d', $effMV)) {
foreach ([1, 2] as $j) {
if (isset($subForms[$st['model' . $j]])) {
$st['model' . $j] = $subForms[$st['model' . $j]][array_rand($subForms[$st['model' . $j]])];
}
}
$displays[0][$id][$i] = array('typeId' => 0, 'displayId' => $st['model2'] ? $st['model' . rand(1, 2)] : $st['model1'], 'creatureType' => $st['creatureType'], 'displayName' => Util::localizedString($st, 'name'));
}
}
}
}
}
}
$results = $displays[0];
if (!empty($displays[TYPE_NPC])) {
$nModels = new CreatureList(array(['id', array_column($displays[TYPE_NPC], 1)]));
foreach ($nModels->iterate() as $nId => $__) {
$srcId = 0;
foreach ($displays[TYPE_NPC] as $srcId => $set) {
if ($set[1] == $nId) {
break;
}
}
foreach ($set[0] as $idx) {
$results[$srcId][$idx] = array('typeId' => $nId, 'displayId' => $nModels->getRandomModelId(), 'displayName' => $nModels->getField('name', true));
}
}
}
if (!empty($displays[TYPE_OBJECT])) {
$oModels = new GameObjectList(array(['id', array_column($displays[TYPE_OBJECT], 1)]));
foreach ($oModels->iterate() as $oId => $__) {
$srcId = 0;
foreach ($displays[TYPE_OBJECT] as $srcId => $set) {
if ($set[1] == $oId) {
break;
}
}
foreach ($set[0] as $idx) {
$results[$srcId][$idx] = array('typeId' => $oId, 'displayId' => $oModels->getField('displayId'), 'displayName' => $oModels->getField('name', true));
}
}
}
if ($spellId && $effIdx) {
return !empty($results[$spellId][$effIdx]) ? $results[$spellId][$effIdx] : 0;
}
return $results;
}
示例12: profiler
function profiler()
{
$success = true;
$scripts = [];
/**********/
/* Quests */
/**********/
$scripts[] = function () {
$success = true;
$condition = [CFG_SQL_LIMIT_NONE, 'AND', [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW], 0], [['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE | QUEST_FLAG_AUTO_REWARDED, '&'], 0], [['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_DUNGEON_FINDER | QUEST_FLAG_SPECIAL_MONTHLY, '&'], 0]];
$questz = new QuestList($condition);
$_ = [];
$currencies = array_column($questz->rewards, TYPE_CURRENCY);
foreach ($currencies as $curr) {
foreach ($curr as $cId => $qty) {
$_[] = $cId;
}
}
$relCurr = new CurrencyList(array(['id', $_]));
foreach (CLISetup::$localeIds as $l) {
set_time_limit(20);
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$buff = "var _ = g_gatheredcurrencies;\n";
foreach ($relCurr->getListviewData() as $id => $data) {
$buff .= '_[' . $id . '] = ' . Util::toJSON($data) . ";\n";
}
$buff .= "\n\nvar _ = g_quests;\n";
foreach ($questz->getListviewData() as $id => $data) {
$buff .= '_[' . $id . '] = ' . Util::toJSON($data) . ";\n";
}
$buff .= "\ng_quest_catorder = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n";
if (!CLISetup::writeFile('datasets/' . User::$localeString . '/p-quests', $buff)) {
$success = false;
}
}
return $success;
};
/****************/
/* Achievements */
/****************/
$scripts[] = function () {
$success = true;
$condition = array(CFG_SQL_LIMIT_NONE, [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], [['flags', 1, '&'], 0]);
$achievez = new AchievementList($condition);
foreach (CLISetup::$localeIds as $l) {
set_time_limit(5);
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$sumPoints = 0;
$buff = "var _ = g_achievements;\n";
foreach ($achievez->getListviewData(ACHIEVEMENTINFO_PROFILE) as $id => $data) {
$sumPoints += $data['points'];
$buff .= '_[' . $id . '] = ' . Util::toJSON($data) . ";\n";
}
// categories to sort by
$buff .= "\ng_achievement_catorder = [92, 14863, 97, 169, 170, 171, 172, 14802, 14804, 14803, 14801, 95, 161, 156, 165, 14806, 14921, 96, 201, 160, 14923, 14808, 14805, 14778, 14865, 14777, 14779, 155, 14862, 14861, 14864, 14866, 158, 162, 14780, 168, 14881, 187, 14901, 163, 14922, 159, 14941, 14961, 14962, 14981, 15003, 15002, 15001, 15041, 15042, 81]";
// sum points
$buff .= "\ng_achievement_points = [" . $sumPoints . "];\n";
if (!CLISetup::writeFile('datasets/' . User::$localeString . '/p-achievements', $buff)) {
$success = false;
}
}
return $success;
};
/**********/
/* Titles */
/**********/
$scripts[] = function () {
$success = true;
$condition = array(CFG_SQL_LIMIT_NONE, [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]);
$titlez = new TitleList($condition);
foreach (CLISetup::$localeIds as $l) {
set_time_limit(5);
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
foreach ([0, 1] as $g) {
$buff = "var _ = g_titles;\n";
foreach ($titlez->getListviewData() as $id => $data) {
$data['name'] = Util::localizedString($titlez->getEntry($id), $g ? 'female' : 'male');
unset($data['namefemale']);
$buff .= '_[' . $id . '] = ' . Util::toJSON($data) . ";\n";
}
if (!CLISetup::writeFile('datasets/' . User::$localeString . '/p-titles-' . $g, $buff)) {
$success = false;
}
}
}
return $success;
};
/**********/
/* Mounts */
/**********/
$scripts[] = function () {
$success = true;
$condition = array(CFG_SQL_LIMIT_NONE, [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], ['typeCat', -5]);
$mountz = new SpellList($condition);
foreach (CLISetup::$localeIds as $l) {
set_time_limit(5);
User::useLocale($l);
//.........这里部分代码省略.........
示例13: generateContent
//.........这里部分代码省略.........
$this->extendGlobalIds(TYPE_ZONE, $_);
}
// we cannot fetch spawns via lists. lists are grouped by entry
$oSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, TYPE_OBJECT);
$cSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, TYPE_NPC);
$conditions = [CFG_SQL_LIMIT_NONE, ['s.areaId', $this->typeId]];
if (!User::isInGroup(U_GROUP_STAFF)) {
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
}
$objectSpawns = new GameObjectList($conditions);
$creatureSpawns = new CreatureList($conditions);
$questsLV = $rewardsLV = [];
// see if we can actually display a map
$hasMap = file_exists('static/images/wow/maps/' . Util::$localeStrings[User::$localeId] . '/normal/' . $this->typeId . '.jpg');
if (!$hasMap) {
// try multilayered
$hasMap = file_exists('static/images/wow/maps/' . Util::$localeStrings[User::$localeId] . '/normal/' . $this->typeId . '-1.jpg');
}
if (!$hasMap) {
// try english fallback
$hasMap = file_exists('static/images/wow/maps/enus/normal/' . $this->typeId . '.jpg');
}
if (!$hasMap) {
// try english fallback, multilayered
$hasMap = file_exists('static/images/wow/maps/enus/normal/' . $this->typeId . '-1.jpg');
}
if ($hasMap) {
$som = [];
foreach ($oSpawns as $spawn) {
$tpl = $objectSpawns->getEntry($spawn['typeId']);
if (!$tpl) {
continue;
}
$n = Util::localizedString($tpl, 'name');
$what = '';
switch ($tpl['typeCat']) {
case -3:
$what = 'herb';
break;
case -4:
$what = 'vein';
break;
case 9:
$what = 'book';
break;
case -6:
if ($tpl['spellFocusId'] == 1) {
$what = 'anvil';
} else {
if ($tpl['spellFocusId'] == 3) {
$what = 'forge';
}
}
break;
}
if ($what) {
$addToMap($what, array('coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], 'name' => $n, 'type' => TYPE_OBJECT, 'id' => $tpl['id']));
}
if ($tpl['startsQuests']) {
$started = new QuestList(array(['qse.method', 1, '&'], ['qse.type', TYPE_OBJECT], ['qse.typeId', $tpl['id']]));
if ($started->error) {
continue;
}
// store data for misc tabs
foreach ($started->getListviewData() as $id => $data) {
if (!empty($started->rewards[$id][TYPE_ITEM])) {
示例14: generateTitle
protected function generateTitle()
{
array_unshift($this->title, Util::ucFirst(Lang::game('achievements')));
if ($this->category) {
$catrow = DB::Aowow()->SelectRow('SELECT * FROM ?_achievementcategory WHERE id = ?d', end($this->category));
array_unshift($this->title, Util::localizedString($catrow, 'name'));
}
}
示例15: createSQLForCriterium
//.........这里部分代码省略.........
if (!$facTpls) {
return [0];
}
return ['faction', $facTpls];
}
break;
case 38:
// relatedevent
if (!$this->isSaneNumeric($cr[1])) {
break;
}
if ($cr[1] == FILTER_ENUM_ANY) {
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids];
} else {
if ($cr[1] == FILTER_ENUM_NONE) {
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids, '!'];
} else {
if ($cr[1]) {
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1]);
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids];
}
}
}
break;
case 42:
// increasesrepwith [enum]
if (in_array($cr[1], $this->enums[3])) {
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1])) {
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
}
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 > 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 > 0)', $cr[1], $cr[1])) {
return ['id', $cIds];
} else {
return [0];
}
}
break;
case 43:
// decreasesrepwith [enum]
if (in_array($cr[1], $this->enums[3])) {
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1])) {
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
}
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 < 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 < 0)', $cr[1], $cr[1])) {
return ['id', $cIds];
} else {
return [0];
}
}
break;
case 12:
// averagemoneydropped [op] [int]
if (!$this->isSaneNumeric($cr[2]) || !$this->int2Op($cr[1])) {
break;
}
return ['AND', ['((minGold + maxGold) / 2)', $cr[2], $cr[1]]];
case 15:
// gatherable [yn]
if ($this->int2Bool($cr[1])) {
if ($cr[1]) {
return ['AND', ['skinLootId', 0, '>'], ['typeFlags', NPC_TYPEFLAG_HERBLOOT, '&']];