%% ----------------------------------
%% desc     :器灵寻宝头文件
%% module   :marble.hrl
%% time     :19/12/17
%% author   :hh
%% ----------------------------------

%% 弹珠人物数据(暂废弃)
-record(role_marble, {
    marble_count = 0,       %% 今日弹珠次数
    marble_reset = 0,       %% 弹珠重置次数
    energy_pro = 0,         %% 充能节点进度
    marble_time = 0,        %% 最后操作时间
    energy_rewards = [],    %% 充能节点奖励领取信息
    fixed_rewards = [],     %% 充能节点保底奖励
    qua_indexs = [],        %% 品质分布
    start_time = 0,         %% 开始时间(不保存)
    cost_type = 0,          %% 弹射消耗是否自动补齐 0不补齐|1补齐
    marble_cost = [],       %% 本次抽奖成本(不保存)
    online_cross_day = 0    %% 在线跨天标志 0|1
    }).

%% 器灵寻宝-格子玩法人物数据
-record(role_lattice, {
    role_id = 0,            %% 人物id
    pos = 0,                %% 当前位置
    circle = 0,             %% 第几轮
    update_time = 0,        %% 更新时间
    circle_reward = []      %% 轮次奖励
    }).

%% 器灵寻宝-商店数据
-record(role_lattice_shop, {
    shop_count = 0,         %% 今日商店手动重置次数
    shop_time = 0,          %% 商店最近操作时间    
    shop_info = [],         %% 商店购买信息 [{index, state},...]
    online_cross_day = 0    
    }).


%% 器灵寻宝-商店配置
-record(base_equip_shop, {
    index = 0,              %% 商品条目
    is_pay = 0,             %% 0免费|1付费
    discount = 0,           %% 折扣
    price = 0,              %% 价格
    goods = 0,              %% 商品
    weight_val = 0          %% 权重
    }).

%% 器灵寻宝-格子奖励配置
-record(base_lattice_reward, {
    pos = 0,                %% 位置
    circle = 0,             %% 轮数
    type = 0,               %% 类型 1普通|2展示|3最终
    rand_reward = [],       %% 随机奖励
    reward = [],            %% 必得奖励
    double_chance = [],     %% 双倍概率
    reward_show = []        %% 奖励展示
    }).


%% 以下几个弹珠配置暂废弃
%% ---------------------------------------------
%% 弹珠收益配置
-record(base_marble_reward, {
    id = 0,                 %% id
    qualitys = [],          %% 品质分布
    val = 0                 %% 权重
    }).

%% 弹珠品质收益配置
-record(base_marble_qual_reward, {
    qual_id = 0,            %% 品质id
    rewards = [],           %% 奖励
    energy_point = 0        %% 充能点数
    }).

%% 弹珠充能次数奖励配置
-record(base_marble_count_reward, {
    index = 0,              %% index
    count = 0,              %% 充能点数节点
    reward = [],            %% 奖励池
    fixed_reward = [],      %% 保底奖励(随机)
    rand_count = 0          %% 随机抽取次数
    }).

-define(MARBLE_TIME_LIMIT, 60).

-define(COSTOPT_1, 1).      %% 优先扣代金券
-define(COSTOPT_2, 2).      %% 优先扣钻石

%% 弹珠玩法
-define(ROLE_MARBLE_SELECT, 
    <<"SELECT `marble_count`, `marble_reset`, `energy_pro`, `marble_time`, `energy_rewards`, `fixed_rewards`, `qua_indexs` FROM role_marble WHERE role_id = ~p">>).
-define(ROLE_MARBLE_REPLACE, 
    <<"REPLACE INTO role_marble SET `role_id` = ~p, `marble_count` = ~p, `marble_reset` = ~p, `energy_pro` = ~p, `marble_time` = ~p,
     `energy_rewards` = ~ts, `fixed_rewards` = ~ts, `qua_indexs` = ~ts">>).

%% ---------------------------------------------


%% 器灵寻宝-走格子
-define(SQL_LATTICE_SELECT, 
    <<"select pos, circle, update_time, circle_reward from role_lattice where role_id = ~p">>).
-define(SQL_LATTICE_REPLACE, 
    <<"replace into role_lattice set role_id = ~p, pos = ~p, circle = ~p, update_time = ~p, circle_reward = '~ts'">>).
-define(SQL_CELL_UPDATE, 
    <<"update role_lattice set pos = ~p, circle = ~p, update_time = ~p where role_id = ~p">>).

%% 器灵寻宝-器灵商店
-define(ROLE_LATTICE_SHOP_SELECT, 
    <<"SELECT `shop_count`, `shop_time`, `shop_info` FROM role_lattice_shop WHERE `role_id` = ~p">>).
-define(ROLE_LATTICE_REPLACE, 
    <<"REPLACE INTO role_lattice_shop SET `role_id` = ~p, `shop_count` = ~p, `shop_time` = ~p, `shop_info` = ~ts">>).

-define(VOUCHER,         1). %% 代金券方式
-define(GOLD_CONSUME,    0). %% 正常消耗方式

-define(CONSUME_TYPES, [?VOUCHER, ?GOLD]).

-define(VOU_FOR_GOLD, 15). %% 一张代金券可抵绑元数

-define(MARBLE_SHOP_UNGET, 0).
-define(MARBLE_SHOP_GETED, 1).

-define(ROLL_MAX_POINT, 6).

-define(LATTICE_DAILY_FREE,     1).     %% 日免费次数
-define(LATTICE_DAILY_RESET,    2).     %% 日重置次数