Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FindXPShrine() {
- if (!NTTM_TownMove("waypoint")) {
- return false;
- }
- if (!NTM_UsePortal("Waypoint", 4)) {
- return false;
- }
- if (!FindShrines(4)) {
- if (!FindShrines(3)) {
- if (!FindShrines(2)) {
- NTTM_CheckAct();
- me.overhead("No XP shrines :(");
- return true;
- }
- }
- }
- me.overhead("Shrine found!");
- return true;
- }
- function FindShrines(area) {
- var i, n, room, shrine,
- ShrineIds = [2, 81, 83],
- ShrineLocs = [],
- unit = getPresetUnits(area);
- if (unit) {
- for (i = 0; i < unit.length; i += 1) {
- for (n = 0; n < ShrineIds.length; n = n + 1) {
- if (ShrineIds[n] === unit[i].id) {
- ShrineLocs.push([unit[i].roomx * 5 + unit[i].x, unit[i].roomy * 5 + unit[i].y]);
- }
- }
- }
- }
- while (ShrineLocs.length > 0) {
- ShrineLocs.sort(Sort);
- room = ShrineLocs.shift();
- NTM_MoveTo(room[0] + 3, room[1]);
- shrine = NTC_GetUnit(NTC_UNIT_OBJECT);
- if (shrine) {
- do {
- if (shrine.objtype === 15 && getDistance(me, shrine) <= 10) {
- for (i = 0; i < 30; i += 1) {
- if (i % 10 === 0 && NTM_GetCloserInt(shrine)) {
- shrine.interact()
- }
- NTC_Delay(200);
- if (shrine.mode) {
- NTTM_CheckAct();
- return true;
- }
- }
- }
- } while (shrine.getNext());
- }
- }
- return false;
- }
- function Sort (a, b) {
- return (getDistance(me.x, me.y, a[0], a[1]) - getDistance(me.x, me.y, b[0], b[1]));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement