%%%-------------------------------------------------------------------
%%% @doc     星辰副本-头文件
%%% Module  : dungeon_galaxy.hrl
%%% Created : 2020-08-28
%%% @Author : ljy
%%%-------------------------------------------------------------------

-define(DUN_GALAXY_BOSS, dun_galaxy_boss).

-define(BOSS_ALIVE,   0).       %% 初始状态
-define(BOSS_INVINCIBLE,  1).   %% 无敌状态
-define(BOSS_BEATABLE,  2).     %% 解除无敌状态

-record(role_chapter_info,{
    chapter_id    = 0       %% 所处章节
    ,reward_info  = []      %% 奖励领取情况
}).

%% ==================================== 后台配置 ===========================
%% 常量配置表
-record(dun_galaxy_kv_cfg, {
    id            = 0       %% Id
    ,key          = ""      %% 键
    ,value        = ""      %% 值
    ,remark       = ""      %% 描述
}).

%% 章节奖励配置表
-record(dun_galaxy_chapter_cfg, {
    chapter_id    = 0       %% Id
    ,dun_ids      = []      %% 章节所包含的副本id
    ,final_dun_id = 0       %% 章节最大副本id
    ,reward       = []      %% 奖励
    ,next_id      = 0       %% 下一章节id
}).

%% 下一副本配置表
-record(dun_galaxy_next_cfg, {
    dun_id          = 0      %% 副本Id
    ,next_id        = 0      %% 下一副本Id
    ,stars_reward   = []     %% 首通星级奖励
    ,normal_reward  = []     %% 普通星级奖励
}).

%% ============================= 数据库操作 =============================
%% 章节奖励
-define(SQL_SELECT_GALAXY_DUN_REWARD,
    <<"SELECT star_list FROM galaxy_dun_chapter_reward WHERE role_id = ~p and chapter_id = ~p">>).
-define(SQL_INSERT_GALAXY_DUN_REWARD,
    <<"REPLACE INTO galaxy_dun_chapter_reward (`role_id`, `chapter_id`, `star_list`) VALUES (~p, ~p, '~s')">>).
%% 玩家所处章节
-define(SQL_SELECT_GALAXY_CHAPTER,
    <<"SELECT chapter_id FROM galaxy_dun_chapter WHERE role_id = ~p limit 1">>).
-define(SQL_INSERT_DUN_GALAXY_CHAPTER,
    <<"REPLACE INTO galaxy_dun_chapter (`role_id`, `chapter_id`) VALUES (~p, ~p)">>).