Added more fist of guthix work

This commit is contained in:
ceikry 2021-07-23 22:30:23 -05:00
parent cbb339518b
commit 01bc39ff3f
6 changed files with 36 additions and 8 deletions

View file

@ -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?) {

View file

@ -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<Any> {
class FOGArenaZone : MapZone("Fist of Guthix Arena", true, ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FIRES), Plugin<Any> {
override fun newInstance(arg: Any?): Plugin<Any> {
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
}

View file

@ -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)
}

View file

@ -40,6 +40,8 @@ object FOGUtils {
1 -> session.playerBScore += amount
2 -> session.playerAScore += amount
}
}
fun isInHouse(player: Player): Boolean {

View file

@ -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<Player>()
val activeSessions = ArrayList<FOGSession>()
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)
}

View file

@ -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() {
}
}