Invoke AbilityManager#onSkillStart and AbilityManager#onSkillEnd

This commit is contained in:
KingRainbow44 2022-08-06 23:35:09 -04:00
parent 6420428660
commit 7df41f616b
2 changed files with 16 additions and 7 deletions

View File

@ -17,6 +17,10 @@ public class HandlerClientAbilityInitFinishNotify extends PacketHandler {
ClientAbilityInitFinishNotify notif = ClientAbilityInitFinishNotify.parseFrom(payload);
Player player = session.getPlayer();
// Call skill end in the player's ability manager.
player.getAbilityManager().onSkillEnd(player);
for (AbilityInvokeEntry entry : notif.getInvokesList()) {
player.getAbilityManager().onAbilityInvoke(entry);
player.getClientAbilityInitFinishHandler().addEntry(entry.getForwardType(), entry);
@ -26,5 +30,4 @@ public class HandlerClientAbilityInitFinishNotify extends PacketHandler {
session.getPlayer().getClientAbilityInitFinishHandler().update(session.getPlayer());
}
}
}

View File

@ -12,10 +12,16 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
EvtDoSkillSuccNotify notify = EvtDoSkillSuccNotify.parseFrom(payload);
var player = session.getPlayer();
int skillId = notify.getSkillId();
int casterId = notify.getCasterId();
session.getPlayer().getStaminaManager().handleEvtDoSkillSuccNotify(session, skillId, casterId);
session.getPlayer().getEnergyManager().handleEvtDoSkillSuccNotify(session, skillId, casterId);
// Call skill perform in the player's ability manager.
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);
}
}