Clean up MapleMap
This commit is contained in:
@@ -82,29 +82,30 @@ public class MapleMap {
|
|||||||
private static final List<MapleMapObjectType> rangedMapobjectTypes = Arrays.asList(MapleMapObjectType.SHOP, MapleMapObjectType.ITEM, MapleMapObjectType.NPC, MapleMapObjectType.MONSTER, MapleMapObjectType.DOOR, MapleMapObjectType.SUMMON, MapleMapObjectType.REACTOR);
|
private static final List<MapleMapObjectType> rangedMapobjectTypes = Arrays.asList(MapleMapObjectType.SHOP, MapleMapObjectType.ITEM, MapleMapObjectType.NPC, MapleMapObjectType.MONSTER, MapleMapObjectType.DOOR, MapleMapObjectType.SUMMON, MapleMapObjectType.REACTOR);
|
||||||
private static final Map<Integer, Pair<Integer, Integer>> dropBoundsCache = new HashMap<>(100);
|
private static final Map<Integer, Pair<Integer, Integer>> dropBoundsCache = new HashMap<>(100);
|
||||||
|
|
||||||
private Map<Integer, MapleMapObject> mapobjects = new LinkedHashMap<>();
|
private final Map<Integer, MapleMapObject> mapobjects = new LinkedHashMap<>();
|
||||||
private Set<Integer> selfDestructives = new LinkedHashSet<>();
|
private final Set<Integer> selfDestructives = new LinkedHashSet<>();
|
||||||
private Collection<SpawnPoint> monsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
private final Collection<SpawnPoint> monsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
||||||
private Collection<SpawnPoint> allMonsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
private final Collection<SpawnPoint> allMonsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
||||||
private AtomicInteger spawnedMonstersOnMap = new AtomicInteger(0);
|
private final AtomicInteger spawnedMonstersOnMap = new AtomicInteger(0);
|
||||||
private AtomicInteger droppedItemCount = new AtomicInteger(0);
|
private final AtomicInteger droppedItemCount = new AtomicInteger(0);
|
||||||
private Collection<Character> characters = new LinkedHashSet<>();
|
private final Collection<Character> characters = new LinkedHashSet<>();
|
||||||
private Map<Integer, Set<Integer>> mapParty = new LinkedHashMap<>();
|
private final Map<Integer, Set<Integer>> mapParty = new LinkedHashMap<>();
|
||||||
private Map<Integer, MaplePortal> portals = new HashMap<>();
|
private final Map<Integer, MaplePortal> portals = new HashMap<>();
|
||||||
private Map<Integer, Integer> backgroundTypes = new HashMap<>();
|
private final Map<Integer, Integer> backgroundTypes = new HashMap<>();
|
||||||
private Map<String, Integer> environment = new LinkedHashMap<>();
|
private final Map<String, Integer> environment = new LinkedHashMap<>();
|
||||||
private Map<MapleMapItem, Long> droppedItems = new LinkedHashMap<>();
|
private final Map<MapleMapItem, Long> droppedItems = new LinkedHashMap<>();
|
||||||
private LinkedList<WeakReference<MapleMapObject>> registeredDrops = new LinkedList<>();
|
private final LinkedList<WeakReference<MapleMapObject>> registeredDrops = new LinkedList<>();
|
||||||
private Map<MobLootEntry, Long> mobLootEntries = new HashMap(20);
|
private final Map<MobLootEntry, Long> mobLootEntries = new HashMap(20);
|
||||||
private List<Runnable> statUpdateRunnables = new ArrayList(50);
|
private final List<Runnable> statUpdateRunnables = new ArrayList(50);
|
||||||
private List<Rectangle> areas = new ArrayList<>();
|
private final List<Rectangle> areas = new ArrayList<>();
|
||||||
private FootholdTree footholds = null;
|
private FootholdTree footholds = null;
|
||||||
private Pair<Integer, Integer> xLimits; // caches the min and max x's with available footholds
|
private Pair<Integer, Integer> xLimits; // caches the min and max x's with available footholds
|
||||||
private Rectangle mapArea = new Rectangle();
|
private final Rectangle mapArea = new Rectangle();
|
||||||
private int mapid;
|
private final int mapid;
|
||||||
private AtomicInteger runningOid = new AtomicInteger(1000000001);
|
private final AtomicInteger runningOid = new AtomicInteger(1000000001);
|
||||||
private int returnMapId;
|
private final int returnMapId;
|
||||||
private int channel, world;
|
private final int channel;
|
||||||
|
private final int world;
|
||||||
private int seats;
|
private int seats;
|
||||||
private byte monsterRate;
|
private byte monsterRate;
|
||||||
private boolean clock;
|
private boolean clock;
|
||||||
@@ -156,12 +157,12 @@ public class MapleMap {
|
|||||||
private int timeExpand;
|
private int timeExpand;
|
||||||
|
|
||||||
//locks
|
//locks
|
||||||
private MonitoredReadLock chrRLock;
|
private final MonitoredReadLock chrRLock;
|
||||||
private MonitoredWriteLock chrWLock;
|
private final MonitoredWriteLock chrWLock;
|
||||||
private MonitoredReadLock objectRLock;
|
private final MonitoredReadLock objectRLock;
|
||||||
private MonitoredWriteLock objectWLock;
|
private final MonitoredWriteLock objectWLock;
|
||||||
|
|
||||||
private Lock lootLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MAP_LOOT, true);
|
private final Lock lootLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MAP_LOOT, true);
|
||||||
|
|
||||||
// due to the nature of loadMapFromWz (synchronized), sole function that calls 'generateMapDropRangeCache', this lock remains optional.
|
// due to the nature of loadMapFromWz (synchronized), sole function that calls 'generateMapDropRangeCache', this lock remains optional.
|
||||||
private static final Lock bndLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MAP_BOUNDS, true);
|
private static final Lock bndLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MAP_BOUNDS, true);
|
||||||
@@ -3331,7 +3332,7 @@ public class MapleMap {
|
|||||||
chrRLock.lock();
|
chrRLock.lock();
|
||||||
try {
|
try {
|
||||||
for (Character chr : this.characters) {
|
for (Character chr : this.characters) {
|
||||||
if (chr.getName().toLowerCase().equals(name.toLowerCase())) {
|
if (chr.getName().equalsIgnoreCase(name)) {
|
||||||
return chr;
|
return chr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3369,16 +3370,16 @@ public class MapleMap {
|
|||||||
|
|
||||||
private class MobLootEntry implements Runnable {
|
private class MobLootEntry implements Runnable {
|
||||||
|
|
||||||
private byte droptype;
|
private final byte droptype;
|
||||||
private int mobpos;
|
private final int mobpos;
|
||||||
private int chRate;
|
private final int chRate;
|
||||||
private Point pos;
|
private final Point pos;
|
||||||
private List<MonsterDropEntry> dropEntry;
|
private final List<MonsterDropEntry> dropEntry;
|
||||||
private List<MonsterDropEntry> visibleQuestEntry;
|
private final List<MonsterDropEntry> visibleQuestEntry;
|
||||||
private List<MonsterDropEntry> otherQuestEntry;
|
private final List<MonsterDropEntry> otherQuestEntry;
|
||||||
private List<MonsterGlobalDropEntry> globalEntry;
|
private final List<MonsterGlobalDropEntry> globalEntry;
|
||||||
private Character chr;
|
private final Character chr;
|
||||||
private Monster mob;
|
private final Monster mob;
|
||||||
|
|
||||||
protected MobLootEntry(byte droptype, int mobpos, int chRate, Point pos, List<MonsterDropEntry> dropEntry, List<MonsterDropEntry> visibleQuestEntry, List<MonsterDropEntry> otherQuestEntry, List<MonsterGlobalDropEntry> globalEntry, Character chr, Monster mob) {
|
protected MobLootEntry(byte droptype, int mobpos, int chRate, Point pos, List<MonsterDropEntry> dropEntry, List<MonsterDropEntry> visibleQuestEntry, List<MonsterDropEntry> otherQuestEntry, List<MonsterGlobalDropEntry> globalEntry, Character chr, Monster mob) {
|
||||||
this.droptype = droptype;
|
this.droptype = droptype;
|
||||||
@@ -3411,9 +3412,9 @@ public class MapleMap {
|
|||||||
|
|
||||||
private class ActivateItemReactor implements Runnable {
|
private class ActivateItemReactor implements Runnable {
|
||||||
|
|
||||||
private MapleMapItem mapitem;
|
private final MapleMapItem mapitem;
|
||||||
private MapleReactor reactor;
|
private final MapleReactor reactor;
|
||||||
private Client c;
|
private final Client c;
|
||||||
|
|
||||||
public ActivateItemReactor(MapleMapItem mapitem, MapleReactor reactor, Client c) {
|
public ActivateItemReactor(MapleMapItem mapitem, MapleReactor reactor, Client c) {
|
||||||
this.mapitem = mapitem;
|
this.mapitem = mapitem;
|
||||||
@@ -4149,8 +4150,8 @@ public class MapleMap {
|
|||||||
private final List<GuardianSpawnPoint> guardianSpawns = new LinkedList<>();
|
private final List<GuardianSpawnPoint> guardianSpawns = new LinkedList<>();
|
||||||
private final List<MCSkill> blueTeamBuffs = new ArrayList();
|
private final List<MCSkill> blueTeamBuffs = new ArrayList();
|
||||||
private final List<MCSkill> redTeamBuffs = new ArrayList();
|
private final List<MCSkill> redTeamBuffs = new ArrayList();
|
||||||
private List<Integer> skillIds = new ArrayList();
|
private final List<Integer> skillIds = new ArrayList();
|
||||||
private List<Pair<Integer, Integer>> mobsToSpawn = new ArrayList();
|
private final List<Pair<Integer, Integer>> mobsToSpawn = new ArrayList();
|
||||||
|
|
||||||
public List<MCSkill> getBlueTeamBuffs() {
|
public List<MCSkill> getBlueTeamBuffs() {
|
||||||
return blueTeamBuffs;
|
return blueTeamBuffs;
|
||||||
@@ -4314,7 +4315,9 @@ public class MapleMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void buffMonsters(int team, MCSkill skill) {
|
public void buffMonsters(int team, MCSkill skill) {
|
||||||
if (skill == null) return;
|
if (skill == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (team == 0) {
|
if (team == 0) {
|
||||||
redTeamBuffs.add(skill);
|
redTeamBuffs.add(skill);
|
||||||
|
|||||||
Reference in New Issue
Block a user