Reformat and clean up "server" package
This commit is contained in:
@@ -49,6 +49,6 @@ public class ChangeableStats extends OverrideMonsterStats {
|
||||
}
|
||||
|
||||
public ChangeableStats(MonsterStats stats, float statModifier, boolean pqMob) {
|
||||
this(stats, (int)(statModifier * stats.getLevel()), pqMob);
|
||||
this(stats, (int) (statModifier * stats.getLevel()), pqMob);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,21 +24,22 @@ package server.life;
|
||||
public enum Element {
|
||||
NEUTRAL(0), PHYSICAL(1), FIRE(2, true), ICE(3, true), LIGHTING(4), POISON(5), HOLY(6, true), DARKNESS(7);
|
||||
|
||||
private int value;
|
||||
private final int value;
|
||||
private boolean special = false;
|
||||
private Element(int v) {
|
||||
this.value = v;
|
||||
|
||||
Element(int v) {
|
||||
this.value = v;
|
||||
}
|
||||
|
||||
private Element(int v, boolean special) {
|
||||
this.value = v;
|
||||
this.special = special;
|
||||
Element(int v, boolean special) {
|
||||
this.value = v;
|
||||
this.special = special;
|
||||
}
|
||||
|
||||
public boolean isSpecial() {
|
||||
return special;
|
||||
return special;
|
||||
}
|
||||
|
||||
|
||||
public static Element getFromChar(char c) {
|
||||
switch (Character.toUpperCase(c)) {
|
||||
case 'F':
|
||||
@@ -52,14 +53,14 @@ public enum Element {
|
||||
case 'H':
|
||||
return HOLY;
|
||||
case 'D':
|
||||
return DARKNESS;
|
||||
return DARKNESS;
|
||||
case 'P':
|
||||
return NEUTRAL;
|
||||
}
|
||||
throw new IllegalArgumentException("unknown elemnt char " + c);
|
||||
}
|
||||
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
package server.life;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Danny (Leifde)
|
||||
*/
|
||||
public class MobAttackInfo {
|
||||
|
||||
@@ -32,12 +32,11 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Danny (Leifde)
|
||||
*/
|
||||
public class MobAttackInfoFactory {
|
||||
private static Map<String, MobAttackInfo> mobAttacks = new HashMap<>();
|
||||
private static DataProvider dataSource = DataProviderFactory.getDataProvider(WZFiles.MOB);
|
||||
private static final Map<String, MobAttackInfo> mobAttacks = new HashMap<>();
|
||||
private static final DataProvider dataSource = DataProviderFactory.getDataProvider(WZFiles.MOB);
|
||||
|
||||
public static MobAttackInfo getMobAttackInfo(Monster mob, int attack) {
|
||||
MobAttackInfo ret = mobAttacks.get(mob.getId() + "" + attack);
|
||||
@@ -55,11 +54,11 @@ public class MobAttackInfoFactory {
|
||||
mobData = dataSource.getData(StringUtil.getLeftPaddedStr(linkedmob + ".img", '0', 11));
|
||||
}
|
||||
Data attackData = mobData.getChildByPath("attack" + (attack + 1) + "/info");
|
||||
|
||||
|
||||
if (attackData == null) {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Data deadlyAttack = attackData.getChildByPath("deadlyAttack");
|
||||
int mpBurn = DataTool.getInt("mpBurn", attackData, 0);
|
||||
int disease = DataTool.getInt("disease", attackData, 0);
|
||||
@@ -70,7 +69,7 @@ public class MobAttackInfoFactory {
|
||||
ret.setMpBurn(mpBurn);
|
||||
ret.setDiseaseSkill(disease);
|
||||
ret.setDiseaseLevel(level);
|
||||
ret.setMpCon(mpCon);
|
||||
ret.setMpCon(mpCon);
|
||||
}
|
||||
mobAttacks.put(mob.getId() + "" + attack, ret);
|
||||
}
|
||||
|
||||
@@ -39,13 +39,14 @@ import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Danny (Leifde)
|
||||
*/
|
||||
public class MobSkill {
|
||||
|
||||
private int skillId, skillLevel, mpCon;
|
||||
private List<Integer> toSummon = new ArrayList<>();
|
||||
private final int skillId;
|
||||
private final int skillLevel;
|
||||
private int mpCon;
|
||||
private final List<Integer> toSummon = new ArrayList<>();
|
||||
private int spawnEffect, hp, x, y, count;
|
||||
private long duration, cooltime;
|
||||
private float prop;
|
||||
@@ -251,7 +252,7 @@ public class MobSkill {
|
||||
int summonLimit = monster.countAvailableMobSummons(summons.size(), skillLimit);
|
||||
if (summonLimit >= 1) {
|
||||
boolean bossRushMap = GameConstants.isBossRush(map.getId());
|
||||
|
||||
|
||||
Collections.shuffle(summons);
|
||||
for (Integer mobId : summons.subList(0, summonLimit)) {
|
||||
Monster toSpawn = LifeFactory.getMonster(mobId);
|
||||
|
||||
@@ -40,14 +40,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Danny (Leifde)
|
||||
*/
|
||||
public class MobSkillFactory {
|
||||
|
||||
private static Map<String, MobSkill> mobSkills = new HashMap<>();
|
||||
private static final Map<String, MobSkill> mobSkills = new HashMap<>();
|
||||
private final static DataProvider dataSource = DataProviderFactory.getDataProvider(WZFiles.SKILL);
|
||||
private static Data skillRoot = dataSource.getData("MobSkill.img");
|
||||
private static final Data skillRoot = dataSource.getData("MobSkill.img");
|
||||
private final static MonitoredReentrantReadWriteLock dataLock = new MonitoredReentrantReadWriteLock(MonitoredLockType.MOBSKILL_FACTORY);
|
||||
private final static MonitoredReadLock rL = MonitoredReadLockFactory.createLock(dataLock);
|
||||
private final static MonitoredWriteLock wL = MonitoredWriteLockFactory.createLock(dataLock);
|
||||
|
||||
@@ -21,18 +21,18 @@
|
||||
package server.life;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LightPepsi
|
||||
*/
|
||||
|
||||
public class MonsterDropEntry {
|
||||
public MonsterDropEntry(int itemId, int chance, int Minimum, int Maximum, short questid) {
|
||||
this.itemId = itemId;
|
||||
this.chance = chance;
|
||||
this.questid = questid;
|
||||
this.Minimum = Minimum;
|
||||
this.Maximum = Maximum;
|
||||
this.itemId = itemId;
|
||||
this.chance = chance;
|
||||
this.questid = questid;
|
||||
this.Minimum = Minimum;
|
||||
this.Maximum = Maximum;
|
||||
}
|
||||
|
||||
public short questid;
|
||||
public int itemId, chance, Minimum, Maximum;
|
||||
}
|
||||
@@ -21,18 +21,18 @@
|
||||
package server.life;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LightPepsi
|
||||
*/
|
||||
public class MonsterGlobalDropEntry {
|
||||
public MonsterGlobalDropEntry(int itemId, int chance, int continent, int Minimum, int Maximum, short questid) {
|
||||
this.itemId = itemId;
|
||||
this.chance = chance;
|
||||
this.questid = questid;
|
||||
this.continentid = continent;
|
||||
this.Minimum = Minimum;
|
||||
this.Maximum = Maximum;
|
||||
this.itemId = itemId;
|
||||
this.chance = chance;
|
||||
this.questid = questid;
|
||||
this.continentid = continent;
|
||||
this.Minimum = Minimum;
|
||||
this.Maximum = Maximum;
|
||||
}
|
||||
|
||||
public int itemId, chance, Minimum, Maximum, continentid;
|
||||
public short questid;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package server.life;
|
||||
|
||||
import client.Character;
|
||||
|
||||
public interface MonsterListener {
|
||||
|
||||
|
||||
void monsterKilled(int aniTime);
|
||||
void monsterDamaged(Character from, int trueDmg);
|
||||
void monsterHealed(int trueHeal);
|
||||
|
||||
@@ -28,12 +28,17 @@ import java.awt.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class SpawnPoint {
|
||||
private int monster, mobTime, team, fh, f;
|
||||
private Point pos;
|
||||
private final int monster;
|
||||
private final int mobTime;
|
||||
private final int team;
|
||||
private final int fh;
|
||||
private final int f;
|
||||
private final Point pos;
|
||||
private long nextPossibleSpawn;
|
||||
private int mobInterval = 5000;
|
||||
private AtomicInteger spawnedMonsters = new AtomicInteger(0);
|
||||
private boolean immobile, denySpawn = false;
|
||||
private final AtomicInteger spawnedMonsters = new AtomicInteger(0);
|
||||
private final boolean immobile;
|
||||
private boolean denySpawn = false;
|
||||
|
||||
public SpawnPoint(final Monster monster, Point pos, boolean immobile, int mobTime, int mobInterval, int team) {
|
||||
this.monster = monster.getId();
|
||||
@@ -46,34 +51,30 @@ public class SpawnPoint {
|
||||
this.mobInterval = mobInterval;
|
||||
this.nextPossibleSpawn = Server.getInstance().getCurrentTime();
|
||||
}
|
||||
|
||||
|
||||
public int getSpawned() {
|
||||
return spawnedMonsters.intValue();
|
||||
}
|
||||
|
||||
|
||||
public void setDenySpawn(boolean val) {
|
||||
denySpawn = val;
|
||||
}
|
||||
|
||||
|
||||
public boolean getDenySpawn() {
|
||||
return denySpawn;
|
||||
}
|
||||
|
||||
public boolean shouldSpawn() {
|
||||
if (denySpawn || mobTime < 0 || spawnedMonsters.get() > 0) {
|
||||
if (denySpawn || mobTime < 0 || spawnedMonsters.get() > 0) {
|
||||
return false;
|
||||
}
|
||||
return nextPossibleSpawn <= Server.getInstance().getCurrentTime();
|
||||
}
|
||||
|
||||
public boolean shouldForceSpawn() {
|
||||
if (mobTime < 0 || spawnedMonsters.get() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return mobTime >= 0 && spawnedMonsters.get() <= 0;
|
||||
}
|
||||
|
||||
|
||||
public Monster getMonster() {
|
||||
Monster mob = new Monster(LifeFactory.getMonster(monster));
|
||||
mob.setPosition(new Point(pos));
|
||||
@@ -92,10 +93,10 @@ public class SpawnPoint {
|
||||
}
|
||||
spawnedMonsters.decrementAndGet();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void monsterDamaged(Character from, int trueDmg) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void monsterHealed(int trueHeal) {}
|
||||
});
|
||||
@@ -104,7 +105,7 @@ public class SpawnPoint {
|
||||
}
|
||||
return mob;
|
||||
}
|
||||
|
||||
|
||||
public int getMonsterId() {
|
||||
return monster;
|
||||
}
|
||||
@@ -120,11 +121,11 @@ public class SpawnPoint {
|
||||
public final int getFh() {
|
||||
return fh;
|
||||
}
|
||||
|
||||
|
||||
public int getMobTime() {
|
||||
return mobTime;
|
||||
}
|
||||
|
||||
|
||||
public int getTeam() {
|
||||
return team;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user