Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- usePortal: function (targetArea, owner, unit) {
- /*
- Pather.usePortal(targetArea, owner, unit);
- targetArea - id of the area the portal leads to
- owner - name of the portal's owner
- unit - use existing portal unit
- */
- if (this.debugPather) { print("ÿc2Pather: ÿc0usePortal: function (targetArea, owner, unit) " + (targetArea + " " + owner + " " + unit)) } ;
- Attack.stopLevel = false;
- this.stopCourse = false;
- if (me.inTown && (targetArea || owner || unit)){
- Town.move("portalspot");
- me.cancel();
- }
- var i, tick, portal, useTK,
- preArea = me.area;
- if (unit) {
- portal = copyUnit(unit);
- if (!portal) {
- return false;
- }
- }
- for (i = 0; i < 5; i += 1) {
- if (!unit) {
- portal = this.getPortal(targetArea, owner);
- }
- if (portal) {
- useTK = me.classid === 1 && me.getSkill(43, 1) && me.inTown && portal.getParent();
- if (useTK) {
- if (getDistance(me, portal) > 12) {
- Attack.getIntoPosition(portal, 12, 0x4);
- }
- Skill.cast(43, 0, portal);
- } else {
- if (getDistance(me, portal) > 2) {
- this.moveToUnit(portal);
- }
- portal.interact();
- //sendPacket(1, 0x13, 4, 2, 4, portal.gid);
- }
- if (portal.mode !== 2 && portal.classid === 298) { // Arcane Sanctuary, maybe some other portals
- portal.interact();
- tick = getTickCount();
- while (getTickCount() - tick < 2000) {
- if (portal.mode === 2) {
- break;
- }
- delay(10);
- }
- }
- tick = getTickCount();
- while (getTickCount() - tick < 1000) {
- while (!me.area) {
- delay(100);
- }
- if (me.area !== preArea) {
- delay(200);
- if(!me.inTown){
- this.checkForWP();
- }
- return true;
- }
- delay(10);
- }
- if (i > 1) {
- Packet.flash(me.gid);
- useTK = false;
- }
- //this.moveTo(me.x + rand(-1, 1) * 3, me.y + rand(-1, 1) * 3); // In case of client/server desync
- }
- delay(100);
- }
- return false;
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement