mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +00:00
Remove 'world' object from global script scope
This commit is contained in:
@@ -23,7 +23,7 @@ on { ObjectActionMessage::class }
|
||||
on { NpcActionMessage::class }
|
||||
.where { option == 2 }
|
||||
.then {
|
||||
val npc = world.npcRepository[index]
|
||||
val npc = it.world.npcRepository[index]
|
||||
|
||||
if (npc.id in BANKER_NPCS) {
|
||||
BankAction.start(this, it, npc.position)
|
||||
|
||||
@@ -3,21 +3,21 @@ import org.apollo.game.message.impl.SendFriendMessage
|
||||
import org.apollo.game.model.entity.setting.PrivacyState
|
||||
|
||||
on { AddFriendMessage::class }
|
||||
.then { player ->
|
||||
player.addFriend(username)
|
||||
.then {
|
||||
it.addFriend(username)
|
||||
|
||||
val playerUsername = player.username
|
||||
val friend = world.getPlayer(username)
|
||||
val playerUsername = it.username
|
||||
val friend = it.world.getPlayer(username)
|
||||
|
||||
if (friend == null) {
|
||||
player.send(SendFriendMessage(username, 0))
|
||||
it.send(SendFriendMessage(username, 0))
|
||||
} else if (friend.friendsWith(playerUsername) || friend.friendPrivacy == PrivacyState.ON) {
|
||||
if (player.friendPrivacy != PrivacyState.OFF) {
|
||||
friend.send(SendFriendMessage(playerUsername, player.worldId))
|
||||
if (it.friendPrivacy != PrivacyState.OFF) {
|
||||
friend.send(SendFriendMessage(playerUsername, it.worldId))
|
||||
}
|
||||
|
||||
if (friend.friendPrivacy != PrivacyState.OFF) {
|
||||
player.send(SendFriendMessage(username, friend.worldId))
|
||||
it.send(SendFriendMessage(username, friend.worldId))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import org.apollo.game.message.impl.AddIgnoreMessage
|
||||
import org.apollo.game.message.impl.RemoveIgnoreMessage
|
||||
|
||||
on { AddIgnoreMessage::class }
|
||||
.then { player -> player.addIgnore(username) }
|
||||
.then { it.addIgnore(username) }
|
||||
|
||||
on { RemoveIgnoreMessage::class }
|
||||
.then { player -> player.removeIgnore(username) }
|
||||
.then { it.removeIgnore(username) }
|
||||
@@ -1,7 +1,7 @@
|
||||
import org.apollo.cache.def.NpcDefinition
|
||||
import org.apollo.game.model.entity.Npc
|
||||
|
||||
start {
|
||||
start { world ->
|
||||
Spawns.list.forEach {
|
||||
val definition = if (it.id != null) NpcDefinition.lookup(it.id) else lookup_npc(it.name)
|
||||
if (definition == null) {
|
||||
@@ -22,6 +22,3 @@ start {
|
||||
world.register(npc)
|
||||
}
|
||||
}
|
||||
|
||||
stop {
|
||||
}
|
||||
|
||||
@@ -12,17 +12,14 @@ import org.apollo.game.plugin.kotlin.*
|
||||
import org.apollo.net.message.Message
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
val world: World = null!!
|
||||
var context: PluginContext = null!!
|
||||
|
||||
fun <T : Message> on(type: () -> KClass<T>): KotlinMessageHandler<T> {
|
||||
null!!
|
||||
}
|
||||
|
||||
fun start(callback: () -> Unit) {
|
||||
fun start(callback: (World) -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun stop(callback: () -> Unit) {
|
||||
fun stop(callback: (World) -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user