Jump to content
Sign in to follow this  
gatero

[Web Services] Tales of Pirates Web Services Integration

Recommended Posts

Please watch the full video and read all post before asking.

 

Here is a video with a resume of what Web Services can do.

 

 

 

After watching this, you are wondering with whats the diference with all the Account Managment tools available in the market?

Well the application you can see in that video does nothing than sending REST requests to my webservices and the web service is the one that create/edit my Micosoft Sql Server Databases

with the values i sent.

For example, in the first process (Account Creation) i define:

  1. Username
  2. Password
  3. Email
  4. GM Level

So the application creates the following json with the given values:

{
	"user": "Admin",
	"pass": "E10ADC3949BA59ABBE56E057F20F883E",
	"oldPass": "123456",
	"email": "[email protected]",
	"gmLevel": 99,
}

Where pass value is the MD5 Hash for "123456"

My web service receives this information, process it and execute the following query to my Microsoft SQL Server Database.

First to create Account

INSERT INTO [AccountServer].[dbo].[account_login] (name, password, originalPassword, email, ban) VALUES ( 'Admin', 'E10ADC3949BA59ABBE56E057F20F883E', '123456' , '[email protected]',0);

Then to set Gm Level

INSERT INTO GameDB.dbo.account (act_id, act_name, gm, cha_ids, last_ip, disc_reason, last_leave, password, merge_state) VALUES ( '1', 'Admin', 99 , ';', ' ', ' ', '2001-01-01 00:00:00.000', null, 0);

And after this, the webservice just return the information of this Created Account with the following Json.

{
	"idCode": "31",
	"name": "Admin",
	"password": "E10ADC3949BA59ABBE56E057F20F883E",
	"originalPassword": "123456",
	"loginStatus": "0",
	"lastLoginTime": "1534535165653",
	"lastLogoutTime": "1534535165653",
	"lastLoginIp": "null",
	"ban": "0",
	"email": "[email protected]"
}

Then my application just process this data received from the Web Service and show it to you.

 

The same works with the Character Editing function, it looks for the character in the Sql Database and update the colums of str,dex,gb,etc.

This are just two examples i had in mind as i dont know too much of Server Development but if you have more ideas of things i can do ingame with sql querys just leave a comment.

 

Finally why we are here, the good thing with this is that this webservice supports request from diferent plataforms.

As i programmed a Vb.Net program to consume my services, you can develope desktop applications(C++, C#, Java, Python, (EVEN LUA, im not a lua programmer so idk if this work but u may be able to do web services from Game client)), web applications, mobile applications, etc.

As long as they support REST Request.

 

So , for example, you can develop a simple website with two textboxes and 1 button. The button function would be just send this Json explained before as a Post Request to my Web Service and the

account would be created.

Later you want to create an addon to ur Game Launcher to create an account. You should program just 2 textbox and 1 botton and the button send a Post Request to my webservice. 

 

The thing with this is that you didnt have to program all the connections and querys to the database again when you programmed your second application. So you can continue programming diferent apps that works with different web services.

 

So what im offering is my Web Services, the development of new web services

And im asking for ideas to develope.

I may create a Tales of Pirates Mall, Character teleportation, etc. And this are services you can use in ur WebSites, Launcher, Tools, Etc.

 

Leave any question or request below.

Thanks you.

 

 

 

 

Edited by gatero
  • Like 1

Share this post


Link to post
Share on other sites

Here i developed a simple website for register an account with my web apis, the same as the Vb.Net Version

 

register.html

<html>
<head>
<title>Tales of Pirates Registration</title>
</head>
<body>

<FORM NAME ="form1" METHOD ="POST" ACTION = "createAcc.php">

<label>Username</label><br />
<INPUT TYPE = "TEXT" NAME ="username" ><br />
<label>Password</label><br />
<INPUT TYPE = "PASSWORD" NAME ="password"><br />
<label>Email</label><br />
<INPUT TYPE = "EMAIL" NAME ="email"><br />
<label>GM Level</label><br />
<INPUT TYPE = "TEXT" NAME ="gmLevel"><br />
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Register">

</FORM>

</body>
</html>

And Script createAcc.php

<?PHP

$username = $_POST['username'];
$password = $_POST['password'];
$md5Pass = $_POST['md5Pass'];
$email = $_POST['email'];
$gmLevel = $_POST['gmLevel'];

 $url = 'http://localhost:8081/create/';

$data_string = json_encode(array("user" => $username, "pass" => md5($password), "email" => $email, "oldPass" => $password, "gmLevel" => $gmLevel));  

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

curl_close($ch);

print ($result);

?>

 

Edited by gatero

Share this post


Link to post
Share on other sites

Something interested of this, is that the web service is running in my pc, buy i host my website in a free web hosting. And as the website just do request to my web service, i dont need to pay for any sql services in this hosting.

For example i tested my scripts in this website, http://survey159.phpnet.us. Changeing the url in the register.html code to my public address (to connect to my web service)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...