Jump to content

script for unstuck&revive


Recommended Posts

Posted

You do this with TMSDK..

http://code.google.com/p/trinmangsdk/

[EDIT]

Do not use this one, it doesn't work, go to my next post...

[/EDIT]

<?php
if($_GET['char']
{
require_once("tmsdk.include.php");
// CONFIG
$_config['mysql_host'] = 'localhost';
$_config['mysql_port'] = 3306;
$_config['mysql_user'] = "root";
$_config['mysql_pass'] = "";
$_config['db_char'] = "characters";
// END CONFIG
$cdb = new conndb($_config['mysql_host'], $_config['mysql_port'], $_config['mysql_user'], $_config['mysql_pass'], $_config['db_char']);
$char = new char($cdb);
$guid = $char->getGuid("NAME HERE");
$status = $char->getOnlineStatus($guid);
if(!$status)
{
$home = $char->getHome($guid);
$char->setLocation($guid,$home['position_x'],$home['position_y'],$home['position_z'],$home['map']);
} else {
echo 'Attention: the character is online. Try again later.';
}
} else {
echo '
<form method="GET">
Character Name:


<input type="text" name="char">
<input type="submit" value="Submit">
</form>
';
?>

That should work fine as far as I can tell, however, I wrote it very quickly and.. it probably won't. You can also add a username and password check to if you want to check that the character is being transfered by it's owner.

Posted
You do this with TMSDK..

http://code.google.com/p/trinmangsdk/

<?php
if($_GET['char']
{
require_once("tmsdk.include.php");
// CONFIG
$_config['mysql_host'] = 'localhost';
$_config['mysql_port'] = 3306;
$_config['mysql_user'] = "root";
$_config['mysql_pass'] = "";
$_config['db_char'] = "characters";
// END CONFIG
$cdb = new conndb($_config['mysql_host'], $_config['mysql_port'], $_config['mysql_user'], $_config['mysql_pass'], $_config['db_char']);
$char = new char($cdb);
$guid = $char->getGuid("NAME HERE");
$status = $char->getOnlineStatus($guid);
if(!$status)
{
$home = $char->getHome($guid);
$char->setLocation($guid,$home['position_x'],$home['position_y'],$home['position_z'],$home['map']);
} else {
echo 'Attention: the character is online. Try again later.';
}
} else {
echo '
<form method="GET">
Character Name:


<input type="text" name="char">
<input type="submit" value="Submit">
</form>
';
?>

That should work fine as far as I can tell, however, I wrote it very quickly and.. it probably won't. You can also add a username and password check to if you want to check that the character is being transfered by it's owner.

the revive option certainly NOT POSSIBLE.because u need a webservice or something else.because use .revive charactername command in mangos console.and it will be possible with using webService.

Posted

Oh yea, I forgot to add the revive part, told you I'd make a mistake, I also made a lot more mistakes other than that, but here's the working version...

<?php
if($_GET['char'])
{
require_once("tmsdk.include.php");
$_config['mysql_host'] = "localhost";
$_config['mysql_port'] = 3306;
$_config['mysql_user'] = "root";
$_config['mysql_pass'] = "";
$_config['db_char'] = "characters";
$cdb = new conndb($_config['mysql_host'], $_config['mysql_port'], $_config['mysql_user'], $_config['mysql_pass'], $_config['db_char']);
$char = new char($cdb);
$guid = $char->getGuid($_GET['char']);
$status = $char->getOnlineStatus($guid);
if(!$status)
{
$home = $char->getHome($guid);
$char->setLocation($guid,$home['position_x'],$home['position_y'],$home['position_z'],$home['map']);
$char->revive($guid);
} else {
echo 'Attention: the character is online. Try again later.';
}
} else {
echo '
<form method="GET">
Character Name:


<input type="text" name="char">
<input type="submit" value="Submit">
</form>
';
}
?>

the revive option certainly NOT POSSIBLE.because u need a webservice or something else.because use .revive charactername command in mangos console.and it will be possible with using webService.

It's possible to revive someone through PHP. The function "revive" does exactly that. It's very hacky, it removes both of the Ghost auras to revive the character, but it works. BTW if you have a better way to implement this function please tell me.

I'm not sure what you mean by "webservice", if you mean using remote conosole, that is also possible through tmsdk, but the other function is much simpler.

If you want to do it through RA, make sure you have RA enabled in your mangosd.conf file first of all. Then you can make a connection to it, login, and use the command..

<?php
require_once("tmsdk.include.php");
$mra = new rasocket();
$mra->connect('localhost');
$mra->auth('USERNAME','PASSWORD');
$mra->sendcommanddelay('revive CHARACTER');
?>

You have to replace "USERNAME" and "PASSWORD" with a GM account or whatever level account you set for remote access and also you have to replace "CHARACTER" with the name of the character who is being revived.

NOTE: The second script only revives the character, it doesn't teleport it.

Posted

<?php
if($_GET['act']=="do")
{
require_once("tmsdk.include.php");
$_config['mysql_host'] = "localhost";
$_config['mysql_port'] = 3306;
$_config['mysql_user'] = "root";
$_config['mysql_pass'] = "";
$_config['db_char'] = "characters";
$_config['db_acct'] = "realmd";
$cdb = new conndb($_config['mysql_host'], $_config['mysql_port'], $_config['mysql_user'], $_config['mysql_pass'], $_config['db_char']);
$rdb = new conndb($_config['mysql_host'], $_config['mysql_port'], $_config['mysql_user'], $_config['mysql_pass'], $_config['db_acct']);
$char = new char($cdb);
$act = new account($rdb);
$auth = $act->login($_POST['user'],$_POST['pass']);
if($auth="1")
{
$guid = $char->getGuid($_POST['char']);
$aid = $act->getId($_POST['user']);
$cid = $char->getAccountId($guid);
if($cid!=$aid)
{
die("The account entered doesn't match the account that the character is on");
}
$status = $char->getOnlineStatus($guid);
if(!$status)
{
$home = $char->getHome($guid);
$char->setLocation($guid,$home['position_x'],$home['position_y'],$home['position_z'],$home['map']);
$char->revive($guid);
} else {
echo 'Attention: the character is online. Try again later.';
}
} else {
echo 'Your username and password did not match.';
}
} else {
echo '
<form action="unstuck.php?act=do" method="POST">
Username:

<input type="text" name="user">
Password:

<input type="password" name="pass">

Character Name:

<input type="text" name="char">

<input type="submit" value="Submit">
</form>
';
}
?>

That should work, if it doesn't, post the error.

Posted

hi maikash,

It seems not check username and password. I leave username, password and type blablabla to Character Name field, click Submit, it go to blank page without requirement username and pass.

Please help me,

tks!

Posted

@ludlamzgull

You have to use SVN to check out this address.. http://trinmangsdk.googlecode.com/svn/trunk/ then you must have all those files in the directory that the script is in or have the "require_once" point to it. For example say I'm in C:\\www and I checkout the SVN at C:\\www\\trinmangsdk\\ then the require_once at the begginning of the script has to say "require_once(".\\trinmangsdk\\tmsdk.include.php");"

@sothich

One sec, my apache is acting up at the moment, I'll post a working script when I get it up again so I can test it.

Posted

<?php
if($_GET['act']=="do")
{
require_once("tmsdk.include.php");
$_config['mysql_host'] = "localhost";
$_config['mysql_port'] = 3306;
$_config['mysql_user'] = "root";
$_config['mysql_pass'] = "";
$_config['db_char'] = "characters";
$_config['db_acct'] = "realmd";
$cdb = new conndb($_config['mysql_host'], $_config['mysql_port'], $_config['mysql_user'], $_config['mysql_pass'], $_config['db_char']);
$rdb = new conndb($_config['mysql_host'], $_config['mysql_port'], $_config['mysql_user'], $_config['mysql_pass'], $_config['db_acct']);
$char = new char($cdb);
$act = new account($rdb);
$auth = $act->login($_POST['user'],$_POST['pass']);
if($auth=="1")
{
$guid = $char->getGuid($_POST['char']);
$aid = $act->getId($_POST['user']);
$cid = $char->getAccountId($guid);
if($cid!=$aid)
{
die("The account entered doesn't match the account that the character is on");
}
$status = $char->getOnlineStatus($guid);
if(!$status)
{
$home = $char->getHome($guid);
$char->setLocation($guid,$home['position_x'],$home['position_y'],$home['position_z'],$home['map']);
$char->revive($guid);
} else {
echo 'Attention: the character is online. Try again later.';
}
} else {
echo 'Your username and password did not match.';
}
} else {
echo '
<form action="unstuck.php?act=do" method="POST">
Username:

<input type="text" name="user">

Password:

<input type="password" name="pass">

Character Name:

<input type="text" name="char">

<input type="submit" value="Submit">
</form>
';
}
?>

Forgot one '=' :lol:

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use