Skip to content

Commit

Permalink
Обновлен сервер.
Browse files Browse the repository at this point in the history
  • Loading branch information
devapromix committed Nov 10, 2022
1 parent d54a4cb commit dc358df
Show file tree
Hide file tree
Showing 14 changed files with 1,807 additions and 15 deletions.
27 changes: 20 additions & 7 deletions worlds/elvion/includes/class.location.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

class Location {

public const SHOP_ARMOR = 1;
public const SHOP_WEAPON = 2;
public const SHOP_ALCHEMY = 3;
public const SHOP_MAGIC = 4;
public const TAVERN = 7;
public const BANK = 9;
public const SHOP_ARMOR = 1;
public const SHOP_WEAPON = 2;
public const SHOP_ALCHEMY = 3;
public const SHOP_MAGIC = 4;
public const TAVERN = 7;
public const BANK = 9;

public const REGION_VILMAR = 1;
public const REGION_EYRINOR = 11;

public const RAND_PLACE_COUNT = 7;
public const RAND_PLACE_COUNT = 7;

public function __construct() {

Expand Down Expand Up @@ -367,6 +370,16 @@ public function get_welcome_phrase($category_ident, $flag = true) {
return $phrase['text'];
}

public static function get_race_start_location($charrace) {
switch($charrace) {
case Player::RACE_ELF:
return self::REGION_EYRINOR;
break;
default:
return self::REGION_VILMAR;
break;
}
}

}

Expand Down
14 changes: 7 additions & 7 deletions worlds/elvion/includes/class.user.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class User {

static function init($username, $userpass) {
public static function init($username, $userpass) {
global $tb_user, $connection;
self::check_login_data($username, $userpass);
$query = 'SELECT * FROM '.$tb_user." WHERE user_name='".$username."' AND user_pass='".$userpass."'";
Expand All @@ -11,14 +11,14 @@ static function init($username, $userpass) {
return $result->fetch_assoc();
}

static function session() {
public static function session() {
global $user;
$user['user_session'] = time();
User::update("user_session='".$user['user_session']."'");
return $user['user_session'];
}

static function check_user($user_name) {
public static function check_user($user_name) {
global $connection, $tb_user;
$query = "SELECT user_name FROM ".$tb_user." WHERE user_name='".$user_name."'";
$user = mysqli_query($connection, $query) or die('{"error":"Ошибка сохранения данных: '.mysqli_error($connection).'"}');
Expand All @@ -29,7 +29,7 @@ static function check_user($user_name) {
}
}

static function check_char($char_name) {
public static function check_char($char_name) {
global $user;
if (strtolower($user['char_name']) == strtolower($char_name)) {
return true;
Expand All @@ -38,15 +38,15 @@ static function check_char($char_name) {
}
}

static function update($s) {
public static function update($s) {
global $user, $tb_user, $connection;
$query = "UPDATE ".$tb_user." SET ".$s." WHERE user_name='".$user['user_name']."'";
if (!mysqli_query($connection, $query)) {
die('{"error":"Ошибка сохранения данных: '.mysqli_error($connection).'"}');
}
}

static private function check_login_data($username, $userpass) {
public static function check_login_data($username, $userpass) {
if ($username == '') die('{"error":"Введите имя учетной записи!"}');
if (strlen($username) < 4) die('{"error":"Имя учетной записи не должно быть короче 4 символов!"}');
if (strlen($username) > 24) die('{"error":"Имя учетной записи должно быть длиннее 24 символов!"}');
Expand All @@ -55,7 +55,7 @@ static private function check_login_data($username, $userpass) {
if (strlen($userpass) > 24) die('{"error":"Пароль не должен быть длиннее 24 символов!"}');
}

static public function check_registration_data($username, $userpass, $charname) {
public static function check_registration_data($username, $userpass, $charname) {
if ($username == '') die('{"error":"Введите имя учетной записи!"}');
if (strlen($username) < 4) die('{"error":"Имя учетной записи не должно быть короче 4 символов!"}');
if (strlen($username) > 24) die('{"error":"Имя учетной записи должно быть длиннее 24 символов!"}');
Expand Down
Loading

0 comments on commit dc358df

Please sign in to comment.