diff --git a/CHANGELOG b/CHANGELOG index 9aac057a7..2f39ef816 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -70,5 +70,7 @@ - Shooting star discovery bonus xp is now gradually disbursed instead of lump-sum. - Spending points to cancel your slayer task no longer sets your task streak to 0. - Stars now have bots that will spawn and help mine for stars higher than level 5. +- Barrows equipment now lasts for 15 hours of combat instead of 40 minutes of combat. +- Fix granting hp xp on controlled - Implemented HCIM Rework -< --- ABOVE Released December 15, 2021 https://gitlab.com/2009scape/2009scape/-/tags/Dec-15-2021 ---- > \ No newline at end of file +< --- ABOVE Released December 15, 2021 https://gitlab.com/2009scape/2009scape/-/tags/Dec-15-2021 ---- > diff --git a/Server/src/main/java/core/game/interaction/npc/bob/BobDialogue.java b/Server/src/main/java/core/game/interaction/npc/bob/BobDialogue.java index dabc11ebb..cffa0e677 100644 --- a/Server/src/main/java/core/game/interaction/npc/bob/BobDialogue.java +++ b/Server/src/main/java/core/game/interaction/npc/bob/BobDialogue.java @@ -9,6 +9,7 @@ import core.game.node.entity.player.Player; import core.game.node.entity.player.link.diary.AchievementDiary; import core.game.node.entity.player.link.diary.DiaryType; import core.game.node.item.Item; +import rs09.game.node.entity.equipment.BarrowsEquipmentRegister; /** * Represents the dialogue plugin used for the bob npc who repairs items. @@ -388,6 +389,7 @@ public final class BobDialogue extends DialoguePlugin { * @return the price. */ public static int getFormatedCost(String name, Item item) { + int ticks = BarrowsEquipmentRegister.TICKS; int[] degrades = new int[] { 100, 75, 50, 25, 0 }; for (int i = 0; i < prices.length; i++) { String check = (String) prices[i][0]; @@ -399,7 +401,7 @@ public final class BobDialogue extends DialoguePlugin { break; } } - degrade -= 25 - (25 * (item.getCharge() * 0.001)); + degrade -= 25 - (25 * ((double)item.getCharge() / (double)ticks)); int max = (int) prices[i][1] * 1000; return (int) (max - (max * (degrade * 0.01))); } @@ -571,4 +573,4 @@ public final class BobDialogue extends DialoguePlugin { } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/node/entity/combat/CombatSwingHandler.kt b/Server/src/main/kotlin/rs09/game/node/entity/combat/CombatSwingHandler.kt index 80f8bbcd1..361f3e739 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/combat/CombatSwingHandler.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/combat/CombatSwingHandler.kt @@ -410,6 +410,10 @@ abstract class CombatSwingHandler(var type: CombatStyle?) { } if (state != null) { val hit = state.totalDamage + if (entity is Player) { + player.skills.addExperience(Skills.HITPOINTS, hit * 1.33, true) + } + var skill = -1 when (attStyle) { WeaponInterface.STYLE_DEFENSIVE -> skill = Skills.DEFENCE @@ -441,7 +445,6 @@ abstract class CombatSwingHandler(var type: CombatStyle?) { } if (skill < 0) return player.skills.addExperience(skill, hit * EXPERIENCE_MOD, true) - player.skills.addExperience(Skills.HITPOINTS, hit * 1.33, true) } } diff --git a/Server/src/main/kotlin/rs09/game/node/entity/combat/equipment/EquipmentDegrader.kt b/Server/src/main/kotlin/rs09/game/node/entity/combat/equipment/EquipmentDegrader.kt index 76bea28ce..2e5589d53 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/combat/equipment/EquipmentDegrader.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/combat/equipment/EquipmentDegrader.kt @@ -15,12 +15,14 @@ class EquipmentDegrader{ companion object StaticDegrader { //Use a static companion object for lists and registers so they persist across instances val itemList = arrayListOf() val setList = arrayListOf>() - fun register(item: Int){ + val itemCharges = hashMapOf() + fun register(charges: Int, item: Int){ itemList.add(item) + itemCharges.put(item, charges) } - fun registerSet(items: Array){ - setList.add(ArrayList(items.map { item -> item.also { register(item) } })) + fun registerSet(charges: Int, items: Array){ + setList.add(ArrayList(items.map { item -> item.also { register(charges, item) } })) } } @@ -54,6 +56,7 @@ class EquipmentDegrader{ charge = 0 } if(this.charge <= 0) { + val charges = itemCharges.getOrElse(this.id, { 1000 }) if (set?.size!! > 2) { p?.equipment?.remove(this) p?.sendMessage("Your $name has degraded.") @@ -61,7 +64,7 @@ class EquipmentDegrader{ p?.inventory?.add(Item(set.getNext(this.id))) p?.sendMessage("Your $name has broken.") } else { - p?.equipment?.add(Item(set.getNext(this.id)), slot, false, false) + p?.equipment?.add(Item(set.getNext(this.id), 1, charges), slot, false, false) p?.equipment?.refresh() } } else if (set.size == 2) { @@ -71,7 +74,7 @@ class EquipmentDegrader{ } else { p?.equipment?.remove(this) p?.sendMessage("Your $name has degraded.") - p?.equipment?.add(Item(set.getNext(this.id)), slot, false, false) + p?.equipment?.add(Item(set.getNext(this.id), 1, charges), slot, false, false) p?.equipment?.refresh() } } @@ -85,4 +88,4 @@ class EquipmentDegrader{ } return null } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/node/entity/equipment/BarrowsEquipmentRegister.kt b/Server/src/main/kotlin/rs09/game/node/entity/equipment/BarrowsEquipmentRegister.kt index b4f235e76..8e3294018 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/equipment/BarrowsEquipmentRegister.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/equipment/BarrowsEquipmentRegister.kt @@ -6,6 +6,12 @@ import core.plugin.Plugin @Initializable class BarrowsEquipmentRegister : Plugin{ + public companion object { + // Barrows equipment lasts for 15 hours of combat, and each piece has 4 stages of degredation + @JvmField + public val TICKS = (15 * 6000) / 4 + } + val DHAROK_HELM = arrayOf(4716,4880,4881,4882,4883,4884) val DHAROK_AXE = arrayOf(4718,4886,4887,4888,4889,4890) val DHAROK_BODY = arrayOf(4720,4892,4893,4894,4895,4896) @@ -37,30 +43,30 @@ class BarrowsEquipmentRegister : Plugin{ val KARIL_SKIRT = arrayOf(4738,4946,4947,4948,4949,4950) override fun newInstance(arg: Any?): Plugin { - EquipmentDegrader.registerSet(AHRIM_HOOD) - EquipmentDegrader.registerSet(AHRIM_STAFF) - EquipmentDegrader.registerSet(AHRIM_TOP) - EquipmentDegrader.registerSet(AHRIM_SKIRT) - EquipmentDegrader.registerSet(KARIL_COIF) - EquipmentDegrader.registerSet(KARIL_CBOW) - EquipmentDegrader.registerSet(KARIL_TOP) - EquipmentDegrader.registerSet(KARIL_SKIRT) - EquipmentDegrader.registerSet(DHAROK_HELM) - EquipmentDegrader.registerSet(DHAROK_AXE) - EquipmentDegrader.registerSet(DHAROK_BODY) - EquipmentDegrader.registerSet(DHAROK_LEGS) - EquipmentDegrader.registerSet(GUTHAN_HELM) - EquipmentDegrader.registerSet(GUTHAN_SPEAR) - EquipmentDegrader.registerSet(GUTHAN_BODY) - EquipmentDegrader.registerSet(GUTHAN_SKIRT) - EquipmentDegrader.registerSet(TORAG_HELM) - EquipmentDegrader.registerSet(TORAG_HAMMER) - EquipmentDegrader.registerSet(TORAG_BODY) - EquipmentDegrader.registerSet(TORAG_LEGS) - EquipmentDegrader.registerSet(VERAC_HELM) - EquipmentDegrader.registerSet(VERAC_FLAIL) - EquipmentDegrader.registerSet(VERAC_BRASS) - EquipmentDegrader.registerSet(VERAC_SKIRT) + EquipmentDegrader.registerSet(TICKS, AHRIM_HOOD) + EquipmentDegrader.registerSet(TICKS, AHRIM_STAFF) + EquipmentDegrader.registerSet(TICKS, AHRIM_TOP) + EquipmentDegrader.registerSet(TICKS, AHRIM_SKIRT) + EquipmentDegrader.registerSet(TICKS, KARIL_COIF) + EquipmentDegrader.registerSet(TICKS, KARIL_CBOW) + EquipmentDegrader.registerSet(TICKS, KARIL_TOP) + EquipmentDegrader.registerSet(TICKS, KARIL_SKIRT) + EquipmentDegrader.registerSet(TICKS, DHAROK_HELM) + EquipmentDegrader.registerSet(TICKS, DHAROK_AXE) + EquipmentDegrader.registerSet(TICKS, DHAROK_BODY) + EquipmentDegrader.registerSet(TICKS, DHAROK_LEGS) + EquipmentDegrader.registerSet(TICKS, GUTHAN_HELM) + EquipmentDegrader.registerSet(TICKS, GUTHAN_SPEAR) + EquipmentDegrader.registerSet(TICKS, GUTHAN_BODY) + EquipmentDegrader.registerSet(TICKS, GUTHAN_SKIRT) + EquipmentDegrader.registerSet(TICKS, TORAG_HELM) + EquipmentDegrader.registerSet(TICKS, TORAG_HAMMER) + EquipmentDegrader.registerSet(TICKS, TORAG_BODY) + EquipmentDegrader.registerSet(TICKS, TORAG_LEGS) + EquipmentDegrader.registerSet(TICKS, VERAC_HELM) + EquipmentDegrader.registerSet(TICKS, VERAC_FLAIL) + EquipmentDegrader.registerSet(TICKS, VERAC_BRASS) + EquipmentDegrader.registerSet(TICKS, VERAC_SKIRT) return this } @@ -68,4 +74,4 @@ class BarrowsEquipmentRegister : Plugin{ return Unit } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/node/entity/equipment/PVPEquipmentRegister.kt b/Server/src/main/kotlin/rs09/game/node/entity/equipment/PVPEquipmentRegister.kt index 12a188f2d..48762e4bd 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/equipment/PVPEquipmentRegister.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/equipment/PVPEquipmentRegister.kt @@ -6,6 +6,9 @@ import core.plugin.Plugin @Initializable class PVPEquipmentRegister : Plugin { + // PVP equipment lasts for 1 hour of combat, which is 6000 ticks + val TICKS = 6000 + val VESTA_BODY = arrayOf(13887,13889) val VESTA_SKIRT = arrayOf(13893,13895) val VESTA_SWORD = arrayOf(13899,13901) @@ -27,21 +30,21 @@ class PVPEquipmentRegister : Plugin { override fun newInstance(arg: Any?): Plugin { - EquipmentDegrader.registerSet(VESTA_BODY) - EquipmentDegrader.registerSet(VESTA_SKIRT) - EquipmentDegrader.registerSet(VESTA_SWORD) - EquipmentDegrader.registerSet(VESTA_SPEAR) - EquipmentDegrader.registerSet(STATIUS_BODY) - EquipmentDegrader.registerSet(STATIUS_HAMMER) - EquipmentDegrader.registerSet(STATIUS_HELM) - EquipmentDegrader.registerSet(STATIUS_LEGS) - EquipmentDegrader.registerSet(ZUREL_BOTTOM) - EquipmentDegrader.registerSet(ZURIEL_HOOD) - EquipmentDegrader.registerSet(ZURIEL_STAFF) - EquipmentDegrader.registerSet(ZURIEL_TOP) - EquipmentDegrader.registerSet(MORRIGAN_BODY) - EquipmentDegrader.registerSet(MORRIGAN_CHAP) - EquipmentDegrader.registerSet(MORRIGAN_COIF) + EquipmentDegrader.registerSet(TICKS, VESTA_BODY) + EquipmentDegrader.registerSet(TICKS, VESTA_SKIRT) + EquipmentDegrader.registerSet(TICKS, VESTA_SWORD) + EquipmentDegrader.registerSet(TICKS, VESTA_SPEAR) + EquipmentDegrader.registerSet(TICKS, STATIUS_BODY) + EquipmentDegrader.registerSet(TICKS, STATIUS_HAMMER) + EquipmentDegrader.registerSet(TICKS, STATIUS_HELM) + EquipmentDegrader.registerSet(TICKS, STATIUS_LEGS) + EquipmentDegrader.registerSet(TICKS, ZUREL_BOTTOM) + EquipmentDegrader.registerSet(TICKS, ZURIEL_HOOD) + EquipmentDegrader.registerSet(TICKS, ZURIEL_STAFF) + EquipmentDegrader.registerSet(TICKS, ZURIEL_TOP) + EquipmentDegrader.registerSet(TICKS, MORRIGAN_BODY) + EquipmentDegrader.registerSet(TICKS, MORRIGAN_CHAP) + EquipmentDegrader.registerSet(TICKS, MORRIGAN_COIF) return this } @@ -49,4 +52,4 @@ class PVPEquipmentRegister : Plugin { return Unit } -} \ No newline at end of file +}