Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (this.isSi) {
- this.isMoving = true;
- while (this.road.length) {
- if (!this.isNextTo(this.road[this.road.length - 1], this.hero)) {
- this.road = [];
- this.isMoving = false;
- break;
- }
- if (
- (this.road[0].x == this.hero.x && this.road[0].y == this.hero.y) ||
- Keys.playerMovesUsingKeyboard()
- ) {
- break;
- }
- if (
- Keys.playerMovesUsingKeyboard() ||
- (this.getRoad.length &&
- this.road.length &&
- this.getRoad[0].x != this.road[0].x &&
- this.getRoad[0].y != this.road[0].y)
- ) {
- await this.sleep(150);
- this.isMoving = false;
- this.road = [];
- break;
- }
- if (
- this.unix_time(true) - this.lastInput > 0.2 &&
- !this.battle &&
- !this.talking
- ) {
- if (this.road.length) {
- if (
- this.road[this.road.length - 1].x == this.hero.x &&
- this.road[this.road.length - 1].y == this.hero.y
- ) {
- this.road.pop();
- }
- if (this.isNextTo(this.hero, this.road[this.road.length - 1])) {
- if (
- !this.npcCol(
- this.road[this.road.length - 1].x,
- this.road[this.road.length - 1].y
- )
- ) {
- if (this.road[this.road.length - 1].x > this.hero.x) {
- try {
- unsafeWindow.hero.dir = 2;
- } catch (error) {}
- } else if (this.road[this.road.length - 1].x < this.hero.x) {
- try {
- unsafeWindow.hero.dir = 1;
- } catch (error) {}
- } else if (this.road[this.road.length - 1].y < this.hero.y) {
- try {
- unsafeWindow.hero.dir = 3;
- } catch (error) {}
- } else {
- try {
- unsafeWindow.hero.dir = 4;
- } catch (error) {}
- }
- this.sendRequest(
- `_&ml=${this.road[this.road.length - 1].x},${
- this.road[this.road.length - 1].y
- }&mts=${this.unix_time(true) + 0.2}`
- );
- } else {
- const blockingNpc = Object.values(this.npc).find((npc) => {
- return (
- npc.x == this.road[this.road.length - 1].x &&
- npc.y == this.road[this.road.length - 1].y
- );
- });
- if (blockingNpc && this.attack) {
- this.sendRequest(
- `fight&a=attack&id=-${blockingNpc.id}&ff=1`,
- (data) => {
- if (
- data.alert &&
- data.alert == "Przeciwnik walczy już z kimś innym"
- ) {
- if (this.blockingNpc.grp) {
- for (const npc of Object.values(this.npc).filter(
- (item) => {
- return (
- item.grp && item.grp == this.blockingNpc.grp
- );
- }
- )) {
- this.delNpcCol(npc);
- delete this.npc[npc.id];
- }
- } else {
- this.delNpcCol(blockingNpc);
- delete this.npc[this.blockingNpc.id];
- }
- }
- this.attack = false;
- if (!this.attackTimeout) {
- this.attackTimeout = setTimeout(() => {
- this.attackTimeout = false;
- this.attack = true;
- }, 1200);
- }
- }
- );
- }
- }
- }
- }
- }
- await this.sleep(200);
- }
- this.isMoving = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement