mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
Clean step is DEAD
This commit is contained in:
parent
534f568ef0
commit
81a12534be
4 changed files with 52 additions and 13 deletions
|
|
@ -57,17 +57,11 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.rs09</groupId>
|
||||
<artifactId>consts</artifactId>
|
||||
<groupId>org.rs09.consts</groupId>
|
||||
<artifactId>ConstLib</artifactId>
|
||||
<version>1.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.rs09</groupId>
|
||||
<artifactId>primextends</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
|
|
@ -247,5 +241,20 @@
|
|||
<name>Maven Central</name>
|
||||
<url>https://repo.maven.apache.org/maven2/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>gitlab-maven</id>
|
||||
<url>https://gitlab.com/api/v4/projects/32237206/packages/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gitlab-maven</id>
|
||||
<url>https://gitlab.com/api/v4/projects/32237206/packages/maven</url>
|
||||
</repository>
|
||||
|
||||
<snapshotRepository>
|
||||
<id>gitlab-maven</id>
|
||||
<url>https://gitlab.com/api/v4/projects/32237206/packages/maven</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -21,4 +21,36 @@ fun Collection<IntArray>.toIntArray() : IntArray {
|
|||
val list = ArrayList<Int>()
|
||||
this.forEach { arr -> arr.forEach { list.add(it) } }
|
||||
return list.toIntArray()
|
||||
}
|
||||
|
||||
inline fun <reified T> Collection<T>.isLast(element: T) : Boolean {
|
||||
return this.indexOf(element) == this.size - 1
|
||||
}
|
||||
|
||||
inline fun <reified T> Collection<T>.getNext(element: T) : T {
|
||||
val idx = this.indexOf(element)
|
||||
return if (idx < this.size - 1)
|
||||
this.elementAt(idx + 1)
|
||||
else
|
||||
element
|
||||
}
|
||||
|
||||
inline fun <reified T> Collection<T>.isNextLast(element: T) : Boolean {
|
||||
return this.isLast(this.getNext(element))
|
||||
}
|
||||
|
||||
fun IntArray.isLast(element: Int) : Boolean {
|
||||
return this.indexOf(element) == this.size - 1
|
||||
}
|
||||
|
||||
fun IntArray.getNext(element: Int) : Int {
|
||||
val idx = this.indexOf(element)
|
||||
return if (idx < this.size - 1)
|
||||
this.elementAt(idx + 1)
|
||||
else
|
||||
element
|
||||
}
|
||||
|
||||
fun IntArray.isNextLast(element: Int) : Boolean {
|
||||
return this.isLast(this.getNext(element))
|
||||
}
|
||||
|
|
@ -20,8 +20,6 @@ import core.game.world.update.flag.context.Animation
|
|||
import core.game.world.update.flag.context.Graphics
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import org.rs09.primextends.getNext
|
||||
import org.rs09.primextends.isLast
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.system.config.ItemConfigParser
|
||||
import rs09.game.world.GameWorld.Pulser
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package rs09.game.node.entity.combat.equipment
|
||||
|
||||
import api.getNext
|
||||
import api.isLast
|
||||
import api.isNextLast
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.primextends.getNext
|
||||
import org.rs09.primextends.isLast
|
||||
import org.rs09.primextends.isNextLast
|
||||
|
||||
/**
|
||||
* Handles equipment degrading
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue