Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
787f3fd4
Commit
787f3fd4
authored
May 04, 2022
by
Melledy
Browse files
Fix damage number not showing up if it was the killing blow
parent
57285885
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/player/Player.java
View file @
787f3fd4
...
...
@@ -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
);
...
...
@@ -415,6 +419,10 @@ public class Player {
return
MpSettingType
.
MP_SETTING_ENTER_AFTER_APPLY
;
// TEMP
}
public
Queue
<
AttackResult
>
getAttackResults
()
{
return
this
.
attackResults
;
}
public
synchronized
Int2ObjectMap
<
CoopRequest
>
getCoopRequests
()
{
return
coopRequests
;
}
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java
View file @
787f3fd4
...
...
@@ -22,7 +22,7 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
case
COMBAT_EVT_BEING_HIT:
// Handle damage
EvtBeingHitInfo
hitInfo
=
EvtBeingHitInfo
.
parseFrom
(
entry
.
getCombatData
());
session
.
getPlayer
().
get
Scene
().
handleAttack
(
hitInfo
.
getAttackResult
());
session
.
getPlayer
().
get
AttackResults
().
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
());
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment