diff --git a/config.php b/config.php index d33c9af..3eed81e 100644 --- a/config.php +++ b/config.php @@ -4,7 +4,7 @@ // TFS 0.3 = TFS_03 (If ur using 0.3.6, set $config['salt'] to false)! // TFS 0.4 = TFS_03 // TFS 1.0 = TFS_10 (Under developement) - $config['TFSVersion'] = 'TFS_04'; + $config['TFSVersion'] = 'TFS_10'; $config['site_title'] = 'Znote AAC'; $config['site_title_context'] = 'Because open communities are good communities. :3'; @@ -14,13 +14,13 @@ // ------------------------ \\ // phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.). - $config['sqlUser'] = 'gremlee'; + $config['sqlUser'] = 'dev'; // phpmyadmin password for OT server: - $config['sqlPassword'] = 'gremlee'; + $config['sqlPassword'] = 'dev'; // The database name to connect to. (This is usually same as username). - $config['sqlDatabase'] = 'gremlee'; + $config['sqlDatabase'] = 'dev'; // Hostname is usually localhost or 127.0.0.1. $config['sqlHost'] = 'localhost'; @@ -160,7 +160,7 @@ ); $config['validate_IP'] = true; // Only allow legal IP addresses to register and create character. - $config['salt'] = true; // Some noob 0.3.6 servers don't support salt. + $config['salt'] = false; // Some noob 0.3.6 servers don't support salt. // Restricted names $config['invalidNameTags'] = array("god", "gm", "cm", "gamemaster", "hoster", "admin", "admim", "adm", "owner", "staff"); @@ -475,5 +475,12 @@ 'describtion' => "Change character gender.", 'points' => 20, ), + 5 => array( + 'type' => 4, + 'itemid' => 12666, + 'count' => 1, + 'describtion' => "Change character name.", + 'points' => 20, + ), ); ?> \ No newline at end of file diff --git a/engine/function/general.php b/engine/function/general.php index ec7a890..b671d17 100644 --- a/engine/function/general.php +++ b/engine/function/general.php @@ -1,7 +1,7 @@ 0, 2 => 100, 3 => 200, 4 => 400, 5 => 800, 6 => 1500, 7 => 2600, 8 => 4200, 9 => 6400, 10 => 9300, 11 => 13000, 12 => 17600, 13 => 23200, 14 => 29900, 15 => 37800, 16 => 47000, 17 => 57600, 18 => 69700, 19 => 83400, 20 => 98800, 21 => 116000, 22 => 135100, 23 => 156200, 24 => 179400, 25 => 204800, 26 => 232500, 27 => 262600, 28 => 295200, 29 => 330400, 30 => 368300, 31 => 409000, 32 => 452600, 33 => 499200, 34 => 548900, 35 => 601800, 36 => 658000, 37 => 717600, 38 => 780700, 39 => 847400, 40 => 917800, 41 => 992000, 42 => 1070100, 43 => 1152200, 44 => 1238400, 45 => 1328800, 46 => 1423500, 47 => 1522600, 48 => 1626200, 49 => 1734400, 50 => 1847300, 51 => 1965000, 52 => 2087600, 53 => 2215200, 54 => 2347900, 55 => 2485800, 56 => 2629000, 57 => 2777600, 58 => 2931700, 59 => 3091400, 60 => 3256800, 61 => 3428000, 62 => 3605100, 63 => 3788200, 64 => 3977400, 65 => 4172800, 66 => 4374500, 67 => 4582600, 68 => 4797200, 69 => 5018400, 70 => 5246300, 71 => 5481000, 72 => 5722600, 73 => 5971200, 74 => 6226900, 75 => 6489800, 76 => 6760000, 77 => 7037600, 78 => 7322700, 79 => 7615400, 80 => 7915800, 81 => 8224000, 82 => 8540100, 83 => 8864200, 84 => 9196400, 85 => 9536800, 86 => 9885500, 87 => 10242600, 88 => 10608200, 89 => 10982400, 90 => 11365300, 91 => 11757000, 92 => 12157600, 93 => 12567200, 94 => 12985900, 95 => 13413800, 96 => 13851000, 97 => 14297600, 98 => 14753700, 99 => 15219400, 100 => 15694800, 101 => 16180000, 102 => 16675100, 103 => 17180200, 104 => 17695400, 105 => 18220800, 106 => 18756500, 107 => 19302600, 108 => 19859200, 109 => 20426400, 110 => 21004300, 111 => 21593000, 112 => 22192600, 113 => 22803200, 114 => 23424900, 115 => 24057800, 116 => 24702000, 117 => 25357600, 118 => 26024700, 119 => 26703400, 120 => 27393800, 121 => 28096000, 122 => 28810100, 123 => 29536200, 124 => 30274400, 125 => 31024800, 126 => 31787500, 127 => 32562600, 128 => 33350200, 129 => 34150400, 130 => 34963300, 131 => 35789000, 132 => 36627600, 133 => 37479200, 134 => 38343900, 135 => 39221800, 136 => 40113000, 137 => 41017600, 138 => 41935700, 139 => 42867400, 140 => 43812800, 141 => 44772000, 142 => 45745100, 143 => 46732200, 144 => 47733400, 145 => 48748800, 146 => 49778500, 147 => 50822600, 148 => 51881200, 149 => 52954400, 150 => 54042300, 151 => 55145000, 152 => 56262600, 153 => 57395200, 154 => 58542900, 155 => 59705800, 156 => 60884000, 157 => 62077600, 158 => 63286700, 159 => 64511400, 160 => 65751800, 161 => 67008000, 162 => 68280100, 163 => 69568200, 164 => 70872400, 165 => 72192800, 166 => 73529500, 167 => 74882600, 168 => 76252200, 169 => 77638400, 170 => 79041300, 171 => 80461000, 172 => 81897600, 173 => 83351200, 174 => 84821900, 175 => 86309800, 176 => 87815000, 177 => 89337600, 178 => 90877700, 179 => 92435400, 180 => 94010800, 181 => 95604000, 182 => 97215100, 183 => 98844200, 184 => 100491400, 185 => 102156800, 186 => 103840500, 187 => 105542600, 188 => 107263200, 189 => 109002400, 190 => 110760300, 191 => 112537000, 192 => 114332600, 193 => 116147200, 194 => 117980900, 195 => 119833800, 196 => 121706000, 197 => 123597600, 198 => 125508700, 199 => 127439400, 200 => 129389800); - - return ($level > 0 && $level <= 200) ? $experience[$level] : false; + return 50/3*(pow($level, 3) - 6*pow($level, 2) + 17*$level - 12); } // Parameter: players.hide_char returns: Status word inside a font with class identifier so it can be designed later on by CSS. diff --git a/myaccount.php b/myaccount.php index 34ba273..aa3bdca 100644 --- a/myaccount.php +++ b/myaccount.php @@ -46,6 +46,55 @@ if (!empty($_POST['selected_delete'])) { } } // end +// CHANGE character name +if (!empty($_POST['change_name'])) { + if (!Token::isValid($_POST['token'])) { + exit(); + } + $oldname = getValue($_POST['change_name']); + $newname = getValue($_POST['newName']); + + + // Check if user is online + $player = false; + if ($config['TFSVersion'] === 'TFS_10') { + $player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'"); + $player['online'] = (user_is_online_10($player['id'])) ? 1 : 0; + } else $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '$oldname'"); + + // Check if player has bough ticket + $order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' LIMIT 1;"); + if ($order !== false) { + // Check if player and account matches + if ($session_user_id == $player['account_id'] && $session_user_id == $order['account_id']) { + // Check if new name is not occupied + $exist = mysql_select_single("SELECT `id` FROM `players` WHERE `name`='$newname';"); + if (!$exist) { + // Check if new name follow rules + $newname = validate_name($newname); + if ($newname !== false) { + $error = false; + // name restriction + $resname = explode(" ", $_POST['name']); + foreach($resname as $res) { + if(in_array(strtolower($res), $config['invalidNameTags'])) { + $error = true; + } + else if(strlen($res) == 1) { + $error = true; + } + } + if ($error === false) { + // Change the name! + mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;"); + mysql_delete("DELETE FROM `znote_shop_orders` WHERE `id`='".$order['id']."' LIMIT 1;"); + } else echo "Illegal name."; + } else echo "Name validation failed, use another name."; + } else echo "The character name you wish to change to already exist."; + } else echo "Failed to sync your account. :|"; + } else echo "Did not find any name change tickets, but them in our shop!"; +} +// end // Change character sex if (!empty($_POST['change_gender'])) { if (!Token::isValid($_POST['token'])) { @@ -221,6 +270,27 @@ if (!empty($_POST['selected_comment'])) { + +