Redwings Drop III: Ceikry GE, Job, Slayer, Achievement Diary rewrites

This commit is contained in:
skelsoft
2022-03-18 23:35:19 +00:00
committed by Ceikry
parent 37a503746b
commit 0b9d540d45
147 changed files with 3488 additions and 2996 deletions
+9 -3
View File
@@ -1379,11 +1379,17 @@ fun announceIfRare(player: Player, item: Item) {
*/
fun getMasteredSkillNames(player: Player): List<String> {
val hasMastered = player.getSkills().masteredSkills > 0
val masteredSkills = ArrayList<String>()
for ((skillId, skillName) in Skills.SKILL_NAME.withIndex()) {
if(hasLevelStat(player, skillId, 99)){
masteredSkills.add(skillName)
if(hasMastered){
for ((skillId, skillName) in Skills.SKILL_NAME.withIndex()) {
//phil you were looping every skill and performing a string comparison (another loop) for every one here.
//that's some real shit code bro.
//you were also performing a dynamic level check rather than a static.
if(hasLevelStat(player, skillId, 99)){
masteredSkills.add(skillName)
}
}
}
return masteredSkills
@@ -0,0 +1,7 @@
package api
import core.game.node.entity.player.Player
interface LoginListener {
fun login(player: Player)
}
@@ -0,0 +1,3 @@
package api.events
interface Event {}
@@ -0,0 +1,7 @@
package api.events
import core.game.node.entity.Entity
interface EventHook<T: Event> {
fun process(entity: Entity, event: T)
}
@@ -0,0 +1,11 @@
package api.events
import core.game.node.Node
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.link.TeleportManager.TeleportType
data class ResourceGatheredEvent(val itemId: Int, val amount: Int, val source: Node) : Event
data class NPCKillEvent(val npc: NPC) : Event
data class TeleportEvent(val type: TeleportType, val source: Int = -1) : Event
data class LitFireEvent(val logId: Int) : Event
data class InteractionEvent(val target: Node, val option: String) : Event