Repository reorganisation
Unified kotlin and java into just src/main Unified the rs09 and core packages Took all content out of the core package, and placed it into the new content package Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import api.IfaceSettingsBuilder
|
||||
import api.splitLines
|
||||
import core.game.node.entity.skill.slayer.Master
|
||||
import core.game.node.entity.skill.slayer.Tasks
|
||||
import core.api.IfaceSettingsBuilder
|
||||
import core.api.splitLines
|
||||
import content.global.skill.slayer.Master
|
||||
import content.global.skill.slayer.SlayerManager
|
||||
import content.global.skill.slayer.Tasks
|
||||
import org.json.simple.JSONObject
|
||||
import org.json.simple.parser.JSONParser
|
||||
import org.junit.Assert
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.game.node.entity.skill.slayer.SlayerManager
|
||||
|
||||
class APITests {
|
||||
val testPlayer = TestUtils.getMockPlayer("test")
|
||||
|
||||
@@ -7,13 +7,11 @@ import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.fail
|
||||
import rs09.game.ge.GEDB
|
||||
import rs09.game.ge.GrandExchange
|
||||
import rs09.game.ge.GrandExchangeOffer
|
||||
import rs09.game.ge.PriceIndex
|
||||
import rs09.game.system.SystemLogger
|
||||
import core.game.ge.GEDB
|
||||
import core.game.ge.GrandExchange
|
||||
import core.game.ge.GrandExchangeOffer
|
||||
import core.game.ge.PriceIndex
|
||||
import java.io.File
|
||||
import kotlin.random.Random
|
||||
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS) class ExchangeTests {
|
||||
companion object {
|
||||
@@ -107,8 +105,10 @@ import kotlin.random.Random
|
||||
|
||||
@Test fun concurrentlySubmittedOffersShouldNotThrowExceptions(){
|
||||
runBlocking {
|
||||
val a = GlobalScope.launch { for(i in 0 until 5) {PriceIndex.allowItem(i); GrandExchange.addBotOffer(i, 1)} }
|
||||
val b = GlobalScope.launch { for(i in 0 until 5) {PriceIndex.allowItem(i); GrandExchange.addBotOffer(i, 1)} }
|
||||
val a = GlobalScope.launch { for(i in 0 until 5) {
|
||||
PriceIndex.allowItem(i); GrandExchange.addBotOffer(i, 1)} }
|
||||
val b = GlobalScope.launch { for(i in 0 until 5) {
|
||||
PriceIndex.allowItem(i); GrandExchange.addBotOffer(i, 1)} }
|
||||
a.join()
|
||||
b.join()
|
||||
Assertions.assertEquals(false, a.isCancelled)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import core.game.node.entity.player.link.music.MusicEntry
|
||||
import core.game.node.entity.skill.construction.HouseLocation
|
||||
import core.game.node.entity.skill.construction.HouseManager
|
||||
import core.game.node.entity.skill.construction.Servant
|
||||
import core.game.node.entity.skill.construction.ServantType
|
||||
import content.global.skill.construction.HouseLocation
|
||||
import content.global.skill.construction.HouseManager
|
||||
import content.global.skill.construction.Servant
|
||||
import content.global.skill.construction.ServantType
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import org.junit.jupiter.api.Assertions
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.game.ge.GEDB
|
||||
import rs09.game.ge.PriceIndex
|
||||
import core.game.ge.GEDB
|
||||
import core.game.ge.PriceIndex
|
||||
|
||||
class PriceIndexTests {
|
||||
companion object {init {TestUtils.preTestSetup(); GEDB.init("ge_test.db")}}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import api.regionspec.*
|
||||
import api.regionspec.contracts.FillChunkContract
|
||||
import core.api.regionspec.*
|
||||
import core.api.regionspec.contracts.FillChunkContract
|
||||
import core.game.world.map.BuildRegionChunk
|
||||
import core.game.world.map.Region
|
||||
import core.game.world.map.RegionChunk
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.map.build.DynamicRegion
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.game.system.SystemLogger
|
||||
|
||||
class RegionSpecificationTests {
|
||||
companion object {
|
||||
|
||||
@@ -7,8 +7,8 @@ import core.game.world.map.build.LandscapeParser
|
||||
import org.junit.Assert
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.game.system.config.ServerConfigParser
|
||||
import rs09.game.system.config.XteaParser
|
||||
import core.game.system.config.ServerConfigParser
|
||||
import core.game.system.config.XteaParser
|
||||
|
||||
class RegionTests {
|
||||
companion object {
|
||||
|
||||
@@ -4,8 +4,8 @@ import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.content.global.shops.Shop
|
||||
import rs09.game.content.global.shops.Shops
|
||||
import core.game.shops.Shop
|
||||
import core.game.shops.Shops
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
|
||||
@@ -9,16 +9,15 @@ import core.game.node.item.Item
|
||||
import core.net.IoSession
|
||||
import core.net.packet.IoBuffer
|
||||
import org.rs09.consts.Items
|
||||
import rs09.ServerConstants
|
||||
import rs09.game.content.global.shops.Shop
|
||||
import rs09.game.content.global.shops.ShopItem
|
||||
import rs09.game.system.SystemLogger
|
||||
import rs09.game.system.config.ConfigParser
|
||||
import rs09.game.system.config.ServerConfigParser
|
||||
import rs09.game.world.GameWorld
|
||||
import rs09.game.world.repository.Repository
|
||||
import rs09.game.world.update.UpdateSequence
|
||||
import java.io.File
|
||||
import core.ServerConstants
|
||||
import core.game.shops.Shop
|
||||
import core.game.shops.ShopItem
|
||||
import core.tools.SystemLogger
|
||||
import core.game.system.config.ConfigParser
|
||||
import core.game.system.config.ServerConfigParser
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.repository.Repository
|
||||
import core.game.world.update.UpdateSequence
|
||||
import java.net.URI
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
package content
|
||||
|
||||
import TestUtils
|
||||
import api.asItem
|
||||
import core.game.content.global.action.DropItemHandler
|
||||
import core.game.node.entity.combat.ImpactHandler
|
||||
import core.api.asItem
|
||||
import core.game.node.entity.player.info.Rights
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.game.world.map.Location
|
||||
import org.junit.Assert
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.node.entity.player.graves.GraveType
|
||||
import rs09.game.node.entity.player.graves.GraveController
|
||||
import rs09.game.world.GameWorld
|
||||
import rs09.tools.secondsToTicks
|
||||
import core.game.node.entity.combat.graves.GraveType
|
||||
import core.game.node.entity.combat.graves.GraveController
|
||||
import core.game.world.GameWorld
|
||||
import core.tools.secondsToTicks
|
||||
class DeathTests {
|
||||
init {
|
||||
//explicitly register the GraveController as a tick listener because tests don't run reflection
|
||||
@@ -307,7 +301,7 @@ class DeathTests {
|
||||
Assertions.assertNotNull(g)
|
||||
Assertions.assertEquals(p.location, g?.location)
|
||||
|
||||
val canDrop = DropItemHandler.drop(p, p.inventory[0])
|
||||
val canDrop = core.game.global.action.DropItemHandler.drop(p, p.inventory[0])
|
||||
Assertions.assertEquals(false, canDrop)
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package content
|
||||
|
||||
import TestUtils
|
||||
import api.EquipmentSlot
|
||||
import core.api.EquipmentSlot
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.content.global.action.EquipHandler
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.interaction.IntType
|
||||
import rs09.game.interaction.InteractionListeners
|
||||
import core.game.global.action.EquipHandler
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListeners
|
||||
|
||||
class EquipTests {
|
||||
companion object {
|
||||
|
||||
@@ -4,29 +4,29 @@ import TestUtils
|
||||
import core.game.node.item.Item
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.interaction.IntType
|
||||
import rs09.game.interaction.InteractionListeners
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListeners
|
||||
|
||||
class ListenerTests : InteractionListener {
|
||||
@Test fun doubleDefinedListenerShouldThrowIllegalStateException() {
|
||||
on(0, IntType.ITEM, "touch") {_,_ -> return@on true}
|
||||
on(0, IntType.ITEM, "touch") { _, _ -> return@on true}
|
||||
Assertions.assertThrows(IllegalStateException::class.java) {
|
||||
on(0, IntType.ITEM, "touch") {_,_ -> return@on true}
|
||||
on(0, IntType.ITEM, "touch") { _, _ -> return@on true}
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun doubleDefinedUseWithShouldThrowIllegalStateException() {
|
||||
onUseWith(IntType.SCENERY, 0, 1) {_,_,_ -> return@onUseWith true}
|
||||
onUseWith(IntType.SCENERY, 0, 1) { _, _, _ -> return@onUseWith true}
|
||||
Assertions.assertThrows(IllegalStateException::class.java) {
|
||||
onUseWith(IntType.SCENERY, 0, 1) {_,_,_ -> return@onUseWith true}
|
||||
onUseWith(IntType.SCENERY, 0, 1) { _, _, _ -> return@onUseWith true}
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun conflictingCatchallShouldThrowIllegalStateException() {
|
||||
on(IntType.ITEM, "boop"){_,_ -> return@on true}
|
||||
on(IntType.ITEM, "boop"){ _, _ -> return@on true}
|
||||
Assertions.assertThrows(IllegalStateException::class.java) {
|
||||
on(IntType.ITEM, "boop") {_,_ -> return@on true}
|
||||
on(IntType.ITEM, "boop") { _, _ -> return@on true}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class ListenerTests : InteractionListener {
|
||||
var specificRan = false
|
||||
var catchAllRan = false
|
||||
on(IntType.ITEM, "zap") { _, _ -> catchAllRan = true; return@on true}
|
||||
on(1, IntType.ITEM, "zap") {_,_ -> specificRan = true; return@on true}
|
||||
on(1, IntType.ITEM, "zap") { _, _ -> specificRan = true; return@on true}
|
||||
|
||||
InteractionListeners.run(1, IntType.ITEM, "zap", TestUtils.getMockPlayer("bilbots"), Item(1))
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import core.game.node.item.Item
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.content.ame.RandomEventNPC
|
||||
import rs09.game.world.GameWorld
|
||||
import content.global.ame.RandomEventNPC
|
||||
import core.game.world.GameWorld
|
||||
|
||||
class RandomEventManagerTests {
|
||||
companion object {init {
|
||||
@@ -15,16 +15,16 @@ class RandomEventManagerTests {
|
||||
|
||||
@Test fun loginShouldEnableManager() {
|
||||
val p = TestUtils.getMockPlayer("Bill")
|
||||
rs09.game.content.ame.RandomEventManager().login(p)
|
||||
val manager = rs09.game.content.ame.RandomEventManager.getInstance(p)
|
||||
content.global.ame.RandomEventManager().login(p)
|
||||
val manager = content.global.ame.RandomEventManager.getInstance(p)
|
||||
Assertions.assertNotNull(manager)
|
||||
Assertions.assertEquals(true, manager!!.enabled)
|
||||
}
|
||||
|
||||
@Test fun loginShouldSetNextSpawn() {
|
||||
val p = TestUtils.getMockPlayer("Bill")
|
||||
rs09.game.content.ame.RandomEventManager().login(p)
|
||||
val manager = rs09.game.content.ame.RandomEventManager.getInstance(p)
|
||||
content.global.ame.RandomEventManager().login(p)
|
||||
val manager = content.global.ame.RandomEventManager.getInstance(p)
|
||||
Assertions.assertNotNull(manager)
|
||||
Assertions.assertEquals(true, manager!!.nextSpawn > GameWorld.ticks)
|
||||
}
|
||||
@@ -32,18 +32,18 @@ class RandomEventManagerTests {
|
||||
@Test fun shouldSpawnRandomEventWithinMAXTICKSGivenNoRestrictions() {
|
||||
val p = TestUtils.getMockPlayer("Bill")
|
||||
p.setAttribute("tutorial:complete", true) //tutorial has to be complete to spawn randoms
|
||||
rs09.game.content.ame.RandomEventManager().login(p)
|
||||
TestUtils.advanceTicks(rs09.game.content.ame.RandomEventManager.MAX_DELAY_TICKS + 5)
|
||||
content.global.ame.RandomEventManager().login(p)
|
||||
TestUtils.advanceTicks(content.global.ame.RandomEventManager.MAX_DELAY_TICKS + 5)
|
||||
Assertions.assertNotNull(p.getAttribute("re-npc", null))
|
||||
}
|
||||
|
||||
@Test fun teleportAndNotePunishmentShouldNotAffectAlreadyNotedItems() {
|
||||
val p = TestUtils.getMockPlayer("Shitforbrains")
|
||||
p.setAttribute("tutorial:complete", true)
|
||||
rs09.game.content.ame.RandomEventManager().login(p)
|
||||
content.global.ame.RandomEventManager().login(p)
|
||||
|
||||
p.inventory.add(Item(Items.RAW_SHARK_384, 1000))
|
||||
rs09.game.content.ame.RandomEventManager.getInstance(p)?.fireEvent()
|
||||
content.global.ame.RandomEventManager.getInstance(p)?.fireEvent()
|
||||
p.getAttribute<RandomEventNPC>("re-npc")!!.noteAndTeleport()
|
||||
|
||||
Assertions.assertEquals(1000, p.inventory.getAmount(Items.RAW_SHARK_384))
|
||||
@@ -52,10 +52,10 @@ class RandomEventManagerTests {
|
||||
@Test fun teleportAndNotePunishmentShouldNoteNotableUnnotedItems() {
|
||||
val p = TestUtils.getMockPlayer("shitforbrains2")
|
||||
p.setAttribute("tutorial:complete", true)
|
||||
rs09.game.content.ame.RandomEventManager().login(p)
|
||||
content.global.ame.RandomEventManager().login(p)
|
||||
|
||||
p.inventory.add(Item(4151, 5))
|
||||
rs09.game.content.ame.RandomEventManager.getInstance(p)?.fireEvent()
|
||||
content.global.ame.RandomEventManager.getInstance(p)?.fireEvent()
|
||||
p.getAttribute<RandomEventNPC>("re-npc")!!.noteAndTeleport()
|
||||
|
||||
Assertions.assertEquals(5, p.inventory.getAmount(4152))
|
||||
@@ -65,10 +65,10 @@ class RandomEventManagerTests {
|
||||
@Test fun teleportAndNotePunishmentShouldNotAffectUnnotableItems() {
|
||||
val p = TestUtils.getMockPlayer("shitforbrains3")
|
||||
p.setAttribute("tutorial:complete", true)
|
||||
rs09.game.content.ame.RandomEventManager().login(p)
|
||||
content.global.ame.RandomEventManager().login(p)
|
||||
|
||||
p.inventory.add(Item(Items.AIR_RUNE_556, 30))
|
||||
rs09.game.content.ame.RandomEventManager.getInstance(p)?.fireEvent()
|
||||
content.global.ame.RandomEventManager.getInstance(p)?.fireEvent()
|
||||
p.getAttribute<RandomEventNPC>("re-npc")!!.noteAndTeleport()
|
||||
|
||||
Assertions.assertEquals(30, p.inventory.getAmount(Items.AIR_RUNE_556))
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package core
|
||||
|
||||
import TestUtils
|
||||
import content.global.skill.gather.GatheringSkillOptionListeners
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.interaction.IntType
|
||||
import rs09.game.interaction.InteractionListeners
|
||||
import rs09.game.node.entity.skill.gather.GatheringSkillOptionListeners
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListeners
|
||||
|
||||
class PathfinderTests {
|
||||
companion object {init {TestUtils.preTestSetup(); GatheringSkillOptionListeners().defineListeners() }}
|
||||
|
||||
@@ -2,10 +2,10 @@ package core.auth
|
||||
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.auth.DevelopmentAuthenticator
|
||||
import rs09.auth.AuthResponse
|
||||
import rs09.auth.UserAccountInfo
|
||||
import rs09.storage.InMemoryStorageProvider
|
||||
import core.auth.DevelopmentAuthenticator
|
||||
import core.auth.AuthResponse
|
||||
import core.auth.UserAccountInfo
|
||||
import core.storage.InMemoryStorageProvider
|
||||
|
||||
class DevelopmentAuthenticatorTests {
|
||||
private val authProvider = DevelopmentAuthenticator()
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.junit.Assert
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.auth.AuthResponse
|
||||
import rs09.auth.ProductionAuthenticator
|
||||
import rs09.auth.UserAccountInfo
|
||||
import rs09.storage.InMemoryStorageProvider
|
||||
import core.auth.AuthResponse
|
||||
import core.auth.ProductionAuthenticator
|
||||
import core.auth.UserAccountInfo
|
||||
import core.storage.InMemoryStorageProvider
|
||||
|
||||
class ProductionAuthenticatorTests {
|
||||
companion object {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package core.cache
|
||||
|
||||
import TestUtils
|
||||
import api.itemDefinition
|
||||
import core.api.itemDefinition
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.io.File
|
||||
|
||||
@@ -2,8 +2,8 @@ package core.net
|
||||
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.auth.AuthResponse
|
||||
import rs09.net.packet.`in`.Login
|
||||
import core.auth.AuthResponse
|
||||
import core.net.packet.`in`.Login
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
class LoginTests {
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package core.storage
|
||||
|
||||
import core.auth.ProductionAuthenticatorTests
|
||||
import org.junit.After
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import rs09.ServerConstants
|
||||
import rs09.auth.UserAccountInfo
|
||||
import rs09.game.system.SystemLogger
|
||||
import rs09.storage.SQLStorageProvider
|
||||
import core.ServerConstants
|
||||
import core.auth.UserAccountInfo
|
||||
import core.tools.SystemLogger
|
||||
import java.sql.SQLDataException
|
||||
|
||||
class SQLStorageProviderTests {
|
||||
|
||||
Reference in New Issue
Block a user