Files
sweetgum-server/src/server/maps/MapleFoothold.java
T
ronancpl f74dfbb46a Alliances & Pet autopot improvement + Crafters patch
Improved Alliance invitations now using "invite popups" just like buddy, party and guild invites.
Pet autopot now properly uses up pots from the inventory, fetching from other inventory slots when one place has been completely used up but the "stop criteria" hasn't been fulfilled yet.
Pet autopot now properly detects pots with healing factor defined by the character's pool.
Fixed old exploit with mineral/jewel crafters.
Patched Doorway's questlines.
2018-01-16 15:34:52 -02:00

104 lines
2.5 KiB
Java

/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <[email protected]>
Matthias Butz <[email protected]>
Jan Christian Meyer <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package server.maps;
import java.awt.Point;
/**
*
* @author Matze
*/
public class MapleFoothold implements Comparable<MapleFoothold> {
private Point p1;
private Point p2;
private int id;
private int next, prev;
public MapleFoothold(Point p1, Point p2, int id) {
this.p1 = p1;
this.p2 = p2;
this.id = id;
}
public boolean isWall() {
return p1.x == p2.x;
}
public int getX1() {
return p1.x;
}
public int getX2() {
return p2.x;
}
public int getY1() {
return p1.y;
}
public int getY2() {
return p2.y;
}
// XXX may need more precision
public int calculateFooting(int x) {
if (p1.y == p2.y) {
return p2.y; // y at both ends is the same
}
int slope = (p1.y - p2.y) / (p1.x - p2.x);
int intercept = p1.y - (slope * p1.x);
return (slope * x) + intercept;
}
@Override
public int compareTo(MapleFoothold o) {
MapleFoothold other = o;
if (p2.y < other.getY1()) {
return -1;
} else if (p1.y > other.getY2()) {
return 1;
} else {
return 0;
}
}
public int getId() {
return id;
}
public int getNext() {
return next;
}
public void setNext(int next) {
this.next = next;
}
public int getPrev() {
return prev;
}
public void setPrev(int prev) {
this.prev = prev;
}
}