From 00f3e439ffae3e59a1c0c51e690310d36f4acca0 Mon Sep 17 00:00:00 2001 From: makeyangcom Date: Thu, 14 Mar 2024 19:01:27 +0800 Subject: [PATCH] 3.0.0 --- wiki/course/2.0.0.md | 122 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/wiki/course/2.0.0.md b/wiki/course/2.0.0.md index 77d483c..ef0f225 100644 --- a/wiki/course/2.0.0.md +++ b/wiki/course/2.0.0.md @@ -51,4 +51,126 @@ GOPROXY=https://goproxy.io,direct ```shell go mod download +``` + +### 创建游戏所需的数据库 + +> 修改数据库配置中的IP地址为虚拟机的实际IP地址 + +> 创建名为`database`的数据库 + +```shell +database +``` + +> 执行下面的MySQL脚本创建游戏账号数据表 + +```mysql +CREATE TABLE `game_account_data` ( + `account_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号', + `account_account` varchar(140) NOT NULL DEFAULT '' COMMENT '邮箱账号', + `account_password` varchar(50) NOT NULL DEFAULT '' COMMENT '密码', + `account_name` varchar(50) NOT NULL DEFAULT '' COMMENT '真实姓名', + `account_number` varchar(140) NOT NULL DEFAULT '' COMMENT '身份证号码', + `account_question_a` varchar(140) NOT NULL DEFAULT '' COMMENT '问题一', + `account_question_b` varchar(140) NOT NULL DEFAULT '' COMMENT '问题二', + `account_answer_a` varchar(140) NOT NULL DEFAULT '' COMMENT '答案一', + `account_answer_b` varchar(140) NOT NULL DEFAULT '' COMMENT '答案二', + `account_status` tinyint(2) NOT NULL DEFAULT '2' COMMENT '状态 1:停用 2:启用', + `create_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `delete_at` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`account_id`), + KEY `status` (`account_status`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='游戏账号数据表'; +``` + +> 执行下面的MySQL脚本创建游戏服务器数据表 + +```mysql +CREATE TABLE `game_server_data` ( + `server_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号', + `server_name` varchar(50) NOT NULL DEFAULT '' COMMENT '服务器名称', + `server_status` tinyint(2) NOT NULL DEFAULT '2' COMMENT '状态 1:停用 2:启用', + `create_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `delete_at` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`server_id`), + KEY `status` (`server_status`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='游戏服务器数据表'; +``` + +> 执行下面的MySQL脚本创建游戏等级数据表 + +```mysql +CREATE TABLE `game_level_data` ( + `level_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号', + `level_server_id` int(11) NOT NULL DEFAULT '0' COMMENT '游戏编号', + `level_career` varchar(20) NOT NULL DEFAULT '' COMMENT '职业', + `level_name` int(50) NOT NULL DEFAULT '0' COMMENT '等级名称', + `level_min` int(11) NOT NULL DEFAULT '0' COMMENT '最小值', + `level_max` int(11) NOT NULL DEFAULT '0' COMMENT '最大值', + `level_life_value` int(11) NOT NULL DEFAULT '0' COMMENT '生命值', + `level_magic_value` int(11) NOT NULL DEFAULT '0' COMMENT '魔法值', + `level_status` tinyint(2) NOT NULL DEFAULT '2' COMMENT '状态 1:停用 2:启用', + `create_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `delete_at` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`level_id`), + KEY `status` (`level_status`), + KEY `server_id` (`level_server_id`) USING BTREE, + KEY `career` (`level_career`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8mb4 COMMENT='游戏等级数据表'; +``` + +> 执行下面的MySQL脚本创建游戏玩家数据表 + +```mysql +CREATE TABLE `game_player_data` ( + `player_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号', + `player_account_id` int(11) NOT NULL DEFAULT '0' COMMENT '账号编号', + `player_server_id` int(11) NOT NULL DEFAULT '0' COMMENT '服务器编号', + `player_nickname` varchar(50) NOT NULL DEFAULT '' COMMENT '昵称', + `player_career` varchar(20) NOT NULL DEFAULT '' COMMENT '职业', + `player_gender` varchar(20) NOT NULL DEFAULT '' COMMENT '性别', + `player_angle` int(11) NOT NULL DEFAULT '2' COMMENT '角度', + `player_map` varchar(50) NOT NULL DEFAULT '' COMMENT '地图', + `player_map_x` int(11) NOT NULL DEFAULT '0' COMMENT '地图X坐标', + `player_map_y` int(11) NOT NULL DEFAULT '0' COMMENT '地图Y坐标', + `player_asset_life` int(11) NOT NULL DEFAULT '0' COMMENT '生命值', + `player_asset_magic` int(11) NOT NULL DEFAULT '0' COMMENT '魔法值', + `player_asset_experience` int(11) NOT NULL DEFAULT '0' COMMENT '经验值', + `player_body_clothe` varchar(50) NOT NULL DEFAULT '' COMMENT '衣服', + `player_body_weapon` varchar(50) NOT NULL DEFAULT '' COMMENT '武器', + `player_body_wing` varchar(50) NOT NULL DEFAULT '' COMMENT '翅膀', + `player_group_id` int(11) NOT NULL DEFAULT '1' COMMENT '权限组', + `player_status` tinyint(2) NOT NULL DEFAULT '2' COMMENT '状态 1:停用 2:启用', + `create_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `delete_at` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`player_id`), + KEY `status` (`player_status`) USING BTREE, + KEY `account_id` (`player_account_id`) USING BTREE, + KEY `server_id` (`player_server_id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='游戏玩家数据表'; +``` + +> 执行下面的MySQL脚本创建游戏地图数据表 + +```mysql +CREATE TABLE `game_map_data` ( + `map_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号', + `map_server_id` int(11) NOT NULL DEFAULT '0' COMMENT '服务器编号', + `map_number` varchar(50) NOT NULL DEFAULT '' COMMENT '地图编号', + `map_name` varchar(50) NOT NULL DEFAULT '' COMMENT '地图名称', + `map_default_x` int(11) NOT NULL DEFAULT '0' COMMENT '默认X坐标', + `map_default_y` int(11) NOT NULL DEFAULT '0' COMMENT '默认Y坐标', + `map_status` tinyint(2) NOT NULL DEFAULT '2' COMMENT '状态 1:停用 2:启用', + `create_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `delete_at` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`map_id`), + KEY `status` (`map_status`) USING BTREE, + KEY `server_id` (`map_server_id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='游戏地图数据表'; ``` \ No newline at end of file