1
This commit is contained in:
parent
039e67fc51
commit
c019d63cf7
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
target/
|
||||||
|
node_modules/
|
||||||
|
#*
|
||||||
|
*#*
|
||||||
|
cs_msgid.rs
|
||||||
|
cs_proto.rs
|
||||||
|
*.lock
|
21
server/stat/Cargo.toml
Normal file
21
server/stat/Cargo.toml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[package]
|
||||||
|
name = "stat"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
protobuf = "2.9.0"
|
||||||
|
serde = "*"
|
||||||
|
serde_derive = "*"
|
||||||
|
serde_json = "*"
|
||||||
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|
||||||
|
r9 = { path = "../../third_party/librust/r9" }
|
||||||
|
r9_macro = { path = "../../third_party/librust/r9_macro" }
|
||||||
|
r9_macro_derive = { path = "../../third_party/librust/r9_macro_derive" }
|
||||||
|
f9 = { path = "../../third_party/librust/f9" }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
protobuf-codegen-pure = "2.9.0"
|
10
server/stat/build.rs
Normal file
10
server/stat/build.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fn main() {
|
||||||
|
protobuf_codegen_pure::Codegen::new()
|
||||||
|
.out_dir("src/cs")
|
||||||
|
.inputs(&[//"proto/mt.proto",
|
||||||
|
"proto/cs_msgid.proto",
|
||||||
|
"proto/cs_proto.proto"])
|
||||||
|
.include("proto")
|
||||||
|
.run()
|
||||||
|
.expect("Codegen failed.");
|
||||||
|
}
|
5
server/stat/makefile
Normal file
5
server/stat/makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
compile:
|
||||||
|
cargo build
|
||||||
|
|
||||||
|
run:
|
||||||
|
cargo run
|
65
server/stat/proto/cs_msgid.proto
Normal file
65
server/stat/proto/cs_msgid.proto
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package cs;
|
||||||
|
|
||||||
|
//消息id定义
|
||||||
|
enum CMMessageId_e
|
||||||
|
{
|
||||||
|
_CMKcpHandshake = 99;
|
||||||
|
_CMPing = 101;
|
||||||
|
|
||||||
|
_CMJoin = 103;
|
||||||
|
_CMReconnect = 104;
|
||||||
|
_CMMove = 201;
|
||||||
|
_CMEmote = 204;
|
||||||
|
_CMVoice = 206;
|
||||||
|
_CMGameOver = 207;
|
||||||
|
_CMWatchWar = 208;
|
||||||
|
_CMLeave = 209;
|
||||||
|
_CMRevive = 210;
|
||||||
|
_CMCancelRevive = 211;
|
||||||
|
_CMExecCommand = 217;
|
||||||
|
_CMMatchCancel = 218;
|
||||||
|
_CMMatchChoose = 219;
|
||||||
|
_CMMatchStartGame = 220;
|
||||||
|
_CMMatchCancelStartGame = 221;
|
||||||
|
_CMMatchSendMsg = 222;
|
||||||
|
_CMMatchBroadcastMsg = 223;
|
||||||
|
_CMRequestBulletDmg = 230;
|
||||||
|
_CMStowShield = 231;
|
||||||
|
_CMImmediateMsg = 232;
|
||||||
|
_CMTeamMarkTargetPos = 233;
|
||||||
|
_CMRequestThrowDmg = 236;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SMMessageId_e
|
||||||
|
{
|
||||||
|
_SMKcpHandshake = 99;
|
||||||
|
_SMPing = 101;
|
||||||
|
_SMRpcError = 102;
|
||||||
|
_SMReconnect = 104;
|
||||||
|
|
||||||
|
_SMWatchWar = 208;
|
||||||
|
_SMLeave = 209;
|
||||||
|
_SMMatchCancel = 218;
|
||||||
|
|
||||||
|
_SMJoinedNotify = 103;
|
||||||
|
_SMMapInfo = 1002;
|
||||||
|
_SMPlayerInfo = 1003;
|
||||||
|
_SMUpdate = 1004;
|
||||||
|
_SMRollMsg = 1005;
|
||||||
|
_SMVoiceNotify = 1007;
|
||||||
|
_SMDisconnectNotify = 1008;
|
||||||
|
_SMGameOver = 1009;
|
||||||
|
_SMDebugMsg = 1010;
|
||||||
|
_SMUiUpdate = 1012;
|
||||||
|
_SMGameStart = 1013;
|
||||||
|
_SMSysPiaoMsg = 1014;
|
||||||
|
_SMShowCountdown = 1015;
|
||||||
|
_SMShowTeamUI = 1016;
|
||||||
|
_SMUpdateMatchInfo = 1017;
|
||||||
|
_SMGetItemNotify = 1018;
|
||||||
|
_SMMatchMemberMsgNotify = 1019;
|
||||||
|
_SMPvePassWave = 1020;
|
||||||
|
_SMTeamMarkTargetPosList = 1021;
|
||||||
|
_SMDebugCmd = 1022;
|
||||||
|
_SMNewBieEnd = 1023;
|
||||||
|
}
|
1680
server/stat/proto/cs_proto.proto
Executable file
1680
server/stat/proto/cs_proto.proto
Executable file
File diff suppressed because it is too large
Load Diff
612
server/stat/proto/mt.proto
Normal file
612
server/stat/proto/mt.proto
Normal file
@ -0,0 +1,612 @@
|
|||||||
|
package mt;
|
||||||
|
|
||||||
|
message Parameter
|
||||||
|
{
|
||||||
|
optional string param_name = 1;
|
||||||
|
optional string param_value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attr
|
||||||
|
{
|
||||||
|
required int32 attr_id = 1;
|
||||||
|
required string attr_cname = 2;
|
||||||
|
required string attr_ename = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Map
|
||||||
|
{
|
||||||
|
optional int32 map_id = 1;
|
||||||
|
optional string template_list = 2;
|
||||||
|
optional string map_name = 3;
|
||||||
|
optional float map_width = 4;
|
||||||
|
optional float map_height = 5;
|
||||||
|
optional string airdrops = 6;
|
||||||
|
optional int32 terminator_airdrop = 7;
|
||||||
|
optional int32 player = 8;
|
||||||
|
optional string refresh_robot = 9;
|
||||||
|
optional int32 map_mode = 10;
|
||||||
|
optional string safearea = 11;
|
||||||
|
optional string game_start_buff_list = 12;
|
||||||
|
optional string map_pic = 13;
|
||||||
|
optional string first_safearea_center = 14;
|
||||||
|
optional int32 init_gas_ring = 15;
|
||||||
|
optional string airraids = 16;
|
||||||
|
optional string car_num_limit = 17;
|
||||||
|
optional float scale = 18;
|
||||||
|
optional string map_collider = 19;
|
||||||
|
optional string world_object_file = 20;
|
||||||
|
optional string terrain_file = 21;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MapArea
|
||||||
|
{
|
||||||
|
optional int32 map_id = 1;
|
||||||
|
optional int32 area_type = 2;
|
||||||
|
optional int32 area_subtype = 3;
|
||||||
|
optional string area_center = 4;
|
||||||
|
optional float area_width = 5;
|
||||||
|
optional float area_height = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MapThing
|
||||||
|
{
|
||||||
|
optional int32 thing_id = 1; //物件id
|
||||||
|
optional int32 thing_type = 16;
|
||||||
|
optional int32 time = 17;
|
||||||
|
optional int32 type = 2; //类型
|
||||||
|
optional int32 height = 3; //高度
|
||||||
|
optional int32 width = 4; //宽度
|
||||||
|
optional int32 hp = 5; //生命
|
||||||
|
optional float damage = 6; //伤害
|
||||||
|
optional float damage_dia = 7; //伤害半径
|
||||||
|
optional string drop = 8; //掉落
|
||||||
|
optional int32 is_door = 10; //是否门
|
||||||
|
optional int32 is_house = 11; //是否房间
|
||||||
|
optional int32 is_tree = 12; //是否树
|
||||||
|
optional int32 house_id = 13; //房间id
|
||||||
|
optional string buff_list = 14;
|
||||||
|
optional int32 explosion_effect = 15;
|
||||||
|
optional int32 explosion_interval = 18;
|
||||||
|
optional int32 explosion_dmg_delay = 37;
|
||||||
|
optional int32 explosion_times = 19;
|
||||||
|
optional int32 explosion_float = 20;
|
||||||
|
optional string preexplosion_summon = 35;
|
||||||
|
optional string monster_list = 21;
|
||||||
|
optional string special_damage_type = 22;
|
||||||
|
optional string receive_special_damage_type = 23;
|
||||||
|
optional string param1 = 24;
|
||||||
|
optional string param2 = 25;
|
||||||
|
optional int32 interaction_mode = 26;
|
||||||
|
optional int32 view_mode = 27;
|
||||||
|
optional int32 bullet_hit = 28;
|
||||||
|
optional int32 collision_hit = 29;
|
||||||
|
optional int32 explosion_hit = 30;
|
||||||
|
optional string sweep_tags = 31;
|
||||||
|
optional int32 prebattle_hide = 32;
|
||||||
|
optional int32 life_time = 33;
|
||||||
|
optional int32 summon_born_rad = 34;
|
||||||
|
optional string shapes = 36;
|
||||||
|
optional int32 delay_destroy = 38;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SafeArea
|
||||||
|
{
|
||||||
|
optional int32 id = 1; //id
|
||||||
|
optional int32 level = 2; //安全区登记
|
||||||
|
optional int32 rad = 3; //半径
|
||||||
|
optional int32 wait_time = 4; //等待时间
|
||||||
|
optional int32 shrink_speed = 5; //收缩速度
|
||||||
|
optional float hurt = 6; //伤害/秒
|
||||||
|
optional int32 type = 7;
|
||||||
|
optional int32 x1 = 8;
|
||||||
|
optional int32 y1 = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SafeAreaPos
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 x1 = 2;
|
||||||
|
optional int32 y1 = 3;
|
||||||
|
optional int32 x2 = 4;
|
||||||
|
optional int32 y2 = 5;
|
||||||
|
optional int32 x3 = 6;
|
||||||
|
optional int32 y3 = 7;
|
||||||
|
optional int32 x4 = 8;
|
||||||
|
optional int32 y4 = 9;
|
||||||
|
optional int32 x5 = 10;
|
||||||
|
optional int32 y5 = 11;
|
||||||
|
optional int32 x6 = 12;
|
||||||
|
optional int32 y6 = 13;
|
||||||
|
optional int32 x7 = 14;
|
||||||
|
optional int32 y7 = 15;
|
||||||
|
optional int32 x8 = 16;
|
||||||
|
optional int32 y8 = 17;
|
||||||
|
optional int32 x9 = 18;
|
||||||
|
optional int32 y9 = 19;
|
||||||
|
optional int32 x10 = 20;
|
||||||
|
optional int32 y10 = 21;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Item
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 type = 2;
|
||||||
|
optional int32 sub_type = 3;
|
||||||
|
optional int32 quality = 4;
|
||||||
|
optional int32 use = 5;
|
||||||
|
optional int32 skinid = 6;
|
||||||
|
optional int32 isdefaultskin = 7;
|
||||||
|
optional int32 playerid = 8;
|
||||||
|
optional int32 relationship = 9;
|
||||||
|
optional string name = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Equip
|
||||||
|
{
|
||||||
|
optional int32 id = 1; //装备id
|
||||||
|
optional int32 equip_type = 2; //装备类型
|
||||||
|
optional int32 equip_subtype = 3; //装备子类型
|
||||||
|
optional int32 equip_lv = 4; //装备等级
|
||||||
|
optional int32 fire_mode = 5; //开火模式
|
||||||
|
optional int32 use_bullet = 6; //使用子弹
|
||||||
|
optional int32 clip_volume = 7; //弹夹数量
|
||||||
|
optional int32 reload_time = 8; //装弹时间
|
||||||
|
optional int32 fire_rate = 9; //武器射速
|
||||||
|
optional string atk = 10; //攻击力
|
||||||
|
optional int32 def = 11; //防御力
|
||||||
|
optional string max_hp = 41;
|
||||||
|
optional int32 explosion_range = 12; //子弹爆炸范围
|
||||||
|
optional int32 bullet_speed = 13; //子弹速度
|
||||||
|
optional int32 range = 14; //射程
|
||||||
|
optional int32 use_time = 15; //使用时间
|
||||||
|
optional string heal = 16; //瞬间生命恢复
|
||||||
|
optional int32 time = 17; //时间
|
||||||
|
optional string volume = 19; //装备容量
|
||||||
|
optional int32 bullet_rad = 20; //子弹半径
|
||||||
|
optional int32 group_num = 21; //每组数量
|
||||||
|
optional int32 is_luck = 22; //是否吉利服
|
||||||
|
optional string bullet_born_offset = 30; //子弹出生偏移
|
||||||
|
optional float bullet_angle = 34; //子弹浮动方向
|
||||||
|
optional string name = 35; //装备名字
|
||||||
|
optional float rad = 36; //半径
|
||||||
|
optional float rad2 = 37;
|
||||||
|
optional int32 buffid = 38;
|
||||||
|
optional int32 drop_id = 40;
|
||||||
|
optional int32 explosion_effect = 42;
|
||||||
|
optional string param1 = 43;
|
||||||
|
optional string param2 = 44;
|
||||||
|
optional int32 reloadtype = 46;
|
||||||
|
optional float recoil_force = 47;
|
||||||
|
optional int32 missiles_time = 48;
|
||||||
|
optional int32 heroid = 49;
|
||||||
|
optional string launch_dev = 50;
|
||||||
|
optional string power_time = 51;
|
||||||
|
optional string power_gun = 52;
|
||||||
|
optional string power_buff = 53;
|
||||||
|
optional int32 through_teammate = 54;
|
||||||
|
optional string text_icon = 55;
|
||||||
|
optional string special_damage_type = 56;
|
||||||
|
optional float max_oil = 57;
|
||||||
|
optional float average_oil = 58;
|
||||||
|
optional float atk_mech = 59;
|
||||||
|
optional int32 use_scene = 60;
|
||||||
|
optional int32 ispenetrate = 61;
|
||||||
|
optional int32 is_penetrate_thing = 62;
|
||||||
|
optional int32 reload_delay_time = 63;
|
||||||
|
optional int32 cast_time = 64;
|
||||||
|
optional int32 aiming_cast_time = 80;
|
||||||
|
optional int32 auto_switch_weapon_time = 65;
|
||||||
|
optional int32 quality = 66;
|
||||||
|
optional int32 explosion_damage_delay = 67;
|
||||||
|
optional int32 bullet_consume_type = 68;
|
||||||
|
|
||||||
|
optional string inventory_slot = 31;
|
||||||
|
optional int32 _inventory_slot = 32;
|
||||||
|
|
||||||
|
optional float critical = 70;
|
||||||
|
optional float cri_damage = 71;
|
||||||
|
|
||||||
|
optional int32 shootfire = 73;
|
||||||
|
optional string hit_buff = 75;
|
||||||
|
|
||||||
|
optional int32 auto_trace = 76;
|
||||||
|
optional int32 trace_range = 77;
|
||||||
|
|
||||||
|
optional int32 double_gun = 78;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Hero
|
||||||
|
{
|
||||||
|
optional int32 id = 1; //唯一id
|
||||||
|
optional float radius = 2; //半径
|
||||||
|
|
||||||
|
optional float move_speed = 4; //移动速度
|
||||||
|
optional float jump_speed = 5; //跳伞速度
|
||||||
|
optional float fall_speed = 6;
|
||||||
|
optional float aim_speed = 8;
|
||||||
|
optional float shoot_speed = 7;
|
||||||
|
optional float reload_speed = 9;
|
||||||
|
optional float medicine_speed = 10; //移动速度4
|
||||||
|
optional float swim_speed = 49;
|
||||||
|
|
||||||
|
optional string volume = 12; //初始库存
|
||||||
|
optional int32 level = 13;
|
||||||
|
optional int32 race = 14;
|
||||||
|
optional string name = 23;
|
||||||
|
optional float hit_offset_x = 42;
|
||||||
|
optional float hit_offset_y = 43;
|
||||||
|
optional float hit_radius = 25;
|
||||||
|
optional string ai_script = 26;
|
||||||
|
optional string init_buffs = 27;
|
||||||
|
optional int32 default_weapon = 28;
|
||||||
|
optional string dead_drop = 29;
|
||||||
|
optional int32 delay_delete = 39;
|
||||||
|
optional int32 ai = 46;
|
||||||
|
optional int32 delay_remove = 47;
|
||||||
|
optional int32 skinlist = 48;
|
||||||
|
optional string pre_appear_effect = 50;
|
||||||
|
|
||||||
|
optional string pve_score = 51;
|
||||||
|
|
||||||
|
optional int32 hp = 52;
|
||||||
|
optional int32 damage = 53;
|
||||||
|
optional int32 defence = 54;
|
||||||
|
optional float crit_atk = 55;
|
||||||
|
optional float crit_atk_ratio = 56;
|
||||||
|
optional float miss = 57;
|
||||||
|
optional float miss_damage_ruduce = 58;
|
||||||
|
|
||||||
|
optional int32 skill1list = 60;
|
||||||
|
optional int32 skill2list = 61;
|
||||||
|
optional int32 skill3list = 62;
|
||||||
|
|
||||||
|
optional float hp_ratio = 63;
|
||||||
|
optional float damage_ratio = 64;
|
||||||
|
optional float defence_ratio = 65;
|
||||||
|
|
||||||
|
optional string bt = 70;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Robot
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional string name = 2;
|
||||||
|
optional int32 hero_id = 3;
|
||||||
|
optional string skin_id = 10;
|
||||||
|
optional int32 weapon_id = 4;
|
||||||
|
optional int32 weapon_lv = 5;
|
||||||
|
|
||||||
|
optional int32 sex = 8;
|
||||||
|
optional float dmg_ratio = 20;
|
||||||
|
optional string bullet_offset = 21;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Skill
|
||||||
|
{
|
||||||
|
required int32 skill_id = 1;
|
||||||
|
required int32 skill_type = 2;
|
||||||
|
required string value_up = 6;
|
||||||
|
required int32 skill_cd = 7;
|
||||||
|
required int32 skill_target = 8;
|
||||||
|
required string buff_list = 9;
|
||||||
|
required float skill_distance = 10;
|
||||||
|
required int32 cold_time_up = 11;
|
||||||
|
required int32 max_times = 12;
|
||||||
|
|
||||||
|
optional int32 phase1_time_offset = 20;
|
||||||
|
optional int32 phase1_func = 21;
|
||||||
|
optional string phase1_param1 = 22;
|
||||||
|
optional string phase1_param2 = 23;
|
||||||
|
optional string phase1_param3 = 24;
|
||||||
|
|
||||||
|
optional int32 phase2_time_offset = 30;
|
||||||
|
optional int32 phase2_func = 31;
|
||||||
|
optional string phase2_param1 = 32;
|
||||||
|
optional string phase2_param2 = 33;
|
||||||
|
optional string phase2_param3 = 34;
|
||||||
|
|
||||||
|
optional int32 phase3_time_offset = 40;
|
||||||
|
optional int32 phase3_func = 41;
|
||||||
|
optional string phase3_param1 = 42;
|
||||||
|
optional string phase3_param2 = 43;
|
||||||
|
optional string phase3_param3 = 44;
|
||||||
|
optional int32 cast_time = 45;
|
||||||
|
|
||||||
|
optional int32 up_exp = 50;
|
||||||
|
optional int32 nextlv_skill = 51;
|
||||||
|
|
||||||
|
optional int32 attack_dir_lock_time = 52;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SkillNumber
|
||||||
|
{
|
||||||
|
required int32 skill_id = 1;
|
||||||
|
optional int32 skill_type = 2;
|
||||||
|
optional float number = 3;
|
||||||
|
optional float damage = 4;
|
||||||
|
optional float damage_addition = 5;
|
||||||
|
optional float damage_change = 6;
|
||||||
|
optional float shield = 7;
|
||||||
|
optional float shield_addition = 8;
|
||||||
|
optional float resume = 9;
|
||||||
|
optional float resume_addition = 10;
|
||||||
|
optional string speed = 11;
|
||||||
|
optional string range = 12;
|
||||||
|
optional string range2 = 13;
|
||||||
|
optional string range3 = 21;
|
||||||
|
optional string time = 14;
|
||||||
|
optional string cd = 15;
|
||||||
|
optional int32 buff_id = 16;
|
||||||
|
optional float buff_time = 17;
|
||||||
|
optional string probability = 18;
|
||||||
|
optional int32 explosion_effect = 19;
|
||||||
|
optional string effect_list = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
message NpcStandard
|
||||||
|
{
|
||||||
|
required int32 id = 1;
|
||||||
|
optional int32 quality = 2;
|
||||||
|
optional int32 hp = 3;
|
||||||
|
optional int32 damage = 4;
|
||||||
|
optional int32 defence = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Buff
|
||||||
|
{
|
||||||
|
required int32 buff_id = 1;
|
||||||
|
required string name = 20;
|
||||||
|
required int32 buff_target = 2;
|
||||||
|
required int32 buff_effect = 3;
|
||||||
|
required int32 trigger_type = 4;
|
||||||
|
required string buff_param1 = 6;
|
||||||
|
required string buff_param2 = 7;
|
||||||
|
required string buff_param3 = 8;
|
||||||
|
required string buff_param4 = 9;
|
||||||
|
optional string buff_param5 = 19;
|
||||||
|
optional string buff_param6 = 37;
|
||||||
|
required string duration_time = 10;
|
||||||
|
optional float buff_valueup = 11;
|
||||||
|
required string immune_buffeffect_list = 12;
|
||||||
|
optional string post_remove_action = 13;
|
||||||
|
optional int32 only_server = 14;
|
||||||
|
optional int32 only_self = 15;
|
||||||
|
optional int32 depend_effect = 16;
|
||||||
|
optional string child_buff = 17;
|
||||||
|
optional int32 coexist_num = 18;
|
||||||
|
optional int32 dead_valid = 23;
|
||||||
|
optional string buff_interval = 24;
|
||||||
|
optional string tag = 25;
|
||||||
|
optional int32 post_battle_valid = 26;
|
||||||
|
optional string only_spec_race = 27;
|
||||||
|
optional string exclude_spec_race = 28;
|
||||||
|
optional int32 dead_remove = 29;
|
||||||
|
optional int32 no_immune = 30;
|
||||||
|
optional int32 lock_move = 31;
|
||||||
|
optional int32 lock_dir = 34;
|
||||||
|
optional int32 lock_move_dir = 36;
|
||||||
|
optional int32 disable_shot = 32;
|
||||||
|
optional int32 disable_useskill = 33;
|
||||||
|
optional string effect_list = 35;
|
||||||
|
optional string res_scale = 39;
|
||||||
|
optional int32 tenacity = 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Drop
|
||||||
|
{
|
||||||
|
optional int32 drop_id = 1;
|
||||||
|
optional string item_id = 2;
|
||||||
|
optional string num = 3;
|
||||||
|
optional string weight = 4;
|
||||||
|
optional int32 type = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AirDrop
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 time = 2;
|
||||||
|
optional int32 appear_time = 3;
|
||||||
|
optional string drop_id = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AirRaid
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 time = 2;
|
||||||
|
optional int32 appear_time = 3;
|
||||||
|
optional string bomb_id = 4;
|
||||||
|
optional string raid_wave = 5;
|
||||||
|
optional float rad = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AirLine
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional string start_point = 2;
|
||||||
|
optional string end_point = 3;
|
||||||
|
optional float plane_speed = 4;
|
||||||
|
optional int32 weight = 5;
|
||||||
|
optional int32 map_id = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RankReward
|
||||||
|
{
|
||||||
|
optional int32 rank = 1;
|
||||||
|
optional float parameter = 2;
|
||||||
|
optional int32 drop = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RankPoint
|
||||||
|
{
|
||||||
|
optional int32 rank = 1;
|
||||||
|
optional int32 parameter = 2;
|
||||||
|
optional int32 parameter2 = 3;
|
||||||
|
optional int32 parameter3 = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message KillReward
|
||||||
|
{
|
||||||
|
optional int32 kill_num = 1;
|
||||||
|
optional float parameter = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message KillPoint
|
||||||
|
{
|
||||||
|
optional int32 kill_num = 1;
|
||||||
|
optional int32 parameter = 2;
|
||||||
|
optional int32 parameter2 = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AI
|
||||||
|
{
|
||||||
|
optional int32 id = 13;
|
||||||
|
//optional int32 ai_level = 1;
|
||||||
|
optional int32 pursuit_radius = 2;
|
||||||
|
optional int32 attack_interval = 3;
|
||||||
|
optional int32 attack_times = 4;
|
||||||
|
optional int32 attack_type = 5;
|
||||||
|
optional int32 shot_offset_angle = 6;
|
||||||
|
optional string random_move_idle_time = 8;
|
||||||
|
optional string random_move_time = 9;
|
||||||
|
optional int32 attack_range = 10;
|
||||||
|
optional float attack_rate = 11;
|
||||||
|
optional int32 ai_mode = 12;
|
||||||
|
optional int32 ai_kind = 14;
|
||||||
|
optional string param1 = 15;
|
||||||
|
optional string param2 = 16;
|
||||||
|
optional string param3 = 17;
|
||||||
|
optional string param4 = 18;
|
||||||
|
optional string param5 = 19;
|
||||||
|
optional int32 peace_time = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Text
|
||||||
|
{
|
||||||
|
optional string textid = 1;
|
||||||
|
optional string text = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GunTalentGrow
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 talent_id = 2;
|
||||||
|
optional int32 talent_lv = 3;
|
||||||
|
optional int32 addtype = 4;
|
||||||
|
optional string addattr = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message HeroQuality
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 quality = 2;
|
||||||
|
optional int32 gold_limit = 3;
|
||||||
|
optional int32 lucky = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GunQuality
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 quality = 2;
|
||||||
|
optional int32 gold_limit = 3;
|
||||||
|
optional int32 lucky = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FormulaPvp
|
||||||
|
{
|
||||||
|
optional float top = 1;
|
||||||
|
optional float ranked_topx = 2;
|
||||||
|
optional float kills_topx = 3;
|
||||||
|
optional float hero_topx = 4;
|
||||||
|
optional float weapon_topx = 5;
|
||||||
|
optional float survival_topx = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PveGemini
|
||||||
|
{
|
||||||
|
optional int32 gemini_id = 1;
|
||||||
|
optional int32 gemini_lv = 2;
|
||||||
|
optional int32 gemini_limit = 3;
|
||||||
|
optional string multiplayer_enemy_hp_mul = 4;
|
||||||
|
optional string born_point = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PveGeminiContent
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 mode_id = 2;
|
||||||
|
optional int32 round = 3;
|
||||||
|
optional string spawn_point = 4;
|
||||||
|
optional string enemy_id = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PveGeminiMode
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 map_id = 2;
|
||||||
|
optional string mode_time = 3;
|
||||||
|
optional string area = 4;
|
||||||
|
optional string score_reward = 5;
|
||||||
|
optional string round_score = 7;
|
||||||
|
optional string next_door = 6;
|
||||||
|
optional int32 wave_prepare_time = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RankRoom
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 elo_min = 2;
|
||||||
|
optional int32 elo_max = 3;
|
||||||
|
optional int32 elo_expansion1 = 4;
|
||||||
|
optional int32 elo_expansion2 = 5;
|
||||||
|
optional int32 expand_time1 = 6;
|
||||||
|
optional int32 expand_time2 = 7;
|
||||||
|
optional int32 player_num_standard = 8;
|
||||||
|
optional int32 final_time = 9;
|
||||||
|
optional int32 final_player_num = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Grasp
|
||||||
|
{
|
||||||
|
optional int32 grasp_id = 1;
|
||||||
|
optional int32 hero_id = 2;
|
||||||
|
optional int32 hero_lv = 3;
|
||||||
|
optional int32 graspbuff_id1 = 4;
|
||||||
|
optional int32 graspbuff_id1_floor2 = 5;
|
||||||
|
optional int32 graspbuff_id2 = 6;
|
||||||
|
optional int32 weapon_id = 7;
|
||||||
|
optional string add_buff_list = 8;
|
||||||
|
optional string remove_buff_list = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GraspBuff
|
||||||
|
{
|
||||||
|
optional int32 graspbuff_id = 1;
|
||||||
|
optional int32 graspbuff_floor = 2;
|
||||||
|
optional string graspbuff_trigger = 4;
|
||||||
|
optional int32 graspbuff_target = 5;
|
||||||
|
optional string graspbuff_time = 6;
|
||||||
|
optional int32 attr_id = 7;
|
||||||
|
optional int32 attr_add_pattern = 8;
|
||||||
|
optional int32 attr_add_pattern2 = 9;
|
||||||
|
optional string attr_num = 10;
|
||||||
|
optional string effect_list = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GuideStep
|
||||||
|
{
|
||||||
|
optional int32 id = 1;
|
||||||
|
optional int32 target = 2;
|
||||||
|
optional string param1 = 3;
|
||||||
|
optional string param2 = 4;
|
||||||
|
optional string param3 = 5;
|
||||||
|
optional string param4 = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message WorldObject
|
||||||
|
{
|
||||||
|
optional int32 object_id= 1;
|
||||||
|
optional int32 object_type = 2;
|
||||||
|
optional float x = 3;
|
||||||
|
optional float y = 4;
|
||||||
|
optional float z = 5;
|
||||||
|
}
|
43
server/stat/src/app/app.rs
Normal file
43
server/stat/src/app/app.rs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
use std::rc::{Rc, Weak};
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use r9_macro::SharedFromSelf;
|
||||||
|
use r9_macro_derive::SharedFromSelf;
|
||||||
|
//use r9_macro::Singleton;
|
||||||
|
use r9_macro_derive::Singleton;
|
||||||
|
|
||||||
|
#[derive(SharedFromSelf)]
|
||||||
|
#[derive(Singleton)]
|
||||||
|
pub struct UserApp {
|
||||||
|
_self_wp: Weak::<RefCell::<Self>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl f9::app::UserApp for UserApp {
|
||||||
|
|
||||||
|
fn get_pkg_name(&self) -> String {
|
||||||
|
return "".to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn init(&mut self) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update(&mut self) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fn uninit(&mut self) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserApp {
|
||||||
|
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let p = UserApp{
|
||||||
|
_self_wp: Default::default(),
|
||||||
|
};
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
1
server/stat/src/app/mod.rs
Normal file
1
server/stat/src/app/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod app;
|
459
server/stat/src/cs/cs_auto_gen.rs
Normal file
459
server/stat/src/cs/cs_auto_gen.rs
Normal file
@ -0,0 +1,459 @@
|
|||||||
|
use std::rc::{Rc, Weak};
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use crate::cs::cs_proto as cs;
|
||||||
|
use crate::cs::cs_msgid as cs_msgid;
|
||||||
|
|
||||||
|
pub struct Handler {
|
||||||
|
pub msg_id: i32,
|
||||||
|
pub handler_id: i32,
|
||||||
|
pub cb: Box::<dyn Fn (&f9::MsgHdr, &dyn MsgHandler)>,
|
||||||
|
}
|
||||||
|
|
||||||
|
static mut HANDLERS: Vec<Option<Handler>> = Vec::new();
|
||||||
|
|
||||||
|
pub fn get_net_msg_handler(msg_id: u16) -> &'static Option<Handler> {
|
||||||
|
unsafe {
|
||||||
|
if (msg_id as usize) < HANDLERS.len() {
|
||||||
|
return &HANDLERS[msg_id as usize];
|
||||||
|
} else {
|
||||||
|
return &None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reg_handler_id(msg_id: u16, handler_id: i32) {
|
||||||
|
unsafe {
|
||||||
|
if (msg_id as usize) < HANDLERS.len() {
|
||||||
|
match &mut HANDLERS[msg_id as usize] {
|
||||||
|
Some(v) => {
|
||||||
|
v.handler_id = handler_id;
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn dispatch_msg(msg_id: u16, hdr: &f9::MsgHdr, h: &dyn MsgHandler) {
|
||||||
|
let mut handler: &Option<Handler> = &None;
|
||||||
|
unsafe {
|
||||||
|
handler = get_net_msg_handler(msg_id);
|
||||||
|
}
|
||||||
|
match handler {
|
||||||
|
Some(v) => {
|
||||||
|
(*v.cb)(hdr, h);
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
func ParsePb(msgId uint16, data []byte) interface{} {
|
||||||
|
handler := handlers[msgId]
|
||||||
|
if handler == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return handler.ParseCb(data)
|
||||||
|
}*/
|
||||||
|
|
||||||
|
pub trait MsgHandler {
|
||||||
|
|
||||||
|
fn cm_ping(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMPing>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_kcp_handshake(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMKcpHandshake>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_join(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMJoin>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_reconnect(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMReconnect>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_move(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMMove>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_immediate_msg(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMImmediateMsg>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_team_mark_target_pos(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMTeamMarkTargetPos>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_exec_command(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMExecCommand>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_emote(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMEmote>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_voice(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMVoice>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_game_over(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMGameOver>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_watch_war(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMWatchWar>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_leave(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMLeave>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_revive(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMRevive>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_cancel_revive(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMCancelRevive>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_match_cancel(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMMatchCancel>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_match_choose(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMMatchChoose>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_match_start_game(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMMatchStartGame>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_match_cancel_start_game(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMMatchCancelStartGame>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_match_send_msg(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMMatchSendMsg>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_match_broadcast_msg(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMMatchBroadcastMsg>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_request_bullet_dmg(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMRequestBulletDmg>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_request_throw_dmg(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMRequestThrowDmg>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn cm_stow_shield(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::CMStowShield>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn registe_handlers() {
|
||||||
|
unsafe {
|
||||||
|
HANDLERS.reserve(2000);
|
||||||
|
for i in 0..1999 {
|
||||||
|
HANDLERS.push(None);
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMPing as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMPing as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMPing>>>() {
|
||||||
|
handler.cm_ping(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMKcpHandshake as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMKcpHandshake as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMKcpHandshake>>>() {
|
||||||
|
handler.cm_kcp_handshake(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMJoin as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMJoin as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMJoin>>>() {
|
||||||
|
handler.cm_join(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMReconnect as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMReconnect as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMReconnect>>>() {
|
||||||
|
handler.cm_reconnect(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMMove as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMMove as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMMove>>>() {
|
||||||
|
handler.cm_move(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMImmediateMsg as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMImmediateMsg as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMImmediateMsg>>>() {
|
||||||
|
handler.cm_immediate_msg(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMTeamMarkTargetPos as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMTeamMarkTargetPos as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMTeamMarkTargetPos>>>() {
|
||||||
|
handler.cm_team_mark_target_pos(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMExecCommand as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMExecCommand as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMExecCommand>>>() {
|
||||||
|
handler.cm_exec_command(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMEmote as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMEmote as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMEmote>>>() {
|
||||||
|
handler.cm_emote(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMVoice as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMVoice as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMVoice>>>() {
|
||||||
|
handler.cm_voice(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMGameOver as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMGameOver as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMGameOver>>>() {
|
||||||
|
handler.cm_game_over(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMWatchWar as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMWatchWar as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMWatchWar>>>() {
|
||||||
|
handler.cm_watch_war(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMLeave as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMLeave as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMLeave>>>() {
|
||||||
|
handler.cm_leave(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMRevive as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMRevive as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMRevive>>>() {
|
||||||
|
handler.cm_revive(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMCancelRevive as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMCancelRevive as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMCancelRevive>>>() {
|
||||||
|
handler.cm_cancel_revive(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMMatchCancel as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMMatchCancel as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMMatchCancel>>>() {
|
||||||
|
handler.cm_match_cancel(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMMatchChoose as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMMatchChoose as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMMatchChoose>>>() {
|
||||||
|
handler.cm_match_choose(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMMatchStartGame as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMMatchStartGame as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMMatchStartGame>>>() {
|
||||||
|
handler.cm_match_start_game(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMMatchCancelStartGame as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMMatchCancelStartGame as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMMatchCancelStartGame>>>() {
|
||||||
|
handler.cm_match_cancel_start_game(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMMatchSendMsg as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMMatchSendMsg as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMMatchSendMsg>>>() {
|
||||||
|
handler.cm_match_send_msg(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMMatchBroadcastMsg as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMMatchBroadcastMsg as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMMatchBroadcastMsg>>>() {
|
||||||
|
handler.cm_match_broadcast_msg(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMRequestBulletDmg as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMRequestBulletDmg as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMRequestBulletDmg>>>() {
|
||||||
|
handler.cm_request_bullet_dmg(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMRequestThrowDmg as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMRequestThrowDmg as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMRequestThrowDmg>>>() {
|
||||||
|
handler.cm_request_throw_dmg(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_CMStowShield as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_CMStowShield as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::CMStowShield>>>() {
|
||||||
|
handler.cm_stow_shield(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
3
server/stat/src/cs/mod.rs
Normal file
3
server/stat/src/cs/mod.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pub mod cs_auto_gen;
|
||||||
|
pub mod cs_proto;
|
||||||
|
pub mod cs_msgid;
|
11
server/stat/src/main.rs
Executable file
11
server/stat/src/main.rs
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
use f9::app::App;
|
||||||
|
|
||||||
|
pub mod app;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
App::instance().borrow_mut().init(
|
||||||
|
crate::app::app::UserApp::instance()
|
||||||
|
);
|
||||||
|
App::instance().borrow_mut().run();
|
||||||
|
App::instance().borrow_mut().uninit();
|
||||||
|
}
|
1
server/stat/src/mtb/mod.rs
Normal file
1
server/stat/src/mtb/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod mtb_auto_gen;
|
558
server/stat/src/mtb/mtb_auto_gen.rs
Normal file
558
server/stat/src/mtb/mtb_auto_gen.rs
Normal file
@ -0,0 +1,558 @@
|
|||||||
|
use std::rc::{Rc, Weak};
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
pub struct Parameter {
|
||||||
|
param_name: Option<String>,
|
||||||
|
param_value: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Attr {
|
||||||
|
attr_id: Option<i32>,
|
||||||
|
attr_cname: Option<String>,
|
||||||
|
attr_ename: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Map {
|
||||||
|
map_id: Option<i32>,
|
||||||
|
template_list: Option<String>,
|
||||||
|
map_name: Option<String>,
|
||||||
|
map_width: Option<f32>,
|
||||||
|
map_height: Option<f32>,
|
||||||
|
airdrops: Option<String>,
|
||||||
|
terminator_airdrop: Option<i32>,
|
||||||
|
player: Option<i32>,
|
||||||
|
refresh_robot: Option<String>,
|
||||||
|
map_mode: Option<i32>,
|
||||||
|
safearea: Option<String>,
|
||||||
|
game_start_buff_list: Option<String>,
|
||||||
|
map_pic: Option<String>,
|
||||||
|
first_safearea_center: Option<String>,
|
||||||
|
init_gas_ring: Option<i32>,
|
||||||
|
airraids: Option<String>,
|
||||||
|
car_num_limit: Option<String>,
|
||||||
|
scale: Option<f32>,
|
||||||
|
map_collider: Option<String>,
|
||||||
|
world_object_file: Option<String>,
|
||||||
|
terrain_file: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MapArea {
|
||||||
|
map_id: Option<i32>,
|
||||||
|
area_type: Option<i32>,
|
||||||
|
area_subtype: Option<i32>,
|
||||||
|
area_center: Option<String>,
|
||||||
|
area_width: Option<f32>,
|
||||||
|
area_height: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MapThing {
|
||||||
|
thing_id: Option<i32>,
|
||||||
|
thing_type: Option<i32>,
|
||||||
|
time: Option<i32>,
|
||||||
|
type: Option<i32>,
|
||||||
|
height: Option<i32>,
|
||||||
|
width: Option<i32>,
|
||||||
|
hp: Option<i32>,
|
||||||
|
damage: Option<f32>,
|
||||||
|
damage_dia: Option<f32>,
|
||||||
|
drop: Option<String>,
|
||||||
|
is_door: Option<i32>,
|
||||||
|
is_house: Option<i32>,
|
||||||
|
is_tree: Option<i32>,
|
||||||
|
house_id: Option<i32>,
|
||||||
|
buff_list: Option<String>,
|
||||||
|
explosion_effect: Option<i32>,
|
||||||
|
explosion_interval: Option<i32>,
|
||||||
|
explosion_dmg_delay: Option<i32>,
|
||||||
|
explosion_times: Option<i32>,
|
||||||
|
explosion_float: Option<i32>,
|
||||||
|
preexplosion_summon: Option<String>,
|
||||||
|
monster_list: Option<String>,
|
||||||
|
special_damage_type: Option<String>,
|
||||||
|
receive_special_damage_type: Option<String>,
|
||||||
|
param1: Option<String>,
|
||||||
|
param2: Option<String>,
|
||||||
|
interaction_mode: Option<i32>,
|
||||||
|
view_mode: Option<i32>,
|
||||||
|
bullet_hit: Option<i32>,
|
||||||
|
collision_hit: Option<i32>,
|
||||||
|
explosion_hit: Option<i32>,
|
||||||
|
sweep_tags: Option<String>,
|
||||||
|
prebattle_hide: Option<i32>,
|
||||||
|
life_time: Option<i32>,
|
||||||
|
summon_born_rad: Option<i32>,
|
||||||
|
shapes: Option<String>,
|
||||||
|
delay_destroy: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SafeArea {
|
||||||
|
id: Option<i32>,
|
||||||
|
level: Option<i32>,
|
||||||
|
rad: Option<i32>,
|
||||||
|
wait_time: Option<i32>,
|
||||||
|
shrink_speed: Option<i32>,
|
||||||
|
hurt: Option<f32>,
|
||||||
|
type: Option<i32>,
|
||||||
|
x1: Option<i32>,
|
||||||
|
y1: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SafeAreaPos {
|
||||||
|
id: Option<i32>,
|
||||||
|
x1: Option<i32>,
|
||||||
|
y1: Option<i32>,
|
||||||
|
x2: Option<i32>,
|
||||||
|
y2: Option<i32>,
|
||||||
|
x3: Option<i32>,
|
||||||
|
y3: Option<i32>,
|
||||||
|
x4: Option<i32>,
|
||||||
|
y4: Option<i32>,
|
||||||
|
x5: Option<i32>,
|
||||||
|
y5: Option<i32>,
|
||||||
|
x6: Option<i32>,
|
||||||
|
y6: Option<i32>,
|
||||||
|
x7: Option<i32>,
|
||||||
|
y7: Option<i32>,
|
||||||
|
x8: Option<i32>,
|
||||||
|
y8: Option<i32>,
|
||||||
|
x9: Option<i32>,
|
||||||
|
y9: Option<i32>,
|
||||||
|
x10: Option<i32>,
|
||||||
|
y10: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Item {
|
||||||
|
id: Option<i32>,
|
||||||
|
type: Option<i32>,
|
||||||
|
sub_type: Option<i32>,
|
||||||
|
quality: Option<i32>,
|
||||||
|
use: Option<i32>,
|
||||||
|
skinid: Option<i32>,
|
||||||
|
isdefaultskin: Option<i32>,
|
||||||
|
playerid: Option<i32>,
|
||||||
|
relationship: Option<i32>,
|
||||||
|
name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Equip {
|
||||||
|
id: Option<i32>,
|
||||||
|
equip_type: Option<i32>,
|
||||||
|
equip_subtype: Option<i32>,
|
||||||
|
equip_lv: Option<i32>,
|
||||||
|
fire_mode: Option<i32>,
|
||||||
|
use_bullet: Option<i32>,
|
||||||
|
clip_volume: Option<i32>,
|
||||||
|
reload_time: Option<i32>,
|
||||||
|
fire_rate: Option<i32>,
|
||||||
|
atk: Option<String>,
|
||||||
|
def: Option<i32>,
|
||||||
|
max_hp: Option<String>,
|
||||||
|
explosion_range: Option<i32>,
|
||||||
|
bullet_speed: Option<i32>,
|
||||||
|
range: Option<i32>,
|
||||||
|
use_time: Option<i32>,
|
||||||
|
heal: Option<String>,
|
||||||
|
time: Option<i32>,
|
||||||
|
volume: Option<String>,
|
||||||
|
bullet_rad: Option<i32>,
|
||||||
|
group_num: Option<i32>,
|
||||||
|
is_luck: Option<i32>,
|
||||||
|
bullet_born_offset: Option<String>,
|
||||||
|
bullet_angle: Option<f32>,
|
||||||
|
name: Option<String>,
|
||||||
|
rad: Option<f32>,
|
||||||
|
rad2: Option<f32>,
|
||||||
|
buffid: Option<i32>,
|
||||||
|
drop_id: Option<i32>,
|
||||||
|
explosion_effect: Option<i32>,
|
||||||
|
param1: Option<String>,
|
||||||
|
param2: Option<String>,
|
||||||
|
reloadtype: Option<i32>,
|
||||||
|
recoil_force: Option<f32>,
|
||||||
|
missiles_time: Option<i32>,
|
||||||
|
heroid: Option<i32>,
|
||||||
|
launch_dev: Option<String>,
|
||||||
|
power_time: Option<String>,
|
||||||
|
power_gun: Option<String>,
|
||||||
|
power_buff: Option<String>,
|
||||||
|
through_teammate: Option<i32>,
|
||||||
|
text_icon: Option<String>,
|
||||||
|
special_damage_type: Option<String>,
|
||||||
|
max_oil: Option<f32>,
|
||||||
|
average_oil: Option<f32>,
|
||||||
|
atk_mech: Option<f32>,
|
||||||
|
use_scene: Option<i32>,
|
||||||
|
ispenetrate: Option<i32>,
|
||||||
|
is_penetrate_thing: Option<i32>,
|
||||||
|
reload_delay_time: Option<i32>,
|
||||||
|
cast_time: Option<i32>,
|
||||||
|
aiming_cast_time: Option<i32>,
|
||||||
|
auto_switch_weapon_time: Option<i32>,
|
||||||
|
quality: Option<i32>,
|
||||||
|
explosion_damage_delay: Option<i32>,
|
||||||
|
bullet_consume_type: Option<i32>,
|
||||||
|
inventory_slot: Option<String>,
|
||||||
|
_inventory_slot: Option<i32>,
|
||||||
|
critical: Option<f32>,
|
||||||
|
cri_damage: Option<f32>,
|
||||||
|
shootfire: Option<i32>,
|
||||||
|
hit_buff: Option<String>,
|
||||||
|
auto_trace: Option<i32>,
|
||||||
|
trace_range: Option<i32>,
|
||||||
|
double_gun: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Hero {
|
||||||
|
id: Option<i32>,
|
||||||
|
radius: Option<f32>,
|
||||||
|
move_speed: Option<f32>,
|
||||||
|
jump_speed: Option<f32>,
|
||||||
|
fall_speed: Option<f32>,
|
||||||
|
aim_speed: Option<f32>,
|
||||||
|
shoot_speed: Option<f32>,
|
||||||
|
reload_speed: Option<f32>,
|
||||||
|
medicine_speed: Option<f32>,
|
||||||
|
swim_speed: Option<f32>,
|
||||||
|
volume: Option<String>,
|
||||||
|
level: Option<i32>,
|
||||||
|
race: Option<i32>,
|
||||||
|
name: Option<String>,
|
||||||
|
hit_offset_x: Option<f32>,
|
||||||
|
hit_offset_y: Option<f32>,
|
||||||
|
hit_radius: Option<f32>,
|
||||||
|
ai_script: Option<String>,
|
||||||
|
init_buffs: Option<String>,
|
||||||
|
default_weapon: Option<i32>,
|
||||||
|
dead_drop: Option<String>,
|
||||||
|
delay_delete: Option<i32>,
|
||||||
|
ai: Option<i32>,
|
||||||
|
delay_remove: Option<i32>,
|
||||||
|
skinlist: Option<i32>,
|
||||||
|
pre_appear_effect: Option<String>,
|
||||||
|
pve_score: Option<String>,
|
||||||
|
hp: Option<i32>,
|
||||||
|
damage: Option<i32>,
|
||||||
|
defence: Option<i32>,
|
||||||
|
crit_atk: Option<f32>,
|
||||||
|
crit_atk_ratio: Option<f32>,
|
||||||
|
miss: Option<f32>,
|
||||||
|
miss_damage_ruduce: Option<f32>,
|
||||||
|
skill1list: Option<i32>,
|
||||||
|
skill2list: Option<i32>,
|
||||||
|
skill3list: Option<i32>,
|
||||||
|
hp_ratio: Option<f32>,
|
||||||
|
damage_ratio: Option<f32>,
|
||||||
|
defence_ratio: Option<f32>,
|
||||||
|
bt: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Robot {
|
||||||
|
id: Option<i32>,
|
||||||
|
name: Option<String>,
|
||||||
|
hero_id: Option<i32>,
|
||||||
|
skin_id: Option<String>,
|
||||||
|
weapon_id: Option<i32>,
|
||||||
|
weapon_lv: Option<i32>,
|
||||||
|
sex: Option<i32>,
|
||||||
|
dmg_ratio: Option<f32>,
|
||||||
|
bullet_offset: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Skill {
|
||||||
|
skill_id: Option<i32>,
|
||||||
|
skill_type: Option<i32>,
|
||||||
|
value_up: Option<String>,
|
||||||
|
skill_cd: Option<i32>,
|
||||||
|
skill_target: Option<i32>,
|
||||||
|
buff_list: Option<String>,
|
||||||
|
skill_distance: Option<f32>,
|
||||||
|
cold_time_up: Option<i32>,
|
||||||
|
max_times: Option<i32>,
|
||||||
|
phase1_time_offset: Option<i32>,
|
||||||
|
phase1_func: Option<i32>,
|
||||||
|
phase1_param1: Option<String>,
|
||||||
|
phase1_param2: Option<String>,
|
||||||
|
phase1_param3: Option<String>,
|
||||||
|
phase2_time_offset: Option<i32>,
|
||||||
|
phase2_func: Option<i32>,
|
||||||
|
phase2_param1: Option<String>,
|
||||||
|
phase2_param2: Option<String>,
|
||||||
|
phase2_param3: Option<String>,
|
||||||
|
phase3_time_offset: Option<i32>,
|
||||||
|
phase3_func: Option<i32>,
|
||||||
|
phase3_param1: Option<String>,
|
||||||
|
phase3_param2: Option<String>,
|
||||||
|
phase3_param3: Option<String>,
|
||||||
|
cast_time: Option<i32>,
|
||||||
|
up_exp: Option<i32>,
|
||||||
|
nextlv_skill: Option<i32>,
|
||||||
|
attack_dir_lock_time: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SkillNumber {
|
||||||
|
skill_id: Option<i32>,
|
||||||
|
skill_type: Option<i32>,
|
||||||
|
number: Option<f32>,
|
||||||
|
damage: Option<f32>,
|
||||||
|
damage_addition: Option<f32>,
|
||||||
|
damage_change: Option<f32>,
|
||||||
|
shield: Option<f32>,
|
||||||
|
shield_addition: Option<f32>,
|
||||||
|
resume: Option<f32>,
|
||||||
|
resume_addition: Option<f32>,
|
||||||
|
speed: Option<String>,
|
||||||
|
range: Option<String>,
|
||||||
|
range2: Option<String>,
|
||||||
|
range3: Option<String>,
|
||||||
|
time: Option<String>,
|
||||||
|
cd: Option<String>,
|
||||||
|
buff_id: Option<i32>,
|
||||||
|
buff_time: Option<f32>,
|
||||||
|
probability: Option<String>,
|
||||||
|
explosion_effect: Option<i32>,
|
||||||
|
effect_list: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct NpcStandard {
|
||||||
|
id: Option<i32>,
|
||||||
|
quality: Option<i32>,
|
||||||
|
hp: Option<i32>,
|
||||||
|
damage: Option<i32>,
|
||||||
|
defence: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Buff {
|
||||||
|
buff_id: Option<i32>,
|
||||||
|
name: Option<String>,
|
||||||
|
buff_target: Option<i32>,
|
||||||
|
buff_effect: Option<i32>,
|
||||||
|
trigger_type: Option<i32>,
|
||||||
|
buff_param1: Option<String>,
|
||||||
|
buff_param2: Option<String>,
|
||||||
|
buff_param3: Option<String>,
|
||||||
|
buff_param4: Option<String>,
|
||||||
|
buff_param5: Option<String>,
|
||||||
|
buff_param6: Option<String>,
|
||||||
|
duration_time: Option<String>,
|
||||||
|
buff_valueup: Option<f32>,
|
||||||
|
immune_buffeffect_list: Option<String>,
|
||||||
|
post_remove_action: Option<String>,
|
||||||
|
only_server: Option<i32>,
|
||||||
|
only_self: Option<i32>,
|
||||||
|
depend_effect: Option<i32>,
|
||||||
|
child_buff: Option<String>,
|
||||||
|
coexist_num: Option<i32>,
|
||||||
|
dead_valid: Option<i32>,
|
||||||
|
buff_interval: Option<String>,
|
||||||
|
tag: Option<String>,
|
||||||
|
post_battle_valid: Option<i32>,
|
||||||
|
only_spec_race: Option<String>,
|
||||||
|
exclude_spec_race: Option<String>,
|
||||||
|
dead_remove: Option<i32>,
|
||||||
|
no_immune: Option<i32>,
|
||||||
|
lock_move: Option<i32>,
|
||||||
|
lock_dir: Option<i32>,
|
||||||
|
lock_move_dir: Option<i32>,
|
||||||
|
disable_shot: Option<i32>,
|
||||||
|
disable_useskill: Option<i32>,
|
||||||
|
effect_list: Option<String>,
|
||||||
|
res_scale: Option<String>,
|
||||||
|
tenacity: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Drop {
|
||||||
|
drop_id: Option<i32>,
|
||||||
|
item_id: Option<String>,
|
||||||
|
num: Option<String>,
|
||||||
|
weight: Option<String>,
|
||||||
|
type: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AirDrop {
|
||||||
|
id: Option<i32>,
|
||||||
|
time: Option<i32>,
|
||||||
|
appear_time: Option<i32>,
|
||||||
|
drop_id: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AirRaid {
|
||||||
|
id: Option<i32>,
|
||||||
|
time: Option<i32>,
|
||||||
|
appear_time: Option<i32>,
|
||||||
|
bomb_id: Option<String>,
|
||||||
|
raid_wave: Option<String>,
|
||||||
|
rad: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AirLine {
|
||||||
|
id: Option<i32>,
|
||||||
|
start_point: Option<String>,
|
||||||
|
end_point: Option<String>,
|
||||||
|
plane_speed: Option<f32>,
|
||||||
|
weight: Option<i32>,
|
||||||
|
map_id: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RankReward {
|
||||||
|
rank: Option<i32>,
|
||||||
|
parameter: Option<f32>,
|
||||||
|
drop: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RankPoint {
|
||||||
|
rank: Option<i32>,
|
||||||
|
parameter: Option<i32>,
|
||||||
|
parameter2: Option<i32>,
|
||||||
|
parameter3: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct KillReward {
|
||||||
|
kill_num: Option<i32>,
|
||||||
|
parameter: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct KillPoint {
|
||||||
|
kill_num: Option<i32>,
|
||||||
|
parameter: Option<i32>,
|
||||||
|
parameter2: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AI {
|
||||||
|
id: Option<i32>,
|
||||||
|
pursuit_radius: Option<i32>,
|
||||||
|
attack_interval: Option<i32>,
|
||||||
|
attack_times: Option<i32>,
|
||||||
|
attack_type: Option<i32>,
|
||||||
|
shot_offset_angle: Option<i32>,
|
||||||
|
random_move_idle_time: Option<String>,
|
||||||
|
random_move_time: Option<String>,
|
||||||
|
attack_range: Option<i32>,
|
||||||
|
attack_rate: Option<f32>,
|
||||||
|
ai_mode: Option<i32>,
|
||||||
|
ai_kind: Option<i32>,
|
||||||
|
param1: Option<String>,
|
||||||
|
param2: Option<String>,
|
||||||
|
param3: Option<String>,
|
||||||
|
param4: Option<String>,
|
||||||
|
param5: Option<String>,
|
||||||
|
peace_time: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Text {
|
||||||
|
textid: Option<String>,
|
||||||
|
text: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct GunTalentGrow {
|
||||||
|
id: Option<i32>,
|
||||||
|
talent_id: Option<i32>,
|
||||||
|
talent_lv: Option<i32>,
|
||||||
|
addtype: Option<i32>,
|
||||||
|
addattr: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct HeroQuality {
|
||||||
|
id: Option<i32>,
|
||||||
|
quality: Option<i32>,
|
||||||
|
gold_limit: Option<i32>,
|
||||||
|
lucky: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct GunQuality {
|
||||||
|
id: Option<i32>,
|
||||||
|
quality: Option<i32>,
|
||||||
|
gold_limit: Option<i32>,
|
||||||
|
lucky: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct FormulaPvp {
|
||||||
|
top: Option<f32>,
|
||||||
|
ranked_topx: Option<f32>,
|
||||||
|
kills_topx: Option<f32>,
|
||||||
|
hero_topx: Option<f32>,
|
||||||
|
weapon_topx: Option<f32>,
|
||||||
|
survival_topx: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct PveGemini {
|
||||||
|
gemini_id: Option<i32>,
|
||||||
|
gemini_lv: Option<i32>,
|
||||||
|
gemini_limit: Option<i32>,
|
||||||
|
multiplayer_enemy_hp_mul: Option<String>,
|
||||||
|
born_point: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct PveGeminiContent {
|
||||||
|
id: Option<i32>,
|
||||||
|
mode_id: Option<i32>,
|
||||||
|
round: Option<i32>,
|
||||||
|
spawn_point: Option<String>,
|
||||||
|
enemy_id: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct PveGeminiMode {
|
||||||
|
id: Option<i32>,
|
||||||
|
map_id: Option<i32>,
|
||||||
|
mode_time: Option<String>,
|
||||||
|
area: Option<String>,
|
||||||
|
score_reward: Option<String>,
|
||||||
|
round_score: Option<String>,
|
||||||
|
next_door: Option<String>,
|
||||||
|
wave_prepare_time: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RankRoom {
|
||||||
|
id: Option<i32>,
|
||||||
|
elo_min: Option<i32>,
|
||||||
|
elo_max: Option<i32>,
|
||||||
|
elo_expansion1: Option<i32>,
|
||||||
|
elo_expansion2: Option<i32>,
|
||||||
|
expand_time1: Option<i32>,
|
||||||
|
expand_time2: Option<i32>,
|
||||||
|
player_num_standard: Option<i32>,
|
||||||
|
final_time: Option<i32>,
|
||||||
|
final_player_num: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Grasp {
|
||||||
|
grasp_id: Option<i32>,
|
||||||
|
hero_id: Option<i32>,
|
||||||
|
hero_lv: Option<i32>,
|
||||||
|
graspbuff_id1: Option<i32>,
|
||||||
|
graspbuff_id1_floor2: Option<i32>,
|
||||||
|
graspbuff_id2: Option<i32>,
|
||||||
|
weapon_id: Option<i32>,
|
||||||
|
add_buff_list: Option<String>,
|
||||||
|
remove_buff_list: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct GraspBuff {
|
||||||
|
graspbuff_id: Option<i32>,
|
||||||
|
graspbuff_floor: Option<i32>,
|
||||||
|
graspbuff_trigger: Option<String>,
|
||||||
|
graspbuff_target: Option<i32>,
|
||||||
|
graspbuff_time: Option<String>,
|
||||||
|
attr_id: Option<i32>,
|
||||||
|
attr_add_pattern: Option<i32>,
|
||||||
|
attr_add_pattern2: Option<i32>,
|
||||||
|
attr_num: Option<String>,
|
||||||
|
effect_list: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct GuideStep {
|
||||||
|
id: Option<i32>,
|
||||||
|
target: Option<i32>,
|
||||||
|
param1: Option<String>,
|
||||||
|
param2: Option<String>,
|
||||||
|
param3: Option<String>,
|
||||||
|
param4: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct WorldObject {
|
||||||
|
object_id: Option<i32>,
|
||||||
|
object_type: Option<i32>,
|
||||||
|
x: Option<f32>,
|
||||||
|
y: Option<f32>,
|
||||||
|
z: Option<f32>,
|
||||||
|
}
|
||||||
|
|
425
server/stat/tools/pbtools/app.js
Normal file
425
server/stat/tools/pbtools/app.js
Normal file
@ -0,0 +1,425 @@
|
|||||||
|
const protobuf = require('protobufjs');
|
||||||
|
const parseArgs = require('minimist');
|
||||||
|
const fs = require('fs');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
|
class PBTools {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.csMsgIdPb = null;
|
||||||
|
this.csProtoPb = null;
|
||||||
|
this.ssMsgIdPb = null;
|
||||||
|
this.ssProtoPb = null;
|
||||||
|
this.mtPb = null;
|
||||||
|
this.protoDir = './proto/';
|
||||||
|
}
|
||||||
|
|
||||||
|
async init() {
|
||||||
|
{
|
||||||
|
this.csProtoPb = await (new protobuf.Root()).load(
|
||||||
|
this.protoDir + 'cs_proto.proto',
|
||||||
|
{
|
||||||
|
'keepCase': true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
this.csMsgIdPb = await (new protobuf.Root()).load(
|
||||||
|
this.protoDir + 'cs_msgid.proto',
|
||||||
|
{
|
||||||
|
'keepCase': true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.csCmMsgId = this.csMsgIdPb.lookup('CMMessageId_e');
|
||||||
|
this.csSmMsgId = this.csMsgIdPb.lookup('SMMessageId_e');
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
this.ssProtoPb = await (new protobuf.Root()).load(
|
||||||
|
this.protoDir + 'ss_proto.proto',
|
||||||
|
{
|
||||||
|
'keepCase': true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
this.ssMsgIdPb = await (new protobuf.Root()).load(
|
||||||
|
this.protoDir + 'ss_msgid.proto',
|
||||||
|
{
|
||||||
|
'keepCase': true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.ssSSmMsgId = this.ssMsgIdPb.lookup('SSMMessageId_e');
|
||||||
|
}*/
|
||||||
|
{
|
||||||
|
this.mtPb = await (new protobuf.Root()).load(
|
||||||
|
this.protoDir + 'mt.proto',
|
||||||
|
{
|
||||||
|
'keepCase': true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await this.genCsAutoGen();
|
||||||
|
await this.genMtbAutoGen();
|
||||||
|
//await this.genSsAutoGen();
|
||||||
|
}
|
||||||
|
|
||||||
|
async genCsAutoGen() {
|
||||||
|
let data =
|
||||||
|
`use std::rc::{Rc, Weak};
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use crate::cs::cs_proto as cs;
|
||||||
|
use crate::cs::cs_msgid as cs_msgid;
|
||||||
|
|
||||||
|
pub struct Handler {
|
||||||
|
msg_id: i32,
|
||||||
|
handler_id: i32,
|
||||||
|
cb: Box::<dyn Fn (&f9::MsgHdr, &dyn MsgHandler)>,
|
||||||
|
}
|
||||||
|
|
||||||
|
static mut HANDLERS: Vec<Option<Handler>> = Vec::new();
|
||||||
|
|
||||||
|
pub fn get_net_msg_handler(msg_id: u16) -> &'static Option<Handler> {
|
||||||
|
unsafe {
|
||||||
|
if (msg_id as usize) < HANDLERS.len() {
|
||||||
|
return &HANDLERS[msg_id as usize];
|
||||||
|
} else {
|
||||||
|
return &None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reg_handler_id(msg_id: u16, handler_id: i32) {
|
||||||
|
unsafe {
|
||||||
|
if (msg_id as usize) < HANDLERS.len() {
|
||||||
|
match &mut HANDLERS[msg_id as usize] {
|
||||||
|
Some(v) => {
|
||||||
|
v.handler_id = handler_id;
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn dispatch_msg(msg_id: u16, hdr: &f9::MsgHdr, h: &dyn MsgHandler) {
|
||||||
|
let mut handler: &Option<Handler> = &None;
|
||||||
|
unsafe {
|
||||||
|
handler = get_net_msg_handler(msg_id);
|
||||||
|
}
|
||||||
|
match handler {
|
||||||
|
Some(v) => {
|
||||||
|
(*v.cb)(hdr, h);
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
func ParsePb(msgId uint16, data []byte) interface{} {
|
||||||
|
handler := handlers[msgId]
|
||||||
|
if handler == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return handler.ParseCb(data)
|
||||||
|
}*/
|
||||||
|
`;
|
||||||
|
data += `
|
||||||
|
pub trait MsgHandler {`;
|
||||||
|
this.csProtoPb.nested.cs.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
if (item.name[0] == 'C' &&
|
||||||
|
item.name[1] == 'M') {
|
||||||
|
const finalyName = this.converLowCaseName(item.name);
|
||||||
|
data += `
|
||||||
|
|
||||||
|
fn ${finalyName}(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::${item.name}>>) {
|
||||||
|
panic!("not implement");
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
data += `
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
data += `
|
||||||
|
pub fn registe_handlers() {
|
||||||
|
unsafe {
|
||||||
|
HANDLERS.reserve(2000);
|
||||||
|
for i in 0..1999 {
|
||||||
|
HANDLERS.push(None);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
this.csProtoPb.nested.cs.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
if (item.name[0] == 'C' &&
|
||||||
|
item.name[1] == 'M') {
|
||||||
|
const finalyName = this.converLowCaseName(item.name);
|
||||||
|
data += `
|
||||||
|
HANDLERS[cs_msgid::CMMessageId_e::_${item.name} as usize] = Some(
|
||||||
|
Handler {
|
||||||
|
msg_id: cs_msgid::CMMessageId_e::_${item.name} as i32,
|
||||||
|
handler_id: 0,
|
||||||
|
cb: Box::new(|hdr: &f9::MsgHdr, handler: &dyn MsgHandler| {
|
||||||
|
if let Some(msg) = hdr.msg.downcast_ref::<Rc::<RefCell::<cs::${item.name}>>>() {
|
||||||
|
handler.${finalyName}(hdr, msg.clone());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
data += `
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
fs.writeFileSync('./src/cs/cs_auto_gen.rs', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
async genSsAutoGen() {
|
||||||
|
let data = `package ss
|
||||||
|
|
||||||
|
import (
|
||||||
|
"f5"
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SsNetMsgHandler f5.NetMsgHandler[MsgHandler];
|
||||||
|
|
||||||
|
type MsgHandlerImpl struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
var handlers [2000]*SsNetMsgHandler
|
||||||
|
|
||||||
|
func GetNetMsgHandler(msgId uint16) *SsNetMsgHandler {
|
||||||
|
handler := handlers[msgId]
|
||||||
|
return handler
|
||||||
|
}
|
||||||
|
|
||||||
|
func DispatchMsg(handler *SsNetMsgHandler, hdr *f5.MsgHdr, msgHandler MsgHandler) {
|
||||||
|
handler.Cb(hdr, msgHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegHandlerId(msgId int, handlerId int) {
|
||||||
|
handler := handlers[msgId]
|
||||||
|
handler.HandlerId = handlerId
|
||||||
|
}
|
||||||
|
|
||||||
|
func ParsePb(msgId uint16, data []byte) interface{} {
|
||||||
|
handler := handlers[msgId]
|
||||||
|
if handler == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return handler.ParseCb(data)
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
data += `
|
||||||
|
type MsgHandler interface {`;
|
||||||
|
this.ssProtoPb.nested.ss.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
if (item.name[0] == 'S' &&
|
||||||
|
item.name[1] == 'S') {
|
||||||
|
data += `
|
||||||
|
${item.name}(*f5.MsgHdr, *${item.name})`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
data += `
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
this.ssProtoPb.nested.ss.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
if (item.name[0] == 'S' &&
|
||||||
|
item.name[1] == 'S') {
|
||||||
|
data += `
|
||||||
|
func (this *MsgHandlerImpl) ${item.name}(hdr *f5.MsgHdr, msg *${item.name}) {
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.ssProtoPb.nested.ss.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
if (item.name[0] == 'S' &&
|
||||||
|
item.name[1] == 'S') {
|
||||||
|
data += `
|
||||||
|
func (this *${item.name}) GetNetMsgId() uint16 {
|
||||||
|
return uint16(SSMessageIdE__${item.name})
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
} else if (item.name[0] == 'S' &&
|
||||||
|
item.name[1] == 'M') {
|
||||||
|
data += `
|
||||||
|
func (this *${item.name}) GetNetMsgId() uint16 {
|
||||||
|
return uint16(SMMessageIdE__${item.name})
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
data += `
|
||||||
|
func init() {
|
||||||
|
`;
|
||||||
|
this.ssProtoPb.nested.ss.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
if (item.name[0] == 'S' &&
|
||||||
|
item.name[1] == 'S') {
|
||||||
|
data += `
|
||||||
|
handlers[int(SSMessageIdE__${item.name})] = &SsNetMsgHandler{
|
||||||
|
MsgId: int(SSMessageIdE__${item.name}),
|
||||||
|
ParseCb: func (data []byte) interface{} {
|
||||||
|
msg := &${item.name}{}
|
||||||
|
proto.Unmarshal(data, msg)
|
||||||
|
return msg
|
||||||
|
},
|
||||||
|
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||||
|
handler.${item.name}(hdr, hdr.Msg.(*${item.name}))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
data += `
|
||||||
|
}`;
|
||||||
|
fs.writeFileSync('./ss/ss.auto_gen.go', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
async genMtbAutoGen() {
|
||||||
|
let data = `use std::rc::{Rc, Weak};
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
`;
|
||||||
|
this.mtPb.nested.mt.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
data += `pub struct ${item.name} {\n`;
|
||||||
|
item.fieldsArray.forEach
|
||||||
|
(
|
||||||
|
(item2, index) => {
|
||||||
|
assert(item2.id <= 127);
|
||||||
|
data += ` ${item2.name}: ` + this.dumpClassField(item, item2, index) + `,\n`;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
data += `}
|
||||||
|
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
data += '';
|
||||||
|
/*
|
||||||
|
this.mtPb.nested.mt.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
item.fieldsArray.forEach
|
||||||
|
(
|
||||||
|
(item2, index) => {
|
||||||
|
const newName = this.converUpperCamelCaseName(item2.name);
|
||||||
|
data += `func (this *${item.name}) Get${newName}() ` +
|
||||||
|
this.dumpClassField(item, item2, index) + ` {\n`;
|
||||||
|
data += ` return this.${item2.name}\n`;
|
||||||
|
data += `}\n\n`;
|
||||||
|
data += `func (this *${item.name}) Has${newName}() bool {\n`;
|
||||||
|
if (item2.id < 64) {
|
||||||
|
data += ` return (this._flags1_ & (uint64(1) << ${item2.id})) > 0\n`;
|
||||||
|
} else {
|
||||||
|
data += ` return (this._flags2_ & (uint64(1) << (${item2.id} - 64))) > 0\n`;
|
||||||
|
}
|
||||||
|
data += `}\n\n`;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.mtPb.nested.mt.nestedArray.forEach(
|
||||||
|
(item) => {
|
||||||
|
data += `
|
||||||
|
func (this *${item.name}) LoadFromKv(kv map[string]interface{}) {
|
||||||
|
`;
|
||||||
|
item.fieldsArray.forEach
|
||||||
|
(
|
||||||
|
(item2, index) => {
|
||||||
|
if (item2.id < 64) {
|
||||||
|
data += ` f5.ReadMetaTableField(&this.${item2.name}, "${item2.name}", &this._flags1_, ${item2.id}, kv)\n`;
|
||||||
|
} else {
|
||||||
|
data += ` f5.ReadMetaTableField(&this.${item2.name}, "${item2.name}", &this._flags2_, ${item2.id} - 64, kv)\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
data += '}\n';
|
||||||
|
}
|
||||||
|
);*/
|
||||||
|
fs.writeFileSync('./src/mtb/mtb_auto_gen.rs', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
dumpClassField(cls, field, index) {
|
||||||
|
const fieldName = field.name;
|
||||||
|
switch (field.type) {
|
||||||
|
case 'int32':
|
||||||
|
{
|
||||||
|
return `Option<i32>`;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'int64':
|
||||||
|
{
|
||||||
|
return `Option<i64>`;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'float':
|
||||||
|
{
|
||||||
|
return `Option<f32>`;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'double':
|
||||||
|
{
|
||||||
|
return `Option<f64>`;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'string':
|
||||||
|
{
|
||||||
|
return `Option<String>`;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(field);
|
||||||
|
assert(false, 'error field type:' + field.type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
converUpperCamelCaseName(name) {
|
||||||
|
let newName = '';
|
||||||
|
let preIs_ = false;
|
||||||
|
for (let i = 0; i < name.length; ++i) {
|
||||||
|
if (i == 0) {
|
||||||
|
newName += name[i].toUpperCase();
|
||||||
|
preIs_ = name[i] == '_';
|
||||||
|
} else {
|
||||||
|
if (preIs_) {
|
||||||
|
if (name[i] != '_') {
|
||||||
|
newName += name[i].toUpperCase();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (name[i] != '_') {
|
||||||
|
newName += name[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
preIs_ = name[i] == '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
converLowCaseName(name) {
|
||||||
|
let newName = 'cm';
|
||||||
|
let preIs_ = false;
|
||||||
|
for (let i = 2; i < name.length; ++i) {
|
||||||
|
if (name[i].charCodeAt(0) >= 65 && name[i].charCodeAt(0) <= 90) {
|
||||||
|
newName += '_' + name[i].toLowerCase();
|
||||||
|
} else {
|
||||||
|
newName += name[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
(new PBTools).init();
|
162
server/stat/tools/pbtools/package-lock.json
generated
Normal file
162
server/stat/tools/pbtools/package-lock.json
generated
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
{
|
||||||
|
"name": "pbtools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@protobufjs/aspromise": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="
|
||||||
|
},
|
||||||
|
"@protobufjs/base64": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
|
||||||
|
},
|
||||||
|
"@protobufjs/codegen": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
|
||||||
|
},
|
||||||
|
"@protobufjs/eventemitter": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="
|
||||||
|
},
|
||||||
|
"@protobufjs/fetch": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
|
||||||
|
"requires": {
|
||||||
|
"@protobufjs/aspromise": "^1.1.1",
|
||||||
|
"@protobufjs/inquire": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@protobufjs/float": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="
|
||||||
|
},
|
||||||
|
"@protobufjs/inquire": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="
|
||||||
|
},
|
||||||
|
"@protobufjs/path": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="
|
||||||
|
},
|
||||||
|
"@protobufjs/pool": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="
|
||||||
|
},
|
||||||
|
"@protobufjs/utf8": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
|
||||||
|
},
|
||||||
|
"@types/long": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA=="
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "20.4.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.9.tgz",
|
||||||
|
"integrity": "sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ=="
|
||||||
|
},
|
||||||
|
"asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
|
},
|
||||||
|
"axios": {
|
||||||
|
"version": "0.27.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||||
|
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||||
|
"requires": {
|
||||||
|
"follow-redirects": "^1.14.9",
|
||||||
|
"form-data": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"requires": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
|
||||||
|
},
|
||||||
|
"follow-redirects": {
|
||||||
|
"version": "1.15.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||||
|
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
|
||||||
|
},
|
||||||
|
"form-data": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
|
"requires": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"long": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
|
||||||
|
},
|
||||||
|
"mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
|
||||||
|
},
|
||||||
|
"mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"requires": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimist": {
|
||||||
|
"version": "1.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||||
|
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
|
||||||
|
},
|
||||||
|
"nodejs-websocket": {
|
||||||
|
"version": "1.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/nodejs-websocket/-/nodejs-websocket-1.7.2.tgz",
|
||||||
|
"integrity": "sha512-PFX6ypJcCNDs7obRellR0DGTebfUhw1SXGKe2zpB+Ng1DQJhdzbzx1ob+AvJCLzy2TJF4r8cCDqMQqei1CZdPQ=="
|
||||||
|
},
|
||||||
|
"protobufjs": {
|
||||||
|
"version": "6.11.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz",
|
||||||
|
"integrity": "sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==",
|
||||||
|
"requires": {
|
||||||
|
"@protobufjs/aspromise": "^1.1.2",
|
||||||
|
"@protobufjs/base64": "^1.1.2",
|
||||||
|
"@protobufjs/codegen": "^2.0.4",
|
||||||
|
"@protobufjs/eventemitter": "^1.1.0",
|
||||||
|
"@protobufjs/fetch": "^1.1.0",
|
||||||
|
"@protobufjs/float": "^1.0.2",
|
||||||
|
"@protobufjs/inquire": "^1.1.0",
|
||||||
|
"@protobufjs/path": "^1.1.2",
|
||||||
|
"@protobufjs/pool": "^1.1.0",
|
||||||
|
"@protobufjs/utf8": "^1.1.0",
|
||||||
|
"@types/long": "^4.0.1",
|
||||||
|
"@types/node": ">=13.7.0",
|
||||||
|
"long": "^4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
server/stat/tools/pbtools/package.json
Normal file
13
server/stat/tools/pbtools/package.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "pbtools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.27.0",
|
||||||
|
"nodejs-websocket": "^1.7.2",
|
||||||
|
"protobufjs": "^6.11.2",
|
||||||
|
"minimist": "^1.2.6"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user