• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

PHP Item name in gesior

Wyat

New Member
Joined
Aug 30, 2015
Messages
36
Reaction score
0
Would anyone have the feature of showing the name of the item when leaving the mouse over it in the gesior? I was trying to find some post / github but I wasn't successful.

If anyone has a base for management, I would appreciate it.
 

Attachments

An idea of how you can get started on it.

PHP:
<?php
function idItemName($nr)
{
$pattern = [
    109=>"flowers",
    20620=>"Zaoan chess box",
    32414=>"falcon circlet",
    32415=>"falcon coif",
    32416=>"falcon rod",
    32417=>"falcon wand",
    32418=>"falcon bow",
    32419=>"falcon plate",
    38918=>"soulshredder",
    38919=>"soulbiter",
    38920=>"souleater",
    38921=>"soulcrusher",
    38922=>"soulmaimer",
    38923=>"soulbleeder",
    38924=>"soulpiercer",
    38925=>"soultainter",
    38926=>"soulhexer",
    38927=>"soulshanks",
    38928=>"soulstrider"
];

return array_key_exists($nr,$pattern) ? $pattern[$nr] : "No name record, please report it";
}

?>
 
An idea of how you can get started on it.

PHP:
<?php
function idItemName($nr)
{
$pattern = [
    109=>"flowers",
    20620=>"Zaoan chess box",
    32414=>"falcon circlet",
    32415=>"falcon coif",
    32416=>"falcon rod",
    32417=>"falcon wand",
    32418=>"falcon bow",
    32419=>"falcon plate",
    38918=>"soulshredder",
    38919=>"soulbiter",
    38920=>"souleater",
    38921=>"soulcrusher",
    38922=>"soulmaimer",
    38923=>"soulbleeder",
    38924=>"soulpiercer",
    38925=>"soultainter",
    38926=>"soulhexer",
    38927=>"soulshanks",
    38928=>"soulstrider"
];

return array_key_exists($nr,$pattern) ? $pattern[$nr] : "No name record, please report it";
}

?>
lol, do this for all the items in tibia, I'm curled up, lol but, great idea
 
You can check out this thing I did for znote:
And load the items the same way.
 
item list parser by @Znote

PHP:
<?php
/* Returns a PHP array $id => 'name'
     $items = getItemList();
     echo $items[2160]; // Returns 'Crystal Coin'
*/

function getItemList() {
    return parseItems();
}

function getItemById($id) {
    $items = parseItems();
    if(isset($items[$id])) {
        return $items[$id];
    }
    return false;
}

function parseItems() {
    $file = Config('server_path') . '/data/items/items.xml';
    if (file_exists($file)) {
        $itemList = array();
        $items = simplexml_load_file($file);
        // Create our parsed item list
        foreach ($items->children() as $item) {
            if ($item['id'] && $item['name'] != NULL) {
                $itemList[(int)$item['id']] = (string)$item['name'];
            }
        }
        return $itemList;
    }
    return $file;
}
?>
 
Be aware that Znote's approach isn't designed for loading items defined as fromid -> toid.
It shouldn't matter if you wan't to load only equipment but if you would like to load things such as monster loot this one wouldn't be the correct approach.
 
item list parser by @Znote

PHP:
<?php
/* Returns a PHP array $id => 'name'
     $items = getItemList();
     echo $items[2160]; // Returns 'Crystal Coin'
*/

function getItemList() {
    return parseItems();
}

function getItemById($id) {
    $items = parseItems();
    if(isset($items[$id])) {
        return $items[$id];
    }
    return false;
}

function parseItems() {
    $file = Config('server_path') . '/data/items/items.xml';
    if (file_exists($file)) {
        $itemList = array();
        $items = simplexml_load_file($file);
        // Create our parsed item list
        foreach ($items->children() as $item) {
            if ($item['id'] && $item['name'] != NULL) {
                $itemList[(int)$item['id']] = (string)$item['name'];
            }
        }
        return $itemList;
    }
    return $file;
}
?>
i have one mistake ... when i see the item name, if the name have a 'its cutting the name .. example: Ferumbras' hat .. if i see the name just showing Ferumbras
 
Last edited:
Back
Top