diff --git a/src/gui/tw/diaoyu/DiaoyuConfig.java b/src/gui/tw/diaoyu/DiaoyuConfig.java index 3babd5f..843baa2 100644 --- a/src/gui/tw/diaoyu/DiaoyuConfig.java +++ b/src/gui/tw/diaoyu/DiaoyuConfig.java @@ -2,8 +2,13 @@ package gui.tw.diaoyu; import cn.hutool.core.lang.WeightRandom; import cn.hutool.core.util.RandomUtil; +import handling.world.MapleParty; +import provider.MapleDataTool; import scripting.PortalPlayerInteraction; import scripting.PortalScript; +import server.life.MapleLifeFactory; +import server.maps.MapleMap; +import server.maps.MapleMapFactory; import java.util.ArrayList; import java.util.Comparator; @@ -32,6 +37,15 @@ public class DiaoyuConfig { public void setMapIds(List mapIds) { this.mapIds = mapIds; } + public void addmap(int mapId,int id) { + DiaoYuMap diaoYuMap = new DiaoYuMap(); + diaoYuMap.setId(id); + diaoYuMap.setMapId(mapId); + + diaoYuMap.setName(getMapStringName(mapId)); + MapleDataTool.getString("mapName", MapleMapFactory.nameData.getChildByPath(getMapStringName(910000000)), ""); + mapIds.add(diaoYuMap); + } List bls=new ArrayList<>(); @@ -112,9 +126,6 @@ public class DiaoyuConfig { } } - public void addMapId(DiaoYuMap mapId){ - mapIds.add(mapId); - } public DiaoyuItem getItem(boolean gj) { int c = RandomUtil.randomInt(1, 1000000); @@ -240,4 +251,45 @@ public class DiaoyuConfig { this.gjye = gjye; } + + private static String getMapStringName(final int mapid) { + final StringBuilder builder = new StringBuilder(); + if (mapid < 100000000) { + builder.append("maple"); + } else if ((mapid >= 100000000 && mapid < 200000000) || mapid / 100000 == 5540) { + builder.append("victoria"); + } else if (mapid >= 200000000 && mapid < 300000000) { + builder.append("ossyria"); + } else if (mapid >= 300000000 && mapid < 400000000) { + builder.append("elin"); + } else if (mapid >= 500000000 && mapid < 510000000) { + builder.append("thai"); + } else if (mapid >= 540000000 && mapid < 600000000) { + builder.append("SG"); + } else if (mapid >= 600000000 && mapid < 620000000) { + builder.append("MasteriaGL"); + } else if ((mapid >= 670000000 && mapid < 677000000) || (mapid >= 678000000 && mapid < 682000000)) { + builder.append("global"); + } else if (mapid >= 677000000 && mapid < 678000000) { + builder.append("Episode1GL"); + } else if (mapid >= 682000000 && mapid < 683000000) { + builder.append("HalloweenGL"); + } else if (mapid >= 683000000 && mapid < 684000000) { + builder.append("event"); + } else if (mapid >= 684000000 && mapid < 685000000) { + builder.append("event_5th"); + } else if (mapid >= 700000000 && mapid < 700000300) { + builder.append("wedding"); + } else if (mapid >= 800000000 && mapid < 900000000) { + builder.append("jp"); + } else if (mapid >= 700000000 && mapid < 782000002) { + builder.append("chinese"); + } else { + builder.append("etc"); + } + builder.append("/"); + builder.append(mapid); + return builder.toString(); + } + } diff --git a/src/server/maps/MapleMapFactory.java b/src/server/maps/MapleMapFactory.java index a15eed6..dd93179 100644 --- a/src/server/maps/MapleMapFactory.java +++ b/src/server/maps/MapleMapFactory.java @@ -43,7 +43,7 @@ import provider.MapleDataProvider; public class MapleMapFactory { private static final MapleDataProvider source = MapleDataProviderFactory.getDataProvider("Map.wz"); - private static final MapleData nameData = MapleDataProviderFactory.getDataProvider("String.wz").getData("Map.img"); + public static final MapleData nameData = MapleDataProviderFactory.getDataProvider("String.wz").getData("Map.img"); private final Map maps; private final Map instanceMap; private static final Map mapInfos = new HashMap(); @@ -54,6 +54,8 @@ public class MapleMapFactory { private int channel; private static boolean changed = false; + + public MapleMapFactory() { this.maps = (Map) new HashMap(); this.instanceMap = (Map) new HashMap();