• 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!

Change item image in acc maker

Joined
Aug 15, 2013
Messages
11
Reaction score
4
Location
DBK
Hello everyone, I have problem.
I using Gesior2012-TFS-0.3.6, everything works well, but I don't know how can change item image. My acc maker takes pictures from http://item-images.ots.me/960/ but I have new items with new id. I mean to acc take picture from for example id 3341 and show it as other id.
I think this is somewhere here, but not sure. Regards :)
PHP:
<?php
if(!defined('INITIALIZED'))
    exit;

class ItemsList extends DatabaseList
{
    private $player_id = 0;

    public function __construct($player_id = 0)
    {
        parent::__construct('Item');
        if($player_id != 0)
        {
            $this->setFilter(new SQL_Filter(new SQL_Field('player_id', 'player_items'), SQL_Filter::EQUAL, $player_id));
            $this->setPlayerId($player_id);
        }
    }

    public function load()
    {
        $this->setClass('Item');
        parent::load();
        if(count($this->data) > 0)
        {
            $_new_items = array();
            $_new_data = array();
            foreach($this->data as $i => $item)
            {
                $_new_items[$i] = new Item($item);
                $_new_data[] = &$_new_items[$i];
            }
            $this->data = $_new_data;
        }
    }
    public function save($deleteCurrentItems = true)
    {
        if(!isset($this->data))
            $this->data = array();
        if($this->player_id != 0)
        {
            if($deleteCurrentItems)
                $this->getDatabaseHandler()->query('DELETE FROM ' . $this->getDatabaseHandler()->tableName('player_items') . ' WHERE ' . $this->getDatabaseHandler()->fieldName('player_id') . ' = ' . $this->getDatabaseHandler()->quote($this->getPlayerId()));

            if(count($this->data) > 0)
            {
                $keys = array();
                foreach($this->fields as $key)
                    $keys[] = $this->getDatabaseHandler()->fieldName($key);

                $query = 'INSERT INTO ' . $this->getDatabaseHandler()->tableName('player_items') . ' (' . implode(', ', $keys) . ') VALUES ';
                $items = array();
                foreach($this->data as $item)
                {
                    $fieldValues = array();
                    foreach($this->fields as $key)
                        if($key != 'player_id' || $this->player_id == 0)
                            $fieldValues[] = $this->getDatabaseHandler()->quote($item->data[$key]);
                        else
                            $fieldValues[] = $this->getDatabaseHandler()->quote($this->player_id);
                    $items[] = '(' . implode(', ', $fieldValues) . ')';
                }
                $this->getDatabaseHandler()->query($query . implode(', ', $items));
            }
        }
        else
            new Error_Critic('Cannot save ItemsList. Player ID not set.');
    }

    public function setPlayerId($value)
    {
        $this->player_id = $value;
    }

    public function getPlayerId()
    {
        return $this->player_id;
    }

    public function getSlot($slot)
    {
        if(!isset($this->data))
            $this->load();
        foreach($this->data as $i => $item)
            if($item->getPID() == $slot)
                return $item;

        return false;
    }

    public function getItem($pid, $sid = null)
    {
        if(!isset($this->data))
            $this->load();
        if($sid != null)
        {
            foreach($this->data as $item)
                if($item->getPID() == $pid && $item->getSID() == $sid)
                    return $item;
            return false;
        }
        else
        {
            $items = array();
            foreach($this->data as $item)
                if($item->getPID() == $pid)
                    $items[$item->getSID()] = $item;
            return $items;
        }
    }
}
 
You can save the image to a folder in your server and then if the item has that id you can tell it to use a different path:

if itemID == 3341 then
--- use this folder path www.yourwebsiteaddress/path/to/your/new_images/
else
--- use this http://item-images.ots.me/960/
end

If you have more you can create an array in your config file and just edit the pages where it's calling item images to call it from X folder if it is in the array of newItems or just use the Y (default -gesior) folder if it's not in the array.

OR

You can host your own item images and just paste the new image over the old id in your folder. (This is what I do)
The tutorial for hosting your own is here:
https://otland.net/threads/gesior2012-item-images-installation-update.170659/#post-1652092
 
Back
Top