Welcome,

Guest

  • Member's Login
  • Member's Registration
  • Community
  • Download
  • Demo
  • Support
  • Store
Azer CMS > Community
Support > Tutorials > [Share] Adding character tools like rename, changerace...
Serayn
Join Date: Oct 26, 2016
Location:
Posts: 3

DM: 🗨
[Share] Adding character tools like rename, changerace...
Posted 06-04-17, at 7:35 PM.

Please Register or Login to remove ads.

There are 3 files should be changed.
1. core/inc/functions.php
1.1 adding tool code like below(it is a rename tool in this example) on the end of function.php:

function tool_rename()
{
global $db, $db_data, $db_acc, $login, $soap_host, $soap_user, $soap_pass;
$dp_price = 4000;

if($login)
{
if(!empty($_POST['submit-rename']))
{
if(!empty($_POST['rename']))
{
$var = $_POST['rename'];
$data = explode("-", $var);

$realm = clean($data[0]);
$guid = clean($data[1]);

$get_realm = $db->query("SELECT id, char_db FROM $db_data.realms WHERE id='$realm'");
$grlm = $db->get($get_realm);
$cdb = $grlm['char_db'];

$sql = $db->query("SELECT `account`.`id`, `account`.`username`, `characters`.`guid`, `characters`.`account` FROM `$db_acc`.`account`, `$cdb`.`characters` WHERE `account`.`id` = `characters`.`account` AND `account`.`username`='$login' AND `characters`.`guid`='$guid'");
$check = $db->num($sql);
$sql2 = $db->query("SELECT `account`.`id`, `account`.`username`, `account`.`dp` , `characters`.`guid`, `characters`.`account` FROM `$db_acc`.`account`, `$cdb`.`characters` WHERE `account`.`id` = `characters`.`account` AND `account`.`username`='$login' AND `characters`.`guid`='$guid'");
$this_account = $db->get($sql2);
$account_id = $this_account['account'.'id'];
if($check != 1)
{
return"Invalid character.";
}
else
{
//Validate Character & Account
$sqlr = $db->query("SELECT id, char_db, port, ra_port FROM $db_data.realms WHERE id='$realm'");
$chkr = $db->num($sqlr);
if($chkr != 1)
{
return "Invalid server。";
}
else
{
$getr = $db->get($sqlr);
$spt = $getr['ra_port'];
$cdb = $getr['char_db'];
$port = status($spt, 2);
if($port != "online"){return "Server offline.";}
else{
if($this_account[`account`.`dp`]>$dp_price)
{
$dp_left = $this_account[`account`.`dp`] - $dp_price;
$sql_left = $db->query("UPDATE `account` SET `account`.`dp` = '$dp_left' WHERE `account`.`id`= '$account_id'");
$sql_char = $db->query("SELECT guid, name FROM $cdb.characters WHERE guid='$guid'");
$chars = $db->get($sql_char);
$char = $chars['name'];
$send = "character rename $char"; //console command here. can be changed to character changerace, changefaction and so on.
$result = exe_send($send, $spt);
return "Rename request has been sent and will apply on next login.";

}else{return "Insufficent DP. This service takes $dp_price DP.";}
}
}
}
}
}
}
}

2.core/parser/replace.php.
2.1 Find ""tool_revive" => tool_revive(),"
2.2 Add ""tool_rename" => tool_rename()," below ""tool_revive" => tool_revive(),".
2.3 Save replace.php
3.styles//pagestool.php.
3.1 Find "{tool_revive}" and add "{tool_rename}" after it.
3.2 Find the line of revive with "" on its end.
3.3 Copy this line and and paste below it.
3.4 Replace the "revive" with "rename" on new line.
3.5 Save tool.php
Chris


Join Date: Sep 10, 2012
Location: Azer CMS
Posts: 637

DM: 🗨
[Share] Adding character tools like rename, changerace...
Posted 06-04-17, at 10:45 PM.
You should replace all instances of 'ra_port' with 'soap_port', as this is the current column name as of v3.1.4. Also, since this is not a module, I've moved the thread to the Tutorials forum. Thank you for sharing this. I will probably take a closer look later on, as I've only taken a quick scan currently.
<<
1

© Copyright 2023 Azer CMS.
All Rights Reserved.
Terms of Service.

DMCA.com Protection Status