Fixed a bunch of minor exceptions
This commit is contained in:
@@ -3,6 +3,8 @@ package core.game.content.dialogue;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.RunScript;
|
||||
import core.game.node.entity.skill.crafting.spinning.SpinningPulse;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import kotlin.Unit;
|
||||
import rs09.game.content.dialogue.SkillDialogueHandler;
|
||||
@@ -59,7 +61,11 @@ public class SkillDialoguePlugin extends DialoguePlugin {
|
||||
handler.create(amount, index);
|
||||
} else {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
handler.create((int) value, index);
|
||||
if (value instanceof String) {
|
||||
handler.create(Integer.parseInt((String) value), index);
|
||||
} else {
|
||||
handler.create((int) value, index);
|
||||
}
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
return true;
|
||||
|
||||
@@ -180,7 +180,10 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, -1, -2, player.getAttribute("container-key", 93), player.getInventory(), false));
|
||||
break;
|
||||
case 155:
|
||||
player.getPacketDispatch().sendMessage((String) CS2Mapping.forId(1089).getMap().get(set.getItemId()));
|
||||
CS2Mapping mapping = CS2Mapping.forId(1089);
|
||||
if (mapping != null && set != null) {
|
||||
player.getPacketDispatch().sendMessage((String) mapping.getMap().get(set.getItemId()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,11 @@ public class SmeltingInterface extends ComponentPlugin {
|
||||
if (barType.getAmount() == -1) {
|
||||
player.getInterfaceManager().closeChatbox();
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
submitIndividualPulse(player, new SmeltingPulse(player, null, barType.getBar(), (int) value));
|
||||
if (value instanceof String) {
|
||||
submitIndividualPulse(player, new SmeltingPulse(player, null, barType.getBar(), Integer.parseInt((String) value)));
|
||||
} else {
|
||||
submitIndividualPulse(player, new SmeltingPulse(player, null, barType.getBar(), (int) value));
|
||||
}
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -46,7 +46,11 @@ public class SpinningInterface extends ComponentPlugin {
|
||||
break;
|
||||
case 199:
|
||||
sendInputDialogue(p, true, "Enter the amount:", (value) -> {
|
||||
submitIndividualPulse(p, new SpinningPulse(p, new Item(spin.getNeed(), 1), (int) value, spin));
|
||||
if (value instanceof String) {
|
||||
submitIndividualPulse(p, new SpinningPulse(p, new Item(spin.getNeed(), 1), Integer.parseInt((String) value), spin));
|
||||
} else {
|
||||
submitIndividualPulse(p, new SpinningPulse(p, new Item(spin.getNeed(), 1), (int) value, spin));
|
||||
}
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -311,6 +311,9 @@ public class NPC extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
if (Shops.getShopsByNpc().get(id) == null) {
|
||||
return false;
|
||||
}
|
||||
Shops.getShopsByNpc().get(id).openFor(player);
|
||||
|
||||
//Fix for issue #11 for shops keeping dialogue open.
|
||||
|
||||
@@ -296,6 +296,11 @@ object PlunderUtils {
|
||||
fun rollUrnSuccess(player: Player, charmed: Boolean = false): Boolean
|
||||
{
|
||||
val level = getDynLevel(player, Skills.THIEVING)
|
||||
|
||||
if (getRoom(player) == null) {
|
||||
return false
|
||||
}
|
||||
|
||||
val room = getRoom(player)!!.room
|
||||
return RandomFunction.random(level) > (room * if(charmed) 2 else 4)
|
||||
}
|
||||
|
||||
@@ -28,17 +28,14 @@ abstract class DialogueFile {
|
||||
}
|
||||
|
||||
open fun npc(vararg messages: String?): Component? {
|
||||
return if (npc == null) {
|
||||
interpreter!!.sendDialogues(
|
||||
npc!!.id,
|
||||
if (npc != null) {
|
||||
return interpreter!!.sendDialogues(
|
||||
npc,
|
||||
if (npc!!.id > 8591) FacialExpression.OLD_NORMAL else FacialExpression.FRIENDLY,
|
||||
*messages
|
||||
)
|
||||
} else interpreter!!.sendDialogues(
|
||||
npc,
|
||||
if (npc!!.id > 8591) FacialExpression.OLD_NORMAL else FacialExpression.FRIENDLY,
|
||||
*messages
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
open fun npc(id: Int, vararg messages: String?): Component? {
|
||||
|
||||
@@ -141,7 +141,11 @@ class FairyRingInterface : InterfaceListener{
|
||||
closeInterface(player)
|
||||
|
||||
ring.let {
|
||||
player.dispatch(FairyRingDialEvent(it!!))
|
||||
if (it == null) {
|
||||
return@let
|
||||
}
|
||||
|
||||
player.dispatch(FairyRingDialEvent(it))
|
||||
teleport(player, tile!!, TeleportManager.TeleportType.FAIRY_RING)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,13 @@ class CookingDialogue(vararg val args: Any) : DialogueFile(){
|
||||
end()
|
||||
val amount = getAmount(buttonID)
|
||||
when (amount) {
|
||||
-1 -> sendInputDialogue(player!!, true, "Enter the amount:") { value -> cook(player!!, `object`, initial, product, value as Int) }
|
||||
-1 -> sendInputDialogue(player!!, true, "Enter the amount:") { value ->
|
||||
if (value is String) {
|
||||
cook(player!!, `object`, initial, product, value.toInt())
|
||||
} else {
|
||||
cook(player!!, `object`, initial, product, value as Int)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
end()
|
||||
|
||||
@@ -4,6 +4,7 @@ import api.TickListener
|
||||
import core.net.packet.OutgoingPacket
|
||||
import core.net.packet.out.*
|
||||
import rs09.game.system.SystemLogger
|
||||
import java.lang.IndexOutOfBoundsException
|
||||
import java.util.*
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
import kotlin.NoSuchElementException
|
||||
@@ -60,6 +61,8 @@ class PacketWriteQueue : TickListener {
|
||||
for (pkt: QueuedPacket<*>? in packetsToWrite) SystemLogger.logWarn(this::class.java, "${pkt?.out?.javaClass?.simpleName ?: "NULL"} <- ${pkt?.context ?: "NULL"}")
|
||||
} catch (ignored: NullPointerException) {
|
||||
//do nothing, we don't care, this can happen when everything is working as intended.
|
||||
} catch (ignored: IndexOutOfBoundsException) {
|
||||
//do nothing, we don't care, this can happen when everything is working as intended.
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user