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