Compare commits

..

No commits in common. "main" and "1.0.0" have entirely different histories.
main ... 1.0.0

7 changed files with 102280 additions and 112689 deletions

View file

@ -17,7 +17,7 @@ Copy and paste launcher.exe and hkprg.dll from launcher folder inside hysilens-s
Windows: Windows:
``` ```
git clone https://git.xeondev.com/HonkaiSlopRail/hysilens-sr git clone https://git.xeondev.com/HonkaiSlopRail/hysilens-sr
cd hysilens-sr cd jingliu-sr
zig build run-dispatch zig build run-dispatch
zig build run-gameserver zig build run-gameserver
``` ```

View file

@ -44,7 +44,7 @@ pub const buffs_unlocked = &[_]u32{
131201, 131301, 131401, 131501, 131502, 131503, 131701, 131702, 140101, 131201, 131301, 131401, 131501, 131502, 131503, 131701, 131702, 140101,
140102, 140201, 140202, 140301, 140401, 140501, 140601, 140701, 140801, 140102, 140201, 140202, 140301, 140401, 140501, 140601, 140701, 140801,
140901, 200501, 200601, 220501, 221201, 800301, 800501, 101401, 101501, 140901, 200501, 200601, 220501, 221201, 800301, 800501, 101401, 101501,
141001, 141001, 141201,
}; };
//TODO: update more Remembrance character in future //TODO: update more Remembrance character in future

View file

@ -225,14 +225,6 @@ const DummyCmdList = [_]struct { CmdID, CmdID }{
.{ CmdID.CmdGetPlanetFesDataCsReq, CmdID.CmdGetPlanetFesDataScRsp }, .{ CmdID.CmdGetPlanetFesDataCsReq, CmdID.CmdGetPlanetFesDataScRsp },
.{ CmdID.CmdParkourGetDataCsReq, CmdID.CmdParkourGetDataScRsp }, .{ CmdID.CmdParkourGetDataCsReq, CmdID.CmdParkourGetDataScRsp },
.{ CmdID.CmdMatchThreeV2GetDataCsReq, CmdID.CmdMatchThreeV2GetDataScRsp }, .{ CmdID.CmdMatchThreeV2GetDataCsReq, CmdID.CmdMatchThreeV2GetDataScRsp },
.{ CmdID.CmdGetMonopolyInfoCsReq, CmdID.CmdGetMonopolyInfoScRsp },
.{ CmdID.CmdMonopolyGetRegionProgressCsReq, CmdID.CmdMonopolyGetRegionProgressScRsp },
.{ CmdID.CmdGetMbtiReportCsReq, CmdID.CmdGetMbtiReportScRsp },
.{ CmdID.CmdDrinkMakerCheersGetDataCsReq, CmdID.CmdDrinkMakerCheersGetDataScRsp },
.{ CmdID.CmdGetDrinkMakerDataCsReq, CmdID.CmdGetDrinkMakerDataScRsp },
.{ CmdID.CmdChimeraGetDataCsReq, CmdID.CmdChimeraGetDataScRsp },
.{ CmdID.CmdMarbleGetDataCsReq, CmdID.CmdMarbleGetDataScRsp },
.{ CmdID.CmdGetPreAvatarActivityListCsReq, CmdID.CmdGetPreAvatarActivityListScRsp },
}; };
const SuppressLogList = [_]CmdID{CmdID.CmdSceneEntityMoveCsReq}; const SuppressLogList = [_]CmdID{CmdID.CmdSceneEntityMoveCsReq};

View file

@ -4,7 +4,6 @@ const Session = @import("../Session.zig");
const Packet = @import("../Packet.zig"); const Packet = @import("../Packet.zig");
const Config = @import("../services/config.zig"); const Config = @import("../services/config.zig");
const Data = @import("../data.zig"); const Data = @import("../data.zig");
const Lineup = @import("../services/lineup.zig");
const ChallengeData = @import("../services/challenge.zig"); const ChallengeData = @import("../services/challenge.zig");
const NodeCheck = @import("../commands/value.zig"); const NodeCheck = @import("../commands/value.zig");
@ -23,43 +22,6 @@ fn isInList(id: u32, list: []const u32) bool {
} }
return false; return false;
} }
const Element = enum {
Physical,
Fire,
Ice,
Thunder,
Wind,
Quantum,
Imaginary,
None,
};
fn getAvatarElement(avatar_id: u32) Element {
return switch (avatar_id) {
1105, 1107, 1111, 1206, 1215, 1221, 1302, 1309, 1315, 1408, 1410, 8001, 8002 => .Physical,
1003, 1009, 1109, 1112, 1210, 1218, 1222, 1225, 1301, 1310, 8003, 8004 => .Fire,
1001, 1013, 1104, 1106, 1209, 1212, 1303, 1312, 1401, 8007, 8008 => .Ice,
1005, 1008, 1103, 1202, 1204, 1211, 1223, 1308, 1402 => .Thunder,
1002, 1014, 1101, 1108, 1205, 1217, 1220, 1307, 1405, 1409, 1412 => .Wind,
1006, 1015, 1102, 1110, 1201, 1208, 1214, 1306, 1314, 1403, 1406, 1407 => .Quantum,
1004, 1203, 1207, 1213, 1224, 1304, 1305, 1313, 1317, 1404, 8005, 8006 => .Imaginary,
else => .None,
};
}
fn getAttackerBuffId() u32 {
const avatar_id = selectedAvatarID[Lineup.leader_slot];
const element = getAvatarElement(avatar_id);
return switch (element) {
.Physical => 1000111,
.Fire => 1000112,
.Ice => 1000113,
.Thunder => 1000114,
.Wind => 1000115,
.Quantum => 1000116,
.Imaginary => 1000117,
.None => 0,
};
}
fn createBattleRelic(allocator: Allocator, id: u32, level: u32, main_affix_id: u32, stat1: u32, cnt1: u32, step1: u32, stat2: u32, cnt2: u32, step2: u32, stat3: u32, cnt3: u32, step3: u32, stat4: u32, cnt4: u32, step4: u32) !protocol.BattleRelic { fn createBattleRelic(allocator: Allocator, id: u32, level: u32, main_affix_id: u32, stat1: u32, cnt1: u32, step1: u32, stat2: u32, cnt2: u32, step2: u32, stat3: u32, cnt3: u32, step3: u32, stat4: u32, cnt4: u32, step4: u32) !protocol.BattleRelic {
var relic = protocol.BattleRelic{ var relic = protocol.BattleRelic{
.id = id, .id = id,
@ -140,7 +102,7 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
.id = buffId, .id = buffId,
.level = 1, .level = 1,
.owner_index = @intCast(avatar_index), .owner_index = @intCast(avatar_index),
.wave_flag = 0xFFFFFFFF, .wave_flag = 1,
.target_index_list = targetIndexList, .target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator), .dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
}; };
@ -154,7 +116,7 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
.id = 1000119, //for is_ignore toughness .id = 1000119, //for is_ignore toughness
.level = 1, .level = 1,
.owner_index = @intCast(avatar_index), .owner_index = @intCast(avatar_index),
.wave_flag = 0xFFFFFFFF, .wave_flag = 1,
.target_index_list = targetIndexList, .target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator), .dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
}; };
@ -167,7 +129,7 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
.id = 122401, //for hunt march 7th tech .id = 122401, //for hunt march 7th tech
.level = 1, .level = 1,
.owner_index = @intCast(avatar_index), .owner_index = @intCast(avatar_index),
.wave_flag = 0xFFFFFFFF, .wave_flag = 1,
.target_index_list = targetIndexList, .target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator), .dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
}; };
@ -183,7 +145,7 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
.id = 1000112, //for firefly tech .id = 1000112, //for firefly tech
.level = 1, .level = 1,
.owner_index = @intCast(avatar_index), .owner_index = @intCast(avatar_index),
.wave_flag = 0xFFFFFFFF, .wave_flag = 1,
.target_index_list = targetIndexList, .target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator), .dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
}; };
@ -196,43 +158,17 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
.id = 800701, //for rmc tech .id = 800701, //for rmc tech
.level = 1, .level = 1,
.owner_index = @intCast(avatar_index), .owner_index = @intCast(avatar_index),
.wave_flag = 0xFFFFFFFF, .wave_flag = 1,
.target_index_list = targetIndexList, .target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator), .dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
}; };
try buff_rmc.dynamic_values.append(.{ .key = .{ .Const = "SkillIndex" }, .value = 0 }); try buff_rmc.dynamic_values.append(.{ .key = .{ .Const = "SkillIndex" }, .value = 0 });
try battle.buff_list.append(buff_rmc); try battle.buff_list.append(buff_rmc);
} }
if (buffedAvatarId == 1412) {
var buff_ce = protocol.BattleBuff{
.id = 141201, //for cerydra core buff
.level = 1,
.owner_index = @intCast(avatar_index),
.wave_flag = 0xFFFFFFFF,
.target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
};
try buff_ce.dynamic_values.append(.{ .key = .{ .Const = "SkillIndex" }, .value = 0 });
var buff_target = protocol.BattleBuff{
.id = 141202, //for switch leader
.level = 1,
.owner_index = Lineup.leader_slot,
.wave_flag = 0xFFFFFFFF,
.target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
};
try buff_target.dynamic_values.appendSlice(&[_]protocol.BattleBuff.DynamicValuesEntry{
.{ .key = .{ .Const = "1" }, .value = 1 },
.{ .key = .{ .Const = "2" }, .value = 1 },
});
try battle.buff_list.append(buff_ce);
try battle.buff_list.append(buff_target);
}
} }
// Function to add future global buff. // Function to add future global buff.
fn addGolbalPassive(allocator: Allocator, battle: *protocol.SceneBattleInfo) !void { fn addGolbalPassive(allocator: Allocator, battle: *protocol.SceneBattleInfo, wave_flag: u32) !void {
if (isInList(1407, Data.AllAvatars)) { //support Castorice if (isInList(1407, Data.AllAvatars)) { //support Castorice
var targetIndexList = ArrayList(u32).init(allocator); var targetIndexList = ArrayList(u32).init(allocator);
try targetIndexList.append(0); try targetIndexList.append(0);
@ -240,7 +176,7 @@ fn addGolbalPassive(allocator: Allocator, battle: *protocol.SceneBattleInfo) !vo
.id = 140703, .id = 140703,
.level = 1, .level = 1,
.owner_index = 1, .owner_index = 1,
.wave_flag = 0xFFFFFFFF, .wave_flag = wave_flag,
.target_index_list = targetIndexList, .target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator), .dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
}; };
@ -248,22 +184,6 @@ fn addGolbalPassive(allocator: Allocator, battle: *protocol.SceneBattleInfo) !vo
try battle.buff_list.append(mazebuff_data); try battle.buff_list.append(mazebuff_data);
} }
} }
// Function to add elemental hit when trigger battle .
fn addTriggerAttack(allocator: Allocator, battle: *protocol.SceneBattleInfo) !void {
var targetIndexList = ArrayList(u32).init(allocator);
try targetIndexList.append(0);
var attack = protocol.BattleBuff{
.id = getAttackerBuffId(),
.level = 1,
.owner_index = Lineup.leader_slot,
.wave_flag = 0xFFFFFFFF,
.target_index_list = targetIndexList,
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
};
try attack.dynamic_values.append(.{ .key = .{ .Const = "SkillIndex" }, .value = 1 });
try battle.buff_list.append(attack);
}
fn createBattleInfo(allocator: Allocator, config: Config.GameConfig, stage_monster_wave_len: u32, stage_id: u32, rounds_limit: u32) protocol.SceneBattleInfo { fn createBattleInfo(allocator: Allocator, config: Config.GameConfig, stage_monster_wave_len: u32, stage_id: u32, rounds_limit: u32) protocol.SceneBattleInfo {
var battle = protocol.SceneBattleInfo.init(allocator); var battle = protocol.SceneBattleInfo.init(allocator);
battle.battle_id = config.battle_config.battle_id; battle.battle_id = config.battle_config.battle_id;
@ -332,7 +252,7 @@ fn addBattleTargets(allocator: Allocator, battle: *protocol.SceneBattleInfo) !vo
try battle.battle_target_info.append(.{ .key = 5, .value = pfTargetTail }); try battle.battle_target_info.append(.{ .key = 5, .value = pfTargetTail });
}, },
// AS // AS
420100...420900 => { 420100...420300 => {
try battle.battle_target_info.append(.{ .key = 1, .value = asTargetHead }); try battle.battle_target_info.append(.{ .key = 1, .value = asTargetHead });
}, },
else => {}, else => {},
@ -372,9 +292,8 @@ pub const BattleManager = struct {
break; break;
} }
try addMonsterWaves(self.allocator, &battle, config.battle_config.monster_wave, config.battle_config.monster_level); try addMonsterWaves(self.allocator, &battle, config.battle_config.monster_wave, config.battle_config.monster_level);
try addTriggerAttack(self.allocator, &battle);
try addStageBlessings(self.allocator, &battle, config.battle_config.blessings.items); try addStageBlessings(self.allocator, &battle, config.battle_config.blessings.items);
try addGolbalPassive(self.allocator, &battle); try addGolbalPassive(self.allocator, &battle, @intCast(config.battle_config.monster_wave.items.len));
try addBattleTargets(self.allocator, &battle); try addBattleTargets(self.allocator, &battle);
return battle; return battle;
} }
@ -418,9 +337,8 @@ pub const ChallegeStageManager = struct {
break; break;
} }
try addMonsterWaves(self.allocator, &battle, stageConf.monster_list, stageConf.level); try addMonsterWaves(self.allocator, &battle, stageConf.monster_list, stageConf.level);
try addTriggerAttack(self.allocator, &battle);
try addStageBlessings(self.allocator, &battle, ChallengeData.challenge_blessing); try addStageBlessings(self.allocator, &battle, ChallengeData.challenge_blessing);
try addGolbalPassive(self.allocator, &battle); try addGolbalPassive(self.allocator, &battle, @intCast(stageConf.monster_list.items.len));
try addBattleTargets(self.allocator, &battle); try addBattleTargets(self.allocator, &battle);
break; break;
} }

View file

@ -9,8 +9,6 @@ const BattleManager = @import("../manager/battle_mgr.zig");
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const CmdID = protocol.CmdID; const CmdID = protocol.CmdID;
pub var leader_slot: u32 = 0;
pub fn onGetCurLineupData(session: *Session, _: *const Packet, allocator: Allocator) !void { pub fn onGetCurLineupData(session: *Session, _: *const Packet, allocator: Allocator) !void {
var lineup_mgr = LineupManager.LineupManager.init(allocator); var lineup_mgr = LineupManager.LineupManager.init(allocator);
const lineup = try lineup_mgr.createLineup(); const lineup = try lineup_mgr.createLineup();
@ -22,7 +20,6 @@ pub fn onGetCurLineupData(session: *Session, _: *const Packet, allocator: Alloca
pub fn onChangeLineupLeader(session: *Session, packet: *const Packet, allocator: Allocator) !void { pub fn onChangeLineupLeader(session: *Session, packet: *const Packet, allocator: Allocator) !void {
const req = try packet.getProto(protocol.ChangeLineupLeaderCsReq, allocator); const req = try packet.getProto(protocol.ChangeLineupLeaderCsReq, allocator);
leader_slot = req.slot;
try session.send(CmdID.CmdChangeLineupLeaderScRsp, protocol.ChangeLineupLeaderScRsp{ try session.send(CmdID.CmdChangeLineupLeaderScRsp, protocol.ChangeLineupLeaderScRsp{
.slot = req.slot, .slot = req.slot,
.retcode = 0, .retcode = 0,

View file

@ -26,7 +26,7 @@ pub fn onSceneEntityMove(session: *Session, packet: *const Packet, allocator: Al
const req = try packet.getProto(protocol.SceneEntityMoveCsReq, allocator); const req = try packet.getProto(protocol.SceneEntityMoveCsReq, allocator);
for (req.entity_motion_list.items) |entity_motion| { for (req.entity_motion_list.items) |entity_motion| {
if (entity_motion.motion) |motion| { if (entity_motion.motion) |motion| {
if (entity_motion.entity_id > 99999 and entity_motion.entity_id < 1000000 or entity_motion.entity_id == 0) //if (entity_motion.entity_id > 99999 and entity_motion.entity_id < 1000000 or entity_motion.entity_id == 0)
log.debug("[POSITION] entity_id: {}, motion: {}", .{ entity_motion.entity_id, motion }); log.debug("[POSITION] entity_id: {}, motion: {}", .{ entity_motion.entity_id, motion });
} }
} }

File diff suppressed because it is too large Load diff