-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
<?php | ||
if (!defined('FLUX_ROOT')) exit; | ||
|
||
require_once 'Flux/TemporaryTable.php'; | ||
|
||
// change this to your packetver | ||
// values stolen from rathena, so if it doesnt work you might need to change it | ||
$packetver = 20200724; | ||
|
||
if ($packetver >= 20200724) { | ||
$cardsep = ')'; | ||
$optsep = '+'; | ||
$optparamsep = ','; | ||
$optvalsep = '-'; | ||
} else if ($packetver >= 20161116) { | ||
$cardsep = '('; | ||
$optsep = '*'; | ||
$optparamsep = '+'; | ||
$optvalsep = ','; | ||
} | ||
|
||
|
||
$itemlink = $params->get('itemlink'); | ||
|
||
$itemlink_len = strlen($itemlink); | ||
|
||
// get substring 5 characters | ||
$ret = $this->parseBase62Until($itemlink, 0, 5); | ||
$equip = $ret[0]; | ||
$idx = $ret[1]; | ||
|
||
$isequip = substr($itemlink, 5, 1); | ||
|
||
$idx = 6; | ||
|
||
// nameid | ||
$ret = $this->parseBase62Until($itemlink, $idx); | ||
$nameid = $ret[0]; | ||
$idx = $ret[1]; | ||
|
||
if ($server->isRenewal) { | ||
$fromTables = array("{$server->charMapDatabase}.item_db_re", "{$server->charMapDatabase}.item_db2_re"); | ||
} else { | ||
$fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); | ||
} | ||
$tableName = "{$server->charMapDatabase}.items"; | ||
$tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); | ||
$itemDescTable = Flux::config('FluxTables.ItemDescTable'); | ||
|
||
$sql = "SELECT items.id AS item_id, name_english AS name, slots "; | ||
|
||
if (Flux::config('ShowItemDesc')) { | ||
$sql .= ', itemdesc '; | ||
} | ||
|
||
$sql .= "FROM {$server->charMapDatabase}.items "; | ||
if (Flux::config('ShowItemDesc')) { | ||
$sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.$itemDescTable ON $itemDescTable.itemid = items.id "; | ||
} | ||
$sql .= "WHERE items.id = ? LIMIT 1"; | ||
|
||
$sth = $server->connection->getStatement($sql); | ||
$sth->execute(array($nameid)); | ||
|
||
$item = $sth->fetch(); | ||
|
||
if (!$item) { | ||
return; | ||
} | ||
|
||
$title = "Viewing Item Link for ($item->name)"; | ||
|
||
|
||
// refines | ||
if ($itemlink[$idx] == '%') { | ||
$idx++; | ||
$ret = $this->parseBase62Until($itemlink, $idx); | ||
$refine = $ret[0]; | ||
$idx = $ret[1]; | ||
} else { | ||
$refine = 0; | ||
} | ||
|
||
// view | ||
if ($itemlink[$idx] == '&') { | ||
$idx++; | ||
$ret = $this->parseBase62Until($itemlink, $idx); | ||
$view = $ret[0]; | ||
$idx = $ret[1]; | ||
} else { | ||
$view = 0; | ||
} | ||
|
||
// enchantgrade | ||
if ($itemlink[$idx] == '\'') { | ||
$idx++; | ||
$ret = $this->parseBase62Until($itemlink, $idx); | ||
$enchantgrade = $ret[0]; | ||
$idx = $ret[1]; | ||
} else { | ||
$enchantgrade = 0; | ||
} | ||
|
||
// cards | ||
$cards = []; | ||
while ($idx < $itemlink_len && $itemlink[$idx] == $cardsep) { | ||
$idx++; | ||
$ret = $this->parseBase62Until($itemlink, $idx); | ||
|
||
$sth = $server->connection->getStatement($sql); | ||
$sth->execute(array($ret[0])); | ||
$card = $sth->fetch(); | ||
$cards[] = $card; | ||
|
||
$idx = $ret[1]; | ||
} | ||
|
||
// options | ||
$options = []; | ||
while ($idx < $itemlink_len && $itemlink[$idx] == $optsep) { | ||
$option = []; | ||
$idx++; | ||
$ret = $this->parseBase62Until($itemlink, $idx); | ||
$option['opt'] = $ret[0]; | ||
$idx = $ret[1]; | ||
if ($itemlink[$idx] != $optparamsep) { | ||
break; | ||
} | ||
$idx++; | ||
$ret = $this->parseBase62Until($itemlink, $idx); | ||
$option['param'] = $ret[0]; | ||
$idx = $ret[1]; | ||
if ($itemlink[$idx] != $optvalsep) { | ||
break; | ||
} | ||
$idx++; | ||
$ret = $this->parseBase62Until($itemlink, $idx); | ||
$option['val'] = $ret[0]; | ||
$idx = $ret[1]; | ||
array_push($options, $option); | ||
} | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php if (!defined('FLUX_ROOT')) exit; ?> | ||
|
||
<?php if ($item): ?> | ||
<?php $icon = $this->iconImage($nameid); ?> | ||
<?php $image = $this->itemImage($nameid) ?> | ||
|
||
<table class="vertical-table"> | ||
<tr> | ||
<th colspan="<?php echo $image && $icon ? 1 : (($image || $icon) ? 2 : 3) ?>"> Item </th> | ||
<?php if ($icon): ?> | ||
<th><img src="<?php echo $icon ?>" /></td> | ||
<?php endif ?> | ||
<?php if ($image): ?> | ||
<td rowspan="<?php echo $isequip ? 4 : 3 ?>" style="width: 150px; text-align: center; vertical-alignment: middle"> | ||
<img src="<?php echo $image ?>" /> | ||
</td> | ||
<?php endif ?> | ||
</tr> | ||
<tr> | ||
<th> Name </th> | ||
<td> | ||
<?php $itemname = $item->name . ($isequip ? " [$item->slots]" : "") ?> | ||
<?php echo $this->linkToItem($nameid, $itemname) ?> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th> Item ID </th> | ||
<td> <?php echo htmlspecialchars($nameid) ?> </td> | ||
</tr> | ||
<tr> | ||
<th> Refine </th> | ||
<td> +<?php echo htmlspecialchars($refine) ?> </td> | ||
</tr> | ||
<?php if (Flux::config('ShowItemDesc')):?> | ||
<tr> | ||
<th> Description </th> | ||
<td> <?php echo htmlspecialchars($item->itemdesc) ?> </td> | ||
</tr> | ||
<?php endif ?> | ||
<?php if ($isequip): ?> | ||
<tr> | ||
<th colspan="<?php echo $image ? 4 : 3 ?>"> Slots </th> | ||
</tr> | ||
<?php foreach(range(1, 4) as $i): ?> | ||
<tr> | ||
<th> Slot <?php echo $i ?> </th> | ||
<?php if (count($cards) >= $i && $cards[$i - 1]): ?> | ||
<td class="display:flex, align-items: center; justify-content: center"><img src="<?php echo $this->iconImage($cards[$i - 1]->item_id) ?>" /></td> | ||
<td colspan="<?php echo $image ? 4 : 3 ?>"> | ||
<?php echo $this->linkToItem($cards[$i - 1]->item_id, $cards[$i - 1]->name) ?> | ||
</td> | ||
<?php elseif ($item->slots >= $i): ?> | ||
<td class="display:flex, align-items: center; justify-content: center"><img src="<?php echo $this->themePath('itemlink/emptysocket.png') ?>" /></td> | ||
<td><span class="not-applicable">Empty</span></td> | ||
<?php else: ?> | ||
<td class="display:flex, align-items: center; justify-content: center"><img src="<?php echo $this->themePath('itemlink/nosocket.png') ?>" /></td> | ||
<td><span class="not-applicable">None</span></td> | ||
<?php endif ?> | ||
<?php endforeach ?> | ||
<?php if (count($options) > 0): ?> | ||
<tr> | ||
<th colspan="<?php echo $image ? 4 : 3 ?>"> Options </th> | ||
</tr> | ||
<?php foreach(range(1, 5) as $i): ?> | ||
<?php if (count($options) >= $i && $options[$i - 1]): ?><tr> | ||
<td colspan="<?php echo $image ? 4 : 3 ?>"> | ||
<?php echo htmlspecialchars($this->itemRandOption($options[$i - 1]['opt'], $options[$i - 1]['val'])) ?> | ||
</td> | ||
</tr> | ||
<?php endif ?> | ||
<?php endforeach ?> | ||
<?php endif ?> | ||
<?php endif ?> | ||
</table> | ||
|
||
<?php else: ?> | ||
<p>Item not found</p> | ||
<?php endif ?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.