Rename and clean up MaplePlayerNPCPodium
This commit is contained in:
@@ -30,8 +30,8 @@ import constants.game.GameConstants;
|
|||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
import net.server.channel.Channel;
|
import net.server.channel.Channel;
|
||||||
import net.server.world.World;
|
import net.server.world.World;
|
||||||
import server.life.positioner.MaplePlayerNPCPodium;
|
|
||||||
import server.life.positioner.MaplePlayerNPCPositioner;
|
import server.life.positioner.MaplePlayerNPCPositioner;
|
||||||
|
import server.life.positioner.PlayerNPCPodium;
|
||||||
import server.maps.AbstractMapleMapObject;
|
import server.maps.AbstractMapleMapObject;
|
||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
import server.maps.MapleMapObject;
|
import server.maps.MapleMapObject;
|
||||||
@@ -389,7 +389,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
|
|||||||
|
|
||||||
if (pos == null) {
|
if (pos == null) {
|
||||||
if (GameConstants.isPodiumHallOfFameMap(map.getId())) {
|
if (GameConstants.isPodiumHallOfFameMap(map.getId())) {
|
||||||
pos = MaplePlayerNPCPodium.getNextPlayerNpcPosition(map);
|
pos = PlayerNPCPodium.getNextPlayerNpcPosition(map);
|
||||||
} else {
|
} else {
|
||||||
pos = MaplePlayerNPCPositioner.getNextPlayerNpcPosition(map);
|
pos = MaplePlayerNPCPositioner.getNextPlayerNpcPosition(map);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,34 +34,25 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author RonanLana
|
* @author RonanLana
|
||||||
*
|
* <p>
|
||||||
* Note: the podium uses getGroundBelow that in its turn uses inputted posY minus 7.
|
* Note: the podium uses getGroundBelow that in its turn uses inputted posY minus 7.
|
||||||
* Podium system will implement increase-by-7 to negate that behaviour.
|
* Podium system will implement increase-by-7 to negate that behaviour.
|
||||||
*/
|
*/
|
||||||
public class MaplePlayerNPCPodium {
|
public class PlayerNPCPodium {
|
||||||
private static int getPlatformPosX(int platform) {
|
private static int getPlatformPosX(int platform) {
|
||||||
switch(platform) {
|
return switch (platform) {
|
||||||
case 0:
|
case 0 -> -50;
|
||||||
return -50;
|
case 1 -> -170;
|
||||||
|
default -> 70;
|
||||||
case 1:
|
};
|
||||||
return -170;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 70;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getPlatformPosY(int platform) {
|
private static int getPlatformPosY(int platform) {
|
||||||
switch(platform) {
|
if (platform == 0) {
|
||||||
case 0:
|
|
||||||
return -47;
|
return -47;
|
||||||
|
|
||||||
default:
|
|
||||||
return 40;
|
|
||||||
}
|
}
|
||||||
|
return 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Point calcNextPos(int rank, int step) {
|
private static Point calcNextPos(int rank, int step) {
|
||||||
@@ -84,7 +75,9 @@ public class MaplePlayerNPCPodium {
|
|||||||
|
|
||||||
private static Point reorganizePlayerNpcs(MapleMap map, int newStep, List<MapleMapObject> mmoList) {
|
private static Point reorganizePlayerNpcs(MapleMap map, int newStep, List<MapleMapObject> mmoList) {
|
||||||
if (!mmoList.isEmpty()) {
|
if (!mmoList.isEmpty()) {
|
||||||
if(YamlConfig.config.server.USE_DEBUG) System.out.println("Reorganizing pnpc map, step " + newStep);
|
if (YamlConfig.config.server.USE_DEBUG) {
|
||||||
|
System.out.println("Reorganizing pnpc map, step " + newStep);
|
||||||
|
}
|
||||||
|
|
||||||
List<MaplePlayerNPC> playerNpcs = new ArrayList<>(mmoList.size());
|
List<MaplePlayerNPC> playerNpcs = new ArrayList<>(mmoList.size());
|
||||||
for (MapleMapObject mmo : mmoList) {
|
for (MapleMapObject mmo : mmoList) {
|
||||||
@@ -131,7 +124,9 @@ public class MaplePlayerNPCPodium {
|
|||||||
int podiumStep = podiumData % (1 << 5), podiumCount = (podiumData / (1 << 5));
|
int podiumStep = podiumData % (1 << 5), podiumCount = (podiumData / (1 << 5));
|
||||||
|
|
||||||
if (podiumCount >= 3 * podiumStep) {
|
if (podiumCount >= 3 * podiumStep) {
|
||||||
if(podiumStep >= YamlConfig.config.server.PLAYERNPC_AREA_STEPS) return null;
|
if (podiumStep >= YamlConfig.config.server.PLAYERNPC_AREA_STEPS) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
List<MapleMapObject> mmoList = map.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC));
|
List<MapleMapObject> mmoList = map.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC));
|
||||||
map.getWorldServer().setPlayerNpcMapPodiumData(map.getId(), encodePodiumData(podiumStep + 1, podiumCount + 1));
|
map.getWorldServer().setPlayerNpcMapPodiumData(map.getId(), encodePodiumData(podiumStep + 1, podiumCount + 1));
|
||||||
@@ -144,7 +139,9 @@ public class MaplePlayerNPCPodium {
|
|||||||
|
|
||||||
public static Point getNextPlayerNpcPosition(MapleMap map) {
|
public static Point getNextPlayerNpcPosition(MapleMap map) {
|
||||||
Point pos = getNextPlayerNpcPosition(map, map.getWorldServer().getPlayerNpcMapPodiumData(map.getId()));
|
Point pos = getNextPlayerNpcPosition(map, map.getWorldServer().getPlayerNpcMapPodiumData(map.getId()));
|
||||||
if(pos == null) return null;
|
if (pos == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return map.getGroundBelow(pos);
|
return map.getGroundBelow(pos);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user