Commit 787f3fd4 authored by Melledy's avatar Melledy
Browse files

Fix damage number not showing up if it was the killing blow

parent 57285885
......@@ -29,6 +29,7 @@ import emu.grasscutter.game.world.Scene;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry;
import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult;
import emu.grasscutter.net.proto.CombatInvokeEntryOuterClass.CombatInvokeEntry;
import emu.grasscutter.net.proto.InteractTypeOuterClass.InteractType;
import emu.grasscutter.net.proto.MpSettingTypeOuterClass.MpSettingType;
......@@ -54,6 +55,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
@Entity(value = "players", useDiscriminator = false)
public class Player {
......@@ -113,6 +115,7 @@ public class Player {
@Transient private long nextSendPlayerLocTime = 0;
@Transient private final Int2ObjectMap<CoopRequest> coopRequests;
@Transient private final Queue<AttackResult> attackResults;
@Transient private final InvokeHandler<CombatInvokeEntry> combatInvokeHandler;
@Transient private final InvokeHandler<AbilityInvokeEntry> abilityInvokeHandler;
@Transient private final InvokeHandler<AbilityInvokeEntry> clientAbilityInitFinishHandler;
......@@ -143,6 +146,7 @@ public class Player {
this.setRegionId(1);
this.sceneState = SceneLoadState.NONE;
this.attackResults = new LinkedBlockingQueue<>();
this.coopRequests = new Int2ObjectOpenHashMap<>();
this.combatInvokeHandler = new InvokeHandler(PacketCombatInvocationsNotify.class);
this.abilityInvokeHandler = new InvokeHandler(PacketAbilityInvocationsNotify.class);
......@@ -414,6 +418,10 @@ public class Player {
public MpSettingType getMpSetting() {
return MpSettingType.MP_SETTING_ENTER_AFTER_APPLY; // TEMP
}
public Queue<AttackResult> getAttackResults() {
return this.attackResults;
}
public synchronized Int2ObjectMap<CoopRequest> getCoopRequests() {
return coopRequests;
......
......@@ -22,7 +22,7 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
case COMBAT_EVT_BEING_HIT:
// Handle damage
EvtBeingHitInfo hitInfo = EvtBeingHitInfo.parseFrom(entry.getCombatData());
session.getPlayer().getScene().handleAttack(hitInfo.getAttackResult());
session.getPlayer().getAttackResults().add(hitInfo.getAttackResult());
break;
case ENTITY_MOVE:
// Handle movement
......@@ -43,9 +43,14 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
session.getPlayer().getCombatInvokeHandler().addEntry(entry.getForwardType(), entry);
}
// Handles sending combat invokes to other players/server
if (notif.getInvokeListList().size() > 0) {
session.getPlayer().getCombatInvokeHandler().update(session.getPlayer());
}
// Handle attack results last
while (!session.getPlayer().getAttackResults().isEmpty()) {
session.getPlayer().getScene().handleAttack(session.getPlayer().getAttackResults().poll());
}
}
}
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