本文整理汇总了PHP中Lang::npc方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::npc方法的具体用法?PHP Lang::npc怎么用?PHP Lang::npc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::npc方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateTitle
protected function generateTitle()
{
array_unshift($this->title, $this->name);
if ($this->category) {
array_unshift($this->title, Lang::npc('cat', $this->category[0]));
}
}
示例2: renderTooltip
public function renderTooltip()
{
if (!$this->curTpl) {
return null;
}
$level = '??';
$type = $this->curTpl['type'];
$row3 = [Lang::game('level')];
$fam = $this->curTpl['family'];
if (!($this->curTpl['typeFlags'] & 0x4)) {
$level = $this->curTpl['minLevel'];
if ($level != $this->curTpl['maxLevel']) {
$level .= ' - ' . $this->curTpl['maxLevel'];
}
} else {
$level = '??';
}
$row3[] = $level;
if ($type) {
$row3[] = Lang::game('ct', $type);
}
if ($_ = Lang::npc('rank', $this->curTpl['rank'])) {
$row3[] = '(' . $_ . ')';
}
$x = '<table>';
$x .= '<tr><td><b class="q">' . $this->getField('name', true) . '</b></td></tr>';
if ($sn = $this->getField('subname', true)) {
$x .= '<tr><td>' . $sn . '</td></tr>';
}
$x .= '<tr><td>' . implode(' ', $row3) . '</td></tr>';
if ($type == 1 && $fam) {
// 1: Beast
$x .= '<tr><td>' . Lang::game('fa', $fam) . '</td></tr>';
}
$fac = new FactionList(array([['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], ['id', (int) $this->getField('factionId')]));
if (!$fac->error) {
$x .= '<tr><td>' . $fac->getField('name', true) . '</td></tr>';
}
$x .= '</table>';
return $x;
}
示例3: isset
</tr><tr>
<td class="padded"><?php
echo Lang::game('level') . Lang::main('colon');
?>
</td>
<td class="padded"> <input type="text" name="minle" maxlength="2" class="smalltextbox" <?php
echo isset($f['minle']) ? 'value="' . $f['minle'] . '" ' : null;
?>
/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?php
echo isset($f['maxle']) ? 'value="' . $f['maxle'] . '" ' : null;
?>
/></td>
<td class="padded" width="100%">
<table><tr>
<td> <?php
echo Lang::npc('react') . Lang::main('colon');
?>
</td>
<td> <select name="ra" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?php
echo isset($f['ra']) ? ' class="q' . ($f['ra'] == 1 ? '2' : ($f['ra'] == -1 ? '10' : null)) . '"' : null;
?>
>
<option></option>
<option value="1" class="q2"<?php
echo isset($f['ra']) && $f['ra'] == 1 ? ' selected' : null;
?>
>A</option>
<option value="0" class="q"<?php
echo isset($f['ra']) && $f['ra'] == 0 ? ' selected' : null;
?>
>A</option>
示例4: 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]';
//.........这里部分代码省略.........
示例5: createFullSpawns
private function createFullSpawns()
{
$data = [];
$wpSum = [];
$wpIdx = 0;
$spawns = DB::Aowow()->select("SELECT * FROM ?_spawns WHERE type = ?d AND typeId = ?d", self::$type, $this->id);
if (!$spawns) {
return;
}
foreach ($spawns as $s) {
// check, if we can attach waypoints to creature
// we will get a nice clusterfuck of dots if we do this for more GUIDs, than we have colors though
if (count($spawns) < 6 && self::$type == TYPE_NPC) {
if ($wPoints = DB::Aowow()->select('SELECT * FROM ?_creature_waypoints WHERE creatureOrPath = ?d AND floor = ?d', $s['pathId'] ? -$s['pathId'] : $this->id, $s['floor'])) {
foreach ($wPoints as $i => $p) {
$label = [Lang::npc('waypoint') . Lang::main('colon') . $p['point']];
if ($p['wait']) {
$label[] = Lang::npc('wait') . Lang::main('colon') . Util::formatTime($p['wait'], false);
}
$set = ['label' => '$<br><span class="q0">' . implode('<br>', $label) . '</span>', 'type' => $wpIdx];
// connective line
if ($i > 0) {
$set['lines'] = [[$wPoints[$i - 1]['posX'], $wPoints[$i - 1]['posY']]];
}
$data[$s['areaId']][$s['floor']]['coords'][] = [$p['posX'], $p['posY'], $set];
if (empty($wpSum[$s['areaId']][$s['floor']])) {
$wpSum[$s['areaId']][$s['floor']] = 1;
} else {
$wpSum[$s['areaId']][$s['floor']]++;
}
}
$wpIdx++;
}
}
$label = [];
if (User::isInGroup(U_GROUP_STAFF)) {
$label[] = $s['guid'] < 0 ? 'Vehicle Accessory' : 'GUID' . Lang::main('colon') . $s['guid'];
}
if ($s['respawn']) {
$label[] = Lang::npc('respawnIn') . Lang::main('colon') . Util::formatTime($s['respawn'] * 1000, false);
}
if (User::isInGroup(U_GROUP_STAFF)) {
if ($s['phaseMask'] > 1 && ($s['phaseMask'] & 0xffff) != 0xffff) {
$label[] = Lang::game('phases') . Lang::main('colon') . Util::asHex($s['phaseMask']);
}
if ($s['spawnMask'] == 15) {
$label[] = Lang::game('mode') . Lang::main('colon') . Lang::game('modes', -1);
} else {
if ($s['spawnMask']) {
$_ = [];
for ($i = 0; $i < 4; $i++) {
if ($s['spawnMask'] & 1 << $i) {
$_[] = Lang::game('modes', $i);
}
}
$label[] = Lang::game('mode') . Lang::main('colon') . implode(', ', $_);
}
}
}
$data[$s['areaId']][$s['floor']]['coords'][] = [$s['posX'], $s['posY'], ['label' => '$<br><span class="q0">' . implode('<br>', $label) . '</span>']];
}
foreach ($data as $a => &$areas) {
foreach ($areas as $f => &$floor) {
$floor['count'] = count($floor['coords']) - (!empty($wpSum[$a][$f]) ? $wpSum[$a][$f] : 0);
}
}
$this->spawnResult[SPAWNINFO_FULL] = $data;
}
示例6: getOnKillRep
private function getOnKillRep($dummyIds, $mapType)
{
$spilledParents = [];
$reputation = [];
// base NPC
if ($base = $this->getRepForId($this->typeId, $spilledParents)) {
$reputation[] = [Lang::npc('modes', 1, 0), $base];
}
// difficulty dummys
if ($dummyIds && ($mapType == 1 || $mapType == 2)) {
$alt = [];
$rep = $this->getRepForId(array_keys($dummyIds), $spilledParents);
// order by difficulty
foreach ($rep as $r) {
$alt[$dummyIds[$r['npc']]][] = $r;
}
// apply by difficulty
foreach ($alt as $mode => $dat) {
$reputation[] = [Lang::npc('modes', $mapType, $mode), $dat];
}
}
// get spillover factions and apply
if ($spilledParents) {
$spilled = new FactionList(array(['parentFactionId', array_keys($spilledParents)]));
foreach ($reputation as &$sets) {
foreach ($sets[1] as &$row) {
if (empty($row['spillover'])) {
continue;
}
foreach ($spilled->iterate() as $spId => $__) {
// find parent
if ($spilled->getField('parentFactionId') != $row['spillover']) {
continue;
}
// don't readd parent
if ($row['id'] == $spId) {
continue;
}
$spMax = $spilledParents[$row['spillover']][1];
$sets[1][] = array('id' => $spId, 'qty' => $spilledParents[$row['spillover']][0], 'name' => $spilled->getField('name', true), 'cap' => $spMax && $spMax < REP_EXALTED ? Lang::game('rep', $spMax) : null);
}
}
}
}
return $reputation;
}
示例7: elseif
<?php
if (isset($this->map) && empty($this->map)) {
echo Lang::zone('noMap');
} elseif (!empty($this->map['data'])) {
if ($this->type != TYPE_ZONE) {
echo ' <div>' . ($this->type == TYPE_OBJECT ? Lang::gameObject('foundIn') : Lang::npc('foundIn')) . ' <span id="locations">';
$n = count($this->map['mapperData']);
$i = 0;
foreach ($this->map['mapperData'] as $areaId => $areaData) {
if ($n > 1 && $i++ > 0) {
echo $i < $n ? ', ' : Lang::main('and');
}
echo '<a href="javascript:;" onclick="myMapper.update({zone: ' . $areaId . '}); g_setSelectedLink(this, \'mapper\'); return false" onmousedown="return false">' . $this->map['extra'][$areaId] . '</a> (' . reset($areaData)['count'] . ')';
}
echo ".</span></div>\n";
}
if (!empty($this->map['data']['zone']) && $this->map['data']['zone'] < 0) {
?>
<div id="mapper" style="width: 778px; margin: 0 auto">
<?php
if (isset($this->map['som'])) {
?>
<div id="som-generic"></div>
<?php
}
?>
<div id="mapper-generic"></div>
<div class="pad clear"></div>
</div>
<?php
示例8: generateContent
protected function generateContent()
{
$this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
/***********/
/* Infobox */
/***********/
$this->infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// boss
if ($_ = $this->subject->getField('bossCreature')) {
$this->extendGlobalIds(TYPE_NPC, $_);
$this->infobox[] = Lang::npc('rank', 3) . Lang::main('colon') . '[npc=' . $_ . ']';
}
// display internal id to staff
if (User::isInGroup(U_GROUP_STAFF)) {
$this->infobox[] = 'Event-Id' . Lang::main('colon') . $this->eId;
}
/****************/
/* Main Content */
/****************/
// no entry in ?_articles? use default HolidayDescription
if ($this->hId && empty($this->article)) {
$this->article = ['text' => Util::jsEscape($this->subject->getField('description', true)), 'params' => []];
}
$this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array(BUTTON_WOWHEAD => $this->hId > 0, BUTTON_LINKS => true);
/**************/
/* Extra Tabs */
/**************/
$hasFilter = in_array($this->hId, [372, 283, 285, 353, 420, 400, 284, 201, 374, 409, 141, 324, 321, 424, 335, 327, 341, 181, 404, 398, 301]);
// tab: npcs
if ($npcIds = DB::World()->selectCol('SELECT id AS ARRAY_KEY, IF(ec.eventEntry > 0, 1, 0) AS added FROM creature c, game_event_creature ec WHERE ec.guid = c.guid AND ABS(ec.eventEntry) = ?d', $this->eId)) {
$creatures = new CreatureList(array(['id', array_keys($npcIds)]));
if (!$creatures->error) {
$data = $creatures->getListviewData();
foreach ($data as &$d) {
$d['method'] = $npcIds[$d['id']];
}
$tabData = ['data' => array_values($data)];
if ($hasFilter) {
$tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=38;crs=' . $this->hId . ';crv=0');
}
$this->lvTabs[] = ['creature', $tabData];
}
}
// tab: objects
if ($objectIds = DB::World()->selectCol('SELECT id AS ARRAY_KEY, IF(eg.eventEntry > 0, 1, 0) AS added FROM gameobject g, game_event_gameobject eg WHERE eg.guid = g.guid AND ABS(eg.eventEntry) = ?d', $this->eId)) {
$objects = new GameObjectList(array(['id', array_keys($objectIds)]));
if (!$objects->error) {
$data = $objects->getListviewData();
foreach ($data as &$d) {
$d['method'] = $objectIds[$d['id']];
}
$tabData = ['data' => array_values($data)];
if ($hasFilter) {
$tabData['note'] = sprintf(Util::$filterResultString, '?objects&filter=cr=16;crs=' . $this->hId . ';crv=0');
}
$this->lvTabs[] = ['object', $tabData];
}
}
// tab: achievements
if ($_ = $this->subject->getField('achievementCatOrId')) {
$condition = $_ > 0 ? [['category', $_]] : [['id', -$_]];
$acvs = new AchievementList($condition);
if (!$acvs->error) {
$this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$tabData = array('data' => array_values($acvs->getListviewData()), 'visibleCols' => ['category']);
if ($hasFilter) {
$tabData['note'] = sprintf(Util::$filterResultString, '?achievements&filter=cr=11;crs=' . $this->hId . ';crv=0');
}
$this->lvTabs[] = ['achievement', $tabData];
}
}
$itemCnd = [];
if ($this->hId) {
$itemCnd = array('OR', ['eventId', $this->eId]);
// tab: quests (by table, go & creature)
$quests = new QuestList(array(['eventId', $this->eId]));
if (!$quests->error) {
$this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$tabData = ['data' => array_values($quests->getListviewData())];
if ($hasFilter) {
$tabData['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=33;crs=' . $this->hId . ';crv=0');
}
$this->lvTabs[] = ['quest', $tabData];
$questItems = [];
foreach (array_column($quests->rewards, TYPE_ITEM) as $arr) {
$questItems = array_merge($questItems, $arr);
}
foreach (array_column($quests->requires, TYPE_ITEM) as $arr) {
$questItems = array_merge($questItems, $arr);
}
if ($questItems) {
$itemCnd[] = ['id', $questItems];
}
}
}
// items from creature
if ($npcIds && !$creatures->error) {
// vendor
$cIds = $creatures->getFoundIDs();
//.........这里部分代码省略.........
示例9: foreach
}
if ($this->reputation) {
?>
<h3><?php
echo Lang::main('gains');
?>
</h3>
<?php
echo Lang::npc('gainsDesc') . Lang::main('colon');
foreach ($this->reputation as $set) {
if (count($this->reputation) > 1) {
echo '<ul><li><span class="rep-difficulty">' . $set[0] . '</span></li>';
}
echo '<ul>';
foreach ($set[1] as $itr) {
echo '<li><div' . ($itr['qty'] < 0 ? ' class="reputation-negative-amount"' : null) . '><span>' . $itr['qty'] . '</span> ' . Lang::npc('repWith') . ' <a href="?faction=' . $itr['id'] . '">' . $itr['name'] . '</a>' . ($itr['cap'] && $itr['qty'] > 0 ? ' (' . sprintf(Lang::npc('stopsAt'), $itr['cap']) . ')' : null) . '</div></li>';
}
echo '</ul>';
if (count($this->reputation) > 1) {
echo '</ul>';
}
}
}
?>
<h2 class="clear"><?php
echo Lang::main('related');
?>
</h2>
</div>
<?php
示例10: empty
}
$addData = ['rewards' => !empty($r['items']) ? $r['items'] : null, 'offset' => $offset, 'extra' => !empty($r['money']) ? $r['money'] : null];
$addData['rewTitle'] = empty($r['choice']) ? Lang::quest('receiveItems') : Lang::quest('receiveAlso');
$this->brick('rewards', $addData);
}
}
if ($g = $this->gains) {
echo ' <h3>' . Lang::main('gains') . "</h3>\n";
echo ' ' . Lang::quest('gainsDesc') . Lang::main('colon') . "\n";
echo " <ul>\n";
if (!empty($g['xp'])) {
echo ' <li><div>' . number_format($g['xp']) . ' ' . Lang::quest('experience') . "</div></li>\n";
}
if (!empty($g['rep'])) {
foreach ($g['rep'] as $r) {
echo ' <li><div>' . ($r['qty'] < 0 ? '<b class="q10">' . $r['qty'] . '</b>' : $r['qty']) . ' ' . Lang::npc('repWith') . ' <a href="?faction=' . $r['id'] . '">' . $r['name'] . "</a></div></li>\n";
}
}
if (!empty($g['title'])) {
echo ' <li><div>' . sprintf(Lang::quest('theTitle'), $g['title']) . "</div></li>\n";
}
if (!empty($g['tp'])) {
echo ' <li><div>' . $g['tp'] . ' ' . Lang::quest('bonusTalents') . "</div></li>\n";
}
echo " </ul>\n";
}
$this->brick('mail');
if (!empty($this->transfer)) {
echo " <div class=\"pad\"></div>\n " . $this->transfer . "\n";
}
?>