%%-----------------------------------------------------------------------------
|
|
%% @Module : fishing
|
|
%% @Author : lhy
|
|
%% @Email : liuhouying73@qq.com
|
|
%% @Created : 2018-09-25
|
|
%% @Description: 钓鱼系统
|
|
%%-----------------------------------------------------------------------------
|
|
|
|
%% 玩家钓鱼信息
|
|
-record(fishing,
|
|
{
|
|
lv = 1, %% 钓鱼等级
|
|
mastery = 0, %% 熟练度
|
|
fish_rod_usage_count = [], %% 鱼竿总剩余使用次数
|
|
fish_illu_map = #{}, %% 鱼鉴 {illu_id => #illu_info{}}
|
|
attr = [], %% 属性
|
|
fishing_gear_select = [], %% 渔具选择
|
|
fish_basket = [], %% 鱼筐记录
|
|
log_cache = [] %% 日志缓存
|
|
}).
|
|
|
|
-record(illu_info,
|
|
{
|
|
illu_id = 0, %% 鱼鉴id
|
|
illu_lv = 0 %% 鱼鉴等级
|
|
}).
|
|
|
|
-record(fishing_gear_select,
|
|
{
|
|
fishing_rod_id = 0, %% 选择的渔具ID
|
|
bait_id = 0, %% 选择的鱼饵ID
|
|
hooked_fish_id = 0 %% 已上钩的鱼类ID
|
|
}).
|
|
|
|
-record(log_cache,
|
|
{
|
|
scene_id = 0, %% 钓鱼场景ID
|
|
water_area = 0, %% 水域距离
|
|
maunal_or_auto = 0, %% 是否自动 1-手动 2-自动
|
|
rods_usage_cost = 0, %% 鱼竿使用次数消耗
|
|
energy_cost = 0 %% 活力值消耗
|
|
}).
|
|
|
|
%% --------------------------------- 配置 -------------------------------------------
|
|
%% 鱼类配置
|
|
-record(base_fish,
|
|
{
|
|
id = 0, %% 序号ID
|
|
fish_id = 0, %% 鱼类ID
|
|
name = "", %% 名称
|
|
quality_type = 0 , %% 品质类型
|
|
hook_probability = 0, %% 上钩概率 -万分比
|
|
range_of_balance = 0, %% 平衡范围
|
|
distri_water_area = [] %% 分布水域 [{1,2,3}]
|
|
}).
|
|
|
|
% 渔具配置
|
|
-record(base_fishing_gear,
|
|
{
|
|
id = 0, %% 序号ID
|
|
fishing_gear_id = 0, %% 渔具ID
|
|
fishing_gear_type = 0, %% 渔具类型 1-鱼竿 2-鱼饵
|
|
quality_type = 0, %% 品质类型
|
|
name = "", %% 名称
|
|
price = [], %% 价格 [{type, goods_id, num}]
|
|
usage_count = 0, %% 使用次数
|
|
probability = [], %% 概率加成
|
|
incr_mastery = 0 %% 熟练度增加值
|
|
}).
|
|
|
|
%% 钓鱼等级
|
|
-record(base_fishing_lv,
|
|
{
|
|
id = 0, %% 序号ID
|
|
lv = 0, %% 钓鱼等级
|
|
mastery = 0, %% 熟练度
|
|
no_comsume_rod_pro = 0, %% 不消耗鱼竿次数的概率
|
|
no_comsume_energy_pro = 0, %% 不消耗活力概率
|
|
fish_quality_pro = [] %% 鱼类品质加成
|
|
}).
|
|
|
|
%% 钓鱼场景
|
|
-record(base_distri_scene,
|
|
{
|
|
id = 0, %% 序号ID
|
|
distri_scene_id = 0, %% 场景ID
|
|
scene_name = "", %% 名称
|
|
scene_type = 0, %% 场景类型 1-野外场景 -其它
|
|
transfer_coordinate = [], %% 传送坐标
|
|
coordinate = [], %% 场景中心坐标
|
|
near_water_area = [], %% 近水域鱼类
|
|
far_water_area = [], %% 远水域鱼类
|
|
middle_water_area = [], %% 中水域鱼类
|
|
open_role_lv = 0, %% 开放等级
|
|
open_mastery_lv = 0, %% 钓鱼开放等级
|
|
home_fish_pond_lv = 0 %% 家园鱼塘开放等级
|
|
}).
|
|
|
|
%% 钓鱼键值配置
|
|
-record(base_fishing_key_value,
|
|
{
|
|
id = 1, %% 序号ID
|
|
key = "", %% 键
|
|
value = 0, %% 值
|
|
describe = "" %% 描述
|
|
}).
|
|
|
|
%% 图鉴类型
|
|
-record(base_fish_illustrated_type,
|
|
{
|
|
type = 0, %% 类型
|
|
name = "", %% 名字
|
|
comment = "" %% 备注
|
|
}).
|
|
|
|
%% 鱼鉴配置
|
|
-record(base_fish_illustrated,
|
|
{
|
|
id = 0, %% 鱼鉴id
|
|
type = 0, %% 鱼鉴类型
|
|
name = "", %% 鱼鉴名称
|
|
quality = 0, %% 鱼鉴品质
|
|
active_condition = [], %% 激活消耗
|
|
photo_id = "" %% 图片资源
|
|
}).
|
|
|
|
%% 鱼鉴升级
|
|
-record(base_fish_illustrated_lv,
|
|
{
|
|
id = 0, %% 鱼鉴id
|
|
lv = 0, %% 等级
|
|
attr = [], %% 属性
|
|
cost = [] %% 升级消耗
|
|
}).
|
|
|
|
%%-------------------------------------------------------------------------------------------------
|
|
|
|
%% 钓鱼状态
|
|
-define(ACT_FISHING, 1). %% 处于钓鱼状态
|
|
-define(NO_ACT_FISHING, 0). %% 未处于钓鱼状态
|
|
|
|
%% 钓鱼动作
|
|
-define(ACT_ID,[0,1,2,3,4,5,6,7,8]). %% 钓鱼动作序号
|
|
|
|
%% 钓鱼类型
|
|
-define(MAUNAL, 1). %% 手动钓鱼
|
|
-define(AUTO, 2). %% 自动钓鱼
|
|
|
|
%% 概率
|
|
-define(RATIO, 10000). %% 万分比
|
|
-define(PERCENTAGE, 100). %% 百分比
|
|
-define(AVERAGE, 5000). %% 平均权重
|
|
|
|
%% 键值对
|
|
-define(ENERGY_COST, consume). %% 单次钓鱼活力消耗值
|
|
-define(SUCCESS_PROB, rate). %% 自动钓鱼成功的概率
|
|
-define(FREE_RODS, free_rods). %% 免费鱼竿id
|
|
-define(FREE_BAIT, free_bait). %% 免费鱼饵id
|
|
|
|
%% 水域
|
|
-define(NEAR, 1). %% 近水域
|
|
-define(MIDDLE, 2). %% 中水域
|
|
-define(FAR, 3). %% 远水域
|
|
|
|
%% 渔具类型
|
|
-define(RODTYPE, 1). %% 鱼竿类型
|
|
-define(BAITTYPE, 2). %% 鱼饵类型
|
|
|
|
%% 收杆验证
|
|
-define(SUCCEED, 1). %% 收杆成功
|
|
-define(FAILURE, 0). %% 收杆失败
|
|
|
|
%% 场景类型
|
|
-define(WILD_SCENE, 1). %% 野外场景类型
|
|
-define(HOME_SCENE, 18). %% 家园鱼塘场景类型
|
|
|
|
%% 钓鱼更新
|
|
-define(PLUS, 1). %% 加法
|
|
-define(MINUS, 0). %% 减法
|
|
-define(FISHNUM, 1). %% 钓鱼数量
|
|
-define(MINUSNUM, 1). %% 消耗使用次数
|
|
-define(FISHINGTIME, 3600). %% 钓鱼保护时长上限(秒)
|
|
-define(INF, 999999999). %% 熟练度上限
|
|
|
|
%% 水域类型
|
|
-define(MAUNAL_WATER_AREA, [4,2,1]). %% 手动钓鱼可选水域类型 4-远 2-中 1-近
|
|
-define(AUTO_WATER_AREA, [4,2,1,3,5,6,7]). %% 自动钓鱼可选水域类型 4-远 2-中 1-近 3-中近 5-远近 6-远中 7-远中近
|
|
|
|
%% SQL执行语句
|
|
-define(sql_player_fishing_select, <<"select `lv`,`mastery`,`fish_rod_usage_count` from `player_fishing` where `role_id` = ~p">>).
|
|
-define(sql_player_update_fish_rod, <<"update `player_fishing` set `fish_rod_usage_count` = '~s' where `role_id` = ~p ">>).
|
|
-define(sql_player_fishing_replace, <<"replace into `player_fishing` (`role_id`,`lv`,`mastery`,`fish_rod_usage_count`) values(~p,~p,~p,'~s')">>).
|
|
-define(sql_fish_illustrated_insert, <<"replace into `fish_illustrated` (`role_id`, `illustrate_id`, `lv`) VALUES (~p, ~p, ~p)">>).
|
|
-define(sql_fish_illustrated_select, <<"select `illustrate_id`,`lv` from `fish_illustrated` where `role_id` = ~p">>).
|