Skip to content

Commit 2c32ccb

Browse files
committed
Merge remote-tracking branch 'upstream/master'
# Conflicts: # src/main/kotlin/game/game/item/experienceLamp/ExperienceLampInterface.kt
2 parents d17539a + 4388da3 commit 2c32ccb

File tree

6 files changed

+48
-64
lines changed

6 files changed

+48
-64
lines changed

src/main/java/io/luna/game/model/mob/overlay/AbstractOverlay.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class AbstractOverlay {
2020
/**
2121
* Current lifecycle state of this overlay.
2222
*/
23-
private InterfaceState state = InterfaceState.IDLE;
23+
private OverlayState state = OverlayState.IDLE;
2424

2525
/**
2626
* Creates a new {@link AbstractOverlay} with the given type.
@@ -35,14 +35,14 @@ public AbstractOverlay(OverlayType type) {
3535
* Sends the client packets required to present this overlay to {@code player}.
3636
* <p>
3737
* This is invoked by {@link #setOpened(Player)} after {@link #onOpen(Player)}. Implementations should assume
38-
* they are called only when the overlay is transitioning from a non-open state to {@link InterfaceState#OPEN}.
38+
* they are called only when the overlay is transitioning from a non-open state to {@link OverlayState#OPEN}.
3939
*
4040
* @param player The player receiving the overlay.
4141
*/
4242
public abstract void open(Player player);
4343

4444
/**
45-
* Hook invoked after the overlay has transitioned to {@link InterfaceState#CLOSED}.
45+
* Hook invoked after the overlay has transitioned to {@link OverlayState#CLOSED}.
4646
* <p>
4747
* Use this to release resources, clear server-side flags, or send additional cleanup packets.
4848
* Called by {@link #setClosed(Player, AbstractOverlay)} regardless of whether a replacement exists.
@@ -53,7 +53,7 @@ public void onClose(Player player) {
5353
}
5454

5555
/**
56-
* Hook invoked just before {@link #open(Player)} when transitioning to {@link InterfaceState#OPEN}.
56+
* Hook invoked just before {@link #open(Player)} when transitioning to {@link OverlayState#OPEN}.
5757
* <p>
5858
* Use this to prepare dynamic content (e.g., strings, config vars) or to perform access checks.
5959
*
@@ -76,14 +76,14 @@ public void onReplace(Player player, AbstractOverlay replace) {
7676
}
7777

7878
/**
79-
* Transitions this overlay to {@link InterfaceState#CLOSED} and fires the appropriate hooks.
79+
* Transitions this overlay to {@link OverlayState#CLOSED} and fires the appropriate hooks.
8080
*
8181
* @param player The player for whom the overlay is closing.
8282
* @param replace The replacement overlay, or {@code null} if the overlay is simply closing.
8383
*/
8484
final void setClosed(Player player, AbstractOverlay replace) {
8585
if (isOpen()) {
86-
state = InterfaceState.CLOSED;
86+
state = OverlayState.CLOSED;
8787
if (replace != null) {
8888
onReplace(player, replace);
8989
}
@@ -92,13 +92,13 @@ final void setClosed(Player player, AbstractOverlay replace) {
9292
}
9393

9494
/**
95-
* Transitions this overlay to {@link InterfaceState#OPEN} and fires the appropriate hooks.
95+
* Transitions this overlay to {@link OverlayState#OPEN} and fires the appropriate hooks.
9696
*
9797
* @param player The player for whom the overlay is opening.
9898
*/
9999
final void setOpened(Player player) {
100100
if (!isOpen()) {
101-
state = InterfaceState.OPEN;
101+
state = OverlayState.OPEN;
102102
onOpen(player);
103103
open(player);
104104
}
@@ -110,7 +110,7 @@ final void setOpened(Player player) {
110110
* @return {@code true} if this interface is open.
111111
*/
112112
public final boolean isOpen() {
113-
return state == InterfaceState.OPEN;
113+
return state == OverlayState.OPEN;
114114
}
115115

116116
/**
@@ -123,7 +123,7 @@ public final OverlayType getOverlayType() {
123123
/**
124124
* @return The interface state.
125125
*/
126-
public final InterfaceState getState() {
126+
public final OverlayState getState() {
127127
return state;
128128
}
129129
}

src/main/java/io/luna/game/model/mob/overlay/InventoryOverlayInterface.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
/**
77
* A {@link StandardInterface} that opens both a main interface and a corresponding inventory overlay.
88
* <p>
9-
* This is used for interfaces that temporarily replace the player’s inventory container with a custom
10-
* layout (such as banking, trading, or shop screens), while a primary fixed interface is displayed.
9+
* This is used for interfaces that temporarily replace the player’s inventory container with a custom layout
10+
* (such as banking, trading, or shop screens), while a primary fixed interface is displayed.
1111
* <p>
12-
* The overlay is opened via {@link InventoryOverlayMessageWriter}, which takes both the main interface id
13-
* and the replacement inventory interface id.
12+
* The overlay is opened via {@link InventoryOverlayMessageWriter}, which takes both the main interface id and the
13+
* replacement inventory interface id.
1414
*
1515
* @author lare96
1616
*/

src/main/java/io/luna/game/model/mob/overlay/InterfaceState.java renamed to src/main/java/io/luna/game/model/mob/overlay/OverlayState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.luna.game.model.mob.overlay;
22

33
/**
4-
* Represents the lifecycle state of an {@link AbstractOverlay} (interface) instance.
4+
* Represents the lifecycle state of an {@link AbstractOverlay} instance.
55
* <p>
66
* Each overlay transitions through these states as it is opened or closed on a player's screen.
77
* The state is managed internally by {@link AbstractOverlaySet} to ensure correct invocation
@@ -19,7 +19,7 @@
1919
*
2020
* @author lare96
2121
*/
22-
public enum InterfaceState {
22+
public enum OverlayState {
2323

2424
/**
2525
* The default state for all overlay instances when first constructed.

src/main/kotlin/engine/engine/combat/death/npcDeath.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package engine.combat.death
22

33
import api.combat.death.DeathHookHandler
44
import api.predef.*
5+
import game.skill.slayer.Slayer
56
import io.luna.game.model.mob.Npc
7+
import io.luna.game.model.mob.Player
68
import io.luna.game.model.mob.block.Animation
79
import io.luna.game.model.mob.block.Animation.AnimationPriority
810

@@ -11,10 +13,13 @@ import io.luna.game.model.mob.block.Animation.AnimationPriority
1113
*/
1214
DeathHookHandler.setDefaultHook(Npc::class) {
1315
preDeath {
14-
victim.combatDef.ifPresent { victim.animation(Animation(it.deathAnimation, AnimationPriority.HIGH)) }
16+
victim.animation(Animation(victim.combatDef.deathAnimation, AnimationPriority.IMMUTABLE))
1517
}
1618

1719
death {
20+
if(source is Player) {
21+
Slayer.record(source, victim.id)
22+
}
1823
drop()
1924
world.npcs.remove(victim)
2025
}

src/main/kotlin/game/game/item/experienceLamp/ExperienceLampInterface.kt

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,32 @@ import io.luna.game.model.mob.overlay.StandardInterface
66
/**
77
* Handles the interface where the player selects which skill to gain experience in,
88
* from a lamp.
9+
* @author hydrozoa
910
*/
1011
class ExperienceLampInterface : StandardInterface(2808) {
1112

12-
enum class InterfaceSkill(val varpValue: Int, val button: Int) {
13-
ATTACK(1, 2812),
14-
STRENGTH(2, 2813),
15-
RANGED(3, 2814),
16-
MAGIC(4, 2815),
17-
DEFENCE(5, 2816),
18-
HITPOINTS(6, 2817),
19-
PRAYER(7, 2818),
20-
AGILITY(8, 2819),
21-
HERBLORE(9, 2820),
22-
THIEVING(10, 2821),
23-
CRAFTING(11, 2822),
24-
RUNECRAFTING(12, 2823),
25-
MINING(13, 2824),
26-
SMITHING(14, 2825),
27-
FISHING(15, 2826),
28-
COOKING(16, 2827),
29-
FIREMAKING(17, 2828),
30-
WOODCUTTING(18, 2829),
31-
FLETCHING(19, 2830),
32-
SLAYER(20, 12034),
33-
FARMING(21, 13914),
13+
enum class InterfaceSkill(val varpValue: Int, val button: Int, val skill: Int) {
14+
ATTACK(1, 2812, SKILL_ATTACK),
15+
STRENGTH(2, 2813, SKILL_STRENGTH),
16+
RANGED(3, 2814, SKILL_RANGED),
17+
MAGIC(4, 2815, SKILL_MAGIC),
18+
DEFENCE(5, 2816, SKILL_DEFENCE),
19+
HITPOINTS(6, 2817, SKILL_HITPOINTS),
20+
PRAYER(7, 2818, SKILL_PRAYER),
21+
AGILITY(8, 2819, SKILL_AGILITY),
22+
HERBLORE(9, 2820, SKILL_HERBLORE),
23+
THIEVING(10, 2821, SKILL_THIEVING),
24+
CRAFTING(11, 2822, SKILL_CRAFTING),
25+
RUNECRAFTING(12, 2823, SKILL_RUNECRAFTING),
26+
MINING(13, 2824, SKILL_MINING),
27+
SMITHING(14, 2825, SKILL_SMITHING),
28+
FISHING(15, 2826, SKILL_FISHING),
29+
COOKING(16, 2827, SKILL_COOKING),
30+
FIREMAKING(17, 2828, SKILL_FIREMAKING),
31+
WOODCUTTING(18, 2829, SKILL_WOODCUTTING),
32+
FLETCHING(19, 2830, SKILL_FLETCHING),
33+
SLAYER(20, 12034, SKILL_SLAYER),
34+
FARMING(21, 13914, SKILL_FARMING),
3435
;
3536

3637
companion object {
@@ -39,30 +40,8 @@ class ExperienceLampInterface : StandardInterface(2808) {
3940
* Returns null if no match is found.
4041
*/
4142
fun getSkillByVarp(value: Int): Int {
42-
when (value) {
43-
1 -> return SKILL_ATTACK
44-
2 -> return SKILL_STRENGTH
45-
3 -> return SKILL_RANGED
46-
4 -> return SKILL_MAGIC
47-
5 -> return SKILL_DEFENCE
48-
6 -> return SKILL_HITPOINTS
49-
7 -> return SKILL_PRAYER
50-
8 -> return SKILL_AGILITY
51-
9 -> return SKILL_HERBLORE
52-
10 -> return SKILL_THIEVING
53-
11 -> return SKILL_CRAFTING
54-
12 -> return SKILL_RUNECRAFTING
55-
13 -> return SKILL_MINING
56-
14 -> return SKILL_SMITHING
57-
15 -> return SKILL_FISHING
58-
16 -> return SKILL_COOKING
59-
17 -> return SKILL_FIREMAKING
60-
18 -> return SKILL_WOODCUTTING
61-
19 -> return SKILL_FLETCHING
62-
20 -> return SKILL_SLAYER
63-
21 -> return SKILL_FARMING
64-
else -> return SKILL_HITPOINTS
65-
}
43+
val map = InterfaceSkill.values().associateBy({i -> i.varpValue})
44+
return map.get(value)?.skill ?: SKILL_HITPOINTS
6645
}
6746
}
6847
}

src/main/kotlin/game/game/skill/thieving/stealFromStall/StealFromAction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class StealFromAction(plr: Player, val obj: GameObject, val thievable: Thievable
109109
if (!world.collisionManager.raycast(guard.position, mob.position) && guard.inViewCone(mob)) {
110110
// The guard can see the player.
111111
guard.speak("Hey! Get your hands off there!")
112-
guard.follow(mob)
112+
guard.combat.attack(mob)
113113
break
114114
}
115115
}

0 commit comments

Comments
 (0)