Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // looks for phoenix at arma, poms, tunnel, cave and beach
- // will stop when it finds phoenix and resume when it dies
- // use your own attack/targetting code
- var zone = 1;
- var phoenix_exists = false;
- parent.socket.emit("transport", { to: "main", s: 2 });
- setInterval(pf, 500);
- function pf() {
- var phoenix = Object.values(parent.entities).filter(m => m.mtype == "phoenix")[0];
- if (phoenix) {
- phoenix_exists = true;
- change_target(phoenix);
- return;
- }
- // Loot Phoenix
- if (!phoenix && phoenix_exists) {
- for (id in parent.chests) { parent.socket.emit("open_chest", { id: id }); }
- phoenix_exists = false;
- parent.socket.emit("transport", { to: "main", s: 2 });
- }
- // -- Begin Boundary Drawing Checks --
- // Draw Beach Boundaries
- if (character.real_x == -968 && character.real_y == -170) {
- zone = 5;
- draw_phoenixbounds();
- }
- // Draw Armadillo Boundaries
- else if (character.real_x == 535 && character.real_y == 1672) {
- zone = 1;
- draw_phoenixbounds();
- }
- // Draw Tunnel Boundaries
- else if (character.real_x == 0 && character.real_y == -16) {
- zone = 3;
- draw_phoenixbounds();
- }
- // Draw Bats Boundaries
- else if (character.real_x == 0 && character.real_y == 8) {
- zone = 4;
- draw_phoenixbounds();
- }
- // Draw Pom Pom Boundaries
- else if (character.real_x == 0 && character.real_y == 0 && character.map == "halloween") {
- zone = 2;
- draw_phoenixbounds();
- }
- // -- End Boundary Drawing Checks --
- switch (zone) {
- // Arma
- case 1:
- // Search for Phoenix
- if (!phoenix && character.real_x == 535 && character.real_y == 1672) {
- move(character.real_x + 100, character.real_y + 100);
- }
- // If the Phoenix isn't here
- else if (character.real_y == 1772) {
- parent.socket.emit("transport", { to: "halloween", s: 2 });
- }
- return;
- // Pom poms
- case 2:
- // Search for Phoenix
- if (!phoenix && character.real_y < 650) {
- move(character.real_x, character.real_y + 40);
- }
- // If there is no Phoenix, move to next area
- else {
- parent.socket.emit("transport", { to: "tunnel", s: 1 });
- }
- return;
- // Moles
- case 3:
- // If moles are attacking you
- if (character.map == "tunnel" && Object.values(parent.entities).filter(m => m.target == character.name).length > 1) {
- parent.socket.emit("transport", { to: "main", s: 2 });
- }
- // -- Begin Tunnel Area Checks --
- if (character.real_x == 0 && character.real_y == -16) {
- move(character.real_x + 220, character.real_y);
- }
- else if (character.real_x == 220 && character.real_y == -16) {
- move(character.real_x, character.real_y - 624);
- }
- else if (character.real_x == 220 && character.real_y == -640) {
- move(character.real_x - 220, character.real_y);
- }
- else if (character.real_x == 0 && character.real_y == -640) {
- move(character.real_x, character.real_y - 160);
- }
- // If Phoenix is not in Tunnels
- else if (!phoenix && character.real_x == 0 && character.real_y == -800) {
- parent.socket.emit("transport", { to: "cave", s: 1 });
- }
- // -- End Tunnel Area Checks --
- return;
- // Cave
- case 4:
- // -- Begin Cave Area Checks --
- if (character.real_x == 0 && character.real_y == 8) {
- move(character.real_x, character.real_y - 150);
- }
- else if (character.real_x == 0 && character.real_y == -142) {
- move(character.real_x + 394, character.real_y - 125);
- }
- else if (character.real_x == 394 && character.real_y == -267) {
- move(character.real_x, character.real_y - 533);
- }
- else if (character.real_x == 394 && character.real_y == -800) {
- move(character.real_x - 283, character.real_y - 357);
- }
- // If Phoenix is not in Cave
- else if (!phoenix && character.real_x == 111 && character.real_y == -1157) {
- parent.socket.emit("transport", { to: "main", s: 1 });
- }
- // -- End Cave Area Checks --
- return;
- // Beach
- case 5:
- // If there is no Phoenix
- if (!phoenix) {
- // If out of bounds, check next area
- if (character.real_y >= 1500) {
- parent.socket.emit("transport", { to: "main", s: 2 });
- return;
- }
- // Search for Phoenix
- move(character.real_x - 2, character.real_y + 40);
- }
- return;
- }
- }
- function draw_phoenixbounds() {
- clear_drawings();
- let bounds = G.maps.main.monsters[19].boundaries;
- for (i in bounds) {
- let c = bounds[i];
- if (c[0] === character.map) {
- // x lines
- draw_line(c[1], c[2], c[3], c[2], 1, '0x00FF00');
- draw_line(c[1], c[4], c[3], c[4], 1, '0x00FF00');
- // y lines
- draw_line(c[1], c[2], c[1], c[4], 1, '0x00FF00');
- draw_line(c[3], c[2], c[3], c[4], 1, '0x00FF00');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement