mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Custom/UiEscapes
* so, apparently the client allows ui escape sequences in the weirdest of places. Guess i have to follow suit. * also, the sequences can be multiline * also also, the file extension for icons is optional
This commit is contained in:
@@ -73,7 +73,7 @@ class GameObjectList extends BaseType
|
||||
{
|
||||
$data[$this->id] = array(
|
||||
'id' => $this->id,
|
||||
'name' => $this->getField('name', true),
|
||||
'name' => Lang::unescapeUISequences($this->getField('name', true), Lang::FMT_RAW),
|
||||
'type' => $this->curTpl['typeCat'],
|
||||
'location' => $this->getSpawns(SPAWNINFO_ZONES)
|
||||
);
|
||||
@@ -95,7 +95,7 @@ class GameObjectList extends BaseType
|
||||
return array();
|
||||
|
||||
$x = '<table>';
|
||||
$x .= '<tr><td><b class="q">'.$this->getField('name', true).'</b></td></tr>';
|
||||
$x .= '<tr><td><b class="q">'.Lang::unescapeUISequences($this->getField('name', true), Lang::FMT_HTML).'</b></td></tr>';
|
||||
if ($this->curTpl['typeCat'])
|
||||
if ($_ = Lang::gameObject('type', $this->curTpl['typeCat']))
|
||||
$x .= '<tr><td>'.$_.'</td></tr>';
|
||||
@@ -115,7 +115,7 @@ class GameObjectList extends BaseType
|
||||
$data = [];
|
||||
|
||||
foreach ($this->iterate() as $__)
|
||||
$data[Type::OBJECT][$this->id] = ['name' => $this->getField('name', true)];
|
||||
$data[Type::OBJECT][$this->id] = ['name' => Lang::unescapeUISequences($this->getField('name', true), Lang::FMT_RAW)];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ class ItemList extends BaseType
|
||||
$data[$this->id][$k] = $v;
|
||||
|
||||
// json vs listview quirk
|
||||
$data[$this->id]['name'] = $data[$this->id]['quality'].$this->getField('name', true);
|
||||
$data[$this->id]['name'] = $data[$this->id]['quality'].Lang::unescapeUISequences($this->getField('name', true), Lang::FMT_RAW);
|
||||
unset($data[$this->id]['quality']);
|
||||
|
||||
if (!empty($this->relEnchant) && $this->curTpl['randomEnchant'])
|
||||
@@ -465,7 +465,7 @@ class ItemList extends BaseType
|
||||
if ($addMask & GLOBALINFO_SELF)
|
||||
{
|
||||
$data[Type::ITEM][$id] = array(
|
||||
'name' => $this->getField('name', true),
|
||||
'name' => Lang::unescapeUISequences($this->getField('name', true), Lang::FMT_RAW),
|
||||
'quality' => $this->curTpl['quality'],
|
||||
'icon' => $this->curTpl['iconString']
|
||||
);
|
||||
@@ -509,7 +509,7 @@ class ItemList extends BaseType
|
||||
if ($this->error)
|
||||
return;
|
||||
|
||||
$_name = $this->getField('name', true);
|
||||
$_name = Lang::unescapeUISequences($this->getField('name', true), Lang::FMT_HTML);
|
||||
$_reqLvl = $this->curTpl['requiredLevel'];
|
||||
$_quality = $this->curTpl['quality'];
|
||||
$_flags = $this->curTpl['flags'];
|
||||
@@ -1155,7 +1155,7 @@ class ItemList extends BaseType
|
||||
|
||||
// funny, yellow text at the bottom, omit if we have a recipe
|
||||
if ($this->curTpl['description_loc0'] && !$this->canTeachSpell())
|
||||
$xMisc[] = '<span class="q">"'.$this->getField('description', true).'"</span>';
|
||||
$xMisc[] = '<span class="q">"'.Util::parseHtmlText($this->getField('description', true), false).'"</span>';
|
||||
|
||||
// readable
|
||||
if ($this->curTpl['pageTextId'])
|
||||
|
||||
@@ -211,7 +211,7 @@ class QuestList extends BaseType
|
||||
'id' => $this->id,
|
||||
'level' => $this->curTpl['level'],
|
||||
'reqlevel' => $this->curTpl['minLevel'],
|
||||
'name' => $this->getField('name', true),
|
||||
'name' => Lang::unescapeUISequences($this->getField('name', true), Lang::FMT_RAW),
|
||||
'side' => Game::sideByRaceMask($this->curTpl['reqRaceMask']),
|
||||
'wflags' => 0x0,
|
||||
'xp' => $this->curTpl['rewardXP']
|
||||
@@ -316,7 +316,7 @@ class QuestList extends BaseType
|
||||
if (!$this->curTpl)
|
||||
return null;
|
||||
|
||||
$title = Util::htmlEscape($this->getField('name', true));
|
||||
$title = Lang::unescapeUISequences(Util::htmlEscape($this->getField('name', true)), Lang::FMT_HTML);
|
||||
$level = $this->curTpl['level'];
|
||||
if ($level < 0)
|
||||
$level = 0;
|
||||
@@ -351,7 +351,7 @@ class QuestList extends BaseType
|
||||
if ($ot)
|
||||
$name = $ot;
|
||||
else
|
||||
$name = $rng > 0 ? CreatureList::getName($rng) : GameObjectList::getName(-$rng);
|
||||
$name = $rng > 0 ? CreatureList::getName($rng) : Lang::unescapeUISequences(GameObjectList::getName(-$rng), Lang::FMT_HTML);
|
||||
|
||||
$xReq .= '<br /> - '.$name.($rngQty > 1 ? ' x '.$rngQty : null);
|
||||
}
|
||||
@@ -364,7 +364,7 @@ class QuestList extends BaseType
|
||||
if (!$ri || $riQty < 1)
|
||||
continue;
|
||||
|
||||
$xReq .= '<br /> - '.ItemList::getName($ri).($riQty > 1 ? ' x '.$riQty : null);
|
||||
$xReq .= '<br /> - '.Lang::unescapeUISequences(ItemList::getName($ri), Lang::FMT_HTML).($riQty > 1 ? ' x '.$riQty : null);
|
||||
}
|
||||
|
||||
if ($et = $this->getField('end', true))
|
||||
|
||||
@@ -638,7 +638,7 @@ class Lang
|
||||
} , $var);
|
||||
|
||||
// color |c<aarrggbb><word>|r
|
||||
$var = preg_replace_callback('/\|c([[:xdigit:]]{2})([[:xdigit:]]{6})(.+?)\|r/i', function ($m) use ($fmt)
|
||||
$var = preg_replace_callback('/\|c([[:xdigit:]]{2})([[:xdigit:]]{6})(.+?)\|r/is', function ($m) use ($fmt)
|
||||
{
|
||||
[$_, $a, $rgb, $text] = $m;
|
||||
|
||||
@@ -656,7 +656,7 @@ class Lang
|
||||
}, $var);
|
||||
|
||||
// icon |T<imgPath+File.blp>:0:0:0:-1|t
|
||||
$var = preg_replace_callback('/\|T([\w]+\\\)*([^\.]+)\.[bB][lL][pP]:([^\|]+)\|t/', function ($m) use ($fmt)
|
||||
$var = preg_replace_callback('/\|T([\w]+\\\)*([^\.:]+)(?:\.[bB][lL][pP])?:([^\|]+)\|t/', function ($m) use ($fmt)
|
||||
{
|
||||
/* iconParam - size1, size2, xoffset, yoffset
|
||||
size1 == 0; size2 omitted: Width = Height = TextHeight (always square!)
|
||||
@@ -682,7 +682,7 @@ class Lang
|
||||
}, $var);
|
||||
|
||||
// hyperlink |H<hyperlinkStruct>|h<name>|h
|
||||
$var = preg_replace_callback('/\|H([^:]+):([^\|]+)\|h([^\|]+)\|h/', function ($m) use ($fmt)
|
||||
$var = preg_replace_callback('/\|H([^:]+):([^\|]+)\|h([^\|]+)\|h/i', function ($m) use ($fmt)
|
||||
{
|
||||
/* type Params
|
||||
|Hchannel channelName, channelname == CHANNEL ? channelNr : null
|
||||
@@ -740,7 +740,7 @@ class Lang
|
||||
}, $var);
|
||||
|
||||
// |1 - digit singular/plural <number> |1<singular;<plural>;
|
||||
$var = preg_replace_callback('/(\d+)\s*\|1([^;]+);([^;]+);/i', function ($m)
|
||||
$var = preg_replace_callback('/(\d+)\s*\|1([^;]+);([^;]+);/is', function ($m)
|
||||
{
|
||||
[$_, $num, $singular, $plural] = $m;
|
||||
|
||||
@@ -793,7 +793,7 @@ class Lang
|
||||
}, $var);
|
||||
|
||||
// |4 - numeric switch <number> |4<singular>:<plural>[:<plural2>];
|
||||
$var = preg_replace_callback('/([\d\.\,]+)([^\d]*)\|4([^:]*):([^:;]+)(?::([^;]+))?;/i', function ($m)
|
||||
$var = preg_replace_callback('/([\d\.\,]+)([^\d]*)\|4([^:]*):([^:;]+)(?::([^;]+))?;/is', function ($m)
|
||||
{
|
||||
[$_, $num, $pad, $singular, $plural1, $plural2] = array_pad($m, 6, null);
|
||||
|
||||
|
||||
@@ -236,13 +236,17 @@ class AchievementPage extends GenericPage
|
||||
['id', $this->typeId, '!']
|
||||
);
|
||||
$saList = new AchievementList($conditions);
|
||||
if (!$saList->error)
|
||||
{
|
||||
$this->extendGlobalData($saList->getJSGlobals());
|
||||
|
||||
$this->lvTabs[] = [AchievementList::$brickFile, array(
|
||||
'data' => array_values($saList->getListviewData()),
|
||||
'id' => 'see-also',
|
||||
'name' => '$LANG.tab_seealso',
|
||||
'visibleCols' => ['category']
|
||||
)];
|
||||
$this->extendGlobalData($saList->getJSGlobals());
|
||||
}
|
||||
|
||||
// tab: criteria of
|
||||
$refs = DB::Aowow()->SelectCol('SELECT refAchievementId FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d',
|
||||
|
||||
@@ -74,7 +74,7 @@ class ItemPage extends genericPage
|
||||
if (!is_numeric($param))
|
||||
$this->typeId = $this->subject->id;
|
||||
|
||||
$this->name = $this->subject->getField('name', true);
|
||||
$this->name = Lang::unescapeUISequences($this->subject->getField('name', true), Lang::FMT_HTML);
|
||||
|
||||
if ($this->mode == CACHE_TYPE_PAGE)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ class ItemPage extends genericPage
|
||||
|
||||
protected function generateTitle()
|
||||
{
|
||||
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::game('item')));
|
||||
array_unshift($this->title, Lang::unescapeUISequences($this->subject->getField('name', true), Lang::FMT_RAW), Util::ucFirst(Lang::game('item')));
|
||||
}
|
||||
|
||||
protected function generateContent()
|
||||
@@ -365,7 +365,7 @@ class ItemPage extends genericPage
|
||||
BUTTON_LINKS => array(
|
||||
'linkColor' => 'ff'.Game::$rarityColorStings[$this->subject->getField('quality')],
|
||||
'linkId' => 'item:'.$this->typeId.':0:0:0:0:0:0:0:0',
|
||||
'linkName' => $this->name,
|
||||
'linkName' => Lang::unescapeUISequences($this->subject->getField('name', true), Lang::FMT_RAW),
|
||||
'type' => $this->type,
|
||||
'typeId' => $this->typeId
|
||||
)
|
||||
@@ -1030,7 +1030,7 @@ class ItemPage extends genericPage
|
||||
$power = new StdClass();
|
||||
if (!$this->subject->error)
|
||||
{
|
||||
$power->{'name_'.User::$localeString} = $this->subject->getField('name', true, false, $this->enhancedTT);
|
||||
$power->{'name_'.User::$localeString} = Lang::unescapeUISequences($this->subject->getField('name', true, false, $this->enhancedTT), Lang::FMT_RAW);
|
||||
$power->quality = $this->subject->getField('quality');
|
||||
$power->icon = rawurlencode($this->subject->getField('iconString', true, true));
|
||||
$power->{'tooltip_'.User::$localeString} = $this->subject->renderTooltip(false, 0, $this->enhancedTT);
|
||||
|
||||
@@ -36,7 +36,7 @@ class ObjectPage extends GenericPage
|
||||
if ($this->subject->error)
|
||||
$this->notFound(Lang::game('object'), Lang::gameObject('notFound'));
|
||||
|
||||
$this->name = $this->subject->getField('name', true);
|
||||
$this->name = Lang::unescapeUISequences($this->subject->getField('name', true), Lang::FMT_HTML);
|
||||
}
|
||||
|
||||
protected function generatePath()
|
||||
@@ -46,7 +46,7 @@ class ObjectPage extends GenericPage
|
||||
|
||||
protected function generateTitle()
|
||||
{
|
||||
array_unshift($this->title, $this->name, Util::ucFirst(Lang::game('object')));
|
||||
array_unshift($this->title, Lang::unescapeUISequences($this->subject->getField('name', true), Lang::FMT_RAW), Util::ucFirst(Lang::game('object')));
|
||||
}
|
||||
|
||||
protected function generateContent()
|
||||
@@ -250,14 +250,14 @@ class ObjectPage extends GenericPage
|
||||
$sai = null;
|
||||
if ($this->subject->getField('ScriptOrAI') == 'SmartGameObjectAI')
|
||||
{
|
||||
$sai = new SmartAI(SAI_SRC_TYPE_OBJECT, $this->typeId, ['name' => $this->name]);
|
||||
$sai = new SmartAI(SAI_SRC_TYPE_OBJECT, $this->typeId, ['name' => $this->subject->getField('name', true)]);
|
||||
if (!$sai->prepare()) // no smartAI found .. check per guid
|
||||
{
|
||||
// at least one of many
|
||||
$guids = DB::World()->selectCol('SELECT guid FROM gameobject WHERE id = ?d LIMIT 1', $this->typeId);
|
||||
while ($_ = array_pop($guids))
|
||||
{
|
||||
$sai = new SmartAI(SAI_SRC_TYPE_OBJECT, -$_, ['name' => $this->name, 'title' => ' [small](for GUID: '.$_.')[/small]']);
|
||||
$sai = new SmartAI(SAI_SRC_TYPE_OBJECT, -$_, ['name' => $this->subject->getField('name', true), 'title' => ' [small](for GUID: '.$_.')[/small]']);
|
||||
if ($sai->prepare())
|
||||
break;
|
||||
}
|
||||
@@ -499,7 +499,7 @@ class ObjectPage extends GenericPage
|
||||
$power = new StdClass();
|
||||
if (!$this->subject->error)
|
||||
{
|
||||
$power->{'name_'.User::$localeString} = $this->subject->getField('name', true);
|
||||
$power->{'name_'.User::$localeString} = Lang::unescapeUISequences($this->subject->getField('name', true), Lang::FMT_RAW);
|
||||
$power->{'tooltip_'.User::$localeString} = $this->subject->renderTooltip();
|
||||
$power->map = $this->subject->getSpawns(SPAWNINFO_SHORT);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class QuestPage extends GenericPage
|
||||
$this->notFound(Lang::game('quest'), Lang::quest('notFound'));
|
||||
|
||||
// may contain htmlesque tags
|
||||
$this->name = Util::htmlEscape($this->subject->getField('name', true));
|
||||
$this->name = Lang::unescapeUISequences(Util::htmlEscape($this->subject->getField('name', true)), Lang::FMT_HTML);
|
||||
}
|
||||
|
||||
protected function generatePath()
|
||||
@@ -57,7 +57,7 @@ class QuestPage extends GenericPage
|
||||
protected function generateTitle()
|
||||
{
|
||||
// page title already escaped
|
||||
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::game('quest')));
|
||||
array_unshift($this->title, Lang::unescapeUISequences($this->subject->getField('name', true), Lang::FMT_RAW), Util::ucFirst(Lang::game('quest')));
|
||||
}
|
||||
|
||||
protected function generateContent()
|
||||
@@ -265,7 +265,7 @@ class QuestPage extends GenericPage
|
||||
'side' => $_side,
|
||||
'typeStr' => Type::getFileString(Type::QUEST),
|
||||
'typeId' => $this->typeId,
|
||||
'name' => $this->name,
|
||||
'name' => Util::htmlEscape($this->subject->getField('name', true)),
|
||||
'_next' => $this->subject->getField('nextQuestIdChain')
|
||||
)
|
||||
)
|
||||
@@ -410,7 +410,7 @@ class QuestPage extends GenericPage
|
||||
$this->objectiveList[] = array(
|
||||
'typeStr' => Type::getFileString(Type::ITEM),
|
||||
'id' => $itemId,
|
||||
'name' => $olItemData->json[$itemId]['name'],
|
||||
'name' => Lang::unescapeUISequences($olItemData->json[$itemId]['name'], Lang::FMT_HTML),
|
||||
'qty' => $qty > 1 ? $qty : 0,
|
||||
'quality' => 7 - $olItemData->json[$itemId]['quality'],
|
||||
'extraText' => $provided ? ' ('.Lang::quest('provided').')' : ''
|
||||
@@ -422,7 +422,7 @@ class QuestPage extends GenericPage
|
||||
{
|
||||
$this->providedItem = array(
|
||||
'id' => $olItems[0][0],
|
||||
'name' => $olItemData->json[$olItems[0][0]]['name'],
|
||||
'name' => Lang::unescapeUISequences($olItemData->json[$olItems[0][0]]['name'], Lang::FMT_HTML),
|
||||
'qty' => $olItems[0][1] > 1 ? $olItems[0][1] : 0,
|
||||
'quality' => 7 - $olItemData->json[$olItems[0][0]]['quality']
|
||||
);
|
||||
@@ -494,7 +494,7 @@ class QuestPage extends GenericPage
|
||||
$this->objectiveList[] = array(
|
||||
'typeStr' => Type::getFileString(Type::OBJECT),
|
||||
'id' => $i,
|
||||
'name' => $pair[1] ?: Util::localizedString($olGOData->getEntry($i), 'name'),
|
||||
'name' => $pair[1] ?: Lang::unescapeUISequences(Util::localizedString($olGOData->getEntry($i), 'name'), Lang::FMT_HTML),
|
||||
'qty' => $pair[0] > 1 ? $pair[0] : 0,
|
||||
'extraText' => ''
|
||||
);
|
||||
@@ -932,7 +932,7 @@ class QuestPage extends GenericPage
|
||||
BUTTON_LINKS => array(
|
||||
'linkColor' => 'ffffff00',
|
||||
'linkId' => 'quest:'.$this->typeId.':'.$_level,
|
||||
'linkName' => $this->name,
|
||||
'linkName' => Util::htmlEscape($this->subject->getField('name', true)),
|
||||
'type' => $this->type,
|
||||
'typeId' => $this->typeId
|
||||
)
|
||||
@@ -959,7 +959,7 @@ class QuestPage extends GenericPage
|
||||
/**************/
|
||||
|
||||
// tab: see also
|
||||
$seeAlso = new QuestList(array(['name_loc'.User::$localeId, '%'.$this->name.'%'], ['id', $this->typeId, '!']));
|
||||
$seeAlso = new QuestList(array(['name_loc'.User::$localeId, '%'.Util::htmlEscape($this->subject->getField('name', true)).'%'], ['id', $this->typeId, '!']));
|
||||
if (!$seeAlso->error)
|
||||
{
|
||||
$this->extendGlobalData($seeAlso->getJSGlobals());
|
||||
@@ -1051,7 +1051,7 @@ class QuestPage extends GenericPage
|
||||
$power = new StdClass();
|
||||
if (!$this->subject->error)
|
||||
{
|
||||
$power->{'name_'.User::$localeString} = $this->subject->getField('name', true);
|
||||
$power->{'name_'.User::$localeString} = Lang::unescapeUISequences($this->subject->getField('name', true), Lang::FMT_RAW);
|
||||
$power->{'tooltip_'.User::$localeString} = $this->subject->renderTooltip();
|
||||
if ($this->subject->isDaily())
|
||||
$power->daily = 1;
|
||||
@@ -1112,7 +1112,7 @@ class QuestPage extends GenericPage
|
||||
$rewards['items'][] = array(
|
||||
'typeStr' => Type::getFileString(Type::ITEM),
|
||||
'id' => $id,
|
||||
'name' => $rewItems->getField('name', true),
|
||||
'name' => Lang::unescapeUISequences($rewItems->getField('name', true), Lang::FMT_HTML),
|
||||
'quality' => $rewItems->getField('quality'),
|
||||
'qty' => $ri[$id],
|
||||
'globalStr' => Type::getJSGlobalString(Type::ITEM)
|
||||
|
||||
Reference in New Issue
Block a user