-- tyl 功能预告日志
CREATE TABLE `log_advance_produce` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_lv` int(11) unsigned NOT NULL COMMENT '角色等级',
  `func_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '功能Id',
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT '功能名称',
  `con_desc` varchar(255) NOT NULL DEFAULT '' COMMENT '条件描述',
  `reward` varchar(255) NOT NULL DEFAULT '' COMMENT '奖励',
  `days` 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`) USING BTREE,
  KEY `func_id` (`func_id`) USING BTREE,
  KEY `name` (`name`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='功能预告产出日志';

-- 龙神扭蛋日志
CREATE TABLE `log_capsule_egg_award_times` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `pool_type` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '奖池类型',
  `times` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前累计抽奖次数',
  `times_need` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '奖励次数要求',
  `award` varchar(255) NOT NULL DEFAULT '[]' COMMENT '奖励',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `pool_type` (`pool_type`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='扭蛋宝库累计次数奖励日志表';

CREATE TABLE `log_capsule_egg_draw` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `pool_type` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '奖池类型',
  `type` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '抽奖类型 1单抽 2十连 3五十连',
  `award` varchar(1000) NOT NULL DEFAULT '[]' COMMENT '奖励',
  `color_max` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '最高奖励档位',
  `absolute` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '必出档位  1有 0无',
  `cost` varchar(255) NOT NULL DEFAULT '[]' COMMENT '消耗列表',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `pool_type` (`pool_type`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `color_max` (`color_max`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='扭蛋宝库抽奖日志表';

-- 精英考核日志
CREATE TABLE `log_elite_assess_award` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_lv` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '角色等级',
  `category` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '章节',
  `sub_category` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '子章节',
  `type` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '操作类型 1-领取任务奖励 2-领取章节奖励',
  `reward_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '奖励对应Id',
  `reward_desc` varchar(255) NOT NULL DEFAULT '' COMMENT '奖励对应名称',
  `reward` varchar(255) NOT NULL DEFAULT '[]' COMMENT '奖励',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `category` (`category`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `reward_id` (`reward_id`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='精英考核奖励日志';

CREATE TABLE `log_elite_assess_task` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_lv` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '角色等级',
  `category` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '章节',
  `sub_category` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '子章节',
  `task_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '任务Id',
  `task_desc` varchar(255) NOT NULL DEFAULT '' COMMENT '任务描述',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `category` (`category`) USING BTREE,
  KEY `task_id` (`task_id`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='精英考核任务日志';

-- 灵能升级日志
CREATE TABLE `log_nucleon_lv` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `old_lv` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '旧等级',
  `new_lv` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '新等级',
  `task` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '任务',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='灵能升级日志';


-- 灵能装备穿戴日志
CREATE TABLE `log_nucleon_equip` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `opty` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作类型0穿1脱',
  `slot` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '槽位',
  `old_item` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '旧道具',
  `new_item` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '新道具',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='灵能装备穿戴日志';


ALTER TABLE `log_nucleon_equip_upgrade`
MODIFY COLUMN `name`  varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '[]' COMMENT '名称' AFTER `role_id`,
ADD COLUMN `auto_buy`  tinyint(2) NOT NULL DEFAULT 0 COMMENT '是否自动购买0否' AFTER `opty`;

ALTER TABLE `log_nucleon_hunt`
MODIFY COLUMN `opty`  int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '奖池类型1普通2高级' AFTER `name`,
MODIFY COLUMN `num`  int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '1单抽2十连' AFTER `opty`;

ALTER TABLE `log_nucleon_hunt`
ADD COLUMN `is_free`  tinyint(2) NOT NULL DEFAULT 0 COMMENT '是否免费' AFTER `num`;

-- 灵能兑换日志
CREATE TABLE `log_nucleon_exchange` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `gain` varchar(200) NOT NULL DEFAULT '[]' COMMENT '奖励',
  `cost` varchar(255) NOT NULL DEFAULT '[]' COMMENT '消耗列表',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='灵能兑换日志';


CREATE TABLE `log_rank`(
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '编号',
    `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家id',
    `nick_name` varchar(256) NOT NULL DEFAULT "" COMMENT '玩家名称',
    `career` smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家职业',
    `rank_type` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排行榜类型',
    `rank` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排名',
    `value` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排名值',
    `time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '时间',
    PRIMARY KEY(`id`),
    KEY `rank_type` (`rank_type`) USING BTREE,
    KEY `career` (`career`) USING BTREE,
    KEY `time` (`time`) USING BTREE
)ENGINE=InnoDB CHARSET=utf8 COMMENT="个人排行榜日志";

CREATE TABLE `log_cross_rank`(
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '序号',
    `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家id',
    `nick_name` varchar(256) NOT NULL DEFAULT "" COMMENT '玩家名称',
    `rank_type` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排行榜类型',
    `rank` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排名',
    `value` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排名值',
    `time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '时间',
    `server_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '服务器编号',
    `server_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '服务器id',
    `zone_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '区编号',
    PRIMARY KEY(`id`),
    KEY `rank_type` (`rank_type`) USING BTREE,
    KEY `time` (`time`) USING BTREE
)ENGINE=InnoDB CHARSET=utf8 COMMENT="跨服个人排行榜日志";

ALTER TABLE `log_god_operate`
    ADD COLUMN `old_star` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作前星数' AFTER `op_type`;
ALTER TABLE `log_god_operate`
    ADD COLUMN `old_lv` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作前等级' AFTER `star`;
ALTER TABLE `log_god_operate`
    ADD COLUMN `name` varchar(500) NOT NULL DEFAULT "" COMMENT '玩家名称' AFTER `role_id`;

ALTER TABLE `log_god_equip_upgrade`
    ADD COLUMN `old_lv` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作前等级' AFTER `god_id`;
ALTER TABLE `log_god_equip_upgrade`
    ADD COLUMN `old_exp` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作前经验' AFTER `lv`;
ALTER TABLE `log_god_equip_upgrade`
    ADD COLUMN `slot` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '装备位置' AFTER `god_id`;
ALTER TABLE `log_god_equip_upgrade`
    ADD COLUMN `type` smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT '装备类型' AFTER `slot`;


-- 放置经验日志
CREATE TABLE `log_onhook_result`(
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '序号',
  `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家id',
  `start_lv` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领奖前等级',
  `after_lv` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领奖后等级',
  `exp` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家获得经验',
  `cost_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '消耗挂机时长(s)',
  `rewards` varchar(800) NOT NULL DEFAULT '[]' COMMENT '奖励列表',
  `time` int(11) NOT NULL DEFAULT 0 COMMENT '操作时间',
  PRIMARY KEY(`id`)
)ENGINE=InnoDB CHARSET=utf8 COMMENT="放置冒险日志";

-- 快速放置冒险日志
CREATE TABLE `log_onhook_fast`(
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '序号',
  `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家id',
  `vip_lv` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'VIP等级',
  `type` tinyint(2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作类型',
  `times` smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT '今日领取次数',
  `rest_times` smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领取剩余次数',
  `pre_gold` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '购买前彩钻数',
  `after_gold` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '购买后彩钻数',
  `cost` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '消耗彩钻数',
  `exp` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家获得经验',
  `rewards` varchar(800) NOT NULL DEFAULT '[]' COMMENT '奖励列表',
  `time` int(11) NOT NULL DEFAULT 0 COMMENT '操作时间',
  PRIMARY KEY(`id`)
)ENGINE=InnoDB CHARSET=utf8 COMMENT="快速放置冒险日志";