mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Added + handled varbit packet
This commit is contained in:
parent
2a1e082485
commit
eb2517ef3e
8 changed files with 74 additions and 9 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package org.runite.client;
|
||||
|
||||
import org.rs09.SystemLogger;
|
||||
import org.rs09.client.data.NodeCache;
|
||||
|
||||
import java.util.Objects;
|
||||
|
|
@ -11,10 +12,10 @@ public class Class163 {
|
|||
public static int localNPCCount = 0;
|
||||
|
||||
|
||||
static void method2209(byte var0, int var1, int var2) {
|
||||
static void updateVarbit(byte var0, int var1, int var2) {
|
||||
try {
|
||||
if (var0 >= -99) {
|
||||
method2209((byte) 57, -14, 120);
|
||||
updateVarbit((byte) 57, -14, 120);
|
||||
}
|
||||
|
||||
Class79 var3 = CS2Script.method378(var2, (byte) 127);
|
||||
|
|
@ -22,12 +23,15 @@ public class Class163 {
|
|||
int var6 = var3.anInt1125;
|
||||
int var5 = var3.anInt1123;
|
||||
int var7 = Class3_Sub6.anIntArray2288[var6 - var5];
|
||||
if (var1 < 0 || var7 < var1) {
|
||||
if (var1 < 0) { //|| var7 < var1) { <-- commented out due to heavy suspicion of it being an Arios modification. Things work fine without it.
|
||||
var1 = 0;
|
||||
}
|
||||
|
||||
var7 <<= var5;
|
||||
TextureOperation39.method281(var1 << var5 & var7 | ~var7 & Class57.varpArray[var4], var4);
|
||||
int arg1 = var1 << var5 & var7 | ~var7 & Class57.varpArray[var4];
|
||||
int arg2 = var4;
|
||||
SystemLogger.logInfo("Setting " + arg1 + " to " + arg2);
|
||||
TextureOperation39.method281(arg1, arg2);
|
||||
} catch (RuntimeException var8) {
|
||||
throw ClientErrorException.clientError(var8, "wd.K(" + var0 + ',' + var1 + ',' + var2 + ')');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.runite.client;
|
|||
|
||||
import org.rs09.Discord;
|
||||
import org.rs09.SlayerTracker;
|
||||
import org.rs09.SystemLogger;
|
||||
import org.rs09.XPGainDraw;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
|
@ -1123,7 +1124,7 @@ public final class PacketParser {
|
|||
} else if (37 == Unsorted.incomingOpcode) {
|
||||
nodeModelId = BufferedDataStream.incomingBuffer.readUnsignedByte128();
|
||||
var19 = BufferedDataStream.incomingBuffer.readUnsignedShortLE();
|
||||
Class163.method2209((byte) -122, nodeModelId, var19);
|
||||
Class163.updateVarbit((byte) -122, nodeModelId, var19);
|
||||
Unsorted.incomingOpcode = -1;
|
||||
return true;
|
||||
} else if (Unsorted.incomingOpcode == 155) {
|
||||
|
|
@ -1400,7 +1401,7 @@ public final class PacketParser {
|
|||
} else if (Unsorted.incomingOpcode == 84) {
|
||||
nodeModelId = BufferedDataStream.incomingBuffer.readIntLE();
|
||||
var19 = BufferedDataStream.incomingBuffer.readUnsignedShortLE128();
|
||||
Class163.method2209((byte) -106, nodeModelId, var19);
|
||||
Class163.updateVarbit((byte) -106, nodeModelId, var19);
|
||||
Unsorted.incomingOpcode = -1;
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public final class PacketRepository {
|
|||
OUTGOING_PACKETS.put(UpdateRandomFile.class, new UpdateRandomFile()); //
|
||||
OUTGOING_PACKETS.put(InstancedLocationUpdate.class, new InstancedLocationUpdate()); //
|
||||
OUTGOING_PACKETS.put(CSConfigPacket.class, new CSConfigPacket()); //
|
||||
OUTGOING_PACKETS.put(Varbit.class, new Varbit());
|
||||
INCOMING_PACKETS.put(22, new ClientFocusPacket());
|
||||
INCOMING_PACKETS.put(93, new PingPacketHandler());
|
||||
INCOMING_PACKETS.put(44, new CommandPacket());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package core.net.packet.context;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.net.packet.Context;
|
||||
|
||||
public class VarbitContext implements Context {
|
||||
|
||||
Player player;
|
||||
public int varbitId;
|
||||
public int value;
|
||||
|
||||
public VarbitContext(Player player, int varbitId, int value){
|
||||
this.player = player;
|
||||
this.varbitId = varbitId;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
|
@ -266,6 +266,7 @@ public final class InteractionPacket implements IncomingPacket {
|
|||
player.debug("dir=" + object.getDirection());
|
||||
VarbitDefinition def = VarbitDefinition.forObjectID(SceneryDefinition.forId(objectId).getVarbitID());
|
||||
player.debug("Varp ID=" + def.getConfigId() + " Offset=" + def.getBitShift() + " Size=" + def.getBitSize());
|
||||
player.debug("Varbit: " + def.getId());
|
||||
if (option.getHandler() != null) {
|
||||
player.debug("Object handler: " + option.getHandler().getClass().getSimpleName());
|
||||
}
|
||||
|
|
|
|||
15
Server/src/main/java/core/net/packet/out/Varbit.java
Normal file
15
Server/src/main/java/core/net/packet/out/Varbit.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package core.net.packet.out;
|
||||
|
||||
import core.net.packet.IoBuffer;
|
||||
import core.net.packet.OutgoingPacket;
|
||||
import core.net.packet.context.VarbitContext;
|
||||
|
||||
public class Varbit implements OutgoingPacket<VarbitContext> {
|
||||
@Override
|
||||
public void send(VarbitContext varbitContext) {
|
||||
IoBuffer buffer = new IoBuffer(37);
|
||||
buffer.put((byte) varbitContext.value);
|
||||
buffer.putLEShort(varbitContext.varbitId);
|
||||
varbitContext.getPlayer().getSession().write(buffer);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ package rs09.game
|
|||
|
||||
import core.cache.def.impl.VarbitDefinition
|
||||
import core.game.node.entity.player.Player
|
||||
import core.net.packet.PacketRepository
|
||||
import core.net.packet.context.VarbitContext
|
||||
import org.json.simple.JSONArray
|
||||
import org.json.simple.JSONObject
|
||||
import rs09.game.node.entity.skill.farming.FarmingPatch
|
||||
|
|
@ -32,6 +34,10 @@ class VarpManager(val player: Player) {
|
|||
get(def.configId).setVarbit(def.bitShift,value).send(player)
|
||||
}
|
||||
|
||||
fun setVarbit(varbitIndex: Int, value: Int){
|
||||
PacketRepository.send(core.net.packet.out.Varbit::class.java, VarbitContext(player, varbitIndex, value))
|
||||
}
|
||||
|
||||
fun flagSave(index: Int){
|
||||
get(index).save = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import core.game.world.map.Location
|
|||
import core.game.world.map.RegionManager
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.world.update.flag.context.Graphics
|
||||
import core.net.packet.PacketRepository
|
||||
import core.net.packet.context.VarbitContext
|
||||
import core.net.packet.out.Varbit
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import rs09.game.system.command.CommandPlugin
|
||||
|
|
@ -221,14 +224,14 @@ class VisualCommand : CommandPlugin() {
|
|||
val cfg_index = (args.getOrNull(2)?.toString()?.toInt() ?: -1)
|
||||
if(cfg_index == -1){
|
||||
ContentAPI.submitWorldPulse(object : Pulse(3, player){
|
||||
var pos = 0
|
||||
var pos = 32
|
||||
var shift = 0
|
||||
override fun pulse(): Boolean {
|
||||
for(i in 0..1999){
|
||||
player?.configManager?.forceSet(i, pos shl shift, false)
|
||||
}
|
||||
player?.sendMessage("$pos << $shift")
|
||||
if(pos++ >= 32){
|
||||
player?.sendMessage("$pos shl $shift")
|
||||
if(pos++ >= 63){
|
||||
shift += 4
|
||||
pos = 0
|
||||
}
|
||||
|
|
@ -246,6 +249,18 @@ class VisualCommand : CommandPlugin() {
|
|||
})
|
||||
}
|
||||
}
|
||||
"setbit" -> {
|
||||
if (args!!.size < 2) {
|
||||
player!!.debug("syntax error: bit value")
|
||||
return true
|
||||
}
|
||||
var bit = toInteger(args[0]!!)
|
||||
var value = toInteger(args[1]!!)
|
||||
var val2 = toInteger(args[2]!!)
|
||||
player!!.debug("$value $val2")
|
||||
PacketRepository.send(Varbit::class.java, VarbitContext(player, value, val2))
|
||||
return true
|
||||
}
|
||||
"loop_anim_on_i" -> {
|
||||
var anim = toInteger(args!![1]!!)
|
||||
ContentAPI.submitWorldPulse(object : Pulse(3){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue