So I've been working on a new project. I've named it JAPI (Josh's API).
Current functions / features:
ReaderClass:
- Client Finder - getFirstClient(), getClientById(int ProcessID), getClients()
- Read Memory - ReadInt32(UInt32 Address, uint length = 4), ReadString(UInt32 Address), ReadInt16(UInt32 Address), ReadInt64(UInt32 Address), ReadByte(UInt32 Address), ReadDouble(UInt32 Address), ReadBytes(UInt32 Address)
- Read Individual Values: Hp(), MaxHp(), Mp(), MaxMp(), Soul(), X(), Y(), Z(), Cid(), Exp()
- Read Group Values: GetPlayerInfo() returns Objects.Player() with .Hp, .MaxHp, .Mp, .MaxMp, .Soul, .X, .Y, .Z, .Cid, .Exp
- Reads Name from Battle List: getMyName() returns string containing name.
- Reads Battle List: BlGet() returns Battle list, for structures see Objects.BList.
ControlWindow:
- Send left/right click - LeftClick(int x, int y), RightClick(int x, int y)
- Sends a string - SendKeys(string Message)
- Finds a suitable hotkey from string - getHotKey(string Key) e.g getHotKey("F12") returns the keycode for F12 in UInt32 form.
- Finds a suitable arrow key from string - getArrowKey(string Key) e.g getArrowKey("down") returns the keycode for down arrow in UInt32 form.
- SendArrow(string Key) - Sends a keydown/keyup event to Tibia, for the entered key... E.g: SendArrow("down") will send down arrow key to Tibia.
- SendHotkey(string Key) - Sends a hotkey event to Tibia, for the entered key... E.g: SendHotkey("F12") will send F12 hotkey to Tibia, works only for F1-F12, must be capital F.
Objects:
- World structure, incomplete, but contains a list of structures for BList, Player, Minimap, GUI - This will be used in UpdateWorld() once it's complete, to automatically update everything at once.
- GUI Structure, incomplete, will contain all GUI shit, so you can store X, Y positions of GUI elements in Tibia.
- Minimap structure, incomplete, will contain minimap shit, so you can store all minimap data.
- BList structure, contains BList structure items, see Objects.cs for list of variables available at the minute.
- Player structure, contains HP, HPMax, MP, MPMax, Soul, Cid, X, Y, Z, Exp.
- HealRule structure, contains int MinHp, int MaxHp, int Mana, string Hotkey for heal rules, see example use in Form1.cs.
Addresses:
- Character info addresses, with an address for each element of the player data structure.
- BListAddresses, with an address for each element of the BList structure.
- MapAddresses, which is still empty since I haven't studied map reading for a while.
I've been kinda busy putting all this together and grown a little tired of it, also hit a mental barrier, I can't seem to process much more at the minute due to lack of concentration. If anyone can find any use for it all of the code is available here, at googlecode. It is completely open source and anyone is free to use it as they wish.
Also, I know I've called it an API when it has a GUI, and I realise the implications of this, but bare in mind that the plan is for it to be an API eventually, once I've finished it off and done with my testing. The current GUI contains a few tabs, each with a few controls in, I don't think the healer works, but everything else should (except the walker, obviously to anyone who bothers to look and see that there are no buttons for it). Some pictures are attached below, they are the 4 tab windows I've made, and they contain pretty much nothing of use. They do, however, demonstrate how you can use the API as intended.
Use:
I always got confused by TibiaAPI, and so I've made this work a little differently, you must declare a new instance of the Reader and ControlWindow classes, but not the Objects classes, e.g:
ReaderClass Read = new ReaderClass();
ControlWindow Ctrl = new ControlWindow();
Then you can call my functions by doing:
textBox1.Text = Read.Hp();
or something like that. There are plenty of examples of how to extract the data with it, and if you know A* search algorithm and how to read the minimap, you may well be at the start of making your own bot.
I will keep updating as I can, though it will be infrequent.
Regards,
Josh
More pictures: http://tpforums.org/forum/threads/56...ll=1#post51337
Updated images: