Template/Update (Part 29)

* convert dbtype 'npc'
This commit is contained in:
Sarjuuk
2025-08-11 22:58:16 +02:00
parent a824bb106c
commit f17b4f58bf
13 changed files with 848 additions and 667 deletions

View File

@@ -1,30 +1,24 @@
<?php namespace Aowow; ?>
<?php
if (isset($this->map) && empty($this->map)):
echo Lang::zone('noMap');
elseif (!empty($this->map['data'])):
if ($this->type == Type::QUEST) :
echo " <div id=\"mapper-zone-generic\"></div>\n";
elseif ($this->map['mapperData']):
echo ' <div>';
namespace Aowow\Template;
echo $this->map['foundIn'];
use \Aowow\Lang;
echo ' <span id="mapper-zone-generic">';
echo Lang::concat($this->map['mapperData'], true, function ($areaData, $areaId) {
return '<a href="javascript:;" onclick="myMapper.update({zone: '.$areaId.'}); g_setSelectedLink(this, \'mapper\'); return false" onmousedown="return false">'.$this->map['extra'][$areaId].'</a>&nbsp;('.array_sum(array_column($areaData, 'count')).')';
if ([$mapper, $mapperData, $som, $foundIn] = $this->map):
if ($foundIn):
echo ' <div>'.$foundIn[0].' <span id="mapper-zone-generic">';
echo Lang::concat($mapperData, true, function ($areaData, $areaId) use ($foundIn) {
return '<a href="javascript:;" onclick="myMapper.update({zone: '.$areaId.'}); g_setSelectedLink(this, \'mapper\'); return false" onmousedown="return false">'.$foundIn[$areaId].'</a>&nbsp;('.array_sum(array_column($areaData, 'count')).')';
});
echo ".</span></div>\n";
else:
echo " <div id=\"mapper-zone-generic\"></div>\n";
endif;
if (!empty($this->map['data']['zone']) && $this->map['data']['zone'] < 0):
if (isset($mapper['zone']) && $mapper['zone'] < 0):
?>
<div id="mapper" style="width: 778px; margin: 0 auto">
<?php
if (isset($this->map['som'])):
if ($som):
?>
<div id="som-generic"></div>
<?php
@@ -34,10 +28,8 @@ elseif (!empty($this->map['data'])):
<div class="pad clear"></div>
</div>
<?php
else:
?>
<?php
if (isset($this->map['som'])):
elseif ($mapper):
if ($som):
?>
<div class="pad"></div>
<div id="som-generic"></div>
@@ -47,48 +39,45 @@ elseif (!empty($this->map['data'])):
<div id="mapper-generic"></div>
<div style="clear: left"></div>
<?php
endif;
else:
?>
<script type="text/javascript">//<![CDATA[
<?=Lang::zone('noMap');?>
<div class="pad"></div>
<?php
if (!empty($this->map['data']['zone'])):
echo " ".(!empty($this->gPageInfo) ? "$.extend(g_pageInfo, {id: ".$this->map['data']['zone']."})" : "var g_pageInfo = {id: ".$this->map['data']['zone']."}").";\n";
elseif (isset($this->map['mapperData'])):
echo " var g_mapperData = ".Util::toJSON($this->map['mapperData'], empty($this->map['mapperData']) ? JSON_FORCE_OBJECT : 0).";\n";
endif;
// dont forget to set "parent: 'mapper-generic'"
echo " var myMapper = new Mapper(".Util::toJSON($this->map['data']).");\n";
if (isset($this->map['som'])):
echo " new ShowOnMap(".Util::toJSON($this->map['som']).");\n";
endif;
if ($this->type != Type::ZONE && $this->type != Type::QUEST):
echo " \$WH.gE(\$WH.ge('mapper-zone-generic'), 'a')[0].onclick();\n";
endif;
if (User::isIngroup(U_GROUP_MODERATOR)):
?>
<script type="text/javascript">//<![CDATA[
<?php if (isset($mapper['zone']) && $this->gPageInfo): ?>
$.extend(g_pageInfo, {id: <?=$mapper['zone'];?>});
<?php elseif (isset($mapper['zone'])): ?>
var g_pageInfo = {id: <?=$mapper['zone'];?>};
<?php elseif ($mapperData): ?>
var g_mapperData = <?=$this->json($mapperData);?>;
<?php endif; ?>
var myMapper = new Mapper(<?=$this->json($mapper);?>);
<?php if ($som): ?>
new ShowOnMap(<?=$this->json($som);?>);
<?php endif;
if ($foundIn): ?>
$WH.gE($WH.ge('mapper-zone-generic'), 'a')[0].onclick();
<?php endif;
if ($this->user::isInGroup(U_GROUP_MODERATOR)): ?>
function spawnposfix(type, typeguid, area, floor)
{
$.ajax({
type: 'GET',
url: '?admin=spawn-override',
data: { type: type, guid: typeguid, area : area, floor: floor, action: 1 },
data: { type: type, guid: typeguid, area : area, floor: floor },
dataType: 'json',
success: function (rsp) {
if (rsp > 0)
location.reload(true);
else if (rsp /* == x */)
if (rsp /* == x */)
alert('move failed. details tbd');
else
location.reload(true);
},
});
}
<?php
endif;
?>
<?php endif; ?>
//]]></script>
<?php endif; ?>

View File

@@ -1,7 +1,10 @@
<?php namespace Aowow; ?>
<?php
namespace Aowow\Template;
<?php $this->brick('header'); ?>
use \Aowow\Lang;
$this->brick('header');
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
@@ -17,49 +20,43 @@
<div class="text">
<?php $this->brick('redButtons'); ?>
<h1><?=$this->name.($this->subname ? ' &lt;'.$this->subname.'&gt;' : null); ?></h1>
<h1><?=$this->h1.($this->subname ? ' &lt;'.$this->subname.'&gt;' : ''); ?></h1>
<?php
$this->brick('article');
$this->brick('markup', ['markup' => $this->article]);
if ($this->accessory):
echo ' <div>'.Lang::npc('accessoryFor').' ';
echo Lang::concat($this->accessory, true, function ($v, $k) { return '<a href="?npc='.$v[0].'">'.$v[1].'</a>'; });
echo Lang::concat($this->accessory, true, fn ($v) => '<a href="?npc='.$v[0].'">'.$v[1].'</a>');
echo ".</div>\n";
endif;
if ($this->placeholder):
echo ' <div>'.Lang::npc('difficultyPH', $this->placeholder)."</div>\n";
?>
<div><?=Lang::npc('difficultyPH', $this->placeholder);?></div>
<div class="pad"></div>
<?php
elseif (!empty($this->map)):
elseif ($this->map):
$this->brick('mapper');
else:
echo ' '.Lang::npc('unkPosition')."\n";
endif;
if ($this->quotes[0]):
if ([$quoteGroups, $count] = $this->quotes):
?>
<h3><a class="disclosure-off" onclick="return g_disclose($WH.ge('quotes-generic'), this)"><?=Lang::npc('quotes').'&nbsp;('.$this->quotes[1]; ?>)</a></h3>
<h3><a class="disclosure-off" onclick="return g_disclose($WH.ge('quotes-generic'), this)"><?=Lang::npc('quotes', [$count]); ?></a></h3>
<div id="quotes-generic" style="display: none"><ul>
<?php
foreach ($this->quotes[0] as $group):
if (count($group) > 1 && count($this->quotes[0]) > 1):
foreach ($quoteGroups as $group):
if (count($group) > 1 && count($quoteGroups) > 1):
echo "<ul>\n";
endif;
echo '<li>';
$last = end($group);
foreach ($group as $itr):
echo sprintf(sprintf($itr['text'], $itr['prefix']), $this->name);
echo ($itr == $last) ? null : "</li>\n<li>";
echo '<li>'.sprintf($itr['text'], $this->h1)."</li>\n";
endforeach;
echo "</li>\n";
if (count($group) > 1 && count($this->quotes[0]) > 1):
if (count($group) > 1 && count($quoteGroups) > 1):
echo "</ul>\n";
endif;
@@ -75,21 +72,16 @@ if ($this->reputation):
<?php
echo Lang::npc('gainsDesc').Lang::main('colon');
foreach ($this->reputation as $set):
foreach ($this->reputation as [$mode, $data]):
if (count($this->reputation) > 1):
echo '<ul><li><span class="rep-difficulty">'.$set[0].'</span></li>';
echo '<ul><li><span class="rep-difficulty">'.$mode.'</span></li>';
endif;
echo '<ul>';
foreach ($set[1] as $itr):
if ($itr['qty'][1] && User::isInGroup(U_GROUP_EMPLOYEE))
$qty = intVal($itr['qty'][0]) . sprintf(Util::$dfnString, Lang::faction('customRewRate'), ($itr['qty'][1] > 0 ? '+' : '').intVal($itr['qty'][1]));
else
$qty = intVal(array_sum($itr['qty']));
echo '<li><div'.($itr['qty'][0] < 0 ? ' class="reputation-negative-amount"' : null).'><span>'.$qty.'</span> '.Lang::npc('repWith') .
' <a href="?faction='.$itr['id'].'">'.$itr['name'].'</a>'.($itr['cap'] && $itr['qty'][0] > 0 ? '&nbsp;('.sprintf(Lang::npc('stopsAt'), $itr['cap']).')' : null).'</div></li>';
foreach ($data as [$id, $qty, $name, $cap]):
echo '<li><div'.($qty[0] < 0 ? ' class="reputation-negative-amount"' : '').'><span>'.($qty[1] ?: $qty[0]).'</span> '.Lang::npc('repWith') .
' <a href="?faction='.$id.'">'.$name.'</a>'.($cap && $qty[0] > 0 ? '&nbsp;('.Lang::npc('stopsAt', [$cap]).')' : '').'</div></li>';
endforeach;
echo '</ul>';
@@ -100,25 +92,14 @@ if ($this->reputation):
endforeach;
endif;
if (isset($this->smartAI)):
?>
<div id="text-generic" class="left"></div>
<script type="text/javascript">//<![CDATA[
Markup.printHtml("<?=$this->smartAI; ?>", "text-generic", {
allow: Markup.CLASS_ADMIN,
dbpage: true
});
//]]></script>
$this->brick('markup', ['markup' => $this->smartAI]);
<div class="pad2"></div>
<?php
endif;
?>
<h2 class="clear"><?=Lang::main('related'); ?></h2>
</div>
<?php
$this->brick('lvTabs', ['relTabs' => true]);
$this->brick('lvTabs');
$this->brick('contribute');
?>

View File

@@ -1,10 +1,11 @@
<?php namespace Aowow; ?>
<?php
$this->brick('header');
$f = $this->filterObj->values // shorthand
?>
namespace Aowow\Template;
use \Aowow\Lang;
$this->brick('header');
$f = $this->filter->values; // shorthand
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
@@ -12,67 +13,62 @@ $f = $this->filterObj->values // shorthand
<?php
$this->brick('announcement');
$this->brick('pageTemplate', ['fiQuery' => $this->filterObj->query, 'fiMenuItem' => [4]]);
$this->brick('pageTemplate', ['fiQuery' => $this->filter->query, 'fiMenuItem' => [4]]);
?>
<div id="fi" style="display: <?=($this->filterObj->query ? 'block' : 'none'); ?>;">
<div id="fi" style="display: <?=($this->filter->query ? 'block' : 'none'); ?>;">
<form action="?filter=npcs<?=$this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="text">
<?php
$this->brick('headIcons');
$this->brick('redButtons');
?>
<h1><?=$this->h1; ?></h1>
</div>
<div class="rightpanel">
<div style="float: left"><?=Lang::npc('classification').Lang::main('colon'); ?></div>
<div style="float: left"><?=Lang::npc('classification', ['']); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['cl[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div>
<select name="cl[]" size="5" multiple="multiple" class="rightselect" style="width: 9.5em">
<?php
foreach (Lang::npc('rank') as $i => $str):
if ($str):
echo ' <option value="'.$i.'"'.(isset($f['cl']) && in_array($i, (array)$f['cl']) ? ' selected' : null).'>'.$str."</option>\n";
endif;
endforeach;
?>
<?=$this->makeOptionsList(Lang::npc('rank'), $f['cl'], 28); ?>
</select>
</div>
<?php if ($this->petFamPanel): ?>
<div class="rightpanel2">
<div style="float: left"><?=Lang::npc('petFamily').Lang::main('colon'); ?></div><small><a href="javascript:;" onclick="document.forms['fi'].elements['fa[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div style="float: left"><?=Lang::npc('petFamily'); ?></div><small><a href="javascript:;" onclick="document.forms['fi'].elements['fa[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div>
<select name="fa[]" size="7" multiple="multiple" class="rightselect">
<?php
foreach (Lang::game('fa') as $i => $str):
if ($str):
echo ' <option value="'.$i.'"'.(isset($f['fa']) && in_array($i, (array)$f['fa']) ? ' selected' : null).'>'.$str."</option>\n";
endif;
endforeach;
?>
<?=$this->makeOptionsList(Lang::game('fa'), $f['fa'], 28); ?>
</select>
</div>
<?php endif; ?>
<table>
<tr>
<td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td><?=$this->ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="2">
<table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="npc-ex" <?=(isset($f['ex']) ? 'checked="checked" ' : null); ?>/></td>
<td>&nbsp;<input type="text" name="na" size="30" <?=($f['na'] ? 'value="'.$this->escHTML($f['na']).'" ' : ''); ?>/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="npc-ex" <?=($f['ex'] ? 'checked="checked" ' : ''); ?>/></td>
<td><label for="npc-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendednpcsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?=Lang::main('extSearch'); ?></span></label></td>
</tr></table>
</td>
</tr><tr>
<td class="padded"><?=Lang::game('level').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?=(isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null); ?>/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?=(isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null); ?>/></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?=($f['minle'] ? 'value="'.$f['minle'].'" ' : ''); ?>/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?=($f['maxle'] ? 'value="'.$f['maxle'].'" ' : ''); ?>/></td>
<td class="padded" width="100%">
<table><tr>
<td>&nbsp;&nbsp;&nbsp;<?=Lang::npc('react').Lang::main('colon'); ?></td>
<td>&nbsp;<select name="ra" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?=(isset($f['ra']) ? ' class="q'.($f['ra'] == 1 ? '2' : ($f['ra'] == -1 ? '10' : null)).'"' : null); ?>>
<td>&nbsp;&nbsp;&nbsp;<?=Lang::npc('react', ['']); ?></td>
<td>&nbsp;<select name="ra" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?=($f['ra'] ? ' class="q'.($f['ra'] == 1 ? '2' : ($f['ra'] == -1 ? '10' : '')).'"' : ''); ?>>
<option></option>
<option value="1" class="q2"<?=(isset($f['ra']) && $f['ra'] == 1 ? ' selected' : null); ?>>A</option>
<option value="0" class="q"<?=(isset($f['ra']) && $f['ra'] == 0 ? ' selected' : null); ?>>A</option>
<option value="-1" class="q10"<?=(isset($f['ra']) && $f['ra'] == -1 ? ' selected' : null); ?>>A</option>
<option value="1" class="q2"<?=( $f['ra'] == 1 ? ' selected' : ''); ?>>A</option>
<option value="0" class="q"<?=( $f['ra'] == 0 ? ' selected' : ''); ?>>A</option>
<option value="-1" class="q10"<?=($f['ra'] == -1 ? ' selected' : ''); ?>>A</option>
</select>
<select name="rh" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?=(isset($f['rh']) ? ' class="q'.($f['rh'] == 1 ? '2' : ($f['rh'] == -1 ? '10' : null)).'"' : null); ?>>
<select name="rh" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?=($f['rh'] ? ' class="q'.($f['rh'] == 1 ? '2' : ($f['rh'] == -1 ? '10' : '')).'"' : ''); ?>>
<option></option>
<option value="1" class="q2"<?=(isset($f['rh']) && $f['rh'] == 1 ? ' selected' : null); ?>>H</option>
<option value="0" class="q"<?=(isset($f['rh']) && $f['rh'] == 0 ? ' selected' : null); ?>>H</option>
<option value="-1" class="q10"<?=(isset($f['rh']) && $f['rh'] == -1 ? ' selected' : null); ?>>H</option>
<option value="1" class="q2"<?=( $f['rh'] == 1 ? ' selected' : ''); ?>>H</option>
<option value="0" class="q"<?=( $f['rh'] == 0 ? ' selected' : ''); ?>>H</option>
<option value="-1" class="q10"<?=($f['rh'] == -1 ? ' selected' : ''); ?>>H</option>
</select>
</td>
</tr></table>
@@ -84,7 +80,7 @@ endforeach;
<div class="padded2 clear">
<div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
<?=Lang::main('match'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!$f['ma'] ? 'checked="checked" ' : ''); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=($f['ma'] ? 'checked="checked" ' : ''); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div>
<div class="clear"></div>
@@ -98,7 +94,7 @@ endforeach;
<div class="pad"></div>
</div>
<?php $this->brick('filter'); ?>
<?=$this->renderFilter(12); ?>
<?php $this->brick('lvTabs'); ?>