Code Monkey home page Code Monkey logo

tibia-outfitter's Introduction

tibia-outfitter

New Tibia Outfitter.php

Why?

I've refactored an existing lib (by Kamil Karkus, used by Gesior) to implement some new features like consistent image output and standardize all to 64x64 sprites (transform 32x32 to 64x64).

What's different?

  • Consistent Image Output: all arguments are optional, no exceptions. And all arguments have validations. It means it will never output an inexistent image. For example, if you pass an inexistent looktype to image, it will use our default (that is 128, male citizen, but you can change in options);
  • Configurable: when instantiate Outfit, first argument is an array with settings options. You can configure/change the queries and default values, also you can queriefy by setting "query" => true;
  • 32x32 to 64x64: all 32x32 images are automagically transformed in 64x64 before output. No more different sizes;
  • Colors are sexy: all colors from head, body, legs and feet can be setted by numbers (tibia default colors table), hex (#FFFFFF or FFFFFF) and presetted color names like "red", "magenta", and "flat-clouds" (all flatuicolors.com colors are available by "flat-" + colorname, like "flat-peterriver").

Outfits folder

In this repository have an outifts.zip with all outfits/creatures until 10.79 (thanks to gesior).

Usage

Direct Properties

With defaults:

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit();
$outfit->render();

Lets change looktype:

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit();
$outfit->looktype = 129;
$outfit->render();

Lets add addons, and see the sexy preset colors:

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit();
$outfit->looktype = 129;
$outfit->addons = 3;
$outfit->body = "red";
$outfit->render();

Now, with all properties:

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit();
$outfit->looktype = 130;
$outfit->direction = 2;
$outfit->movement = 3;
$outfit->addons = 3;
$outfit->mount = 450;
$outfit->head = "flat-emerald"; // preset color
$outfit->body = "#FF9900"; // css-like hex
$outfit->legs = "4FE7A9"; // hex
$outfit->feet = 4; // tibia color table
$outfit->render();

Enable properties by $_GET with queriefy()

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit();
$outfit->queriefy();
$outfit->render();

Queriefy enables properties set by $_GET with this params:
id (looktype), addons, movement, direction, mount, head, body, legs and feet.
Example: outfit.php?id=128&movement=2&direction=1

But, its a long query with long words. Fortunately you can change these query names by settings.

Settings

Auto Queriefy

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit(array('query' => true));
$outfit->render();

Queries

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit(array(
    'query' => true,
    'queries' => array(
        'mount' => 'foo'
    )
));
$outfit->render();

Defaults

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit(array(
    'query' => true,
    'defaults' => array(
        'body' => 'red',
        'mount' => 322,
        'direction' => 2 //right
    )
));
$outfit->render();

Adapting to gesior-style

My term for gesior-style means that query arguments are a, b, c, d, e etc. You will need to change queries and enable hexmount setting

<?php
include('Outfit.class.php');
header('Content-type: image/png');

$outfit = new Outfit(array(
    'query' => true,
    'hexmount' => true,
    'queries' => array(
        'looktype' => 'a',
        'addons' => 'b',
        'head' => 'c',
        'body' => 'd',
        'legs' => 'e',
        'feet' => 'f',
        'mount' => 'g',
        'direction' => 'h',
        'movement' => 'i'
    )
));
$outfit->render();

Now you can test
outfit.php?a=514&b=2&c=45&d=13&e=65&f=1&g=66083&&h=2&i=3


[Otland post][https://otland.net/threads/new-tibia-outfitter-php.239183/]

tibia-outfitter's People

Contributors

renatorib avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.