Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @filename ClearAnyArea.js
- * @author kolton
- * @desc Clears any area
- */
- function ClearAnyArea() {
- this.clickWP = function () { // Move to nearest wp and click it.
- var i, j, wp, presetUnit,
- wpIDs = [119, 145, 156, 157, 237, 238, 288, 323, 324, 398, 402, 429, 494, 496, 511, 539];
- for (i = 0 ; i < wpIDs.length ; i += 1) {
- presetUnit = getPresetUnit(me.area, 2, wpIDs[i]);
- if (presetUnit) {
- print("going to nearest WP");
- while (getDistance(me.x, me.y, presetUnit.roomx * 5 + presetUnit.x, presetUnit.roomy * 5 + presetUnit.y) > 10) {
- try {
- Pather.moveToPreset(me.area, 2, wpIDs[i], 0, 0, Config.ClearType, false);
- } catch (e) {
- print("Caught Error.");
- print(e);
- }
- Packet.flash(me.gid);
- delay(me.ping * 2 + 500);
- }
- wp = getUnit(2, "waypoint");
- if (wp) {
- for (j = 0 ; j < 10 ; j += 1) {
- sendPacket(1, 0x13, 4, wp.type, 4, wp.gid);
- delay(me.ping * 2 + 500);
- if (getUIFlag(0x14)) {
- me.cancel();
- break;
- }
- Packet.flash(me.gid);
- delay(me.ping * 2 + 500);
- Pather.moveToUnit(presetUnit, 0, 0, Config.ClearType, false);
- }
- }
- }
- }
- };
- var room, i;
- Town.doChores();
- for (i = 0; i < Config.ClearAnyArea.AreaList.length; i += 1) {
- if (Pather.journeyTo(Config.ClearAnyArea.AreaList[i])) {
- this.clickWP();
- Attack.clearLevel(Config.ClearType);
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement