-- liushl
-- 本服社团战
drop table if exists guild_war_division;
drop table if exists guild_war_reward;
drop table if exists guild_war_break_reward;
drop table if exists guild_war_key_val;
drop table if exists log_guild_war_allot_reward;
drop table if exists log_guild_war_battle;
drop table if exists log_guild_war_division;
drop table if exists log_guild_war_reward;
drop table if exists log_guild_war_scene;
CREATE TABLE `log_guild_war_role_rank` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '序号',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '玩家ID',
  `name` varchar(50) NOT NULL DEFAULT '[]' COMMENT '名称',
  `rank` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '排名',
  `score` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY role_id(`role_id`),
  KEY time(`time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='日志-社团战本服-个人排名';
CREATE TABLE `log_guild_war_guild_rank` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '序号',
  `guild_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '社团ID',
  `name` varchar(50) NOT NULL DEFAULT '[]' COMMENT '名称',
  `rank` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '排名',
  `score` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY guild_id(`guild_id`),
  KEY name(`name`),
  KEY time(`time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='日志-社团战本服-社团排名';


-- tyl
-- 精英考核
CREATE TABLE IF NOT EXISTS `elite_assess_category_reward` (
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `category` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '章节',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '奖励领取状态 0: 未达成 1: 已达成 2: 已领取',
  PRIMARY KEY (`role_id`,`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='精英考核-章节奖励数据表';

CREATE TABLE IF NOT EXISTS `elite_assess_task` (
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `task_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '任务Id',
  `progress` int(2) unsigned NOT NULL DEFAULT '0' COMMENT '进度',
  `status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '奖励领取状态 0: 未达成 1: 已达成 2: 已领取',
  PRIMARY KEY (`role_id`,`task_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='精英考核-任务数据表';

-- hh
-- 唤神系统
CREATE TABLE `role_god` (
  `role_id` bigint(20) UNSIGNED NOT NULL COMMENT '玩家id',
  `unlock_pos` varchar(500) NOT NULL DEFAULT '[]' COMMENT '出战解锁信息[{出战位置/援助位置|_]',
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='玩家唤神神相关信息';


CREATE TABLE `role_god_info` (
  `role_id` bigint(20) UNSIGNED NOT NULL COMMENT '玩家id',
  `god_id` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '唤神id',
  `star` int(11) NOT NULL DEFAULT '0' COMMENT '星级',
  `lv` int(11) NOT NULL DEFAULT '0' COMMENT '等级',
  `exp` int(11) NOT NULL DEFAULT '0' COMMENT '经验',
  `pos` smallint(5) NOT NULL DEFAULT '0' COMMENT '出战位置##0未出战|1-99为出战位置|101-9999为援护位置',
  `skills` varchar(500) NOT NULL DEFAULT '[]' COMMENT '技能等级##[{技能id,技能等级}|_]',
  PRIMARY KEY (`role_id`,`god_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='玩家唤神信息';


CREATE TABLE `log_god_operate` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '序号',
  `role_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '玩家ID',
  `god_id` int(11) NOT NULL DEFAULT '0' COMMENT '唤神id',
  `op_type` smallint(2) NOT NULL DEFAULT '0' COMMENT '操作类型##1激活/2升星/3升级/5技能',
  `star` int(11) NOT NULL DEFAULT '0' COMMENT '当前星级',
  `lv` int(11) NOT NULL DEFAULT '0' COMMENT '当前等级',
  `exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前经验值',
  `skill` varchar(500) NOT NULL DEFAULT '[]' COMMENT '当前技能状态',
  `cost` varchar(500) NOT NULL DEFAULT '[]' COMMENT '消耗',
  `time` int(11) UNSIGNED DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT="玩家唤神操作日志";


CREATE TABLE `log_god_equip_upgrade` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '序号',
  `role_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '玩家ID',
  `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '装备id',
  `god_id` int(11) NOT NULL DEFAULT '0' COMMENT '唤神id',
  `lv` int(11) NOT NULL DEFAULT '0' COMMENT '当前等级',
  `exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前经验',
  `cost` varchar(5000) NOT NULL DEFAULT '[]' COMMENT '消耗##[{装备id,是否绑定,装备等级,装备经验}|_]',
  `add_exp` int(11) NOT NULL DEFAULT '0' COMMENT '提供的经验',
  `time` int(11) UNSIGNED DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='唤神装备升级日志';

-- tyl
-- 修改宠物副本排行榜
DROP TABLE IF EXISTS `dun_pet_rank`;
CREATE TABLE `dun_pet_rank` (
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `score` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分',
  `reach_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '达成时间',
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- -------------------------------------------------
-- 跨服分区相关功能部分表
-- huangyongxing
-- 2020-07-16
-- -------------------------------------------------
-- 跨服分区管理 - 已注册服务器的信息
CREATE TABLE `center_reg_svr` (
  `server_id` smallint(5) unsigned NOT NULL COMMENT '游戏服id',
  `server_num` smallint(5) unsigned NOT NULL COMMENT '游戏服编号',
  `svr_cid` int(11) unsigned NOT NULL COMMENT '全部跨服唯一编号（0为未正式分配）',
  `m_server_ids` text COMMENT '游戏服合服列表',
  `open_time` int(11) unsigned NOT NULL COMMENT '开服时间',
  `time` int(11) unsigned NOT NULL COMMENT '数据更新时间',
  PRIMARY KEY (`server_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跨服中心已注册游戏服信息';

-- 全跨服游戏服唯一id维护管理
CREATE TABLE `center_svr_cid` (
  `center_id` smallint(5) unsigned NOT NULL COMMENT '跨服中心id',
  `reg_cnt` smallint(5) unsigned NOT NULL COMMENT '当前已注册数量，程序中将此值与center_id按规则生成svr_cid',
  PRIMARY KEY (`center_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='全跨服游戏服唯一id维护管理（跨服中心数据表）';

-- 标准跨服分区信息表
CREATE TABLE `center_zones` (
  `center_id` smallint(5) unsigned NOT NULL COMMENT '跨服中心id',
  `main_reg_order` smallint(5) unsigned NOT NULL COMMENT '分区各服中挑选的主注册序号',
  `stage` tinyint(3) unsigned NOT NULL COMMENT '分区阶段',
  `server_ids` text NOT NULL COMMENT '游戏服server_id列表',
  PRIMARY KEY (`center_id`, `main_reg_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='标准跨服分区之分区信息表';

-- 标准跨服分区单服基础信息表
CREATE TABLE `center_zone_svr_base` (
  `server_id` smallint(5) unsigned NOT NULL COMMENT '主服游戏服server_id',
  `faction` tinyint(3) unsigned NOT NULL COMMENT '阵营',
  `world_level` smallint(5) unsigned NOT NULL COMMENT '世界等级',
  PRIMARY KEY (`server_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='标准跨服分区单服基础信息表';

-- 跨服注册服基本信息表
CREATE TABLE `center_svr_base` (
  `server_id` smallint(5) unsigned NOT NULL COMMENT '游戏服id',
  `server_num` smallint(5) unsigned NOT NULL COMMENT '游戏服编号',
  `server_name` varchar(100) NOT NULL COMMENT '游戏服名称',
  PRIMARY KEY (`server_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跨服注册服基本信息表';
-- -------------------------------------------------
