mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 10:49:23 +02:00
More robust spells.xml parsing
This commit is contained in:
parent
1de2c8c1d3
commit
4169b671da
52
spells.php
52
spells.php
@ -33,6 +33,11 @@ if (user_logged_in() && is_admin($user_data)) {
|
|||||||
//if (isset($attributes['id'])) unset($attributes['id']);
|
//if (isset($attributes['id'])) unset($attributes['id']);
|
||||||
//if (isset($attributes['conjureId'])) unset($attributes['conjureId']);
|
//if (isset($attributes['conjureId'])) unset($attributes['conjureId']);
|
||||||
if (isset($attributes['function'])) unset($attributes['function']);
|
if (isset($attributes['function'])) unset($attributes['function']);
|
||||||
|
|
||||||
|
// Alias attributes
|
||||||
|
if (isset($attributes['level'])) $attributes['lvl'] = $attributes['level'];
|
||||||
|
if (isset($attributes['magiclevel'])) $attributes['maglv'] = $attributes['magiclevel'];
|
||||||
|
|
||||||
// Populate type attributes
|
// Populate type attributes
|
||||||
foreach (array_keys($attributes) as $attr) {
|
foreach (array_keys($attributes) as $attr) {
|
||||||
if (!in_array($attr, $type_attr[$type]))
|
if (!in_array($attr, $type_attr[$type]))
|
||||||
@ -67,6 +72,7 @@ if (user_logged_in() && is_admin($user_data)) {
|
|||||||
$spells[$type][$name][$att] = (isset($attributes[$att])) ? $attributes[$att] : false;
|
$spells[$type][$name][$att] = (isset($attributes[$att])) ? $attributes[$att] : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the spell list properly
|
// Sort the spell list properly
|
||||||
foreach (array_keys($spells) as $type) {
|
foreach (array_keys($spells) as $type) {
|
||||||
usort($spells[$type], function ($a, $b) {
|
usort($spells[$type], function ($a, $b) {
|
||||||
@ -155,12 +161,16 @@ if ($spells) {
|
|||||||
<td><?php echo $spell['mana']; ?></td>
|
<td><?php echo $spell['mana']; ?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
if (!empty($spell['vocations'])) {
|
if (!empty($spell['vocations'])) {
|
||||||
$names = array();
|
if ($getVoc !== 'all') {
|
||||||
foreach ($spell['vocations'] as $id) {
|
echo $configVoc[$getVoc]['name'];
|
||||||
if (isset($configVoc[$id]))
|
} else {
|
||||||
$names[] = $configVoc[$id]['name'];
|
$names = array();
|
||||||
|
foreach ($spell['vocations'] as $id) {
|
||||||
|
if (isset($configVoc[$id]))
|
||||||
|
$names[] = $configVoc[$id]['name'];
|
||||||
|
}
|
||||||
|
echo implode(',<br>', $names);
|
||||||
}
|
}
|
||||||
echo implode(',<br>', $names);
|
|
||||||
}
|
}
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -187,12 +197,16 @@ if ($spells) {
|
|||||||
<td><img src="<?php echo $itemServer.$spell['id'].'.gif'; ?>" alt="Rune image"></td>
|
<td><img src="<?php echo $itemServer.$spell['id'].'.gif'; ?>" alt="Rune image"></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
if (!empty($spell['vocations'])) {
|
if (!empty($spell['vocations'])) {
|
||||||
$names = array();
|
if ($getVoc !== 'all') {
|
||||||
foreach ($spell['vocations'] as $id) {
|
echo $configVoc[$getVoc]['name'];
|
||||||
if (isset($configVoc[$id]))
|
} else {
|
||||||
$names[] = $configVoc[$id]['name'];
|
$names = array();
|
||||||
|
foreach ($spell['vocations'] as $id) {
|
||||||
|
if (isset($configVoc[$id]))
|
||||||
|
$names[] = $configVoc[$id]['name'];
|
||||||
|
}
|
||||||
|
echo implode(',<br>', $names);
|
||||||
}
|
}
|
||||||
echo implode(',<br>', $names);
|
|
||||||
}
|
}
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -200,6 +214,7 @@ if ($spells) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<?php if (isset($spells['conjure'])): ?>
|
||||||
<h2 id="spell_conjure">Conjure Spells</h2>
|
<h2 id="spell_conjure">Conjure Spells</h2>
|
||||||
<a href="#spells">Jump to top</a>
|
<a href="#spells">Jump to top</a>
|
||||||
<table class="table tbl-hover">
|
<table class="table tbl-hover">
|
||||||
@ -225,12 +240,16 @@ if ($spells) {
|
|||||||
<td><img src="<?php echo $itemServer.$spell['conjureId'].'.gif'; ?>" alt="Rune image"></td>
|
<td><img src="<?php echo $itemServer.$spell['conjureId'].'.gif'; ?>" alt="Rune image"></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
if (!empty($spell['vocations'])) {
|
if (!empty($spell['vocations'])) {
|
||||||
$names = array();
|
if ($getVoc !== 'all') {
|
||||||
foreach ($spell['vocations'] as $id) {
|
echo $configVoc[$getVoc]['name'];
|
||||||
if (isset($configVoc[$id]))
|
} else {
|
||||||
$names[] = $configVoc[$id]['name'];
|
$names = array();
|
||||||
|
foreach ($spell['vocations'] as $id) {
|
||||||
|
if (isset($configVoc[$id]))
|
||||||
|
$names[] = $configVoc[$id]['name'];
|
||||||
|
}
|
||||||
|
echo implode(',<br>', $names);
|
||||||
}
|
}
|
||||||
echo implode(',<br>', $names);
|
|
||||||
}
|
}
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -238,6 +257,7 @@ if ($spells) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<a href="#spells">Jump to top</a>
|
<a href="#spells">Jump to top</a>
|
||||||
|
<?php endif; ?>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
@ -252,6 +272,6 @@ foreach ($spells as $type => $spells) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All spell attributes?
|
// All spell attributes?
|
||||||
'group', 'words', 'lvl', 'maglv', 'charges', 'allowfaruse', 'blocktype', 'mana', 'soul', 'prem', 'aggressive', 'range', 'selftarget', 'needtarget', 'blockwalls', 'needweapon', 'exhaustion', 'groupcooldown', 'needlearn', 'casterTargetOrDirection', 'direction', 'params', 'playernameparam', 'conjureId', 'reagentId', 'conjureCount', 'vocations'
|
'group', 'words', 'lvl', 'level', 'maglv', 'magiclevel', 'charges', 'allowfaruse', 'blocktype', 'mana', 'soul', 'prem', 'aggressive', 'range', 'selftarget', 'needtarget', 'blockwalls', 'needweapon', 'exhaustion', 'groupcooldown', 'needlearn', 'casterTargetOrDirection', 'direction', 'params', 'playernameparam', 'conjureId', 'reagentId', 'conjureCount', 'vocations'
|
||||||
*/
|
*/
|
||||||
include 'layout/overall/footer.php'; ?>
|
include 'layout/overall/footer.php'; ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user