Skip to content

Instantly share code, notes, and snippets.

@xcvd
xcvd / 0_reuse_code.js
Created March 3, 2014 13:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@xcvd
xcvd / COutPacket.cs
Created June 14, 2012 10:21
COutPacket functions in C# ready to be hooked
namespace Polar.MapleFunctions
{
using System;
using System.Runtime.InteropServices;
using Polar.Util;
public class COutPacket
{
public static readonly FunctionInfo[] FunctionInfo = new[]
@xcvd
xcvd / Hooks.cs
Created June 1, 2012 16:26
Hooks example
// -----------------------------------------------------------------------
// <copyright file="Hooks.cs" company="Home">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------
namespace PacketLogger
{
using System;
using System.Runtime.InteropServices;
@xcvd
xcvd / Inject.fs
Created May 17, 2012 08:29
DLL Injection
open Syringe
open System.Diagnostics
printfn "Trying to inject dll into MapleStory.exe"
try
let syringe = new Injector(Process.GetProcessesByName("MapleStory").[0])
syringe.InjectLibrary("PacketLogger.dll")
printfn "PacketLogger.dll injected into MapleStory, trying to call Start() with no parameters"
ignore (syringe.CallExport("PacketLogger.dll", "Start"))
with
@xcvd
xcvd / COutPacket.cs
Created May 15, 2012 20:37
Packet Sending
// -----------------------------------------------------------------------
// <copyright file="COutPacket.cs" company="Home">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------
namespace PacketSender
{
using System;
using System.Runtime.InteropServices;
@xcvd
xcvd / ProblemA.groovy
Created April 15, 2012 12:03
Google Code Jam 2012 Qualification
// ProblemA
new File('new.txt').withWriter { file ->
new File('orig.txt').withReader { reader ->
def lines = Integer.parseInt(reader.readLine())
for (int i = 1; i <= lines; i++)
file.writeLine("Case #" + i + ": " + translate(reader.readLine()))
}
}
String translate(String str) {
@xcvd
xcvd / lazyVal.scala
Created April 9, 2012 00:31
lazy val example
def bankItemWidgets = Widgets.get(762).getChild(95).getChildren()
def getBankWidgetChild(id: Int): WidgetChild = {
bankItemWidgets.foreach(itemWidget =>
if (itemWidget.getChildId == itemIdVial) { return itemWidget })
null
}
val itemIdVial = 229
lazy val itemBankWidgetVial: WidgetChild = getBankWidgetChild(itemIdVial)
@xcvd
xcvd / waitWhileUntil.scala
Created April 9, 2012 00:06
Passing function example
/**
* Waits while a condition is true, with a specified timeout.
*
* @param condition the method to be evaluated in order to discover if the condition
* still holds true
* @param timeout the time in milliseconds until the wait times out
* @return whether the true if the condition was falisified within the time limit,
* otherwise returns false.
*/
def waitWhile(condition: () => Boolean, timeout: Int): Boolean = {
@xcvd
xcvd / GatestoneCreator.scala
Created April 6, 2012 14:44
Gatestone Creator
/* )............( /
/ / ___/| \ /
/ | /o \/| | /
/ | \_____/\| | /
/ \ -xcvd- / /
/ ')__________(' */
import java.awt._
import java.net.URL
import javax.imageio.ImageIO
@xcvd
xcvd / GoatHornCrusher.java
Created April 5, 2012 22:58
Goat Horn Crusher
/* )............( /
/ / ___/| \ /
/ | /o \/| | /
/ | \_____/\| | /
/ \ -xcvd- / /
/ ')__________(' */
import org.powerbot.concurrent.Task;
import org.powerbot.concurrent.strategy.Strategy;
import org.powerbot.game.api.ActiveScript;