Fixed achievement related NPEs in ClimbActionHandler
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package core.game.content.global.action;
|
package core.game.content.global.action;
|
||||||
|
|
||||||
|
import api.ContentAPIKt;
|
||||||
import core.game.container.impl.EquipmentContainer;
|
import core.game.container.impl.EquipmentContainer;
|
||||||
import org.rs09.consts.Items;
|
import org.rs09.consts.Items;
|
||||||
import core.game.node.entity.player.link.diary.DiaryType;
|
import core.game.node.entity.player.link.diary.DiaryType;
|
||||||
@@ -13,6 +14,8 @@ import core.game.world.map.Location;
|
|||||||
import core.game.world.map.RegionManager;
|
import core.game.world.map.RegionManager;
|
||||||
import core.game.world.update.flag.context.Animation;
|
import core.game.world.update.flag.context.Animation;
|
||||||
|
|
||||||
|
import static api.ContentAPIKt.isEquipped;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a ladder climbing reward.
|
* Handles a ladder climbing reward.
|
||||||
* @author Emperor
|
* @author Emperor
|
||||||
@@ -207,9 +210,9 @@ public final class ClimbActionHandler {
|
|||||||
}
|
}
|
||||||
// falador dark wizards tower proselyte
|
// falador dark wizards tower proselyte
|
||||||
if (destination.equals(2908, 3336, 2)
|
if (destination.equals(2908, 3336, 2)
|
||||||
&& player.getEquipment().get(EquipmentContainer.SLOT_HAT).getId() == Items.PROSELYTE_SALLET_9672
|
&& isEquipped(player, Items.PROSELYTE_SALLET_9672)
|
||||||
&& player.getEquipment().get(EquipmentContainer.SLOT_CHEST).getId() == Items.PROSELYTE_HAUBERK_9674
|
&& isEquipped(player, Items.PROSELYTE_HAUBERK_9674)
|
||||||
&& player.getEquipment().get(EquipmentContainer.SLOT_LEGS).getId() == Items.PROSELYTE_CUISSE_9676) {
|
&& isEquipped(player, Items.PROSELYTE_CUISSE_9676)) {
|
||||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.FALADOR, 2, 0);
|
player.getAchievementDiaryManager().finishTask(player, DiaryType.FALADOR, 2, 0);
|
||||||
}
|
}
|
||||||
// falador enter the mining guild
|
// falador enter the mining guild
|
||||||
|
|||||||
@@ -128,6 +128,13 @@ fun amountInEquipment(player: Player, id: Int): Int{
|
|||||||
return player.equipment.getAmount(id)
|
return player.equipment.getAmount(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that an item is equipped by the given player
|
||||||
|
*/
|
||||||
|
fun isEquipped(player: Player, id: Int): Boolean {
|
||||||
|
return amountInEquipment(player, id) > 0
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an item from a player's inventory
|
* Remove an item from a player's inventory
|
||||||
* @param player the player whose inventory to remove the item from
|
* @param player the player whose inventory to remove the item from
|
||||||
|
|||||||
Reference in New Issue
Block a user