Merge branch 2009scape:master into master

This commit is contained in:
Tooze 2026-06-10 01:57:32 +00:00
commit 0096a3fdab
12 changed files with 113586 additions and 120548 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,7 @@
<version>1.0.0</version>
<properties>
<project.mainClassName>core.Server</project.mainClassName>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<kotlin.version>1.8.20</kotlin.version>
<kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget>

View file

@ -346,7 +346,7 @@ public enum Consumables {
AGILITY(new Potion(new int[] {3032, 3034, 3036, 3038}, new SkillEffect(Skills.AGILITY, 3, 0))),
HUNTER(new Potion(new int[] {9998, 10000, 10002, 10004}, new SkillEffect(Skills.HUNTER, 3, 0))),
RESTORE(new Potion(new int[] {2430, 127, 129, 131}, new RestoreEffect(10, 0.3))),
SARA_BREW(new Potion(new int[] {6685, 6687, 6689, 6691}, new MultiEffect(new PercentHeal(0, .15), new SkillEffect(Skills.ATTACK, 0, -0.10), new SkillEffect(Skills.STRENGTH, 0, -0.10), new SkillEffect(Skills.MAGIC, 0, -0.10), new SkillEffect(Skills.RANGE, 0, -0.10), new SkillEffect(Skills.DEFENCE, 0, 0.25)))),
SARA_BREW(new Potion(new int[] {6685, 6687, 6689, 6691}, new MultiEffect(new PercentHeal(2, .15), new SkillEffect(Skills.ATTACK, 0, -0.10), new SkillEffect(Skills.STRENGTH, 0, -0.10), new SkillEffect(Skills.MAGIC, 0, -0.10), new SkillEffect(Skills.RANGE, 0, -0.10), new SkillEffect(Skills.DEFENCE, 2, 0.2)))),
SUMMONING(new Potion(new int[] {12140, 12142, 12144, 12146}, new MultiEffect(new RestoreSummoningSpecial(), new SummoningEffect(7, 0.25)))),
COMBAT(new Potion(new int[] {9739, 9741, 9743, 9745}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, .1), new SkillEffect(Skills.ATTACK, 3, .1)))),
ENERGY(new Potion(new int[] {3008, 3010, 3012, 3014}, new EnergyEffect(10))),

View file

@ -43,7 +43,6 @@ public class IntentionalBurnPulse extends StandardCookingPulse {
@Override
public boolean cook(Player player, Scenery object, boolean burned, int initial, int product) {
super.animate();
Item initialItem = new Item(initial);
Item productItem = new Item(product);
@ -51,6 +50,7 @@ public class IntentionalBurnPulse extends StandardCookingPulse {
player.getInventory().add(productItem);
player.getPacketDispatch().sendMessage(getMessage(initialItem, productItem, burned));
playAudio(player, Sounds.FRY_2577);
super.animate();
return true;
}
return false;

View file

@ -149,7 +149,6 @@ public class StandardCookingPulse extends Pulse {
public boolean cook(final Player player, final Scenery object, final boolean burned, final int initial, final int product) {
Item initialItem = new Item(initial);
Item productItem = new Item(product);
animate();
//handle special cooking results (spits, cake, etc) that don't justify separate plugin
switch (initial) {
@ -188,6 +187,7 @@ public class StandardCookingPulse extends Pulse {
}
player.getPacketDispatch().sendMessage(getMessage(initialItem, productItem, burned));
playAudio(player, Sounds.FRY_2577);
animate();
return true;
}
return false;

View file

@ -24,6 +24,8 @@ fun getAudio(count: Int): Int {
}
fun homeTeleport(player: Player, dest: Location) {
player.walkingQueue.reset()
player.pulseManager.clear()
if (player.timers.getTimer("teleblock") != null) {
sendMessage(player, "A magical force prevents you from teleporting.")
return
@ -43,4 +45,4 @@ fun homeTeleport(player: Player, dest: Location) {
player.packetDispatch.sendAnimation(HOME_ANIMATIONS[stage])
return@queueScript delayScript(player, 1)
}
}
}

View file

@ -296,10 +296,13 @@ class CombatPulse(
}
setVictim(victim)
entity.onAttack(victim as Entity?)
victim.scripts.removeWeakScripts()
if (isAttacking) {
victim.scripts.removeWeakScripts()
}
if (!isAttacking)
if (!isAttacking) {
entity.pulseManager.run(this)
}
}
/**
@ -428,6 +431,7 @@ class CombatPulse(
}
handler.adjustBattleState(entity, victim!!, state)
handler.addExperience(entity, victim, state)
handler.postSwing(entity, victim, state)
handler.visualize(entity, victim, state)
if (delay - 1 < 1) {
handler.visualizeImpact(entity, victim, state)

View file

@ -531,6 +531,12 @@ abstract class CombatSwingHandler(var type: CombatStyle?) {
}
}
/**
* Hook for operations that conceptually happen during swing but could mess with experience granting logic if they
* happened earlier.
*/
open fun postSwing(entity: Entity?, victim: Entity?, state: BattleState?) {}
/**
* Gets the formated hit.
* @param attacker The attacking entity.

View file

@ -119,6 +119,9 @@ open class MultiSwingHandler(meleeDistance: Boolean, vararg attacks: SwitchAttac
override fun addExperience(entity: Entity?, victim: Entity?, state: BattleState?) {
current.handler.addExperience(entity, victim, state)
}
override fun postSwing(entity: Entity?, victim: Entity?, state: BattleState?) {
current.handler.postSwing(entity, victim, state)
}
override fun visualizeImpact(entity: Entity?, victim: Entity?, state: BattleState?) {
if (current.isUseHandler) {
current.handler.visualizeImpact(entity, victim, state)

View file

@ -101,10 +101,15 @@ open class RangeSwingHandler (vararg flags: SwingHandlerFlag) : CombatSwingHandl
}
if(state.estimatedHit > victim.skills.lifepoints) state.estimatedHit = victim.skills.lifepoints
if(state.estimatedHit + state.secondaryHit > victim.skills.lifepoints) state.secondaryHit -= ((state.estimatedHit + state.secondaryHit) - victim.skills.lifepoints)
useAmmo(entity, state, victim.location)
return 1 + ceil(entity.location.getDistance(victim.location) * 0.3).toInt()
}
override fun postSwing(entity: Entity?, victim: Entity?, state: BattleState?) {
// Using the last piece of ammo in swing causes experience calculations to assume we're using unarmed combat
// which gives wrong experience values. Delay ammo consumption until later to avoid this problem.
useAmmo(entity!!, state!!, victim!!.location)
}
/**
* Configures the range data.
* @param entity The entity.

View file

@ -57,6 +57,7 @@ class Poison : PersistTimer (30, "poison", flags = arrayOf(TimerFlag.ClearOnDeat
}
override fun run (entity: Entity) : Boolean {
entity.scripts.removeWeakScripts()
entity.impactHandler.manualHit (
damageSource,
getDamageFromSeverity (severity--),