Snippets
HorridoJoho Introduction of Interact X/Y. It is required because the position from doors is the doors hinge position.
Created by
HorridoJoho
last modified
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | diff --git a/src/main/java/com/l2jserver/gameserver/GeoData.java b/src/main/java/com/l2jserver/gameserver/GeoData.java
index d05fac7..ea34d89 100644
--- a/src/main/java/com/l2jserver/gameserver/GeoData.java
+++ b/src/main/java/com/l2jserver/gameserver/GeoData.java
@@ -212,7 +212,7 @@
*/
public int getSpawnHeight(Location location)
{
- return getSpawnHeight(location.getX(), location.getY(), location.getZ());
+ return getSpawnHeight(location.getInteractX(), location.getInteractY(), location.getInteractZ());
}
/**
@@ -231,7 +231,7 @@
{
return true;
}
- return canSeeTarget(cha.getX(), cha.getY(), cha.getZ(), cha.getInstanceId(), target.getX(), target.getY(), target.getZ(), target.getInstanceId());
+ return canSeeTarget(cha.getInteractX(), cha.getInteractY(), cha.getInteractZ(), cha.getInstanceId(), target.getInteractX(), target.getInteractY(), target.getInteractZ(), target.getInstanceId());
}
/**
@@ -242,7 +242,7 @@
*/
public boolean canSeeTarget(L2Object cha, ILocational worldPosition)
{
- return canSeeTarget(cha.getX(), cha.getY(), cha.getZ(), cha.getInstanceId(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
+ return canSeeTarget(cha.getInteractX(), cha.getInteractY(), cha.getInteractZ(), cha.getInstanceId(), worldPosition.getInteractX(), worldPosition.getInteractY(), worldPosition.getInteractZ());
}
/**
@@ -250,12 +250,12 @@
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
- * @param instanceId
+ * @param instanceId the instance to check in
* @param tx the target's x coordinate
* @param ty the target's y coordinate
* @param tz the target's z coordinate
* @param tInstanceId the target's instanceId
- * @return
+ * @return true when seeing, otherwise false
*/
public boolean canSeeTarget(int x, int y, int z, int instanceId, int tx, int ty, int tz, int tInstanceId)
{
@@ -271,7 +271,7 @@
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
- * @param instanceId
+ * @param instanceId the instance to check in
* @param tx the target's x coordinate
* @param ty the target's y coordinate
* @param tz the target's z coordinate
@@ -446,7 +446,17 @@
*/
public Location moveCheck(ILocational origin, ILocational destination)
{
- return moveCheck(origin.getX(), origin.getY(), origin.getZ(), destination.getX(), destination.getY(), destination.getZ(), origin.getInstanceId());
+ return moveCheck(origin.getInteractX(), origin.getInteractY(), origin.getInteractZ(), destination.getInteractX(), destination.getInteractY(), destination.getInteractZ(), origin.getInstanceId());
+ }
+
+ public Location moveCheck(ILocational origin, int tx, int ty, int tz)
+ {
+ return moveCheck(origin.getInteractX(), origin.getInteractY(), origin.getInteractZ(), tx, ty, tz, origin.getInstanceId());
+ }
+
+ public Location moveCheck(int x, int y, int z, ILocational destination)
+ {
+ return moveCheck(x, y, z, destination.getInteractX(), destination.getInteractY(), destination.getInteractZ(), destination.getInstanceId());
}
/**
@@ -607,7 +617,7 @@
*/
public boolean canMove(ILocational from, int toX, int toY, int toZ)
{
- return canMove(from.getX(), from.getY(), from.getZ(), toX, toY, toZ, from.getInstanceId());
+ return canMove(from.getInteractX(), from.getInteractY(), from.getInteractZ(), toX, toY, toZ, from.getInstanceId());
}
/**
@@ -618,7 +628,7 @@
*/
public boolean canMove(ILocational from, ILocational to)
{
- return canMove(from, to.getX(), to.getY(), to.getZ());
+ return canMove(from, to.getInteractX(), to.getInteractY(), to.getInteractZ());
}
/**
diff --git a/src/main/java/com/l2jserver/gameserver/ai/AbstractAI.java b/src/main/java/com/l2jserver/gameserver/ai/AbstractAI.java
index b3a12c7..63e5de8 100644
--- a/src/main/java/com/l2jserver/gameserver/ai/AbstractAI.java
+++ b/src/main/java/com/l2jserver/gameserver/ai/AbstractAI.java
@@ -500,8 +500,8 @@
/**
* Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn <I>(broadcast)</I>.<br>
* <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
- * @param pawn
- * @param offset
+ * @param pawn the pawn
+ * @param offset the offset
*/
protected void moveToPawn(L2Object pawn, int offset)
{
@@ -549,7 +549,7 @@
}
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
- _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset);
+ _actor.moveToLocation(pawn.getInteractX(), pawn.getInteractY(), pawn.getInteractZ(), offset);
if (!_actor.isMoving())
{
@@ -584,9 +584,9 @@
/**
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <I>(broadcast)</I>.<br>
* <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
- * @param x
- * @param y
- * @param z
+ * @param x x
+ * @param y y
+ * @param z z
*/
protected void moveTo(int x, int y, int z)
{
@@ -613,7 +613,7 @@
/**
* Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation <I>(broadcast)</I>.<br>
* <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
- * @param loc
+ * @param loc stop location correction
*/
protected void clientStopMoving(Location loc)
{
@@ -794,7 +794,7 @@
/**
* Create and Launch an AI Follow Task to execute every 0.5s, following at specified range.
* @param target The L2Character to follow
- * @param range
+ * @param range the follow avoid distance
*/
public synchronized void startFollow(L2Character target, int range)
{
diff --git a/src/main/java/com/l2jserver/gameserver/ai/L2AttackableAI.java b/src/main/java/com/l2jserver/gameserver/ai/L2AttackableAI.java
index 59a84e6..5248620 100644
--- a/src/main/java/com/l2jserver/gameserver/ai/L2AttackableAI.java
+++ b/src/main/java/com/l2jserver/gameserver/ai/L2AttackableAI.java
@@ -642,22 +642,22 @@
y1 = (int) Math.sqrt((y1 * y1) - (x1 * x1)); // y
if (x1 > (offset + minRadius))
{
- x1 = (leader.getX() + x1) - offset;
+ x1 = (leader.getInteractX() + x1) - offset;
}
else
{
- x1 = (leader.getX() - x1) + minRadius;
+ x1 = (leader.getInteractX() - x1) + minRadius;
}
if (y1 > (offset + minRadius))
{
- y1 = (leader.getY() + y1) - offset;
+ y1 = (leader.getInteractY() + y1) - offset;
}
else
{
- y1 = (leader.getY() - y1) + minRadius;
+ y1 = (leader.getInteractY() - y1) + minRadius;
}
- z1 = leader.getZ();
+ z1 = leader.getInteractZ();
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
moveTo(x1, y1, z1);
return;
@@ -739,7 +739,7 @@
}
}
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
- final Location moveLoc = GeoData.getInstance().moveCheck(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceId());
+ final Location moveLoc = GeoData.getInstance().moveCheck(npc, x1, y1, z1);
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
}
@@ -892,26 +892,26 @@
int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean())
{
- newX = mostHate.getX() + newX;
+ newX = mostHate.getInteractX() + newX;
}
else
{
- newX = mostHate.getX() - newX;
+ newX = mostHate.getInteractX() - newX;
}
int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean())
{
- newY = mostHate.getY() + newY;
+ newY = mostHate.getInteractY() + newY;
}
else
{
- newY = mostHate.getY() - newY;
+ newY = mostHate.getInteractY() - newY;
}
if (!npc.isInsideRadius(newX, newY, 0, collision, false, false))
{
- int newZ = npc.getZ() + 30;
- if (GeoData.getInstance().canMove(npc.getX(), npc.getY(), npc.getZ(), newX, newY, newZ, npc.getInstanceId()))
+ int newZ = npc.getInteractZ() + 30;
+ if (GeoData.getInstance().canMove(npc, newX, newY, newZ))
{
moveTo(newX, newY, newZ);
}
@@ -929,9 +929,9 @@
double distance2 = npc.calculateDistance(mostHate, false, true);
if (Math.sqrt(distance2) <= (60 + combinedCollision))
{
- int posX = npc.getX();
- int posY = npc.getY();
- int posZ = npc.getZ() + 30;
+ int posX = npc.getInteractX();
+ int posY = npc.getInteractY();
+ int posZ = npc.getInteractZ() + 30;
if (originalAttackTarget.getX() < posX)
{
@@ -951,7 +951,7 @@
posY = posY - 300;
}
- if (GeoData.getInstance().canMove(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceId()))
+ if (GeoData.getInstance().canMove(npc, posX, posY, posZ))
{
setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ, 0));
}
diff --git a/src/main/java/com/l2jserver/gameserver/ai/L2CharacterAI.java b/src/main/java/com/l2jserver/gameserver/ai/L2CharacterAI.java
index cd9d22b..19a7f84 100644
--- a/src/main/java/com/l2jserver/gameserver/ai/L2CharacterAI.java
+++ b/src/main/java/com/l2jserver/gameserver/ai/L2CharacterAI.java
@@ -384,7 +384,7 @@
_actor.abortAttack();
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
- moveTo(loc.getX(), loc.getY(), loc.getZ());
+ moveTo(loc.getInteractX(), loc.getInteractY(), loc.getInteractZ());
}
/**
@@ -964,9 +964,9 @@
{
double radians = Math.toRadians(start ? Util.calculateAngleFrom(effector, _actor) : Util.convertHeadingToDegree(_actor.getHeading()));
- int posX = (int) (_actor.getX() + (FEAR_RANGE * Math.cos(radians)));
- int posY = (int) (_actor.getY() + (FEAR_RANGE * Math.sin(radians)));
- int posZ = _actor.getZ();
+ int posX = (int) (_actor.getInteractX() + (FEAR_RANGE * Math.cos(radians)));
+ int posY = (int) (_actor.getInteractY() + (FEAR_RANGE * Math.sin(radians)));
+ int posZ = _actor.getInteractZ();
if (!_actor.isPet())
{
@@ -977,7 +977,7 @@
final Location destination;
if (Config.PATHFINDING > 0)
{
- destination = GeoData.getInstance().moveCheck(_actor.getX(), _actor.getY(), _actor.getZ(), posX, posY, posZ, _actor.getInstanceId());
+ destination = GeoData.getInstance().moveCheck(_actor, posX, posY, posZ);
}
else
{
@@ -1013,11 +1013,11 @@
stopFollow();
- int x = _actor.getX();
- int y = _actor.getY();
+ int x = _actor.getInteractX();
+ int y = _actor.getInteractY();
- double dx = worldPosition.getX() - x;
- double dy = worldPosition.getY() - y;
+ double dx = worldPosition.getInteractX() - x;
+ double dy = worldPosition.getInteractY() - y;
double dist = Math.sqrt((dx * dx) + (dy * dy));
@@ -1029,7 +1029,7 @@
x += (int) (dist * cos);
y += (int) (dist * sin);
- moveTo(x, y, worldPosition.getZ());
+ moveTo(x, y, worldPosition.getInteractZ());
return true;
}
@@ -1078,28 +1078,7 @@
final boolean needToMove;
- if (target.isDoor())
- {
- L2DoorInstance dor = (L2DoorInstance) target;
- int xPoint = 0;
- int yPoint = 0;
- for (int i : dor.getTemplate().getNodeX())
- {
- xPoint += i;
- }
- for (int i : dor.getTemplate().getNodeY())
- {
- yPoint += i;
- }
- xPoint /= 4;
- yPoint /= 4;
- needToMove = !_actor.isInsideRadius(xPoint, yPoint, dor.getTemplate().getNodeZ(), offset, false, false);
- }
- else
- {
- needToMove = !_actor.isInsideRadius(target, offset, false, false);
- }
-
+ needToMove = !_actor.isInsideRadius(target, offset, false, false);
if (needToMove)
{
// Caller should be L2Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
diff --git a/src/main/java/com/l2jserver/gameserver/ai/L2PlayerAI.java b/src/main/java/com/l2jserver/gameserver/ai/L2PlayerAI.java
index 4c532c9..3fbcd8d 100644
--- a/src/main/java/com/l2jserver/gameserver/ai/L2PlayerAI.java
+++ b/src/main/java/com/l2jserver/gameserver/ai/L2PlayerAI.java
@@ -216,7 +216,7 @@
_actor.abortAttack();
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
- moveTo(loc.getX(), loc.getY(), loc.getZ());
+ moveTo(loc.getInteractX(), loc.getInteractY(), loc.getInteractZ());
}
@Override
diff --git a/src/main/java/com/l2jserver/gameserver/ai/L2SummonAI.java b/src/main/java/com/l2jserver/gameserver/ai/L2SummonAI.java
index 934165b..8c4370a 100644
--- a/src/main/java/com/l2jserver/gameserver/ai/L2SummonAI.java
+++ b/src/main/java/com/l2jserver/gameserver/ai/L2SummonAI.java
@@ -53,7 +53,7 @@
@Override
protected void onIntentionAttack(L2Character target)
{
- if ((Config.PATHFINDING > 0) && (PathFinding.getInstance().findPath(_actor.getX(), _actor.getY(), _actor.getZ(), target.getX(), target.getY(), target.getZ(), _actor.getInstanceId(), true) == null))
+ if ((Config.PATHFINDING > 0) && (PathFinding.getInstance().findPath(_actor, target, true) == null))
{
return;
}
@@ -241,15 +241,15 @@
if (!_clientMoving && !_actor.isDead() && !_actor.isMovementDisabled())
{
- final int ownerX = ((L2Summon) _actor).getOwner().getX();
- final int ownerY = ((L2Summon) _actor).getOwner().getY();
- final double angle = Math.toRadians(Rnd.get(-90, 90)) + Math.atan2(ownerY - _actor.getY(), ownerX - _actor.getX());
+ final int ownerX = ((L2Summon) _actor).getOwner().getInteractX();
+ final int ownerY = ((L2Summon) _actor).getOwner().getInteractY();
+ final double angle = Math.toRadians(Rnd.get(-90, 90)) + Math.atan2(ownerY - _actor.getInteractY(), ownerX - _actor.getInteractX());
final int targetX = ownerX + (int) (AVOID_RADIUS * Math.cos(angle));
final int targetY = ownerY + (int) (AVOID_RADIUS * Math.sin(angle));
- if (GeoData.getInstance().canMove(_actor.getX(), _actor.getY(), _actor.getZ(), targetX, targetY, _actor.getZ(), _actor.getInstanceId()))
+ if (GeoData.getInstance().canMove(_actor, targetX, targetY, _actor.getInteractZ()))
{
- moveTo(targetX, targetY, _actor.getZ());
+ moveTo(targetX, targetY, _actor.getInteractZ());
}
}
}
diff --git a/src/main/java/com/l2jserver/gameserver/data/xml/impl/DoorData.java b/src/main/java/com/l2jserver/gameserver/data/xml/impl/DoorData.java
index 7f6cc88..b049111 100644
--- a/src/main/java/com/l2jserver/gameserver/data/xml/impl/DoorData.java
+++ b/src/main/java/com/l2jserver/gameserver/data/xml/impl/DoorData.java
@@ -121,7 +121,7 @@
L2DoorTemplate template = new L2DoorTemplate(set);
L2DoorInstance door = new L2DoorInstance(template);
door.setCurrentHp(door.getMaxHp());
- door.spawnMe(template.getX(), template.getY(), template.getZ());
+ door.spawnMe(template.getHingeX(), template.getHingeY(), template.getHingeZ());
putDoor(door, MapRegionManager.getInstance().getMapRegionLocId(door));
}
diff --git a/src/main/java/com/l2jserver/gameserver/model/L2Object.java b/src/main/java/com/l2jserver/gameserver/model/L2Object.java
index dd192ce..a0fc6b9 100644
--- a/src/main/java/com/l2jserver/gameserver/model/L2Object.java
+++ b/src/main/java/com/l2jserver/gameserver/model/L2Object.java
@@ -500,7 +500,7 @@
/**
* Charging shot into the current object.
* @param type of the shot to be charged.
- * @param charged
+ * @param charged whatever to set charged state
*/
public void setChargedShot(ShotType type, boolean charged)
{
@@ -516,9 +516,9 @@
}
/**
- * @param <T>
- * @param script
- * @return
+ * @param <T> the type
+ * @param script the script instance
+ * @return the script instance
*/
public final <T> T addScript(T script)
{
@@ -537,9 +537,9 @@
}
/**
- * @param <T>
- * @param script
- * @return
+ * @param <T> the type
+ * @param script the script type
+ * @return the old script instance
*/
@SuppressWarnings("unchecked")
public final <T> T removeScript(Class<T> script)
@@ -552,9 +552,9 @@
}
/**
- * @param <T>
- * @param script
- * @return
+ * @param <T> the type
+ * @param script the script type
+ * @return the script instance
*/
@SuppressWarnings("unchecked")
public final <T> T getScript(Class<T> script)
@@ -684,6 +684,24 @@
return _z.get();
}
+ @Override
+ public int getInteractX()
+ {
+ return getX();
+ }
+
+ @Override
+ public int getInteractY()
+ {
+ return getY();
+ }
+
+ @Override
+ public int getInteractZ()
+ {
+ return getZ();
+ }
+
/**
* Gets the heading.
* @return the heading
@@ -889,7 +907,7 @@
*/
public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared)
{
- final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0);
+ final double distance = Math.pow(x - getInteractX(), 2) + Math.pow(y - getInteractY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0);
return (squared) ? distance : Math.sqrt(distance);
}
@@ -902,7 +920,7 @@
*/
public final double calculateDistance(ILocational loc, boolean includeZAxis, boolean squared)
{
- return calculateDistance(loc.getX(), loc.getY(), loc.getZ(), includeZAxis, squared);
+ return calculateDistance(loc.getInteractX(), loc.getInteractY(), loc.getInteractZ(), includeZAxis, squared);
}
/**
@@ -951,7 +969,7 @@
/**
* Sets this object as invisible or not
- * @param invis
+ * @param invis whatever to set invisible or not
*/
public void setInvisible(boolean invis)
{
@@ -977,7 +995,7 @@
}
/**
- * @param player
+ * @param player the player to check visibility for
* @return {@code true} if player can see an invisible object if it's invisible, {@code false} otherwise.
*/
public boolean isVisibleFor(L2PcInstance player)
diff --git a/src/main/java/com/l2jserver/gameserver/model/L2Spawn.java b/src/main/java/com/l2jserver/gameserver/model/L2Spawn.java
index 745e85d..92ef7d1 100644
--- a/src/main/java/com/l2jserver/gameserver/model/L2Spawn.java
+++ b/src/main/java/com/l2jserver/gameserver/model/L2Spawn.java
@@ -308,6 +308,24 @@
setXYZ(loc.getX(), loc.getY(), loc.getZ());
}
+ @Override
+ public int getInteractX()
+ {
+ return getX();
+ }
+
+ @Override
+ public int getInteractY()
+ {
+ return getY();
+ }
+
+ @Override
+ public int getInteractZ()
+ {
+ return getZ();
+ }
+
/**
* @return the heading of L2NpcInstance when they are spawned.
*/
diff --git a/src/main/java/com/l2jserver/gameserver/model/Location.java b/src/main/java/com/l2jserver/gameserver/model/Location.java
index 96b093c..b5285f9 100644
--- a/src/main/java/com/l2jserver/gameserver/model/Location.java
+++ b/src/main/java/com/l2jserver/gameserver/model/Location.java
@@ -142,6 +142,24 @@
setXYZ(loc.getX(), loc.getY(), loc.getZ());
}
+ @Override
+ public int getInteractX()
+ {
+ return getX();
+ }
+
+ @Override
+ public int getInteractY()
+ {
+ return getY();
+ }
+
+ @Override
+ public int getInteractZ()
+ {
+ return getZ();
+ }
+
/**
* Get the heading.
* @return the heading
diff --git a/src/main/java/com/l2jserver/gameserver/model/MobGroup.java b/src/main/java/com/l2jserver/gameserver/model/MobGroup.java
index 38cc739..392df6b 100644
--- a/src/main/java/com/l2jserver/gameserver/model/MobGroup.java
+++ b/src/main/java/com/l2jserver/gameserver/model/MobGroup.java
@@ -316,7 +316,7 @@
int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
- ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
+ ai.move(activeChar.getInteractX() + (signX * randX), activeChar.getInteractY() + (signY * randY), activeChar.getInteractZ());
}
}
diff --git a/src/main/java/com/l2jserver/gameserver/model/actor/L2Character.java b/src/main/java/com/l2jserver/gameserver/model/actor/L2Character.java
index 661ca64..0afedc5 100644
--- a/src/main/java/com/l2jserver/gameserver/model/actor/L2Character.java
+++ b/src/main/java/com/l2jserver/gameserver/model/actor/L2Character.java
@@ -4292,9 +4292,9 @@
}
// Get current position of the L2Character
- final int curX = super.getX();
- final int curY = super.getY();
- final int curZ = super.getZ();
+ final int curX = getInteractX();
+ final int curY = getInteractY();
+ final int curZ = getInteractZ();
// Calculate distance (dx,dy) between current position and destination
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
@@ -4685,7 +4685,7 @@
*/
public final boolean isInsideRadius(ILocational loc, int radius, boolean checkZAxis, boolean strictCheck)
{
- return isInsideRadius(loc.getX(), loc.getY(), loc.getZ(), radius, checkZAxis, strictCheck);
+ return isInsideRadius(loc.getInteractX(), loc.getInteractY(), loc.getInteractZ(), radius, checkZAxis, strictCheck);
}
/**
diff --git a/src/main/java/com/l2jserver/gameserver/model/actor/L2Summon.java b/src/main/java/com/l2jserver/gameserver/model/actor/L2Summon.java
index c05e240..1fc570c 100644
--- a/src/main/java/com/l2jserver/gameserver/model/actor/L2Summon.java
+++ b/src/main/java/com/l2jserver/gameserver/model/actor/L2Summon.java
@@ -674,7 +674,7 @@
return false;
}
- if ((this != target) && skill.isPhysical() && (Config.PATHFINDING > 0) && (PathFinding.getInstance().findPath(getX(), getY(), getZ(), target.getX(), target.getY(), target.getZ(), getInstanceId(), true) == null))
+ if ((this != target) && skill.isPhysical() && (Config.PATHFINDING > 0) && (PathFinding.getInstance().findPath(this, target, true) == null))
{
sendPacket(SystemMessageId.CANT_SEE_TARGET);
return false;
diff --git a/src/main/java/com/l2jserver/gameserver/model/actor/instance/L2DoorInstance.java b/src/main/java/com/l2jserver/gameserver/model/actor/instance/L2DoorInstance.java
index 9cc5d7a..e088716 100644
--- a/src/main/java/com/l2jserver/gameserver/model/actor/instance/L2DoorInstance.java
+++ b/src/main/java/com/l2jserver/gameserver/model/actor/instance/L2DoorInstance.java
@@ -137,6 +137,24 @@
}
@Override
+ public int getInteractX()
+ {
+ return getTemplate().getInteractX();
+ }
+
+ @Override
+ public int getInteractY()
+ {
+ return getTemplate().getInteractY();
+ }
+
+ @Override
+ public int getInteractZ()
+ {
+ return getTemplate().getNodeZ();
+ }
+
+ @Override
public final DoorKnownList getKnownList()
{
return (DoorKnownList) super.getKnownList();
diff --git a/src/main/java/com/l2jserver/gameserver/model/actor/templates/L2DoorTemplate.java b/src/main/java/com/l2jserver/gameserver/model/actor/templates/L2DoorTemplate.java
index fac19be..bf668be 100644
--- a/src/main/java/com/l2jserver/gameserver/model/actor/templates/L2DoorTemplate.java
+++ b/src/main/java/com/l2jserver/gameserver/model/actor/templates/L2DoorTemplate.java
@@ -36,6 +36,8 @@
private final int _posX;
private final int _posY;
private final int _posZ;
+ private final int _interactX;
+ private final int _interactY;
private final int _emmiter;
private final int _childDoorId;
private final String _name;
@@ -80,6 +82,8 @@
_nodeX[i] = Integer.parseInt(split[0]);
_nodeY[i] = Integer.parseInt(split[1]);
}
+ _interactX = (_nodeX[0] + _nodeX[1] + _nodeX[2] + _nodeX[3]) / 4;
+ _interactY = (_nodeY[0] + _nodeY[1] + _nodeY[2] + _nodeY[3]) / 4;
// optional
_emmiter = set.getInt("emitter_id", 0);
@@ -146,21 +150,31 @@
return _height;
}
- public int getX()
+ public int getHingeX()
{
return _posX;
}
- public int getY()
+ public int getHingeY()
{
return _posY;
}
- public int getZ()
+ public int getHingeZ()
{
return _posZ;
}
+ public int getInteractX()
+ {
+ return _interactX;
+ }
+
+ public int getInteractY()
+ {
+ return _interactY;
+ }
+
public int getEmmiter()
{
return _emmiter;
diff --git a/src/main/java/com/l2jserver/gameserver/model/entity/Instance.java b/src/main/java/com/l2jserver/gameserver/model/entity/Instance.java
index cf8fa9e..b6df727 100644
--- a/src/main/java/com/l2jserver/gameserver/model/entity/Instance.java
+++ b/src/main/java/com/l2jserver/gameserver/model/entity/Instance.java
@@ -275,7 +275,7 @@
final L2DoorInstance newdoor = new L2DoorInstance(new L2DoorTemplate(set));
newdoor.setInstanceId(getId());
newdoor.setCurrentHp(newdoor.getMaxHp());
- newdoor.spawnMe(newdoor.getTemplate().getX(), newdoor.getTemplate().getY(), newdoor.getTemplate().getZ());
+ newdoor.spawnMe(newdoor.getTemplate().getHingeX(), newdoor.getTemplate().getHingeY(), newdoor.getTemplate().getHingeZ());
_doors.put(doorId, newdoor);
}
@@ -915,7 +915,7 @@
player.teleToLocation(TeleportWhereType.TOWN);
}
}
- } , _ejectTime));
+ }, _ejectTime));
}
}
diff --git a/src/main/java/com/l2jserver/gameserver/model/interfaces/ILocational.java b/src/main/java/com/l2jserver/gameserver/model/interfaces/ILocational.java
index 1b6bd33..905bb0a 100644
--- a/src/main/java/com/l2jserver/gameserver/model/interfaces/ILocational.java
+++ b/src/main/java/com/l2jserver/gameserver/model/interfaces/ILocational.java
@@ -43,6 +43,24 @@
public int getZ();
/**
+ * Gets the X coordinate used to interact with this object
+ * @return the X coordinate used to interact with this object
+ */
+ public int getInteractX();
+
+ /**
+ * Gets the Y coordinate used to interact with this object
+ * @return the Y coordinate used to interact with this object
+ */
+ public int getInteractY();
+
+ /**
+ * Gets the Z coordinate used to interact with this object
+ * @return the Z coordinate used to interact with this object
+ */
+ public int getInteractZ();
+
+ /**
* Gets the heading of this object.
* @return the current heading
*/
diff --git a/src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java b/src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java
index c65abc0..170d2f9 100644
--- a/src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java
+++ b/src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java
@@ -1562,7 +1562,7 @@
if (_dropper != null)
{
- Location dropDest = GeoData.getInstance().moveCheck(_dropper.getX(), _dropper.getY(), _dropper.getZ(), _x, _y, _z, _dropper.getInstanceId());
+ Location dropDest = GeoData.getInstance().moveCheck(_dropper, _x, _y, _z);
_x = dropDest.getX();
_y = dropDest.getY();
_z = dropDest.getZ();
diff --git a/src/main/java/com/l2jserver/gameserver/model/stats/Formulas.java b/src/main/java/com/l2jserver/gameserver/model/stats/Formulas.java
index 2d49b89..98e4e42 100644
--- a/src/main/java/com/l2jserver/gameserver/model/stats/Formulas.java
+++ b/src/main/java/com/l2jserver/gameserver/model/stats/Formulas.java
@@ -102,8 +102,8 @@
/**
* Return the period between 2 regeneration task (3s for L2Character, 5 min for L2DoorInstance).
- * @param cha
- * @return
+ * @param cha character
+ * @return hp regen period
*/
public static int getRegeneratePeriod(L2Character cha)
{
diff --git a/src/main/java/com/l2jserver/gameserver/network/serverpackets/JoinParty.java b/src/main/java/com/l2jserver/gameserver/network/serverpackets/JoinParty.java
index d27c868..1cbded6 100644
--- a/src/main/java/com/l2jserver/gameserver/network/serverpackets/JoinParty.java
+++ b/src/main/java/com/l2jserver/gameserver/network/serverpackets/JoinParty.java
@@ -23,7 +23,7 @@
private final int _response;
/**
- * @param response
+ * @param response the response
*/
public JoinParty(int response)
{
diff --git a/src/main/java/com/l2jserver/gameserver/network/serverpackets/L2GameServerPacket.java b/src/main/java/com/l2jserver/gameserver/network/serverpackets/L2GameServerPacket.java
index 30747fd..6fc3121 100644
--- a/src/main/java/com/l2jserver/gameserver/network/serverpackets/L2GameServerPacket.java
+++ b/src/main/java/com/l2jserver/gameserver/network/serverpackets/L2GameServerPacket.java
@@ -76,7 +76,7 @@
/**
* Set "invisible" boolean flag in the packet.<br>
* Packets from invisible characters will not be broadcasted to players.
- * @param b
+ * @param b invisible flag
*/
public void setInvisible(boolean b)
{
@@ -85,7 +85,7 @@
/**
* Writes 3 D (int32) with current location x, y, z
- * @param loc
+ * @param loc the location
*/
protected void writeLoc(IPositionable loc)
{
diff --git a/src/main/java/com/l2jserver/gameserver/network/serverpackets/LoginFail.java b/src/main/java/com/l2jserver/gameserver/network/serverpackets/LoginFail.java
index 7418b58..0c9d5fa 100644
--- a/src/main/java/com/l2jserver/gameserver/network/serverpackets/LoginFail.java
+++ b/src/main/java/com/l2jserver/gameserver/network/serverpackets/LoginFail.java
@@ -35,7 +35,7 @@
private final int _reason;
/**
- * @param reason
+ * @param reason the reason
*/
public LoginFail(int reason)
{
diff --git a/src/main/java/com/l2jserver/gameserver/network/serverpackets/MoveToLocationInVehicle.java b/src/main/java/com/l2jserver/gameserver/network/serverpackets/MoveToLocationInVehicle.java
index 06d476b..96da1a0 100644
--- a/src/main/java/com/l2jserver/gameserver/network/serverpackets/MoveToLocationInVehicle.java
+++ b/src/main/java/com/l2jserver/gameserver/network/serverpackets/MoveToLocationInVehicle.java
@@ -32,9 +32,9 @@
private final Location _origin;
/**
- * @param player
- * @param destination
- * @param origin
+ * @param player the player
+ * @param destination the destination
+ * @param origin the origin
*/
public MoveToLocationInVehicle(L2PcInstance player, Location destination, Location origin)
{
diff --git a/src/main/java/com/l2jserver/gameserver/network/serverpackets/MoveToPawn.java b/src/main/java/com/l2jserver/gameserver/network/serverpackets/MoveToPawn.java
index dd368a3..feb0793 100644
--- a/src/main/java/com/l2jserver/gameserver/network/serverpackets/MoveToPawn.java
+++ b/src/main/java/com/l2jserver/gameserver/network/serverpackets/MoveToPawn.java
@@ -32,12 +32,12 @@
_charObjId = cha.getObjectId();
_targetId = target.getObjectId();
_distance = distance;
- _x = cha.getX();
- _y = cha.getY();
- _z = cha.getZ();
- _tx = target.getX();
- _ty = target.getY();
- _tz = target.getZ();
+ _x = cha.getInteractX();
+ _y = cha.getInteractY();
+ _z = cha.getInteractZ();
+ _tx = target.getInteractX();
+ _ty = target.getInteractY();
+ _tz = target.getInteractZ();
}
@Override
diff --git a/src/main/java/com/l2jserver/gameserver/network/serverpackets/MyTargetSelected.java b/src/main/java/com/l2jserver/gameserver/network/serverpackets/MyTargetSelected.java
index 6623124..53e7471 100644
--- a/src/main/java/com/l2jserver/gameserver/network/serverpackets/MyTargetSelected.java
+++ b/src/main/java/com/l2jserver/gameserver/network/serverpackets/MyTargetSelected.java
@@ -32,8 +32,8 @@
private final int _color;
/**
- * @param player
- * @param target
+ * @param player the player
+ * @param target the target
*/
public MyTargetSelected(L2PcInstance player, L2Character target)
{
diff --git a/src/main/java/com/l2jserver/gameserver/pathfinding/PathFinding.java b/src/main/java/com/l2jserver/gameserver/pathfinding/PathFinding.java
index c99a0b1..cf876e3 100644
--- a/src/main/java/com/l2jserver/gameserver/pathfinding/PathFinding.java
+++ b/src/main/java/com/l2jserver/gameserver/pathfinding/PathFinding.java
@@ -22,6 +22,7 @@
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.interfaces.ILocational;
import com.l2jserver.gameserver.pathfinding.cellnodes.CellPathFinding;
import com.l2jserver.gameserver.pathfinding.geonodes.GeoPathFinding;
@@ -43,6 +44,12 @@
public abstract boolean pathNodesExist(short regionoffset);
+ public abstract List<AbstractNodeLoc> findPath(ILocational src, ILocational dst, boolean playable);
+
+ public abstract List<AbstractNodeLoc> findPath(ILocational src, int tx, int ty, int tz, boolean playable);
+
+ public abstract List<AbstractNodeLoc> findPath(int x, int y, int z, ILocational dst, boolean playable);
+
public abstract List<AbstractNodeLoc> findPath(int x, int y, int z, int tx, int ty, int tz, int instanceId, boolean playable);
// @formatter:off
diff --git a/src/main/java/com/l2jserver/gameserver/pathfinding/cellnodes/CellPathFinding.java b/src/main/java/com/l2jserver/gameserver/pathfinding/cellnodes/CellPathFinding.java
index bce18c5..c2e6e2d 100644
--- a/src/main/java/com/l2jserver/gameserver/pathfinding/cellnodes/CellPathFinding.java
+++ b/src/main/java/com/l2jserver/gameserver/pathfinding/cellnodes/CellPathFinding.java
@@ -28,6 +28,7 @@
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.idfactory.IdFactory;
+import com.l2jserver.gameserver.model.interfaces.ILocational;
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.pathfinding.AbstractNode;
@@ -92,6 +93,24 @@
}
@Override
+ public List<AbstractNodeLoc> findPath(ILocational src, ILocational dst, boolean playable)
+ {
+ return findPath(src, dst.getInteractX(), dst.getInteractY(), dst.getInteractZ(), playable);
+ }
+
+ @Override
+ public List<AbstractNodeLoc> findPath(ILocational src, int tx, int ty, int tz, boolean playable)
+ {
+ return findPath(src.getInteractX(), src.getInteractY(), src.getInteractZ(), tx, ty, tz, src.getInstanceId(), playable);
+ }
+
+ @Override
+ public List<AbstractNodeLoc> findPath(int x, int y, int z, ILocational dst, boolean playable)
+ {
+ return findPath(x, y, z, dst.getInteractX(), dst.getInteractY(), dst.getInteractZ(), dst.getInstanceId(), playable);
+ }
+
+ @Override
public List<AbstractNodeLoc> findPath(int x, int y, int z, int tx, int ty, int tz, int instanceId, boolean playable)
{
int gx = GeoData.getInstance().getGeoX(x);
@@ -387,7 +406,8 @@
StringUtil.append(stat, "LOS postfilter uses:", String.valueOf(_postFilterUses), "/", String.valueOf(_postFilterPlayableUses));
if (_postFilterUses > 0)
{
- StringUtil.append(stat, " total/avg(ms):", String.valueOf(_postFilterElapsed), "/", String.format("%1.2f", (double) _postFilterElapsed / _postFilterUses), " passes total/avg:", String.valueOf(_postFilterPasses), "/", String.format("%1.1f", (double) _postFilterPasses / _postFilterUses), Config.EOL);
+ StringUtil.append(stat, " total/avg(ms):", String.valueOf(_postFilterElapsed), "/", String.format("%1.2f", (double) _postFilterElapsed / _postFilterUses), " passes total/avg:", String.valueOf(_postFilterPasses), "/", String.format("%1.1f", (double) _postFilterPasses
+ / _postFilterUses), Config.EOL);
}
StringUtil.append(stat, "Pathfind success/fail:", String.valueOf(_findSuccess), "/", String.valueOf(_findFails));
result[result.length - 1] = stat.toString();
diff --git a/src/main/java/com/l2jserver/gameserver/pathfinding/geonodes/GeoPathFinding.java b/src/main/java/com/l2jserver/gameserver/pathfinding/geonodes/GeoPathFinding.java
index b8558ba..4a29ebd 100644
--- a/src/main/java/com/l2jserver/gameserver/pathfinding/geonodes/GeoPathFinding.java
+++ b/src/main/java/com/l2jserver/gameserver/pathfinding/geonodes/GeoPathFinding.java
@@ -40,6 +40,7 @@
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.Location;
+import com.l2jserver.gameserver.model.interfaces.ILocational;
import com.l2jserver.gameserver.pathfinding.AbstractNode;
import com.l2jserver.gameserver.pathfinding.AbstractNodeLoc;
import com.l2jserver.gameserver.pathfinding.PathFinding;
@@ -67,6 +68,24 @@
}
@Override
+ public List<AbstractNodeLoc> findPath(ILocational src, ILocational dst, boolean playable)
+ {
+ return findPath(src, dst.getInteractX(), dst.getInteractY(), dst.getInteractZ(), playable);
+ }
+
+ @Override
+ public List<AbstractNodeLoc> findPath(ILocational src, int tx, int ty, int tz, boolean playable)
+ {
+ return findPath(src.getInteractX(), src.getInteractY(), src.getInteractZ(), tx, ty, tz, src.getInstanceId(), playable);
+ }
+
+ @Override
+ public List<AbstractNodeLoc> findPath(int x, int y, int z, ILocational dst, boolean playable)
+ {
+ return findPath(x, y, z, dst.getInteractX(), dst.getInteractY(), dst.getInteractZ(), dst.getInstanceId(), playable);
+ }
+
+ @Override
public List<AbstractNodeLoc> findPath(int x, int y, int z, int tx, int ty, int tz, int instanceId, boolean playable)
{
int gx = (x - L2World.MAP_MIN_X) >> 4;
diff --git a/src/main/java/com/l2jserver/gameserver/util/Util.java b/src/main/java/com/l2jserver/gameserver/util/Util.java
index f4f5713..64271a7 100644
--- a/src/main/java/com/l2jserver/gameserver/util/Util.java
+++ b/src/main/java/com/l2jserver/gameserver/util/Util.java
@@ -728,7 +728,7 @@
}
final L2Character cha = (L2Character) obj;
- if (((cha.getZ() < (npc.getZ() - 100)) && (cha.getZ() > (npc.getZ() + 100))) || !(GeoData.getInstance().canSeeTarget(cha.getX(), cha.getY(), cha.getZ(), npc.getX(), npc.getY(), npc.getZ())))
+ if (((cha.getInteractZ() < (npc.getInteractZ() - 100)) && (cha.getInteractZ() > (npc.getInteractZ() + 100))) || !(GeoData.getInstance().canSeeTarget(cha, npc)))
{
continue;
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | diff --git a/dist/game/data/scripts/ai/group_template/FleeMonsters.java b/dist/game/data/scripts/ai/group_template/FleeMonsters.java
index 2ae96a0..41521a0 100644
--- a/dist/game/data/scripts/ai/group_template/FleeMonsters.java
+++ b/dist/game/data/scripts/ai/group_template/FleeMonsters.java
@@ -18,8 +18,6 @@
*/
package ai.group_template;
-import ai.npc.AbstractNpcAI;
-
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.Location;
@@ -29,6 +27,8 @@
import com.l2jserver.gameserver.model.interfaces.ILocational;
import com.l2jserver.gameserver.util.Util;
+import ai.npc.AbstractNpcAI;
+
/**
* Flee Monsters AI.
* @author Pandragon, NosBit
@@ -69,11 +69,11 @@
final L2Summon summon = isSummon ? attacker.getSummon() : null;
final ILocational attackerLoc = summon == null ? attacker : summon;
final double radians = Math.toRadians(Util.calculateAngleFrom(attackerLoc, npc));
- final int posX = (int) (npc.getX() + (FLEE_DISTANCE * Math.cos(radians)));
- final int posY = (int) (npc.getY() + (FLEE_DISTANCE * Math.sin(radians)));
+ final int posX = (int) (npc.getInteractX() + (FLEE_DISTANCE * Math.cos(radians)));
+ final int posY = (int) (npc.getInteractY() + (FLEE_DISTANCE * Math.sin(radians)));
final int posZ = npc.getZ();
- final Location destination = GeoData.getInstance().moveCheck(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, attacker.getInstanceId());
+ final Location destination = GeoData.getInstance().moveCheck(npc.getInteractX(), npc.getInteractY(), npc.getInteractZ(), posX, posY, posZ, attacker.getInstanceId());
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
return super.onAttack(npc, attacker, damage, isSummon);
}
diff --git a/dist/game/data/scripts/ai/group_template/PrimevalIsle.java b/dist/game/data/scripts/ai/group_template/PrimevalIsle.java
index e102725..6256df2 100644
--- a/dist/game/data/scripts/ai/group_template/PrimevalIsle.java
+++ b/dist/game/data/scripts/ai/group_template/PrimevalIsle.java
@@ -269,9 +269,9 @@
final double radian = Math.toRadians(angle);
final double sin = Math.sin(radian);
final double cos = Math.cos(radian);
- final int newX = (int) (npc.getX() + (cos * distance));
- final int newY = (int) (npc.getY() + (sin * distance));
- final Location loc = GeoData.getInstance().moveCheck(npc.getX(), npc.getY(), npc.getZ(), newX, newY, npc.getZ(), npc.getInstanceId());
+ final int newX = (int) (npc.getInteractX() + (cos * distance));
+ final int newY = (int) (npc.getInteractY() + (sin * distance));
+ final Location loc = GeoData.getInstance().moveCheck(npc.getInteractX(), npc.getInteractY(), npc.getInteractZ(), newX, newY, npc.getZ(), npc.getInstanceId());
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc, 0);
}
else if (ag_type == 1)
diff --git a/dist/game/data/scripts/ai/individual/Valakas.java b/dist/game/data/scripts/ai/individual/Valakas.java
index 2aa8037..5402a18 100644
--- a/dist/game/data/scripts/ai/individual/Valakas.java
+++ b/dist/game/data/scripts/ai/individual/Valakas.java
@@ -478,9 +478,9 @@
{
if (getRandom(10) == 0)
{
- int x = npc.getX();
- int y = npc.getY();
- int z = npc.getZ();
+ int x = npc.getInteractX();
+ int y = npc.getInteractY();
+ int z = npc.getInteractZ();
int posX = x + getRandom(-1400, 1400);
int posY = y + getRandom(-1400, 1400);
diff --git a/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java b/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java
index 4104303..b5b89ef 100644
--- a/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java
+++ b/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java
@@ -76,7 +76,7 @@
}
if (activeChar.getTarget() != null)
{
- List<AbstractNodeLoc> path = PathFinding.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId(), true);
+ List<AbstractNodeLoc> path = PathFinding.getInstance().findPath(activeChar, activeChar.getTarget(), true);
if (path == null)
{
activeChar.sendMessage("No Route!");
diff --git a/dist/game/data/scripts/handlers/effecthandlers/Blink.java b/dist/game/data/scripts/handlers/effecthandlers/Blink.java
index e5e3286..8c2507b 100644
--- a/dist/game/data/scripts/handlers/effecthandlers/Blink.java
+++ b/dist/game/data/scripts/handlers/effecthandlers/Blink.java
@@ -72,7 +72,7 @@
int y = effected.getY() + y1;
int z = effected.getZ();
- final Location destination = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
+ final Location destination = GeoData.getInstance().moveCheck(effected, x, y, z);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.DUMMY));
diff --git a/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java b/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java
index 9c19535..93126e3 100644
--- a/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java
+++ b/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java
@@ -53,18 +53,18 @@
}
// Get current position of the L2Character
- final int curX = info.getEffector().getX();
- final int curY = info.getEffector().getY();
- final int curZ = info.getEffector().getZ();
+ final int curX = info.getEffector().getInteractX();
+ final int curY = info.getEffector().getInteractY();
+ final int curZ = info.getEffector().getInteractZ();
// Calculate distance (dx,dy) between current position and destination
- double dx = info.getEffected().getX() - curX;
- double dy = info.getEffected().getY() - curY;
- double dz = info.getEffected().getZ() - curZ;
+ double dx = info.getEffected().getInteractX() - curX;
+ double dy = info.getEffected().getInteractY() - curY;
+ double dz = info.getEffected().getInteractZ() - curZ;
double distance = Math.sqrt((dx * dx) + (dy * dy));
if (distance > 2000)
{
- _log.info("EffectEnemyCharge was going to use invalid coordinates for characters, getEffector: " + curX + "," + curY + " and getEffected: " + info.getEffected().getX() + "," + info.getEffected().getY());
+ _log.info("EffectEnemyCharge was going to use invalid coordinates for characters, getEffector: " + curX + "," + curY + " and getEffected: " + info.getEffected().getInteractX() + "," + info.getEffected().getInteractY());
return;
}
@@ -91,9 +91,9 @@
// Calculate the new destination with offset included
int x = curX + (int) ((distance - offset) * cos);
int y = curY + (int) ((distance - offset) * sin);
- int z = info.getEffected().getZ();
+ int z = info.getEffected().getInteractZ();
- final Location destination = GeoData.getInstance().moveCheck(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
+ final Location destination = GeoData.getInstance().moveCheck(info.getEffector(), x, y, z);
info.getEffector().broadcastPacket(new FlyToLocation(info.getEffector(), destination, FlyType.CHARGE));
diff --git a/dist/game/data/scripts/handlers/effecthandlers/Fishing.java b/dist/game/data/scripts/handlers/effecthandlers/Fishing.java
index 48e711b..1ec98fe 100644
--- a/dist/game/data/scripts/handlers/effecthandlers/Fishing.java
+++ b/dist/game/data/scripts/handlers/effecthandlers/Fishing.java
@@ -249,7 +249,7 @@
// always use water zone, fishing zone high z is high in the air...
int baitZ = waterZone.getWaterZ();
- if (!GeoData.getInstance().canSeeTarget(player.getX(), player.getY(), player.getZ(), baitX, baitY, baitZ))
+ if (!GeoData.getInstance().canSeeTarget(player.getInteractX(), player.getInteractY(), player.getInteractZ(), baitX, baitY, baitZ))
{
return Integer.MIN_VALUE;
}
diff --git a/dist/game/data/scripts/handlers/effecthandlers/TeleportToTarget.java b/dist/game/data/scripts/handlers/effecthandlers/TeleportToTarget.java
index 4eb9961..0e18f31 100644
--- a/dist/game/data/scripts/handlers/effecthandlers/TeleportToTarget.java
+++ b/dist/game/data/scripts/handlers/effecthandlers/TeleportToTarget.java
@@ -65,8 +65,8 @@
return;
}
- int px = target.getX();
- int py = target.getY();
+ int px = target.getInteractX();
+ int py = target.getInteractY();
double ph = Util.convertHeadingToDegree(target.getHeading());
ph += 180;
@@ -78,9 +78,9 @@
ph = (Math.PI * ph) / 180;
int x = (int) (px + (25 * Math.cos(ph)));
int y = (int) (py + (25 * Math.sin(ph)));
- int z = target.getZ();
+ int z = target.getInteractZ();
- final Location loc = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceId());
+ final Location loc = GeoData.getInstance().moveCheck(activeChar, x, y, z);
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
activeChar.broadcastPacket(new FlyToLocation(activeChar, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
diff --git a/dist/game/data/scripts/handlers/effecthandlers/ThrowUp.java b/dist/game/data/scripts/handlers/effecthandlers/ThrowUp.java
index ae7bbd6..a6c851a 100644
--- a/dist/game/data/scripts/handlers/effecthandlers/ThrowUp.java
+++ b/dist/game/data/scripts/handlers/effecthandlers/ThrowUp.java
@@ -55,14 +55,14 @@
public void onStart(BuffInfo info)
{
// Get current position of the L2Character
- final int curX = info.getEffected().getX();
- final int curY = info.getEffected().getY();
- final int curZ = info.getEffected().getZ();
+ final int curX = info.getEffected().getInteractX();
+ final int curY = info.getEffected().getInteractY();
+ final int curZ = info.getEffected().getInteractZ();
// Calculate distance between effector and effected current position
- double dx = info.getEffector().getX() - curX;
- double dy = info.getEffector().getY() - curY;
- double dz = info.getEffector().getZ() - curZ;
+ double dx = info.getEffector().getInteractX() - curX;
+ double dy = info.getEffector().getInteractY() - curY;
+ double dz = info.getEffector().getInteractZ() - curZ;
double distance = Math.sqrt((dx * dx) + (dy * dy));
if (distance > 2000)
{
@@ -93,11 +93,11 @@
cos = dx / distance;
// Calculate the new destination with offset included
- int x = info.getEffector().getX() - (int) (offset * cos);
- int y = info.getEffector().getY() - (int) (offset * sin);
- int z = info.getEffected().getZ();
+ int x = info.getEffector().getInteractX() - (int) (offset * cos);
+ int y = info.getEffector().getInteractY() - (int) (offset * sin);
+ int z = info.getEffected().getInteractZ();
- final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId());
+ final Location destination = GeoData.getInstance().moveCheck(info.getEffected(), x, y, z);
info.getEffected().broadcastPacket(new FlyToLocation(info.getEffected(), destination, FlyType.THROW_UP));
// TODO: Review.
diff --git a/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java b/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
index 27d66e3..787f9b7 100644
--- a/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
+++ b/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
@@ -656,14 +656,14 @@
private void Throw(L2Character effector, L2Character effected)
{
// Get current position of the L2Character
- final int curX = effected.getX();
- final int curY = effected.getY();
- final int curZ = effected.getZ();
+ final int curX = effected.getInteractX();
+ final int curY = effected.getInteractY();
+ final int curZ = effected.getInteractZ();
// Calculate distance between effector and effected current position
- double dx = effector.getX() - curX;
- double dy = effector.getY() - curY;
- double dz = effector.getZ() - curZ;
+ double dx = effector.getInteractX() - curX;
+ double dy = effector.getInteractY() - curY;
+ double dz = effector.getInteractZ() - curZ;
double distance = Math.sqrt((dx * dx) + (dy * dy));
int offset = Math.min((int) distance + 300, 1400);
@@ -687,11 +687,11 @@
cos = dx / distance;
// Calculate the new destination with offset included
- int _x = effector.getX() - (int) (offset * cos);
- int _y = effector.getY() - (int) (offset * sin);
- int _z = effected.getZ();
+ int _x = effector.getInteractX() - (int) (offset * cos);
+ int _y = effector.getInteractY() - (int) (offset * sin);
+ int _z = effected.getInteractZ();
- Location destination = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), _x, _y, _z, effected.getInstanceId());
+ Location destination = GeoData.getInstance().moveCheck(effected, _x, _y, _z);
effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.THROW_UP));
|
Comments (1)
You can clone a snippet to your computer for local editing. Learn more.
okey oyna
batak oyna
tavla oyna