Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var D2Bot = {
- handle: 0,
- init: function () {
- var handle = DataFile.getStats().handle;
- if (handle) {
- this.handle = handle;
- }
- return this.handle;
- },
- sendMessage: function (handle, mode, msg) {
- sendCopyData(null, handle, mode, msg);
- },
- printToConsole: function (msg, color, tooltip, trigger) {
- var printObj = {
- msg: msg,
- color: color || 0,
- tooltip: tooltip || "",
- trigger: trigger || ""
- },
- obj = {
- profile: me.profile,
- func: "printToConsole",
- args: [JSON.stringify(printObj)]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- printToItemLog: function (itemObj) {
- var obj = {
- profile: me.profile,
- func: "printToItemLog",
- args: [JSON.stringify(itemObj)]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- writeToFile: function (filename, msg) {
- var obj = {
- profile: me.profile,
- func: "writeToFile",
- args: [filename, msg]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- postToIRC: function (ircProfile, recepient, msg) {
- var obj = {
- profile: me.profile,
- func: "postToIRC",
- args: [ircProfile, recepient, msg]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- ircEvent: function (mode) {
- var obj = {
- profile: me.profile,
- func: "ircEvent",
- args: [mode ? "true" : "false"]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- notify: function (msg) {
- var obj = {
- profile: me.profile,
- func: "notify",
- args: [msg]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- saveItem: function (itemObj) {
- var obj = {
- profile: me.profile,
- func: "saveItem",
- args: [JSON.stringify(itemObj)]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- updateStatus: function (msg) {
- var obj = {
- profile: me.profile,
- func: "updateStatus",
- args: [msg]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- updateRuns: function () {
- var obj = {
- profile: me.profile,
- func: "updateRuns",
- args: []
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- updateChickens: function () {
- var obj = {
- profile: me.profile,
- func: "updateChickens",
- args: []
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- updateDeaths: function () {
- var obj = {
- profile: me.profile,
- func: "updateDeaths",
- args: []
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- requestGameInfo: function () {
- var obj = {
- profile: me.profile,
- func: "requestGameInfo",
- args: []
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- restart: function (keySwap) {
- var obj = {
- profile: me.profile,
- func: "restartProfile",
- args: arguments.length > 0 ? [me.profile, keySwap] : [me.profile]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- CDKeyInUse: function () {
- var obj = {
- profile: me.profile,
- func: "CDKeyInUse",
- args: []
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- CDKeyDisabled: function () {
- var obj = {
- profile: me.profile,
- func: "CDKeyDisabled",
- args: []
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- CDKeyRD: function () {
- var obj = {
- profile: me.profile,
- func: "CDKeyRD",
- args: []
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- stop: function (profile) {
- if (!profile) {
- profile = me.profile;
- }
- var obj = {
- profile: me.profile,
- func: "stop",
- args: [profile]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- start: function (profile) {
- var obj = {
- profile: me.profile,
- func: "start",
- args: [profile]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- startSchedule: function (profile) {
- var obj = {
- profile: me.profile,
- func: "startSchedule",
- args: [profile]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- stopSchedule: function (profile) {
- var obj = {
- profile: me.profile,
- func: "stopSchedule",
- args: [profile]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- updateCount: function () {
- var obj = {
- profile: me.profile,
- func: "updateCount",
- args: ["1"]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- shoutGlobal: function (msg, mode) {
- var obj = {
- profile: me.profile,
- func: "shoutGlobal",
- args: [msg, mode]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- heartBeat: function () {
- var obj = {
- profile: me.profile,
- func: "heartBeat",
- args: []
- };
- //print("ΓΏc1Heart beat " + this.handle);
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- sendWinMsg: function (wparam, lparam) {
- var obj = {
- profile: me.profile,
- func: "winmsg",
- args: [wparam, lparam]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- ingame: function () {
- this.sendWinMsg(0x0086, 0x0000);
- this.sendWinMsg(0x0006, 0x0002);
- this.sendWinMsg(0x001c, 0x0000);
- },
- // Profile to profile communication
- joinMe: function (profile, gameName, gameCount, gamePass, isUp) {
- var obj = {
- gameName: gameName + gameCount,
- gamePass: gamePass,
- inGame: isUp === "yes"
- };
- sendCopyData(null, profile, 1, JSON.stringify(obj));
- },
- requestGame: function (profile) {
- var obj = {
- profile: me.profile
- };
- sendCopyData(null, profile, 3, JSON.stringify(obj));
- },
- // Store info in d2bot# cache
- store: function (info) {
- this.remove();
- var obj = {
- profile: me.profile,
- func: "store",
- args: [me.profile, info]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- // Get info from d2bot# cache
- retrieve: function () {
- var obj = {
- profile: me.profile,
- func: "retrieve",
- args: [me.profile]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- },
- // Delete info from d2bot# cache
- remove: function () {
- var obj = {
- profile: me.profile,
- func: "delete",
- args: [me.profile]
- };
- sendCopyData(null, this.handle, 0, JSON.stringify(obj));
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement