Rename and clean up MapleReactorFactory

This commit is contained in:
P0nk
2021-09-09 22:38:37 +02:00
parent dc4d710d12
commit 036854a8be
3 changed files with 7 additions and 8 deletions

View File

@@ -352,7 +352,7 @@ public class MapFactory {
} }
private static Reactor loadReactor(Data reactor, String id, final byte FacingDirection) { private static Reactor loadReactor(Data reactor, String id, final byte FacingDirection) {
Reactor myReactor = new Reactor(MapleReactorFactory.getReactor(Integer.parseInt(id)), Integer.parseInt(id)); Reactor myReactor = new Reactor(ReactorFactory.getReactor(Integer.parseInt(id)), Integer.parseInt(id));
int x = DataTool.getInt(reactor.getChildByPath("x")); int x = DataTool.getInt(reactor.getChildByPath("x"));
int y = DataTool.getInt(reactor.getChildByPath("y")); int y = DataTool.getInt(reactor.getChildByPath("y"));
myReactor.setFacingDirection(FacingDirection); myReactor.setFacingDirection(FacingDirection);

View File

@@ -4299,7 +4299,7 @@ public class MapleMap {
return -1; return -1;
} }
int reactorID = 9980000 + team; int reactorID = 9980000 + team;
Reactor reactor = new Reactor(MapleReactorFactory.getReactorS(reactorID), reactorID); Reactor reactor = new Reactor(ReactorFactory.getReactorS(reactorID), reactorID);
pt.setTaken(true); pt.setTaken(true);
reactor.setPosition(pt.getPosition()); reactor.setPosition(pt.getPosition());
reactor.setName(team + "" + num); //lol reactor.setName(team + "" + num); //lol

View File

@@ -35,11 +35,10 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class MapleReactorFactory { public class ReactorFactory {
private static DataProvider data = DataProviderFactory.getDataProvider(WZFiles.REACTOR); private static final DataProvider data = DataProviderFactory.getDataProvider(WZFiles.REACTOR);
private static Map<Integer, MapleReactorStats> reactorStats = new HashMap<>(); private static final Map<Integer, MapleReactorStats> reactorStats = new HashMap<>();
public static final MapleReactorStats getReactorS(int rid) { public static final MapleReactorStats getReactorS(int rid) {
MapleReactorStats stats = reactorStats.get(rid); MapleReactorStats stats = reactorStats.get(rid);
if (stats == null) { if (stats == null) {
@@ -93,7 +92,7 @@ public class MapleReactorFactory {
} }
return stats; return stats;
} }
public static MapleReactorStats getReactor(int rid) { public static MapleReactorStats getReactor(int rid) {
MapleReactorStats stats = reactorStats.get(rid); MapleReactorStats stats = reactorStats.get(rid);
if (stats == null) { if (stats == null) {
@@ -121,7 +120,7 @@ public class MapleReactorFactory {
Data eventData = reactorInfoData.getChildByPath("event"); Data eventData = reactorInfoData.getChildByPath("event");
if (eventData != null) { if (eventData != null) {
int timeOut = -1; int timeOut = -1;
for (Data fknexon : eventData.getChildren()) { for (Data fknexon : eventData.getChildren()) {
if (fknexon.getName().equalsIgnoreCase("timeOut")) { if (fknexon.getName().equalsIgnoreCase("timeOut")) {
timeOut = DataTool.getInt(fknexon); timeOut = DataTool.getInt(fknexon);