DROP TABLE IF EXISTS `cross_guild_war_city_info`;
CREATE TABLE `cross_guild_war_city_info` (
    `zone_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区Id',
    `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '城池Id',
    `server_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '游戏服ServerId',
    `server_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '游戏服编号(玩家看到的服数)',
    `guild_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '帮派Id',
    `guild_name` varchar(50) NOT NULL DEFAULT '' COMMENT '帮派名称',
    `guild_power` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '帮派战力',
    `chief_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '帮主Id',
    `chief_name` varchar(50) NOT NULL DEFAULT '' COMMENT '帮主名称',
    `chief_power` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '帮主战力',
    PRIMARY KEY (`zone_id`,`city_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跨服帮战-城池占领信息(在跨服中使用-保留主跨服的)';

DROP TABLE IF EXISTS `log_cgwar_city_info`;
CREATE TABLE `log_cgwar_city_info` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
    `zone_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区Id',
    `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '城池Id',
    `server_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '游戏服ServerId',
    `server_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '游戏服编号(玩家看到的服数)',
    `guild_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '帮派Id',
    `guild_name` varchar(50) NOT NULL DEFAULT '' COMMENT '帮派名称',
    `guild_power` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '帮派战力',
    `chief_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '帮主Id',
    `chief_name` varchar(50) NOT NULL DEFAULT '' COMMENT '帮主名称',
    `chief_power` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '帮主战力',
    `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='跨服国战往期战报';

DROP TABLE IF EXISTS `cross_guild_war_guild_info`;
CREATE TABLE `cross_guild_war_guild_info` (
    `guild_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '帮派Id',
    `node_name` varchar(100) NOT NULL DEFAULT '' COMMENT '所在节点',
    `server_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '游戏服ServerId',
    `server_num` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '服务器编号(玩家可见的服编号)',
    `zone_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区Id',
    `guild_name` varchar(100) NOT NULL DEFAULT '' COMMENT '帮派名称',
    `guild_power` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '帮派战力',
    `chief_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '帮主Id',
    `chief_name` varchar(50) NOT NULL DEFAULT '' COMMENT '帮主名称',
    `chief_power` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '帮主战力',
    `sign_ups` varchar(6000) NOT NULL DEFAULT '[]' COMMENT '报名列表',
    `help_ups` varchar(6000) NOT NULL DEFAULT '[]' COMMENT '外援列表',
    `supports` text NOT NULL COMMENT '支援列表',
    `support_num` int(11) NOT NULL DEFAULT '0' COMMENT '支援人数',
    PRIMARY KEY (`guild_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跨服帮战-参战(报名)帮派信息(在跨服中使用-保留主跨服的)';


DROP TABLE IF EXISTS `log_cross_guild_war`;
CREATE TABLE `log_cross_guild_war` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
    `zone` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区ID',
    `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '玩家id',
    `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
    `guild` bigint(11) unsigned NOT NULL DEFAULT '0' COMMENT '社团',
    `stage` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '跨服阶段',
    `power` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '战力',
    `filed` 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 `guild` (`guild`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='跨服国战参与日志';

DROP TABLE IF EXISTS `log_cross_guild_war_conquer`;
CREATE TABLE `log_cross_guild_war_conquer` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
    `zone` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区ID',
    `server_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器ID(后台唯一服号)',
    `server_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器编号(玩家可见的服编号)',
    `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '玩家id',
    `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
    `guild` bigint(11) unsigned NOT NULL DEFAULT '0' COMMENT '社团',
    `is_lord` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否团长',
    `city` 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 `zone` (`zone`),
    KEY `guild` (`guild`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='跨服国战占领日志';


CREATE TABLE `role_legion`(
    `rid` bigint(20) UNSIGNED NOT NULL COMMENT '玩家id',
    `post` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '军衔',
    `score` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分积累',
    `rank_score` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排名积分',
    `arms` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '军备值',
    `process` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '进度值',
    `dot` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领取点',
    `click_role` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已膜拜',
    `day_award` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '每日领取态',
    `tasks` varchar(2000) NOT NULL DEFAULT '[]' COMMENT '任务',
    `ltime` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '上次更新时间',
    PRIMARY KEY(`rid`)
)ENGINE=InnoDb CHARSET=utf8 COMMENT="玩家战团数据";

-- 当期榜单数据
CREATE TABLE `legion_rank_now`(
    `rid` bigint(20) UNSIGNED NOT NULL COMMENT '玩家id',
    `name` varchar(200) NOT NULL DEFAULT '[]' COMMENT '玩家名',
    `zone` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区ID',
    `fact` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '阵营',
    `server_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器ID(后台唯一服号)',
    `server_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器编号(玩家可见的服编号)',
    `sex` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别',
    `career` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '职业',
    `turn` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '转生',
    `vip` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'vip',
    `sup_vip` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'svip',
    `picture` varchar(100) NOT NULL DEFAULT '' COMMENT '玩家上传的头像url',
    `picture_ver` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '玩家上传的头像版本号',
    `gname` varchar(200) NOT NULL DEFAULT '[]' COMMENT '社团名',
    `score` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分',
    `rank` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排名',
    `time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY(`rid`)
)ENGINE=InnoDb CHARSET=utf8 COMMENT="当期榜单数据";

-- 昨天榜单数据
CREATE TABLE `legion_rank_last`(
    `rid` bigint(20) UNSIGNED NOT NULL COMMENT '玩家id',
    `name` varchar(200) NOT NULL DEFAULT '[]' COMMENT '玩家名',
    `zone` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区ID',
    `fact` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '阵营',
    `server_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器ID(后台唯一服号)',
    `server_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器编号(玩家可见的服编号)',
    `sex` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别',
    `career` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '职业',
    `turn` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '转生',
    `vip` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'vip',
    `sup_vip` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'svip',
    `picture` varchar(100) NOT NULL DEFAULT '' COMMENT '玩家上传的头像url',
    `picture_ver` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '玩家上传的头像版本号',
    `gname` varchar(200) NOT NULL DEFAULT '[]' COMMENT '社团名',
    `score` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分',
    `rank` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排名',
    `time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY(`rid`)
)ENGINE=InnoDb CHARSET=utf8 COMMENT="昨天榜单数据";

-- 上周榜单数据
CREATE TABLE `legion_rank_week`(
    `rid` bigint(20) UNSIGNED NOT NULL COMMENT '玩家id',
    `name` varchar(200) NOT NULL DEFAULT '[]' COMMENT '玩家名',
    `zone` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区ID',
    `fact` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '阵营',
    `server_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器ID(后台唯一服号)',
    `server_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器编号(玩家可见的服编号)',
    `sex` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别',
    `career` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '职业',
    `turn` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '转生',
    `vip` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'vip',
    `sup_vip` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'svip',
    `picture` varchar(100) NOT NULL DEFAULT '' COMMENT '玩家上传的头像url',
    `picture_ver` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '玩家上传的头像版本号',
    `gname` varchar(200) NOT NULL DEFAULT '[]' COMMENT '社团名',
    `score` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分',
    `rank` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排名',
    `time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY(`rid`)
)ENGINE=InnoDb CHARSET=utf8 COMMENT="上期榜单数据";