Improvements for DoorData class.

This commit is contained in:
MobiusDevelopment 2020-01-25 13:43:52 +00:00
parent 56bc0a2d2b
commit 8e7ecd2ac0
7 changed files with 908 additions and 935 deletions

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
<xs:attribute type="xs:int" name="pDef" use="required"/>
<xs:attribute type="xs:short" name="mDef" use="required"/>
<xs:attribute type="xs:string" name="unlockable" use="required"/>
<xs:attribute type="xs:string" name="autoOpen" use="required"/>
<xs:attribute type="xs:string" name="isOpen" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

View File

@ -389,33 +389,8 @@ public class GameServer
Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());
try
{
final DoorData doorTable = DoorData.getInstance();
// Opened by players like L2OFF
doorTable.getDoor(19160012).openMe();
doorTable.getDoor(19160013).openMe();
doorTable.getDoor(19160014).openMe();
doorTable.getDoor(19160015).openMe();
doorTable.getDoor(19160016).openMe();
doorTable.getDoor(19160017).openMe();
doorTable.getDoor(24190001).openMe();
doorTable.getDoor(24190002).openMe();
doorTable.getDoor(24190003).openMe();
doorTable.getDoor(24190004).openMe();
doorTable.getDoor(23180001).openMe();
doorTable.getDoor(23180002).openMe();
doorTable.getDoor(23180003).openMe();
doorTable.getDoor(23180004).openMe();
doorTable.getDoor(23180005).openMe();
doorTable.getDoor(23180006).openMe();
doorTable.checkAutoOpen();
}
catch (NullPointerException e)
{
LOGGER.info("There are errors in Doors.xml file, or missing doors.");
}
// Schedule auto opening/closing doors.
DoorData.getInstance().checkAutoOpen();
Util.printSection("Scripts");
if (!Config.ALT_DEV_NO_SCRIPT)

View File

@ -74,7 +74,7 @@ public class DoorData implements IXmlReader
set.set(attr.getNodeName(), attr.getNodeValue());
}
final DoorInstance door = parseList(set);
final DoorInstance door = createDoor(set);
DOORS.put(door.getDoorId(), door);
door.spawnMe(door.getX(), door.getY(), door.getZ());
final ClanHall clanhall = ClanHallManager.getInstance().getNearbyClanHall(door.getX(), door.getY(), 500);
@ -91,7 +91,7 @@ public class DoorData implements IXmlReader
}
}
public static DoorInstance parseList(StatsSet set)
public static DoorInstance createDoor(StatsSet set)
{
final String name = set.getString("name");
final int id = set.getInt("id");
@ -108,7 +108,7 @@ public class DoorData implements IXmlReader
final int pDef = set.getInt("pDef");
final int mDef = set.getInt("mDef");
final boolean unlockable = set.getBoolean("unlockable", false);
final boolean autoOpen = set.getBoolean("autoOpen", false);
final boolean isOpen = set.getBoolean("isOpen", false);
if (xMin > xMax)
{
@ -192,7 +192,7 @@ public class DoorData implements IXmlReader
LOGGER.warning("Error in door data, ID:" + id + " " + e);
}
door.setCurrentHpMp(door.getMaxHp(), door.getMaxMp());
door.setOpen(autoOpen);
door.setOpen(isOpen);
door.setXYZInvisible(x, y, z);
return door;

View File

@ -527,7 +527,7 @@ public class ClanHall
if (door.getCurrentHp() <= 0)
{
door.decayMe(); // Kill current if not killed already
door = DoorData.parseList(_doorDefault.get(i));
door = DoorData.createDoor(_doorDefault.get(i));
door.spawnMe(door.getX(), door.getY(), door.getZ());
getDoors().set(i, door);
@ -883,7 +883,7 @@ public class ClanHall
set.set("mDef", rs.getInt("mDef"));
_doorDefault.add(set);
final DoorInstance door = DoorData.parseList(_doorDefault.get(_doorDefault.size() - 1));
final DoorInstance door = DoorData.createDoor(set);
door.spawnMe(door.getX(), door.getY(), door.getZ());
_doors.add(door);
DoorData.getInstance().putDoor(door);

View File

@ -454,7 +454,7 @@ public class Castle
if (door.getCurrentHp() <= 0)
{
door.decayMe(); // Kill current if not killed already
door = DoorData.parseList(_doorDefault.get(i));
door = DoorData.createDoor(_doorDefault.get(i));
if (isDoorWeak)
{
@ -588,7 +588,7 @@ public class Castle
set.set("mDef", rs.getInt("mDef"));
_doorDefault.add(set);
final DoorInstance door = DoorData.parseList(_doorDefault.get(_doorDefault.size() - 1));
final DoorInstance door = DoorData.createDoor(set);
door.spawnMe(door.getX(), door.getY(), door.getZ());
_doors.add(door);
DoorData.getInstance().putDoor(door);

View File

@ -287,7 +287,7 @@ public class Fort
if (door.getCurrentHp() >= 0)
{
door.decayMe(); // Kill current if not killed already
door = DoorData.parseList(_doorDefault.get(i));
door = DoorData.createDoor(_doorDefault.get(i));
if (isDoorWeak)
{
@ -413,11 +413,9 @@ public class Fort
set.set("mDef", rs.getInt("mDef"));
_doorDefault.add(set);
final DoorInstance door = DoorData.parseList(_doorDefault.get(_doorDefault.size() - 1));
final DoorInstance door = DoorData.createDoor(set);
door.spawnMe(door.getX(), door.getY(), door.getZ());
_doors.add(door);
DoorData.getInstance().putDoor(door);
}