Files
sweetgum-server/src/server/maps/MapleDoorObject.java
T
ronancpl ad812de001 Improved login phase + C. scheduler & EXP share & MoveLifeHandler fix
Refactored login system, caching account data, merging some queries and using way less DB queries on login.
Server now uses associative tables for character-account and character-world, lowering considerably usage of some DB queries.
Fixed getPartyMembersOnSameMap method trying to access disconnected members, promptly throwing nulls.
Improved EXP distribution system, now crediting damage-contributing EXP to the party when the player is not present on the map.
Improved the "View-all-chars" feature mechanics, not so often disconnecting players for server response timeout anymore.
Improved Mystic Doors mechanics, now correctly spawning party players at actual door location on the off-town map.
Fixed "fly" command not working properly. All characters of that account are able to use this mechanic (client session limitation).
Fixed a critical deadlock issue on the new channel scheduler system.
Fixed some mobs not using skills, issue brought on the latest MoveLifeHandler update.
Improved slightly skill/movement synergy on the MoveLifeHandler responses.
GMs no longer creates Hall-of-fame PlayerNPCs when reaching max class level.
Fixed monsterValue script method being triggered multiple times for party members.
Fixed pinkbean not dropping items inside expedition.
Moved "recharge" command from Donator to JrGM.
2018-07-14 13:10:40 -03:00

127 lines
3.9 KiB
Java

/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2018 RonanLana
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;
import client.MapleCharacter;
import client.MapleClient;
import tools.MaplePacketCreator;
/**
*
* @author Ronan
*/
public class MapleDoorObject extends AbstractMapleMapObject {
private int ownerId;
private int pairOid;
private boolean isTown;
private MapleMap from;
private MapleMap to;
private Point toPos;
public MapleDoorObject(int owner, MapleMap destination, MapleMap origin, boolean town, Point targetPosition, Point toPosition) {
super();
setPosition(targetPosition);
ownerId = owner;
isTown = town;
from = origin;
to = destination;
toPos = toPosition;
}
public void warp(final MapleCharacter chr) {
if (chr.getId() == ownerId || (chr.getParty() != null && chr.getParty().getMemberById(ownerId) != null)) {
chr.changeMap(to, toPos);
} else {
chr.getClient().announce(MaplePacketCreator.blockedMessage(6));
chr.getClient().announce(MaplePacketCreator.enableActions());
}
}
@Override
public void sendSpawnData(MapleClient client) {
if (from.getId() == client.getPlayer().getMapId()) {
if (client.getPlayer().getParty() != null && (ownerId == client.getPlayer().getId() || client.getPlayer().getParty().getMemberById(ownerId) != null)) {
client.announce(MaplePacketCreator.partyPortal(this.getFrom().getId(), this.getTo().getId(), this.toPosition()));
}
client.announce(MaplePacketCreator.spawnPortal(this.getFrom().getId(), this.getTo().getId(), this.toPosition()));
if(!this.inTown()) client.announce(MaplePacketCreator.spawnDoor(this.getOwnerId(), this.getPosition(), true));
}
}
@Override
public void sendDestroyData(MapleClient client) {
if (from.getId() == client.getPlayer().getMapId()) {
if (client.getPlayer().getParty() != null && (ownerId == client.getPlayer().getId() || client.getPlayer().getParty().getMemberById(ownerId) != null)) {
client.announce(MaplePacketCreator.partyPortal(999999999, 999999999, new Point(-1, -1)));
}
client.announce(MaplePacketCreator.removeDoor(ownerId, isTown));
}
}
public int getOwnerId() {
return ownerId;
}
public void setPairOid(int oid) {
this.pairOid = oid;
}
public int getPairOid() {
return pairOid;
}
public boolean inTown() {
return isTown;
}
public MapleMap getFrom() {
return from;
}
public MapleMap getTo() {
return to;
}
public MapleMap getTown() {
return isTown ? from : to;
}
public MapleMap getArea() {
return !isTown ? from : to;
}
public Point getAreaPosition() {
return !isTown ? getPosition() : toPos;
}
public Point toPosition() {
return toPos;
}
@Override
public MapleMapObjectType getType() {
return MapleMapObjectType.DOOR;
}
}