Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[PHP][KO Panel] Nation Transfer Script (SNOXDKO)

Newbie Spellweaver
Joined
Dec 3, 2006
Messages
42
Reaction score
0
Re: [Share][PHP][KO Panel] Nation Transfer Script (SNOXDKO)

Again this is due to 1098 -> 1299. If you can gimmie some more info on this I can probs help you. It's likely the race ID's - look at the differences you might be able to fix it yourself.

It's gonna be in this:

$query = "SELECT strUserID, Race, Class FROM USERDATA WHERE strUserID = '" . $char . "'";
$results = odbc_exec($connect, $query);
while (odbc_fetch_row($results)) {
$race = odbc_result($results, 2);
$class = odbc_result($results, 3);
}

if ($race < 12) {
$hashmap = array (1 => 11, 2 => 12, 3 => 13, 4 => 13, 11 => 1);
$NewRace = $hashmap[$race];
} elseif (($race == 12) || ($race == 13) || ($race == 14)) {
if ($class == 201) $NewRace = 1;
elseif ($class == 202) $NewRace = 2;
elseif ($class == 203) $NewRace = 3;
elseif ($class == 204) $NewRace = 4;
elseif ($class == 205) $NewRace = 1;
elseif ($class == 207) $NewRace = 2;
elseif ($class == 209) $NewRace = 3;
elseif ($class == 211) $NewRace = 4;
}
if ($class >= 199) {
$NewClass = $class - 100;
} else {
$NewClass = $class + 100;
}

I probably shoulda kept my documentation for that.. Took quit ea while making new characters on each nation to check their values lol. But yeah, if you could do this for me i'd be greatful.
 
Experienced Elementalist
Joined
Aug 18, 2007
Messages
204
Reaction score
0
Re: [Share][PHP][KO Panel] Nation Transfer Script (SNOXDKO)

Again this is due to 1098 -> 1299. If you can gimmie some more info on this I can probs help you. It's likely the race ID's - look at the differences you might be able to fix it yourself.

It's gonna be in this:

$query = "SELECT strUserID, Race, Class FROM USERDATA WHERE strUserID = '" . $char . "'";
$results = odbc_exec($connect, $query);
while (odbc_fetch_row($results)) {
$race = odbc_result($results, 2);
$class = odbc_result($results, 3);
}

if ($race < 12) {
$hashmap = array (1 => 11, 2 => 12, 3 => 13, 4 => 13, 11 => 1);
$NewRace = $hashmap[$race];
} elseif (($race == 12) || ($race == 13) || ($race == 14)) {
if ($class == 201) $NewRace = 1;
elseif ($class == 202) $NewRace = 2;
elseif ($class == 203) $NewRace = 3;
elseif ($class == 204) $NewRace = 4;
elseif ($class == 205) $NewRace = 1;
elseif ($class == 207) $NewRace = 2;
elseif ($class == 209) $NewRace = 3;
elseif ($class == 211) $NewRace = 4;
}
if ($class >= 199) {
$NewClass = $class - 100;
} else {
$NewClass = $class + 100;
}

I probably shoulda kept my documentation for that.. Took quit ea while making new characters on each nation to check their values lol. But yeah, if you could do this for me i'd be greatful.

Yeah bro I sure apprciate all this work you have done and are sharing..

As soon as I get some time all post, However I reformatted my whole box yesterday due to this problem I was having so I'm a little tied up atm..
 
Newbie Spellweaver
Joined
Jan 24, 2007
Messages
45
Reaction score
0
Re: [Share][PHP][KO Panel] Nation Transfer Script (SNOXDKO)

can you send the nation.php ?
 
Newbie Spellweaver
Joined
Dec 3, 2006
Messages
42
Reaction score
0
There isn't a nation.php

This is a total re-rewrite by me- it's not the original which had a request and action file.
 
Experienced Elementalist
Joined
Aug 18, 2007
Messages
204
Reaction score
0
No matter what I do this script is still saying to me, 'All characters must be logged out of the game first!'
 
Experienced Elementalist
Joined
Aug 18, 2007
Messages
204
Reaction score
0
Ok reading the whole topic again refreshed my mind..

Heres how the script looks now after some edits..


Code:
<?php

include('./anti_inject.php');

parth1tr();
parth1('100%', 2, 'center');
[COLOR=#000000][COLOR=#007700]echo [/COLOR][COLOR=#DD0000]'Nation Transfer - Beta - by BlaDe @ Snoxd.net'[/COLOR][COLOR=#007700];[/COLOR][/COLOR]
parth2();
parth2tr();

if (isset($_SESSION['sesuser'])) {
    if ($_GET['Confirmed'] == 1) {
        $connect = odbc_connect("$dbname", "$dbuser", "$dbpass");
        $query = "SELECT strCharID1, strCharID2, strCharID3 FROM Account_Char WHERE strAccountID ='" . $_SESSION['sesuser'] . "' ";
        $results = odbc_exec($connect, $query); 
        // Store all char names in var's.....
        while (odbc_fetch_row($results)) {
            $char1 = odbc_result($results, 1);
            $char2 = odbc_result($results, 2);
            $char3 = odbc_result($results, 3);
        } 
        // Confirm they have a character
        if ((empty($char1)) && (empty($char2)) && (empty($char3))) {
            part1('100%', 1, 1, 'center');
            echo '</br>Your not part of a Nation, how do you expect to change it?';
            echo '</br></br><a href="./index.php">Back</a></br>';
            part2();
        } else {
            // Confirm none of the chars are logged in..
            // Updated during the for loop

            $query = "SELECT count(strCharID) FROM CURRENTUSER WHERE strCharID = '" . $char1 . "' OR strCharID = '" . $char2 . "' OR strCharID = '" . $char3 . "'";
            $results = odbc_exec($connect, $query);
            while (odbc_fetch_row($results)) {
                $online = odbc_result($results, 1);
            } 
              if (strlen(trim($online != 0)) > 0) {
                part1('100%', 1, 1, 'center');
                echo '</br>All characters must be logged out of the game first!';
                echo '</br></br><a href="./index.php">Back</a></br>';
                part2();
                die();
            } 
            // Check they aren't in a clan on any of 3 characters.
            
            $query = "SELECT count(Knights) FROM USERDATA WHERE strUserID = '" . $char1 . "' OR strUserID = '" . $char2 . "' OR strUserID = '" . $char3 . "'";
            $results = odbc_exec($connect, $query);
            while (odbc_fetch_row($results)) {
                $knights = odbc_result($results, 1);
            } 
            if (trim($Knights) > 0) {
                part1('100%', 1, 1, 'center');
                echo '</br>All characters on account have to be clanless.';
                echo '</br></br><a href="./index.php">Back</a></br>';
                part2();
                die();
            } 
            $query = "SELECT COUNT(*) FROM NT_LOG WHERE DATEDIFF(Hour,[Date],GETDATE()) < 48 AND Account = '" . $_SESSION['sesuser'] . "'";
            $results = odbc_exec($connect, $query);
            while (odbc_fetch_row($results)) {
                $logcheck = odbc_result($results, 1);
            } 
            if ($logcheck > 0) {
                part1('100%', 1, 1, 'center');
                echo '</br>You may only use this feature once every 48hours.';
                echo '</br></br><a href="./index.php">Back</a></br>';
                part2();
                die();
            } else {
                // Get the nation and calculate desired nation
                $query = "SELECT strAccountID, bNation FROM ACCOUNT_CHAR WHERE strAccountID = '" . $_SESSION['sesuser'] . "'";
                $results = odbc_exec($connect, $query);
                while (odbc_fetch_row($results)) {
                    $nation = odbc_result($results, 2);
                } 
                if ($nation == 1) $desiredNation = 2;
                if ($nation == 2) $desiredNation = 1; 
                // Test 1
                $check1 = odbc_exec($connect, "SELECT COUNT(*) FROM USERDATA WHERE Nation='" . $desiredNation . "'");
                $check2 = odbc_exec($connect, "SELECT COUNT(*) FROM USERDATA");

                $tot1 = odbc_result ($check1, 1);
                $tot2 = odbc_result($check2, 1);
                if ($tot1 / $tot2 > 0.6) {
                    part1('100%', 1, 1, 'center');
                    echo '</br>Sorry your desired nation has too many users.';
                    echo '</br>The desired population must be less than 60% Population!';
                    echo '</br></br><a href="./index.php">Back</a></br>';
                    part2();
                    die();
                } 
                // Test 2
                $check3 = odbc_exec($connect, "SELECT SUM(Loyalty) AS nps FROM USERDATA WHERE Nation='" . $desiredNation . "'");
                $check4 = odbc_exec($connect, "SELECT SUM(Loyalty) AS totnps FROM USERDATA");
                $nps = odbc_result_all($check3);
                $totnps = odbc_result_all($check4);
                if ($nps / $totnps > 0.575) {
                    part1('100%', 1, 1, 'center');
                    echo '</br>Sorry your desired nation has too many National Points.';
                    echo '</br>The desired population must be less than 57% total National Points!';
                    echo '</br></br><a href="./index.php">Back</a></br>';
                    part2();
                    die();
                } else {
                    // Calculate the newrace + class of the characters..
                    foreach (array($char1, $char2, $char3) as $char) {
                        if ($char != "") {
                        $getuser = "SELECT strCharID FROM CURRENTUSER where strCharID = '" . $char . "'";
                        $getusere = odbc_exec($connect, $getuser);
                        $characterID = odbc_result($getusere, 1);

                        if (strlen(trim($characterID)) > 0) {
                        $killed = 1;
                        KillUserAndWait(trim($characterID), $connect);
                         } 
                            $query = "SELECT strUserID, Race, Class FROM USERDATA WHERE strUserID = '" . $char . "'";
                            $results = odbc_exec($connect, $query);
                            while (odbc_fetch_row($results)) {
                                $race = odbc_result($results, 2);
                                $class = odbc_result($results, 3);
                            } 

                            if ($race < 12) {
                                $hashmap = array (1 => 11, 2 => 12, 3 => 13, 4 => 13, 11 => 1);
                                $NewRace = $hashmap[$race];
                            } elseif (($race == 12) || ($race == 13) || ($race == 14)) {
                                if ($class == 201) $NewRace = 1;
                                elseif ($class == 202) $NewRace = 2;
                                elseif ($class == 203) $NewRace = 3;
                                elseif ($class == 204) $NewRace = 4;
                                elseif ($class == 205) $NewRace = 1;
                                elseif ($class == 207) $NewRace = 2;
                                elseif ($class == 209) $NewRace = 3;
                                elseif ($class == 211) $NewRace = 4;
                            } 
                            if ($class >= 199) {
                                $NewClass = $class - 100;
                            } else {
                                $NewClass = $class + 100;
                            } 
                            if (($NewRace == '') || ($NewClass == '')) {
                                part1('100%', 1, 1, 'center');
                                echo 'Error: (Char: ' . $char . ')</br> New Class:';
                                echo $NewClass;
                                echo '</br> New Race:';
                                echo $NewRace;
                                echo '</br> Old Class:';
                                echo $class;
                                echo '</br> Old Race:';
                                echo $race;
                                echo '</br></br><a href="./index.php">Back</a></br>';
                                part2();
                                die();
                            } 
                            $query = "UPDATE USERDATA SET Nation = '" . $desiredNation . "', Race = '" . $NewRace . "', Class = '" . $NewClass . "', Zone = 21, PX = 33550, PZ = 38400, PY = 0 WHERE strUserID = '" . $char . "'";
                            $results = odbc_exec($connect, $query);
                        } 
                    } 
                    $query = "INSERT INTO NT_LOG([Date], Account, Char1, Char2, Char3, NationTo) VALUES (GETDATE(), '" . $_SESSION['sesuser'] . "', '" . $char1 . "', '" . $char2 . "', '" . $char3 . "', '" . $desiredNation . "')";
                    $results = odbc_exec($connect, $query);
                    $query = "UPDATE ACCOUNT_CHAR SET bNation = '" . $desiredNation . "' WHERE strAccountID = '" . $_SESSION['sesuser'] . "'";
                    $results = odbc_exec($connect, $query);
                } 
                // Done
                part1tr();
                part1('100%', 1, 1, 'center');
                echo 'Done';
echo '</br></br><a href="./index.php">Back</a>';
                if ($killed == 1) { echo '</br>A character was disconnected during this process'; }
                part2();
                part2tr();
            } 
        } 
    } else {
        part1tr();
        part1('25%', 1, 1, 'center');
        echo 'Please confirm your transfer:</br></br></br>
        <li>You must be <b>logged out</b> of <b>all</b> characters</li>
        <li>You must be <b>Clanless</b> on <b>all</b> characters</li>
        <li>You may only use this feature <b>once</b> every 48hours</li>
        <li>The Desired Nation must be <b>Less Than</b> 60% Total Population </li>
        <li>The Desired Nation must be <b>Less Than</b> 57.5% Total National Points</li></br></br>
        <FORM method=post name=confirm action=index.php?act=NationTransfer&Confirmed=1>
            <input class="input" type="submit" value="Confirm">
            </form>';
        part2();
        part2tr();
    } 
} else {
    part1('100%', 1, 1, 'center');
    echo 'You must login first!';
    part2();
} 

?>


But I think there is a bug with 'Sorry your desired nation has too many National Points.
The desired population must be less than 57% total National Points!'

I tried it for both nations and get this message all the time..
 
Newbie Spellweaver
Joined
Oct 8, 2006
Messages
17
Reaction score
0
if (strlen(trim($online)) > 0) {
part1('100%', 1, 1, 'center');
echo
'</br>All characters must be logged out of the game first!';
echo
'</br></br><a href="./index.php">Back</a></br>';
part2();
die();

im a complete noob with php right now but shouldnt that line be

if (strlen(trim($online)) > 1) {

????? wouldnt that fix the all characters must be logged out thing??

 
Experienced Elementalist
Joined
Aug 18, 2007
Messages
204
Reaction score
0
if (strlen(trim($online)) > 0) {
part1('100%', 1, 1, 'center');
echo
'</br>All characters must be logged out of the game first!';
echo
'</br></br><a href="./index.php">Back</a></br>';
part2();
die();

im a complete noob with php right now but shouldnt that line be

if (strlen(trim($online)) > 1) {

????? wouldnt that fix the all characters must be logged out thing??


I got past that bit already, but im getting this for both nations..

'Sorry your desired nation has too many National Points.
The desired population must be less than 57% total National Points!'
 
Newbie Spellweaver
Joined
Dec 3, 2006
Messages
42
Reaction score
0
I got past that bit already, but im getting this for both nations..

Apologies to bump an old topic, someone asked me about it on MSN. That isn't a bug - you can change the values if you want but I implemented those fail safes to stop imbalanced nation transfers.
 
Back
Top