Commit 7df41f61 authored by KingRainbow44's avatar KingRainbow44
Browse files

Invoke `AbilityManager#onSkillStart` and `AbilityManager#onSkillEnd`

parent 64204286
...@@ -11,20 +11,23 @@ import emu.grasscutter.utils.Utils; ...@@ -11,20 +11,23 @@ import emu.grasscutter.utils.Utils;
@Opcodes(PacketOpcodes.ClientAbilityInitFinishNotify) @Opcodes(PacketOpcodes.ClientAbilityInitFinishNotify)
public class HandlerClientAbilityInitFinishNotify extends PacketHandler { public class HandlerClientAbilityInitFinishNotify extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
ClientAbilityInitFinishNotify notif = ClientAbilityInitFinishNotify.parseFrom(payload); ClientAbilityInitFinishNotify notif = ClientAbilityInitFinishNotify.parseFrom(payload);
Player player = session.getPlayer(); Player player = session.getPlayer();
// Call skill end in the player's ability manager.
player.getAbilityManager().onSkillEnd(player);
for (AbilityInvokeEntry entry : notif.getInvokesList()) { for (AbilityInvokeEntry entry : notif.getInvokesList()) {
player.getAbilityManager().onAbilityInvoke(entry); player.getAbilityManager().onAbilityInvoke(entry);
player.getClientAbilityInitFinishHandler().addEntry(entry.getForwardType(), entry); player.getClientAbilityInitFinishHandler().addEntry(entry.getForwardType(), entry);
} }
if (notif.getInvokesList().size() > 0) { if (notif.getInvokesList().size() > 0) {
session.getPlayer().getClientAbilityInitFinishHandler().update(session.getPlayer()); session.getPlayer().getClientAbilityInitFinishHandler().update(session.getPlayer());
} }
} }
}
} \ No newline at end of file
...@@ -12,10 +12,16 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler { ...@@ -12,10 +12,16 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
EvtDoSkillSuccNotify notify = EvtDoSkillSuccNotify.parseFrom(payload); EvtDoSkillSuccNotify notify = EvtDoSkillSuccNotify.parseFrom(payload);
var player = session.getPlayer();
int skillId = notify.getSkillId(); int skillId = notify.getSkillId();
int casterId = notify.getCasterId(); int casterId = notify.getCasterId();
session.getPlayer().getStaminaManager().handleEvtDoSkillSuccNotify(session, skillId, casterId); // Call skill perform in the player's ability manager.
session.getPlayer().getEnergyManager().handleEvtDoSkillSuccNotify(session, skillId, casterId); player.getAbilityManager().onSkillStart(session.getPlayer(), skillId, casterId);
// Handle skill notify in other managers.
player.getStaminaManager().handleEvtDoSkillSuccNotify(session, skillId, casterId);
player.getEnergyManager().handleEvtDoSkillSuccNotify(session, skillId, casterId);
} }
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment