From be4f6a9bec120221f77b2b6e0a90916763209867 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Mon, 29 Mar 2021 13:47:28 -0500 Subject: [PATCH] Some bugfixes --- Server/data/configs/npc_configs.json | 8 +-- .../PyramidPlunderActivity.java | 1 + .../content/dialogue/RugMerchantDialogue.java | 6 ++ .../entity/skill/cooking/CookingRewrite.kt | 6 +- .../content/dialogue/DukeHoracioDialogue.kt | 1 - .../content/jobs/CancelJobDialogueFile.kt | 39 ++++++++++--- .../rs09/game/content/jobs/JobManager.kt | 1 + .../jobs/WorkForInteractionListener.kt | 2 +- .../skill/farming/UseWithPatchHandler.kt | 11 ++++ .../entity/skill/magic/ModernListeners.kt | 18 ++++++ .../node/entity/skill/thieving/Pickpockets.kt | 2 + .../state/newsys/states/SeedlingState.kt | 8 +-- build.sh | 56 +------------------ 13 files changed, 84 insertions(+), 75 deletions(-) mode change 100755 => 100644 build.sh diff --git a/Server/data/configs/npc_configs.json b/Server/data/configs/npc_configs.json index ffadce483..212006f9e 100644 --- a/Server/data/configs/npc_configs.json +++ b/Server/data/configs/npc_configs.json @@ -2437,7 +2437,7 @@ "slayer_task": "30", "melee_animation": "393", "range_animation": "0", - "attack_speed": "5", + "attack_speed": "4", "respawn_delay": "60", "defence_animation": "0", "weakness": "7", @@ -2445,14 +2445,14 @@ "magic_animation": "0", "death_animation": "836", "name": "Earth warrior", - "defence_level": "56", + "defence_level": "42", "safespot": null, "lifepoints": "54", - "strength_level": "56", + "strength_level": "42", "id": "124", "aggressive": "true", "range_level": "1", - "attack_level": "56" + "attack_level": "42" }, { "examine": "A cold-hearted elemental warrior.", diff --git a/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidPlunderActivity.java b/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidPlunderActivity.java index a16111cf0..dbd7eabe7 100644 --- a/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidPlunderActivity.java +++ b/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidPlunderActivity.java @@ -49,6 +49,7 @@ public final class PyramidPlunderActivity extends ActivityPlugin { if (e instanceof Player) { ((Player) e).getInterfaceManager().closeOverlay(); ((PlunderSession) ((Player) e).getAttribute("plunder-session",null)).setActive(false); + ((Player) e).removeAttribute("plunder-session"); } return super.leave(e, logout); } diff --git a/Server/src/main/java/core/game/content/dialogue/RugMerchantDialogue.java b/Server/src/main/java/core/game/content/dialogue/RugMerchantDialogue.java index c36cd5629..aa2a5e18c 100644 --- a/Server/src/main/java/core/game/content/dialogue/RugMerchantDialogue.java +++ b/Server/src/main/java/core/game/content/dialogue/RugMerchantDialogue.java @@ -10,6 +10,7 @@ import core.game.node.entity.npc.NPC; import core.game.node.entity.player.Player; import core.game.node.item.Item; import core.game.system.task.Pulse; +import kotlin.Unit; import rs09.game.world.GameWorld; import core.game.world.map.Location; import core.game.world.update.flag.context.Animation; @@ -284,6 +285,10 @@ public final class RugMerchantDialogue extends DialoguePlugin { player.getInterfaceManager().hideTabs(0,1,2,3,4,5,6,7,8,9,10,11,12,13); player.getEquipment().replace(new Item(Items.MAGIC_CARPET_5614),EquipmentContainer.SLOT_WEAPON); player.getPacketDispatch().sendInterfaceConfig(548,69,true); + player.logoutListeners.put("magic-carpet", (pl) -> { + pl.getEquipment().replace(null,EquipmentContainer.SLOT_WEAPON); + return Unit.INSTANCE; + }); GameWorld.getPulser().submit(new Pulse(1, player) { int count; int index; @@ -323,6 +328,7 @@ public final class RugMerchantDialogue extends DialoguePlugin { player.unlock(); player.animate(new Animation(-1)); player.getConfigManager().set(499, 0); + player.logoutListeners.remove("magic-carpet"); break; case 902: player.moveStep(); diff --git a/Server/src/main/java/core/game/node/entity/skill/cooking/CookingRewrite.kt b/Server/src/main/java/core/game/node/entity/skill/cooking/CookingRewrite.kt index 356da297c..bdb1387a8 100644 --- a/Server/src/main/java/core/game/node/entity/skill/cooking/CookingRewrite.kt +++ b/Server/src/main/java/core/game/node/entity/skill/cooking/CookingRewrite.kt @@ -19,6 +19,8 @@ class CookingRewrite : InteractionListener() { init { val list = CookableItems.values().map { it.raw }.toMutableList() list.add(Items.COOKED_MEAT_2142) + list.add(RAW_BEEF_2132) + list.add(SEAWEED_401) RAW_FOODS = list.toIntArray() } @@ -30,11 +32,11 @@ class CookingRewrite : InteractionListener() { val range = obj.name.toLowerCase().contains("range") when (item.id) { RAW_BEEF_2132 -> if (range) { - player.dialogueInterpreter.open(CookingDialogue(item,9436,true,obj)) + player.dialogueInterpreter.open(CookingDialogue(item.id,9436,true,obj)) return@onUseWith true } SEAWEED_401 -> if (range) { - player.dialogueInterpreter.open(CookingDialogue(item,1781,false,obj)) + player.dialogueInterpreter.open(CookingDialogue(item.id,1781,false,obj)) return@onUseWith true } BREAD_DOUGH_2307, UNCOOKED_CAKE_1889 -> if (!range) { diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/DukeHoracioDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/DukeHoracioDialogue.kt index 531248f29..31303db91 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/DukeHoracioDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/DukeHoracioDialogue.kt @@ -33,7 +33,6 @@ class DukeHoracioDialogue(player: Player? = null) : DialoguePlugin(player) { if (!sendChoices()) { interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Greetings. Welcome to my castle.") } - stage = 0 // Speak to the Duke of Lumbridge player.achievementDiaryManager.finishTask(player, DiaryType.LUMBRIDGE, 0, 2) return true diff --git a/Server/src/main/kotlin/rs09/game/content/jobs/CancelJobDialogueFile.kt b/Server/src/main/kotlin/rs09/game/content/jobs/CancelJobDialogueFile.kt index 48c4f9373..8dbecf145 100644 --- a/Server/src/main/kotlin/rs09/game/content/jobs/CancelJobDialogueFile.kt +++ b/Server/src/main/kotlin/rs09/game/content/jobs/CancelJobDialogueFile.kt @@ -1,5 +1,8 @@ package rs09.game.content.jobs +import GatheringJobs +import SlayingJob +import core.game.node.entity.npc.NPC import core.game.node.item.Item import rs09.game.content.dialogue.DialogueFile import rs09.tools.END_DIALOGUE @@ -7,14 +10,32 @@ import rs09.tools.END_DIALOGUE class CancelJobDialogueFile : DialogueFile() { override fun handle(componentID: Int, buttonID: Int) { when(stage){ - 0 -> npc("Would you like to cancel your job?","It will cost 500 coins.").also { stage++ } - 1 -> options("Yes, please.","No, thanks.").also { stage++ } - 2 -> when(buttonID){ - 1 -> player("Yes, please.").also{ stage = 10 } - 2 -> player("No, thanks.").also { stage = 20 } + 0 -> options("Check Job Progress","Cancel Job").also { stage++ } + 1 -> when(buttonID){ + 1 -> player("How am I doing on my job?").also { stage++ } + 2 -> player("I'd like to cancel my job.").also { stage = 10 } } - 10 -> npc("Alright then, hand over the money.").also { stage++ } - 11 -> if(player!!.inventory.contains(995,500)){ + 2 -> { + val amt = player!!.getAttribute("jobs:original_amount",0) + val type = player!!.getAttribute("jobs:type",0) + val jobId = player!!.getAttribute("jobs:id",0) + val needed = player!!.getAttribute("jobs:amount",0) + if(type == 0){ + player!!.dialogueInterpreter.sendItemMessage(GatheringJobs.values()[jobId].itemId,"You still need to gather ${needed} more.") + } else { + player!!.dialogueInterpreter.sendDialogue("You still need to kill $needed more ${NPC(SlayingJob.values()[jobId].ids[0]).name.toLowerCase()}.") + } + stage = END_DIALOGUE + } + + 10 -> npc("It will cost 500 coins.").also { stage++ } + 11 -> options("Yes, please.","No, thanks.").also { stage++ } + 12 -> when(buttonID){ + 1 -> player("Yes, please.").also{ stage = 20 } + 2 -> player("No, thanks.").also { stage = 30 } + } + 20 -> npc("Alright then, hand over the money.").also { stage++ } + 21 -> if(player!!.inventory.contains(995,500)){ player("Here you go.") player!!.inventory.remove(Item(995,500)) player!!.removeAttribute("jobs:id") @@ -27,8 +48,8 @@ class CancelJobDialogueFile : DialogueFile() { stage++ } - 12 -> npc("Ah, that sucks! Get to work.").also { stage = END_DIALOGUE } - 20 -> npc("Alright then, get to work!").also { stage = END_DIALOGUE } + 22 -> npc("Ah, that sucks! Get to work.").also { stage = END_DIALOGUE } + 30 -> npc("Alright then, get to work!").also { stage = END_DIALOGUE } } } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/jobs/JobManager.kt b/Server/src/main/kotlin/rs09/game/content/jobs/JobManager.kt index 4ff12bd64..713ac01cb 100644 --- a/Server/src/main/kotlin/rs09/game/content/jobs/JobManager.kt +++ b/Server/src/main/kotlin/rs09/game/content/jobs/JobManager.kt @@ -89,6 +89,7 @@ object JobManager { player.removeAttribute("jobs:original_amount") player.removeAttribute("jobs:type") player.incrementAttribute("/save:jobs:dailyAmt",1) + System.out.println("Complete amount: ${player.getAttribute("jobs:dailyAmt",0)}") if(player.getAttribute("jobs:dailyAmt",0) == 3){ player.setAttribute("/save:jobs:reset_time",System.currentTimeMillis() + TimeUnit.HOURS.toMillis(24)) } diff --git a/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt b/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt index 034803b21..e11f1aff5 100644 --- a/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt @@ -57,7 +57,7 @@ class WorkForInteractionListener : InteractionListener() { var amount = 0 var jobId = 0 - if(player.getAttribute("jobs:reset_time",0L) < System.currentTimeMillis()){ + if(player.getAttribute("jobs:reset_time",Long.MAX_VALUE) < System.currentTimeMillis()){ player.setAttribute("/save:jobs:dailyAmt",0) } diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt index 581dffced..528372d6a 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt @@ -169,6 +169,17 @@ object UseWithPatchHandler{ return true } } + if(patch.type != PatchType.FRUIT_TREE && patch.type != PatchType.TREE){ + if(!player.inventory.contains(Items.SEED_DIBBER_5343,1)){ + player.sendMessage("You need a seed dibber to plant that.") + return true + } + } else { + if(!player.inventory.contains(Items.SPADE_952,1)){ + player.sendMessage("You need a spade to plant that.") + return true + } + } player.lock() if(player.inventory.remove(plantItem)) { player.animator.animate(Animation(2291)) diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/magic/ModernListeners.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/magic/ModernListeners.kt index d2f7ff28a..022a20a8c 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/magic/ModernListeners.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/magic/ModernListeners.kt @@ -101,6 +101,11 @@ class ModernListeners : SpellListener("modern"){ sendTeleport(player,74.0, Location.create(2754, 2784, 0)) } + onCast(Modern.TELEPORT_TO_HOUSE,NONE){player, _ -> + requires(player,40, arrayOf(Item(Items.LAW_RUNE_563), Item(Items.AIR_RUNE_556), Item(Items.EARTH_RUNE_557))) + attemptHouseTeleport(player) + } + onCast(Modern.LOW_ALCHEMY,ITEM){player, node -> val item = node?.asItem() ?: return@onCast requires(player,21, arrayOf(Item(Items.FIRE_RUNE_554,3),Item(Items.NATURE_RUNE_561))) @@ -243,4 +248,17 @@ class ModernListeners : SpellListener("modern"){ addXP(player,xp) setDelay(player,true) } + + private fun attemptHouseTeleport(player: Player){ + val loc = player.houseManager.location.exitLocation + if(loc == null){ + player.sendMessage("You do not have a house whose portal you can teleport to.") + return + } + + player.teleporter.send(loc,TeleportManager.TeleportType.NORMAL) + removeRunes(player) + addXP(player,30.0) + setDelay(player,true) + } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/Pickpockets.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/Pickpockets.kt index 245996fd0..a67052eb3 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/Pickpockets.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/Pickpockets.kt @@ -29,6 +29,7 @@ enum class Pickpockets(val ids: IntArray, val requiredLevel: Int, val low: Doubl WeightedItem(Items.HAM_HOOD_4302,1,1,0.25), WeightedItem(Items.HAM_LOGO_4306,1,1,0.25), WeightedItem(Items.HAM_ROBE_4300,1,1,0.25), + WeightedItem(Items.HAM_SHIRT_4298,1,1,0.25), WeightedItem(Items.BOOTS_4310,1,1,1.0), WeightedItem(Items.GLOVES_4308,1,1,1.0), WeightedItem(Items.BRONZE_PICKAXE_1265,1,1,5.0), @@ -55,6 +56,7 @@ enum class Pickpockets(val ids: IntArray, val requiredLevel: Int, val low: Doubl WeightedItem(Items.HAM_CLOAK_4304,1,1,0.25), WeightedItem(Items.HAM_HOOD_4302,1,1,0.25), WeightedItem(Items.HAM_LOGO_4306,1,1,0.25), + WeightedItem(Items.HAM_SHIRT_4298,1,1,0.25), WeightedItem(Items.HAM_ROBE_4300,1,1,0.25), WeightedItem(Items.BOOTS_4310,1,1,1.0), WeightedItem(Items.GLOVES_4308,1,1,1.0), diff --git a/Server/src/main/kotlin/rs09/game/node/entity/state/newsys/states/SeedlingState.kt b/Server/src/main/kotlin/rs09/game/node/entity/state/newsys/states/SeedlingState.kt index f7dee360d..e6ba38ab3 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/state/newsys/states/SeedlingState.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/state/newsys/states/SeedlingState.kt @@ -1,15 +1,15 @@ package rs09.game.node.entity.state.newsys.states import core.game.node.entity.player.Player -import rs09.game.node.entity.skill.farming.Seedling -import rs09.game.node.entity.state.newsys.PlayerState -import rs09.game.node.entity.state.newsys.State import core.game.node.item.Item import core.game.system.task.Pulse import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import org.json.simple.JSONArray import org.json.simple.JSONObject +import rs09.game.node.entity.skill.farming.Seedling +import rs09.game.node.entity.state.newsys.PlayerState +import rs09.game.node.entity.state.newsys.State import java.util.concurrent.TimeUnit @PlayerState("seedling") @@ -17,7 +17,7 @@ class SeedlingState(player: Player? = null) : State(player) { val seedlings = ArrayList() fun addSeedling(seedling: Int){ - seedlings.add(Seedling(seedling, System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5),seedling + 6)) + seedlings.add(Seedling(seedling, System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5),seedling + if(seedling > 5400) 8 else 6)) } override fun save(root: JSONObject) { diff --git a/build.sh b/build.sh old mode 100755 new mode 100644 index 4881fd9e7..dcdabc084 --- a/build.sh +++ b/build.sh @@ -1,54 +1,2 @@ -#!/bin/sh -origDir=$(pwd) -if [ $# -eq 0 ]; then - echo "Usage: $0 type" - echo "Available types: client, server, ms, all" - exit -else type=$1 -fi - -build_server() { - echo "Building server..." - cd Server/ || exit - gradle build || exit - cd "$origDir" || exit - tar xvf Server/build/distributions/Server.tar || exit -} -build_client() { - echo "Building client..." - echo "Change IP from 127.0.0.1?(y/N)" - read -r changeIP - if [ "$changeIP" = "y" ]; then - echo "Enter desired IP address:" - read -r newIP - echo "target_ip_addr:$newIP" > Client/src/main/resources/client.conf - fi - cd Client/ || exit - gradle build || exit - cd "$origDir" || exit - tar xvf Client/build/distributions/Client.tar || exit - cp Client/build/libs/client-1.0.0.jar Client/bin/2009scape.jar || exit - echo "Client jarfile can be found at Client/bin/2009scape.jar" -} -build_ms() { - echo "Building management server..." - cd Management-Server/ || exit - gradle build || exit - cd "$origDir" || exit - tar xvf Management-Server/build/distributions/Management-Server.tar || exit -} - - -if [ "$type" = "client" ]; then - build_client -elif [ "$type" = "server" ]; then - build_server -elif [ "$type" = "ms" ]; then - build_ms -elif [ "$type" = "all" ]; then - build_ms - build_server - build_client -else echo "Invalid type. Should be one of: client, server, ms, all" -fi - +cd Server +gradle jar