GithubHelp home page GithubHelp logo

open-tibia's Introduction

Open Tibia Framework


Loading versions from a xml file

XML format sample

<versions>
    <version value="1079" description="Client 10.79" dat="3A71" spr="557A5E34" otb="56" />
</versions>

Code

// path to the versions xml file.
string path = @"versions.xml";

// creates a VersionStorage instance.
OpenTibia.Core.VersionStorage versions = new OpenTibia.Core.VersionStorage();

// loads the xml
versions.Load(path);

// gets a version from the storage by the signatures.
OpenTibia.Core.Version version = versions.GetBySignatures(0x3A71, 0x557A5E34);

// gets all versions 10.79
System.Collections.Generic.List<OpenTibia.Core.Version> result = versions.GetByVersionValue(1079);

// adds a new version.
versions.AddVersion(new OpenTibia.Core.Version(1078, "Client 10.78", 0x39CC, 0x554C7373, 56));

// replaces a version by the signatures.
versions.ReplaceVersion(new OpenTibia.Core.Version(1078, "My description 10.78", 0x39CC, 0x554C7373, 56), 0x39CC, 0x554C7373);

// removes a version by the signatures.
versions.RemoveVersion(0x39CC, 0x554C7373);

// saves the xml.
versions.Save();

Loading and compiling a SPR file

// creates a Version 10.79.
OpenTibia.Core.Version version = new OpenTibia.Core.Version(1079, "Client 10.79", 0x3A71, 0x557A5E34, 0);

// the path to the spr file.
string path = @"C:\Clients\10.79\Tibia.spr";

// loads the spr file.
OpenTibia.Client.Sprites.SpriteStorage sprites = OpenTibia.Client.Sprites.SpriteStorage.Load(path, version);

// gets a sprite from the storage
OpenTibia.Client.Sprites.Sprite sprite = sprites.GetSprite(100);

// adding a sprite.
sprites.AddSprite(new OpenTibia.Client.Sprites.Sprite());

// replacing a sprite.
sprites.ReplaceSprite(new OpenTibia.Client.Sprites.Sprite(), 12);

// removing a sprite.
sprites.RemoveSprite(10);

// compiles the spr file.
sprites.Save();

Loading and displaying sprites

// Assuming that you have a SpriteListBox named 'spriteListBox' in the form.

// creates a Version 10.79.
OpenTibia.Core.Version version = new OpenTibia.Core.Version(1079, "Client 10.79", 0x3A71, 0x557A5E34, 0);

// the path to the spr file.
string path = @"C:\Clients\10.79\Tibia.spr";

// loads the spr file.
OpenTibia.Client.Sprites.SpriteStorage sprites = OpenTibia.Client.Sprites.SpriteStorage.Load(path, version);

// gets 100 sprites from the storage and displays in the SpriteListBox
OpenTibia.Client.Sprites.Sprite[] list = new OpenTibia.Client.Sprites.Sprite[100];

for (uint i = 0; i < list.Length; i++)
{
    list[i] = sprites.GetSprite(i);
}

this.spriteListBox.AddRange(list);

SpriteListBox control

A control to display a list of sprites.

SpriteListBox

EightBitColorGrid control

A control that displays minimap and light colors.

EightBitColorGrid

HsiColorGrid control

A control that displays outfit colors.

HsiColorGrid

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.