Tibia 11 Discussion(+Tutorial how to able to use it)

Yamaken

Pro OpenTibia Developer
Premium User
Joined
Jul 27, 2013
Messages
457
Reaction score
326
First of all i wanted a thread to the community be able to discuss about what we should do about how things are changing in Tibia and how it will affect OpenTibia. Another thing i want to bring into that discussion is about how the community is only relying in few great developers to do anything.

Now the tutorial of how to make it work:

First thing, the login server/webservice. You need to change the loginWebService url:

Open Tibia 11 install folder, go into packages/Tibia/bin and open client.exe with notepad++, search for the text "loginWebService=". You will find a ini file text inside the exe file and you will need to change the loginWebService url.

From this:


Into this:



Don't forget to add few "NUL" in the end of the ini text if your webservice url is of a different text length than the original url.(its like changing the ips in the old client).

Now the server will request the character list from our webservice. Me and @ATT3 have made a hack php script to make our accounts works with tfs 1.0+, be aware it does not test for passwords in the script.

http://pastebin.com/3fkeXV9Y

Save this script as login.php inside the main htdocs/www folder.

Now you should get the character list.




Now the last thing, changing from Tibia Public RSA Key into OpenTibia Public RSA Key. Search for this text with notepad++ in the client.exe:

BC27F992A96B8E2A43F4DFBE1CEF8FD51CF43D2803EE34FBBD8634D8B4FA32F7D9D9E159978DD29156D62F4153E9C5914263FC4986797E12245C1A6C4531EFE48A6F7C2EFFFFF18F2C9E1C504031F3E4A2C788EE96618FFFCEC2C3E5BFAFAF743B3FC7A872EE60A52C29AA688BDAF8692305312882F1F66EE9D8AEB7F84B1949
And change it into this:

9B646903B45B07AC956568D87353BD7165139DD7940703B03E6DD079399661B4A837AA60561D7CCB9452FA0080594909882AB5BCA58A1A1B35F8B1059B72B1212611C6152AD3DBB3CFBEE7ADC142A75D3D75971509C321C5C24A5BD51FD460F01B4E15BEB0DE1930528A5D3F15C1E3CBF5C401D6777E10ACAAB33DBE8D5B7FF5
Now you will be able to login with the beta QT tibia client! Just run client.exe and input your account/password. You will need a tfs 1.0+ with support for 10.90/10.92(just edit definitions.h to accept 1092 version).

Already made client(just save it inside the bin folder): http://www.mediafire.com/download/lamj395ia0itpoo/client2.7z


Hope you guys will enjoy the new client.

@Mark @HalfAway @Codex NG @Techrlz @Printer
 
Last edited:

Techrlz

System Manager & Programmer
Premium User
Joined
Feb 20, 2014
Messages
1,063
Reaction score
156

Tuts

¯\_(ツ)_/¯
Joined
May 2, 2016
Messages
49
Reaction score
22
Congrats to you guys for your work!
 

MartyX

I'm renewing
Joined
Jun 6, 2007
Messages
1,218
Reaction score
149
Location
El Grullo
pastebin no load ... upload to other site or paste code here
 

Cornex

Web Developer
Staff member
Global Moderator
Joined
Jun 15, 2008
Messages
3,447
Reaction score
1,051
Location
Sweden
pastebin no load ... upload to other site or paste code here
Pastebin do loads.
PHP:
<?php
//really ugly script, feel free to release a better one :)
// be aware that we don't even test the password in this script
$host = "localhost";
$user = "root";
$passwd = "";
$db = "tfs10";

$lnk = mysql_connect("$host", "$user", "$passwd") or die ('ERROR MySql: ' . mysql_error());
mysql_select_db("$db", $lnk) or die ('ERROR MySql: ' . mysql_error());   

$request_body = file_get_contents('php://input');
$result = json_decode($request_body, true);

$acc = $result["accountname"];
$password = $result["password"];

$dbResource = mysql_query("SELECT `id` FROM `accounts` WHERE `name` = '$acc' LIMIT 1;");

if(!$dbResource) {
    die("failed to get account.");
}

$dbRet = mysql_fetch_array($dbResource);

$accId = $dbRet[0];

$dbResource = mysql_query("SELECT `name` FROM `players` WHERE `account_id` = '$accId';");
if(!$dbResource) {
    die("failed to get charactters.");
}

$accArray = array();

while ($dbRet = mysql_fetch_array($dbResource, MYSQL_BOTH)) {
    $dict = array("worldid" => 0, "name" => $dbRet["name"]);
    $accArray[] = $dict;
}

$data = array();

$session = array(
    "sessionkey" => $acc . "\n" . $password,
    "lastlogintime" => 1461290246,
    "ispremium" => true,
    "premiumuntil" => 1463788913,
    "status" => "active"   
);

$data["session"] = $session;

$playerData = array();

$world = array(
    "id" => 0,
    "name" => "servername",
    "externaladdress" => "127.0.0.1",
    "externalport" => 7172,
    "previewstate" => 0
);

$worlds = array($world);
$playerData["worlds"] = $worlds;
$playerData["characters"] = $accArray;

$data["playdata"] = $playerData;

echo json_encode($data);


//echo '{   "session": {     "sessionkey": "DhZUxAPjDFQqwCy65z2JQKB145750y",     "lastlogintime": 1461290246,     "ispremium": true,     "premiumuntil": 1463788913,     "status": "active"   },   "playdata": {     "worlds": [       {         "id": 0,         "name": "Amera",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       },       {         "id": 1,         "name": "Chrona",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       },       {         "id": 2,         "name": "Eldera",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       }     ],     "characters": [       {         "worldid": 0,         "name": "Paladin"       },       {         "worldid": 1,         "name": "Sorcerer"       },       {         "worldid": 2,         "name": "Druid"       }     ]   },   "survey": {     "id": 759822,     "invitationtext": "Dear Tibian! A few days ago, you have received an email invitation to join the Beta phase of Tibia 11. We\'d love to hear about your experiences with client version 11.0 so please help us with your feedback by completing this survey.",     "invitationtoken": "9ILillainoj7CsWxxoCRgOqSnGtt3L",     "endtimestamp": 1461535200   } }';

/*
example json
{
  "session": {
    "sessionkey": "DhZUxAPjDFQqwCy65z2JQKB145750y",
    "lastlogintime": 1461290246,
    "ispremium": true,
    "premiumuntil": 1463788913,
    "status": "active"
  },
  "playdata": {
    //an array/list of worlds and theirs data
    "worlds": [
      {
        "id": 0,
        "name": "Amera",
        "externaladdress": "66.150.54.19",
        "externalport": 7171,
        "previewstate": 0
      },
      {
        "id": 1,
        "name": "Chrona",
        "externaladdress": "193.200.156.112",
        "externalport": 7171,
        "previewstate": 0
      },
      {
        "id": 2,
        "name": "Eldera",
        "externaladdress": "66.150.54.94",
        "externalport": 7171,
        "previewstate": 0
      }
    ],
    "characters": [
      {
        "worldid": 0,
        "name": "Paladin"
      },
      {
        "worldid": 1,
        "name": "Sorcerer"
      },
      {
        "worldid": 2,
        "name": "Druid"
      }
    ]
  },
  //i believe this can just be removed, not needed
  "survey": {
    "id": 759822,
    "invitationtext": "Dear Tibian! A few days ago, you have received an email invitation to join the Beta phase of Tibia 11. We'd love to hear about your experiences with client version 11.0 so please help us with your feedback by completing this survey.",
    "invitationtoken": "9ILillainoj7CsWxxoCRgOqSnGtt3L",
    "endtimestamp": 1461535200
  }
}
*/
?>
 

Mkalo

ボーカロイド
Joined
Jun 1, 2011
Messages
1,118
Reaction score
887
Location
Japan
Shouldn't you escape the info in that query? It's easy to use SQL Injection the way this PHP was done.
 
OP
Yamaken

Yamaken

Pro OpenTibia Developer
Premium User
Joined
Jul 27, 2013
Messages
457
Reaction score
326
Shouldn't you escape the info in that query? It's easy to use SQL Injection the way this PHP was done.
Its a hack script only meant to make it work, if someone wants to use this in production of course it should be remade.
 
OP
Yamaken

Yamaken

Pro OpenTibia Developer
Premium User
Joined
Jul 27, 2013
Messages
457
Reaction score
326
@Yamaken still working ?
tfs 1.x and protocol 10.95.
I don't know if still working, i did not even download the new tibia 11 open beta client. You can of course take the new client and try with the method i have teach in this topic.
 

silveralol

Veteran OT User
Joined
Mar 16, 2010
Messages
1,461
Reaction score
182
I test with version 10.96, don't work the login.php, when I try enter in the client says "ilegal value"
my login.php
Code:
<?php
//really ugly script, feel free to release a better one :)
// be aware that we don't even test the password in this script
$host = "localhost";
$user = "root";
$passwd = "root";
$db = "otserv";

$lnk = mysql_connect("$host", "$user", "$passwd") or die ('ERROR MySql: ' . mysql_error());
mysql_select_db("$db", $lnk) or die ('ERROR MySql: ' . mysql_error());

$request_body = file_get_contents('php://input');
$result = json_decode($request_body, true);

$acc = $result["accountname"];
$password = $result["password"];

$dbResource = mysql_query("SELECT `id` FROM `accounts` WHERE `name` = '$acc' LIMIT 1;");

if(!$dbResource) {
    die("failed to get account.");
}

$dbRet = mysql_fetch_array($dbResource);

$accId = $dbRet[0];

$dbResource = mysql_query("SELECT `name` FROM `players` WHERE `account_id` = '$accId';");
if(!$dbResource) {
    die("failed to get charactters.");
}

$accArray = array();

while ($dbRet = mysql_fetch_array($dbResource, MYSQL_BOTH)) {
    $dict = array("worldid" => 0, "name" => $dbRet["name"]);
    $accArray[] = $dict;
}

$data = array();

$session = array(
    "sessionkey" => $acc . "\n" . $password,
    "lastlogintime" => 1461290246,
    "ispremium" => true,
    "premiumuntil" => 1463788913,
    "status" => "active"
);

$data["session"] = $session;

$playerData = array();

$world = array(
    "id" => 0,
    "name" => "servername",
    "externaladdress" => "127.0.0.1",
    "externalport" => 7172,
    "previewstate" => 0
);

$worlds = array($world);
$playerData["worlds"] = $worlds;
$playerData["characters"] = $accArray;


$data["playdata"] = $playerData;

echo json_encode($data);


//echo '{   "session": {     "sessionkey": "DhZUxAPjDFQqwCy65z2JQKB145750y",     "lastlogintime": 1461290246,     "ispremium": true,     "premiumuntil": 1463788913,     "status": "active"   },   "playdata": {     "worlds": [       {         "id": 0,         "name": "Amera",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       },       {         "id": 1,         "name": "Chrona",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       },       {         "id": 2,         "name": "Eldera",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       }     ],     "characters": [       {         "worldid": 0,         "name": "Paladin"       },       {         "worldid": 1,         "name": "Sorcerer"       },       {         "worldid": 2,         "name": "Druid"       }     ]   },   "survey": {     "id": 759822,     "invitationtext": "Dear Tibian! A few days ago, you have received an email invitation to join the Beta phase of Tibia 11. We\'d love to hear about your experiences with client version 11.0 so please help us with your feedback by completing this survey.",     "invitationtoken": "9ILillainoj7CsWxxoCRgOqSnGtt3L",     "endtimestamp": 1461535200   } }';

/*
example json
{
  "session": {
    "sessionkey": "DhZUxAPjDFQqwCy65z2JQKB145750y",
    "lastlogintime": 1461290246,
    "ispremium": true,
    "premiumuntil": 1463788913,
    "status": "active"
  },
  "playdata": {
    //an array/list of worlds and theirs data
    "worlds": [
      {
        "id": 0,
        "name": "Amera",
        "externaladdress": "66.150.54.19",
        "externalport": 7171,
        "previewstate": 0
      },
      {
        "id": 1,
        "name": "Chrona",
        "externaladdress": "193.200.156.112",
        "externalport": 7171,
        "previewstate": 0
      },
      {
        "id": 2,
        "name": "Eldera",
        "externaladdress": "66.150.54.94",
        "externalport": 7171,
        "previewstate": 0
      }
    ],
    "characters": [
      {
        "worldid": 0,
        "name": "Paladin"
      },
      {
        "worldid": 1,
        "name": "Sorcerer"
      },
      {
        "worldid": 2,
        "name": "Druid"
      }
    ]
  },
  //i believe this can just be removed, not needed
  "survey": {
    "id": 759822,
    "invitationtext": "Dear Tibian! A few days ago, you have received an email invitation to join the Beta phase of Tibia 11. We'd love to hear about your experiences with client version 11.0 so please help us with your feedback by completing this survey.",
    "invitationtoken": "9ILillainoj7CsWxxoCRgOqSnGtt3L",
    "endtimestamp": 1461535200
  }
}
*/
?>
ERROR MySql: Can't connect to MySQL server on 'localhost' (111)
 
Last edited:

Techrlz

System Manager & Programmer
Premium User
Joined
Feb 20, 2014
Messages
1,063
Reaction score
156
I test with version 10.96, don't work the login.php, when I try enter in the client says "ilegal value"
my login.php
Code:
<?php
//really ugly script, feel free to release a better one :)
// be aware that we don't even test the password in this script
$host = "localhost";
$user = "root";
$passwd = "root";
$db = "otserv";

$lnk = mysql_connect("$host", "$user", "$passwd") or die ('ERROR MySql: ' . mysql_error());
mysql_select_db("$db", $lnk) or die ('ERROR MySql: ' . mysql_error());

$request_body = file_get_contents('php://input');
$result = json_decode($request_body, true);

$acc = $result["accountname"];
$password = $result["password"];

$dbResource = mysql_query("SELECT `id` FROM `accounts` WHERE `name` = '$acc' LIMIT 1;");

if(!$dbResource) {
    die("failed to get account.");
}

$dbRet = mysql_fetch_array($dbResource);

$accId = $dbRet[0];

$dbResource = mysql_query("SELECT `name` FROM `players` WHERE `account_id` = '$accId';");
if(!$dbResource) {
    die("failed to get charactters.");
}

$accArray = array();

while ($dbRet = mysql_fetch_array($dbResource, MYSQL_BOTH)) {
    $dict = array("worldid" => 0, "name" => $dbRet["name"]);
    $accArray[] = $dict;
}

$data = array();

$session = array(
    "sessionkey" => $acc . "\n" . $password,
    "lastlogintime" => 1461290246,
    "ispremium" => true,
    "premiumuntil" => 1463788913,
    "status" => "active"
);

$data["session"] = $session;

$playerData = array();

$world = array(
    "id" => 0,
    "name" => "servername",
    "externaladdress" => "127.0.0.1",
    "externalport" => 7172,
    "previewstate" => 0
);

$worlds = array($world);
$playerData["worlds"] = $worlds;
$playerData["characters"] = $accArray;


$data["playdata"] = $playerData;

echo json_encode($data);


//echo '{   "session": {     "sessionkey": "DhZUxAPjDFQqwCy65z2JQKB145750y",     "lastlogintime": 1461290246,     "ispremium": true,     "premiumuntil": 1463788913,     "status": "active"   },   "playdata": {     "worlds": [       {         "id": 0,         "name": "Amera",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       },       {         "id": 1,         "name": "Chrona",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       },       {         "id": 2,         "name": "Eldera",         "externaladdress": "127.0.0.1",         "externalport": 7172,         "previewstate": 0       }     ],     "characters": [       {         "worldid": 0,         "name": "Paladin"       },       {         "worldid": 1,         "name": "Sorcerer"       },       {         "worldid": 2,         "name": "Druid"       }     ]   },   "survey": {     "id": 759822,     "invitationtext": "Dear Tibian! A few days ago, you have received an email invitation to join the Beta phase of Tibia 11. We\'d love to hear about your experiences with client version 11.0 so please help us with your feedback by completing this survey.",     "invitationtoken": "9ILillainoj7CsWxxoCRgOqSnGtt3L",     "endtimestamp": 1461535200   } }';

/*
example json
{
  "session": {
    "sessionkey": "DhZUxAPjDFQqwCy65z2JQKB145750y",
    "lastlogintime": 1461290246,
    "ispremium": true,
    "premiumuntil": 1463788913,
    "status": "active"
  },
  "playdata": {
    //an array/list of worlds and theirs data
    "worlds": [
      {
        "id": 0,
        "name": "Amera",
        "externaladdress": "66.150.54.19",
        "externalport": 7171,
        "previewstate": 0
      },
      {
        "id": 1,
        "name": "Chrona",
        "externaladdress": "193.200.156.112",
        "externalport": 7171,
        "previewstate": 0
      },
      {
        "id": 2,
        "name": "Eldera",
        "externaladdress": "66.150.54.94",
        "externalport": 7171,
        "previewstate": 0
      }
    ],
    "characters": [
      {
        "worldid": 0,
        "name": "Paladin"
      },
      {
        "worldid": 1,
        "name": "Sorcerer"
      },
      {
        "worldid": 2,
        "name": "Druid"
      }
    ]
  },
  //i believe this can just be removed, not needed
  "survey": {
    "id": 759822,
    "invitationtext": "Dear Tibian! A few days ago, you have received an email invitation to join the Beta phase of Tibia 11. We'd love to hear about your experiences with client version 11.0 so please help us with your feedback by completing this survey.",
    "invitationtoken": "9ILillainoj7CsWxxoCRgOqSnGtt3L",
    "endtimestamp": 1461535200
  }
}
*/
?>
ERROR MySql: Can't connect to MySQL server on 'localhost' (111)
Your mysql password is root?
 

silveralol

Veteran OT User
Joined
Mar 16, 2010
Messages
1,461
Reaction score
182
Your mysql password is root?
yes, user:root pass:root db: otserv

edit: I test with a true localhost, I had try with an ubuntu server vpn, ofcourse using some "mask" in my ip :)
then now during the test in localhost
could not connect
 
Last edited:

Nekiro

7375727072697365643F203A29
Support Team
Joined
Sep 7, 2015
Messages
1,775
Reaction score
546
Nice work, works great here on 10.96.
Client looks very good :)
 

GOD javii

New Member
Joined
Jul 18, 2015
Messages
25
Reaction score
4
whats configuration en config.lua ?

clientVersionMin = 1097
clientVersionMax = 1100
clientVersionStr = "10.97-11.00"

????????????????
 
Top