Dragon-Knight/templates/admin/edit_item.php

56 lines
2.5 KiB
PHP

<h2>Edit <?= $item['name'] ?></h2>
<form action="/admin/items/<?= $item['id'] ?>" method="post" hx-post="/admin/items/<?= $item['id'] ?>" hx-target="#main">
<table>
<tr><td width="20%">ID:</td><td><?= $item['id'] ?></td></tr>
<tr>
<td width="20%">Name:</td>
<td><input type="text" name="name" value="<?= $item['name'] ?>"></td>
</tr>
<tr>
<td width="20%">Type:</td>
<td><select name="type">
<option value="1" <?= $item['type'] === 1 ? 'selected' : '' ?>>Weapon</option>
<option value="2" <?= $item['type'] === 2 ? 'selected' : '' ?>>Armor</option>
<option value="3" <?= $item['type'] === 3 ? 'selected' : '' ?>>Shield</option>
</select></td>
</tr>
<tr>
<td width="20%">Cost:</td>
<td><input type="text" name="buycost" value="<?= $item['buycost'] ?>"> gold</td>
</tr>
<tr>
<td width="20%">Attribute:</td>
<td>
<input type="number" name="attribute" value="<?= $item['attribute'] ?>"><br>
<span class="small">How much the item adds to total attackpower (weapons) or defensepower (armor/shields).</span>
</td>
</tr>
<tr>
<td width="20%">Special:</td>
<td>
<input type="text" name="special" value="<?= $item['special'] ?>"><br>
<span class="small">Should be either a special code or <span class="highlight">X</span> to disable. Edit
this field very carefully because mistakes to formatting or field names can create problems in the game.</span>
</td>
</tr>
</table>
<button type="submit">Save</button>
<button type="reset">Reset</button>
</form>
<br>
<h3>Special Codes</h3>
Special codes can be added in the item's Special field to give it extra user attributes. Special codes are in the format <span class="highlight">attribute,value</span>. <span class="highlight">Attribute</span> can be any database field from the Users table - however, it is suggested that you only use the ones from the list below, otherwise things can get freaky. <span class="highlight">Value</span> may be any positive or negative whole number. For example, if you want a weapon to give an additional 50 max hit points, the special code would be <span class="highlight">maxhp,50</span>.<br><br>
Suggested user fields for special codes:<br>
maxhp - max hit points<br>
maxmp - max magic points<br>
maxtp - max travel points<br>
goldbonus - gold bonus, in percent<br>
expbonus - experience bonus, in percent<br>
strength - strength (which also adds to attackpower)<br>
dexterity - dexterity (which also adds to defensepower)<br>
attackpower - total attack power<br>
defensepower - total defense power