This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[proc,moveallinv](inv $src, inv $dest) | |
def_int $size = inv_size($src); | |
def_int $i = 0; | |
while ($i < $size) { | |
def_obj $obj = inv_getobj($src, $i); | |
if ($obj ! null) { | |
inv_moveitem($src, $dest, $obj, inv_total($src, $obj)); | |
} | |
$i = add($i, 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[opplayeru,christmas_cracker] @player_pull_christmas_cracker; | |
[label,player_pull_christmas_cracker] | |
if (inv_total(inv, christmas_cracker) = 0) { | |
return; | |
} | |
if(.busy = true) { | |
mes("<.displayname> is busy."); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ScriptOpcode.MAP_BLOCKED]: (state) => { | |
const coord = state.popInt(); | |
if (coord < 0 || coord > Position.max) { | |
throw new Error(`MAP_BLOCKED attempted to use coord that was out of range: ${coord}. Range should be: 0 to ${Position.max}`); | |
} | |
const pos = Position.unpackCoord(coord); | |
const zone = World.getZone(pos.x, pos.z, pos.level); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[debugproc,test] | |
def_int $radius = 1; // 1, 2 or 3 | |
def_coord $coord = coord; | |
def_int $x = coordx($coord); | |
def_int $z = coordz($coord); | |
def_int $centerX = divide($x, pow(2, 3)); | |
def_int $centerZ = divide($z, pow(2, 3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun ByteBuffer.rsadec(exponent: BigInteger, modulus: BigInteger) { | |
val length = g1 | |
val dec = BigInteger(gdata(length)).modPow(exponent, modulus).toByteArray() | |
position(0) | |
pdata(dec) | |
position(0) | |
} | |
====================================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val buffer = ByteBuffer.allocate(100) | |
buffer.withBitAccess { | |
pBit(2, 3) | |
pBit(1, 0) | |
} | |
} | |
inline fun ByteBuffer.withBitAccess(function: ByteBuffer.() -> Unit) { | |
position(position() * 8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JvmInline | |
value class MapSquareLandTile( | |
private val packed: Long | |
) { | |
constructor( | |
height: Int, | |
overlayId: Int, | |
overlayPath: Int, | |
overlayRotation: Int, | |
collision: Int, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RSByteBuffer( | |
private val buffer: ByteBuffer | |
) { | |
constructor(array: ByteArray) : this(ByteBuffer.wrap(array)) | |
private var accessBitsIndex = -1 | |
fun readByte(): Int { | |
checkAccessingBytes() | |
return buffer.get().toInt() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActorRenderer( | |
val lowDefinitionRenderBlocks: Array<LowDefinitionRenderBlock<*>?> = arrayOfNulls(13), | |
val highDefinitionRenderBlocks: Array<HighDefinitionRenderBlock<*>?> = arrayOfNulls(13) | |
) { | |
fun <T : RenderType> update(type: T): T { | |
val block = type.toBlock() | |
highDefinitionRenderBlocks[block.index] = HighDefinitionRenderBlock(type, block) | |
return type | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Viewport( | |
val player: Player | |
) { | |
val nsnFlags = IntArray(MAX_PLAYERS) | |
val locations = IntArray(MAX_PLAYERS) | |
val highDefinitions = IntArray(MAX_PLAYERS) | |
val lowDefinitions = IntArray(MAX_PLAYERS) | |
val highDefinitionUpdates = ArrayList<Int>() | |
val lowDefinitionUpdates = ArrayList<Int>() | |
val players = arrayOfNulls<Player?>(MAX_PLAYERS) |