From 01bc39ff3f3322301744eb8027abc0412e14515d Mon Sep 17 00:00:00 2001 From: ceikry Date: Fri, 23 Jul 2021 22:30:23 -0500 Subject: [PATCH] Added more fist of guthix work --- .../rs09/game/ai/general/GeneralBotCreator.kt | 2 ++ .../fog/{FOGZone.kt => FOGArenaZone.kt} | 3 ++- .../game/content/activity/fog/FOGSession.kt | 19 +++++++++++++------ .../game/content/activity/fog/FOGUtils.kt | 2 ++ .../content/activity/fog/FOGWaitingArea.kt | 6 +++++- .../content/activity/fog/FogCommandSet.kt | 12 ++++++++++++ 6 files changed, 36 insertions(+), 8 deletions(-) rename Server/src/main/kotlin/rs09/game/content/activity/fog/{FOGZone.kt => FOGArenaZone.kt} (95%) create mode 100644 Server/src/main/kotlin/rs09/game/content/activity/fog/FogCommandSet.kt diff --git a/Server/src/main/kotlin/rs09/game/ai/general/GeneralBotCreator.kt b/Server/src/main/kotlin/rs09/game/ai/general/GeneralBotCreator.kt index 78005f894..07f1ae0f6 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/GeneralBotCreator.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/GeneralBotCreator.kt @@ -12,10 +12,12 @@ import rs09.game.ai.general.scriptrepository.Idler import rs09.game.ai.general.scriptrepository.Script class GeneralBotCreator { + var bot: AIPlayer? = null //org/crandor/net/packet/in/InteractionPacket.java <<< This is a very useful class for learning to code bots constructor(loc: Location?, botScript: Script) { botScript.bot = AIPBuilder.create(loc) GameWorld.Pulser.submit(BotScriptPulse(botScript)) + bot = (botScript.bot as AIPlayer?)!! } constructor(botScript: Script, bot: AIPlayer?) { diff --git a/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGZone.kt b/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGArenaZone.kt similarity index 95% rename from Server/src/main/kotlin/rs09/game/content/activity/fog/FOGZone.kt rename to Server/src/main/kotlin/rs09/game/content/activity/fog/FOGArenaZone.kt index 7e5869f55..5cd205c81 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGZone.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGArenaZone.kt @@ -15,7 +15,7 @@ import core.plugin.Plugin import org.rs09.consts.Items @Initializable -class FOGZone : MapZone("Fist of Guthix", true, ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FIRES), Plugin { +class FOGArenaZone : MapZone("Fist of Guthix Arena", true, ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FIRES), Plugin { override fun newInstance(arg: Any?): Plugin { ZoneBuilder.configure(this) ContentAPI.submitWorldPulse(pulse) @@ -73,6 +73,7 @@ class FOGZone : MapZone("Fist of Guthix", true, ZoneRestriction.RANDOM_EVENTS, Z } ContentAPI.addItem(e, Items.STONE_OF_POWER_12845) + FOGUtils.hideStoneNotice(e) return true } diff --git a/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGSession.kt b/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGSession.kt index 60d1b58f3..1be50c285 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGSession.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGSession.kt @@ -21,22 +21,29 @@ class FOGSession(val playerA: Player, val playerB: Player) { var round = 1 var roundTimer = 0 + var interfaceTimerCounter = 0 fun start(){ playerA.setAttribute("fog-session",this) playerA.logoutListeners["fog-logout"] = { player -> ContentAPI.teleport(player, Location.create(1714, 5599, 0)); isActive = false } playerB.setAttribute("fog-session",this) playerB.logoutListeners["fog-logout"] = { player -> ContentAPI.teleport(player, Location.create(1714, 5599, 0)); isActive = false } - + playerA.properties.teleportLocation = FOGUtils.getRandomStartLocation() + playerB.properties.teleportLocation = FOGUtils.getRandomStartLocation() + FOGWaitingArea.currentlyWaiting.remove(playerA) + FOGWaitingArea.currentlyWaiting.remove(playerB) } fun tick() { roundTimer++ - playerA.varpManager.get(FOGUtils.TIMER_VARP).setVarbit(4, roundTimer).send(playerA) - playerB.varpManager.get(FOGUtils.TIMER_VARP).setVarbit(4, roundTimer).send(playerB) - - if(FOGUtils.carryingStone(hunted) && roundTimer % 5 == 0){ - FOGUtils.incrementHuntedScore(this, FOGUtils.getTickScore(hunted)) + if(roundTimer % 16 == 0) { + interfaceTimerCounter++ + playerA.varpManager.get(FOGUtils.TIMER_VARP).setVarbit(4, interfaceTimerCounter).send(playerA) + playerB.varpManager.get(FOGUtils.TIMER_VARP).setVarbit(4, interfaceTimerCounter).send(playerB) + } + if(FOGUtils.carryingStone(hunted)){ + if(roundTimer % 5 == 0) + FOGUtils.incrementHuntedScore(this, FOGUtils.getTickScore(hunted)) } else if (!ContentAPI.inInventory(hunted, Items.STONE_OF_POWER_12845)){ FOGUtils.showStoneNotice(hunted) } diff --git a/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGUtils.kt b/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGUtils.kt index bf89c28be..aacd6e4d8 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGUtils.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGUtils.kt @@ -40,6 +40,8 @@ object FOGUtils { 1 -> session.playerBScore += amount 2 -> session.playerAScore += amount } + + } fun isInHouse(player: Player): Boolean { diff --git a/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGWaitingArea.kt b/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGWaitingArea.kt index 80d6854c6..2775ada60 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGWaitingArea.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/fog/FOGWaitingArea.kt @@ -3,13 +3,16 @@ package rs09.game.content.activity.fog import api.ContentAPI import core.game.node.entity.player.Player import core.game.system.task.Pulse +import rs09.game.system.SystemLogger object FOGWaitingArea { + var pulseStarted = false val currentlyWaiting = ArrayList() val activeSessions = ArrayList() val pulse = object : Pulse(10){ override fun pulse(): Boolean { + SystemLogger.logInfo("Ticking") if(currentlyWaiting.size < 4) return false val sortedByCombat = currentlyWaiting.sortedBy { it.properties.currentCombatLevel }.toMutableList() @@ -22,6 +25,7 @@ object FOGWaitingArea { else{ val session = FOGSession(previousPlayer, player) session.start() + SystemLogger.logInfo("Starting session") activeSessions.add(session) previousPlayer = null } @@ -32,7 +36,7 @@ object FOGWaitingArea { } fun register(player: Player): Boolean { - if(!pulse.isRunning) ContentAPI.submitWorldPulse(pulse) + if(!pulseStarted) ContentAPI.submitWorldPulse(pulse).also { pulseStarted = true } return currentlyWaiting.add(player) } diff --git a/Server/src/main/kotlin/rs09/game/content/activity/fog/FogCommandSet.kt b/Server/src/main/kotlin/rs09/game/content/activity/fog/FogCommandSet.kt new file mode 100644 index 000000000..9f74932a5 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/activity/fog/FogCommandSet.kt @@ -0,0 +1,12 @@ +package rs09.game.content.activity.fog + +import rs09.game.ai.general.GeneralBotCreator +import rs09.game.ai.general.scriptrepository.GlassBlowingBankstander +import rs09.game.system.command.Command +import rs09.game.system.command.sets.CommandSet + +class FogCommandSet : CommandSet(Command.Privilege.ADMIN) { + override fun defineCommands() { + + } +} \ No newline at end of file