1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-21 23:17:45 +00:00

Fixes and workarounds for battling

This commit is contained in:
Joshua Goins 2025-03-29 14:38:40 -04:00
parent d54b4c945e
commit 1ef4078ec1
4 changed files with 29 additions and 10 deletions

View file

@ -5,5 +5,6 @@ end
function doAction(player) function doAction(player)
-- give sprint -- give sprint
player:give_status_effect(50, 5.0) -- commented out because it breaks other stats due to stubs
--player:give_status_effect(50, 5.0)
end end

View file

@ -814,6 +814,14 @@ async fn main() {
// tell them the action results // tell them the action results
{ {
let mut effects = [ActionEffect::default(); 8];
effects[0] = ActionEffect {
action_type: 3,
value: 22,
param1: 133,
..Default::default()
};
let ipc = ServerZoneIpcSegment { let ipc = ServerZoneIpcSegment {
op_code: ServerZoneIpcType::ActionResult, op_code: ServerZoneIpcType::ActionResult,
timestamp: timestamp_secs(), timestamp: timestamp_secs(),
@ -823,18 +831,17 @@ async fn main() {
object_id: ObjectId(0x106ad804), object_id: ObjectId(0x106ad804),
object_type: 0, object_type: 0,
}, },
target_id_again: ObjectTypeId {
object_id: ObjectId(0x106ad804),
object_type: 0,
},
action_id: 31, action_id: 31,
animation_lock_time: 0.6, animation_lock_time: 0.6,
rotation: connection.player_data.rotation, rotation: connection.player_data.rotation,
action_animation_id: 31, action_animation_id: 31,
flag: 1, flag: 1,
effect_count: 1, effect_count: 1,
effects: [ActionEffect { effects,
action_type: 3,
value: 50,
..Default::default()
};
8],
..Default::default() ..Default::default()
}, },
), ),

View file

@ -348,8 +348,8 @@ impl ZoneConnection {
}; };
self.send_segment(PacketSegment { self.send_segment(PacketSegment {
source_actor: self.player_data.actor_id, source_actor: actor_id.0,
target_actor: actor_id.0, target_actor: self.player_data.actor_id,
segment_type: SegmentType::Ipc { data: ipc }, segment_type: SegmentType::Ipc { data: ipc },
}) })
.await; .await;

View file

@ -35,8 +35,9 @@ pub struct ActionResult {
pub effect_count: u8, pub effect_count: u8,
pub unk4: u16, pub unk4: u16,
pub unk5: [u8; 6], pub unk5: [u8; 6],
#[brw(pad_after = 18)] // idk, target is here too?
pub effects: [ActionEffect; 8], pub effects: [ActionEffect; 8],
#[brw(pad_before = 6, pad_after = 4)]
pub target_id_again: ObjectTypeId,
} }
#[cfg(test)] #[cfg(test)]
@ -59,6 +60,10 @@ mod tests {
let action_result = ActionResult::read_le(&mut buffer).unwrap(); let action_result = ActionResult::read_le(&mut buffer).unwrap();
assert_eq!(action_result.main_target.object_id, ObjectId(0x400097d0)); assert_eq!(action_result.main_target.object_id, ObjectId(0x400097d0));
assert_eq!(
action_result.target_id_again.object_id,
ObjectId(0x400097d0)
);
assert_eq!(action_result.action_id, 31); assert_eq!(action_result.action_id, 31);
assert_eq!(action_result.animation_lock_time, 0.6); assert_eq!(action_result.animation_lock_time, 0.6);
assert_eq!(action_result.rotation, 1.9694216); assert_eq!(action_result.rotation, 1.9694216);
@ -68,6 +73,12 @@ mod tests {
// effect 0: attack // effect 0: attack
assert_eq!(action_result.effects[0].action_type, 3); assert_eq!(action_result.effects[0].action_type, 3);
assert_eq!(action_result.effects[0].param0, 0);
assert_eq!(action_result.effects[0].param1, 113);
assert_eq!(action_result.effects[0].param2, 0);
assert_eq!(action_result.effects[0].param3, 0);
assert_eq!(action_result.effects[0].param4, 0);
assert_eq!(action_result.effects[0].value, 22);
// effect 1: start action combo // effect 1: start action combo
assert_eq!(action_result.effects[1].action_type, 27); assert_eq!(action_result.effects[1].action_type, 27);