Rename and clean up MapleStat
This commit is contained in:
@@ -48,7 +48,7 @@ public abstract class AbstractCharacterObject extends AbstractAnimatedMapleMapOb
|
||||
protected float transienthp = Float.NEGATIVE_INFINITY, transientmp = Float.NEGATIVE_INFINITY;
|
||||
|
||||
private AbstractCharacterListener listener = null;
|
||||
protected Map<MapleStat, Integer> statUpdates = new HashMap<>();
|
||||
protected Map<Stat, Integer> statUpdates = new HashMap<>();
|
||||
|
||||
protected Lock effLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EFF, true);
|
||||
protected MonitoredReadLock statRlock;
|
||||
@@ -332,13 +332,13 @@ public abstract class AbstractCharacterObject extends AbstractAnimatedMapleMapOb
|
||||
|
||||
poolUpdate = true;
|
||||
setMaxHp(newMaxHp);
|
||||
statUpdates.put(MapleStat.MAXHP, clientmaxhp);
|
||||
statUpdates.put(MapleStat.HP, hp);
|
||||
statUpdates.put(Stat.MAXHP, clientmaxhp);
|
||||
statUpdates.put(Stat.HP, hp);
|
||||
}
|
||||
|
||||
if (newHp != Short.MIN_VALUE) {
|
||||
setHp(newHp);
|
||||
statUpdates.put(MapleStat.HP, hp);
|
||||
statUpdates.put(Stat.HP, hp);
|
||||
}
|
||||
|
||||
if (newMaxMp != Short.MIN_VALUE) {
|
||||
@@ -348,13 +348,13 @@ public abstract class AbstractCharacterObject extends AbstractAnimatedMapleMapOb
|
||||
|
||||
poolUpdate = true;
|
||||
setMaxMp(newMaxMp);
|
||||
statUpdates.put(MapleStat.MAXMP, clientmaxmp);
|
||||
statUpdates.put(MapleStat.MP, mp);
|
||||
statUpdates.put(Stat.MAXMP, clientmaxmp);
|
||||
statUpdates.put(Stat.MP, mp);
|
||||
}
|
||||
|
||||
if (newMp != Short.MIN_VALUE) {
|
||||
setMp(newMp);
|
||||
statUpdates.put(MapleStat.MP, mp);
|
||||
statUpdates.put(Stat.MP, mp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,27 +366,27 @@ public abstract class AbstractCharacterObject extends AbstractAnimatedMapleMapOb
|
||||
|
||||
if (newStr >= 4) {
|
||||
setStr(newStr);
|
||||
statUpdates.put(MapleStat.STR, str);
|
||||
statUpdates.put(Stat.STR, str);
|
||||
}
|
||||
|
||||
if (newDex >= 4) {
|
||||
setDex(newDex);
|
||||
statUpdates.put(MapleStat.DEX, dex);
|
||||
statUpdates.put(Stat.DEX, dex);
|
||||
}
|
||||
|
||||
if (newInt >= 4) {
|
||||
setInt(newInt);
|
||||
statUpdates.put(MapleStat.INT, int_);
|
||||
statUpdates.put(Stat.INT, int_);
|
||||
}
|
||||
|
||||
if (newLuk >= 4) {
|
||||
setLuk(newLuk);
|
||||
statUpdates.put(MapleStat.LUK, luk);
|
||||
statUpdates.put(Stat.LUK, luk);
|
||||
}
|
||||
|
||||
if (newAp >= 0) {
|
||||
setRemainingAp(newAp);
|
||||
statUpdates.put(MapleStat.AVAILABLEAP, remainingAp);
|
||||
statUpdates.put(Stat.AVAILABLEAP, remainingAp);
|
||||
}
|
||||
|
||||
statUpdate = true;
|
||||
@@ -397,7 +397,7 @@ public abstract class AbstractCharacterObject extends AbstractAnimatedMapleMapOb
|
||||
short skillbook = newSp.shortValue();
|
||||
|
||||
setRemainingSp(sp, skillbook);
|
||||
statUpdates.put(MapleStat.AVAILABLESP, remainingSp[skillbook]);
|
||||
statUpdates.put(Stat.AVAILABLESP, remainingSp[skillbook]);
|
||||
}
|
||||
|
||||
if (!statUpdates.isEmpty()) {
|
||||
|
||||
@@ -268,19 +268,19 @@ public class Character extends AbstractCharacterObject {
|
||||
|
||||
@Override
|
||||
public void onHpmpPoolUpdate() {
|
||||
List<Pair<MapleStat, Integer>> hpmpupdate = recalcLocalStats();
|
||||
for (Pair<MapleStat, Integer> p : hpmpupdate) {
|
||||
List<Pair<Stat, Integer>> hpmpupdate = recalcLocalStats();
|
||||
for (Pair<Stat, Integer> p : hpmpupdate) {
|
||||
statUpdates.put(p.getLeft(), p.getRight());
|
||||
}
|
||||
|
||||
if (hp > localmaxhp) {
|
||||
setHp(localmaxhp);
|
||||
statUpdates.put(MapleStat.HP, hp);
|
||||
statUpdates.put(Stat.HP, hp);
|
||||
}
|
||||
|
||||
if (mp > localmaxmp) {
|
||||
setMp(localmaxmp);
|
||||
statUpdates.put(MapleStat.MP, mp);
|
||||
statUpdates.put(Stat.MP, mp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,8 +291,8 @@ public class Character extends AbstractCharacterObject {
|
||||
|
||||
@Override
|
||||
public void onAnnounceStatPoolUpdate() {
|
||||
List<Pair<MapleStat, Integer>> statup = new ArrayList<>(8);
|
||||
for (Map.Entry<MapleStat, Integer> s : statUpdates.entrySet()) {
|
||||
List<Pair<Stat, Integer>> statup = new ArrayList<>(8);
|
||||
for (Map.Entry<Stat, Integer> s : statUpdates.entrySet()) {
|
||||
statup.add(new Pair<>(s.getKey(), s.getValue()));
|
||||
}
|
||||
|
||||
@@ -1129,14 +1129,14 @@ public class Character extends AbstractCharacterObject {
|
||||
addMaxMPMaxHP(addhp, addmp, true);
|
||||
recalcLocalStats();
|
||||
|
||||
List<Pair<MapleStat, Integer>> statup = new ArrayList<>(7);
|
||||
statup.add(new Pair<>(MapleStat.HP, hp));
|
||||
statup.add(new Pair<>(MapleStat.MP, mp));
|
||||
statup.add(new Pair<>(MapleStat.MAXHP, clientmaxhp));
|
||||
statup.add(new Pair<>(MapleStat.MAXMP, clientmaxmp));
|
||||
statup.add(new Pair<>(MapleStat.AVAILABLEAP, remainingAp));
|
||||
statup.add(new Pair<>(MapleStat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())]));
|
||||
statup.add(new Pair<>(MapleStat.JOB, job.getId()));
|
||||
List<Pair<Stat, Integer>> statup = new ArrayList<>(7);
|
||||
statup.add(new Pair<>(Stat.HP, hp));
|
||||
statup.add(new Pair<>(Stat.MP, mp));
|
||||
statup.add(new Pair<>(Stat.MAXHP, clientmaxhp));
|
||||
statup.add(new Pair<>(Stat.MAXMP, clientmaxmp));
|
||||
statup.add(new Pair<>(Stat.AVAILABLEAP, remainingAp));
|
||||
statup.add(new Pair<>(Stat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())]));
|
||||
statup.add(new Pair<>(Stat.JOB, job.getId()));
|
||||
sendPacket(PacketCreator.updatePlayerStats(statup, true, this));
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
@@ -3032,11 +3032,11 @@ public class Character extends AbstractCharacterObject {
|
||||
expgain = this.gachaexp.getAndSet(0);
|
||||
}
|
||||
gainExp(expgain, false, true);
|
||||
updateSingleStat(MapleStat.GACHAEXP, this.gachaexp.get());
|
||||
updateSingleStat(Stat.GACHAEXP, this.gachaexp.get());
|
||||
}
|
||||
|
||||
public void addGachaExp(int gain) {
|
||||
updateSingleStat(MapleStat.GACHAEXP, gachaexp.addAndGet(gain));
|
||||
updateSingleStat(Stat.GACHAEXP, gachaexp.addAndGet(gain));
|
||||
}
|
||||
|
||||
public void gainExp(int gain) {
|
||||
@@ -3104,7 +3104,7 @@ public class Character extends AbstractCharacterObject {
|
||||
total = Integer.MAX_VALUE - exp.get();
|
||||
leftover = nextExp - Integer.MAX_VALUE;
|
||||
}
|
||||
updateSingleStat(MapleStat.EXP, exp.addAndGet((int) total));
|
||||
updateSingleStat(Stat.EXP, exp.addAndGet((int) total));
|
||||
if (show) {
|
||||
announceExpGain(gain, equip, party, inChat, white);
|
||||
}
|
||||
@@ -3112,7 +3112,7 @@ public class Character extends AbstractCharacterObject {
|
||||
levelUp(true);
|
||||
if (level == getMaxLevel()) {
|
||||
setExp(0);
|
||||
updateSingleStat(MapleStat.EXP, 0);
|
||||
updateSingleStat(Stat.EXP, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3151,7 +3151,7 @@ public class Character extends AbstractCharacterObject {
|
||||
delta = fameRes.getRight();
|
||||
if (delta != 0) {
|
||||
int thisFame = fameRes.getLeft();
|
||||
updateSingleStat(MapleStat.FAME, thisFame);
|
||||
updateSingleStat(Stat.FAME, thisFame);
|
||||
|
||||
if (fromPlayer != null) {
|
||||
fromPlayer.sendPacket(PacketCreator.giveFameResponse(mode, getName(), thisFame));
|
||||
@@ -3195,7 +3195,7 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
|
||||
if (gain != 0) {
|
||||
updateSingleStat(MapleStat.MESO, (int) nextMeso, enableActions);
|
||||
updateSingleStat(Stat.MESO, (int) nextMeso, enableActions);
|
||||
if (show) {
|
||||
sendPacket(PacketCreator.getShowMesoGain(gain, inChat));
|
||||
}
|
||||
@@ -6431,17 +6431,17 @@ public class Character extends AbstractCharacterObject {
|
||||
recalcLocalStats();
|
||||
changeHpMp(localmaxhp, localmaxmp, true);
|
||||
|
||||
List<Pair<MapleStat, Integer>> statup = new ArrayList<>(10);
|
||||
statup.add(new Pair<>(MapleStat.AVAILABLEAP, remainingAp));
|
||||
statup.add(new Pair<>(MapleStat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())]));
|
||||
statup.add(new Pair<>(MapleStat.HP, hp));
|
||||
statup.add(new Pair<>(MapleStat.MP, mp));
|
||||
statup.add(new Pair<>(MapleStat.EXP, exp.get()));
|
||||
statup.add(new Pair<>(MapleStat.LEVEL, level));
|
||||
statup.add(new Pair<>(MapleStat.MAXHP, clientmaxhp));
|
||||
statup.add(new Pair<>(MapleStat.MAXMP, clientmaxmp));
|
||||
statup.add(new Pair<>(MapleStat.STR, str));
|
||||
statup.add(new Pair<>(MapleStat.DEX, dex));
|
||||
List<Pair<Stat, Integer>> statup = new ArrayList<>(10);
|
||||
statup.add(new Pair<>(Stat.AVAILABLEAP, remainingAp));
|
||||
statup.add(new Pair<>(Stat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())]));
|
||||
statup.add(new Pair<>(Stat.HP, hp));
|
||||
statup.add(new Pair<>(Stat.MP, mp));
|
||||
statup.add(new Pair<>(Stat.EXP, exp.get()));
|
||||
statup.add(new Pair<>(Stat.LEVEL, level));
|
||||
statup.add(new Pair<>(Stat.MAXHP, clientmaxhp));
|
||||
statup.add(new Pair<>(Stat.MAXMP, clientmaxmp));
|
||||
statup.add(new Pair<>(Stat.STR, str));
|
||||
statup.add(new Pair<>(Stat.DEX, dex));
|
||||
|
||||
sendPacket(PacketCreator.updatePlayerStats(statup, true, this));
|
||||
} finally {
|
||||
@@ -7862,12 +7862,12 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
private List<Pair<MapleStat, Integer>> recalcLocalStats() {
|
||||
private List<Pair<Stat, Integer>> recalcLocalStats() {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
List<Pair<MapleStat, Integer>> hpmpupdate = new ArrayList<>(2);
|
||||
List<Pair<Stat, Integer>> hpmpupdate = new ArrayList<>(2);
|
||||
int oldlocalmaxhp = localmaxhp;
|
||||
int oldlocalmaxmp = localmaxmp;
|
||||
|
||||
@@ -7875,7 +7875,7 @@ public class Character extends AbstractCharacterObject {
|
||||
|
||||
if (YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) {
|
||||
if (localmaxhp != oldlocalmaxhp) {
|
||||
Pair<MapleStat, Integer> hpUpdate;
|
||||
Pair<Stat, Integer> hpUpdate;
|
||||
|
||||
if (transienthp == Float.NEGATIVE_INFINITY) {
|
||||
hpUpdate = calcHpRatioUpdate(localmaxhp, oldlocalmaxhp);
|
||||
@@ -7887,7 +7887,7 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
|
||||
if (localmaxmp != oldlocalmaxmp) {
|
||||
Pair<MapleStat, Integer> mpUpdate;
|
||||
Pair<Stat, Integer> mpUpdate;
|
||||
|
||||
if (transientmp == Float.NEGATIVE_INFINITY) {
|
||||
mpUpdate = calcMpRatioUpdate(localmaxmp, oldlocalmaxmp);
|
||||
@@ -7913,7 +7913,7 @@ public class Character extends AbstractCharacterObject {
|
||||
statWlock.lock();
|
||||
try {
|
||||
int oldmaxhp = localmaxhp;
|
||||
List<Pair<MapleStat, Integer>> hpmpupdate = recalcLocalStats();
|
||||
List<Pair<Stat, Integer>> hpmpupdate = recalcLocalStats();
|
||||
enforceMaxHpMp();
|
||||
|
||||
if (!hpmpupdate.isEmpty()) {
|
||||
@@ -9031,18 +9031,18 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
private Pair<MapleStat, Integer> calcHpRatioUpdate(int newHp, int oldHp) {
|
||||
private Pair<Stat, Integer> calcHpRatioUpdate(int newHp, int oldHp) {
|
||||
int delta = newHp - oldHp;
|
||||
this.hp = calcHpRatioUpdate(hp, oldHp, delta);
|
||||
|
||||
hpChangeAction(Short.MIN_VALUE);
|
||||
return new Pair<>(MapleStat.HP, hp);
|
||||
return new Pair<>(Stat.HP, hp);
|
||||
}
|
||||
|
||||
private Pair<MapleStat, Integer> calcMpRatioUpdate(int newMp, int oldMp) {
|
||||
private Pair<Stat, Integer> calcMpRatioUpdate(int newMp, int oldMp) {
|
||||
int delta = newMp - oldMp;
|
||||
this.mp = calcMpRatioUpdate(mp, oldMp, delta);
|
||||
return new Pair<>(MapleStat.MP, mp);
|
||||
return new Pair<>(Stat.MP, mp);
|
||||
}
|
||||
|
||||
private static int calcTransientRatio(float transientpoint) {
|
||||
@@ -9050,16 +9050,16 @@ public class Character extends AbstractCharacterObject {
|
||||
return !(ret <= 0 && transientpoint > 0.0f) ? ret : 1;
|
||||
}
|
||||
|
||||
private Pair<MapleStat, Integer> calcHpRatioTransient() {
|
||||
private Pair<Stat, Integer> calcHpRatioTransient() {
|
||||
this.hp = calcTransientRatio(transienthp * localmaxhp);
|
||||
|
||||
hpChangeAction(Short.MIN_VALUE);
|
||||
return new Pair<>(MapleStat.HP, hp);
|
||||
return new Pair<>(Stat.HP, hp);
|
||||
}
|
||||
|
||||
private Pair<MapleStat, Integer> calcMpRatioTransient() {
|
||||
private Pair<Stat, Integer> calcMpRatioTransient() {
|
||||
this.mp = calcTransientRatio(transientmp * localmaxmp);
|
||||
return new Pair<>(MapleStat.MP, mp);
|
||||
return new Pair<>(Stat.MP, mp);
|
||||
}
|
||||
|
||||
private int calcHpRatioUpdate(int curpoint, int maxpoint, int diffpoint) {
|
||||
@@ -10047,11 +10047,11 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSingleStat(MapleStat stat, int newval) {
|
||||
public void updateSingleStat(Stat stat, int newval) {
|
||||
updateSingleStat(stat, newval, false);
|
||||
}
|
||||
|
||||
private void updateSingleStat(MapleStat stat, int newval, boolean itemReaction) {
|
||||
private void updateSingleStat(Stat stat, int newval, boolean itemReaction) {
|
||||
sendPacket(PacketCreator.updatePlayerStats(Collections.singletonList(new Pair<>(stat, Integer.valueOf(newval))), itemReaction, this));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package client;
|
||||
|
||||
public enum MapleStat {
|
||||
|
||||
public enum Stat {
|
||||
SKIN(0x1),
|
||||
FACE(0x2),
|
||||
HAIR(0x4),
|
||||
@@ -45,7 +44,7 @@ public enum MapleStat {
|
||||
GACHAEXP(0x200000);
|
||||
private final int i;
|
||||
|
||||
private MapleStat(int i) {
|
||||
Stat(int i) {
|
||||
this.i = i;
|
||||
}
|
||||
|
||||
@@ -53,8 +52,8 @@ public enum MapleStat {
|
||||
return i;
|
||||
}
|
||||
|
||||
public static MapleStat getByValue(int value) {
|
||||
for (MapleStat stat : MapleStat.values()) {
|
||||
public static Stat getByValue(int value) {
|
||||
for (Stat stat : Stat.values()) {
|
||||
if (stat.getValue() == value) {
|
||||
return stat;
|
||||
}
|
||||
@@ -62,7 +61,7 @@ public enum MapleStat {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MapleStat getBy5ByteEncoding(int encoded) {
|
||||
public static Stat getBy5ByteEncoding(int encoded) {
|
||||
switch (encoded) {
|
||||
case 64:
|
||||
return STR;
|
||||
@@ -76,7 +75,7 @@ public enum MapleStat {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MapleStat getByString(String type) {
|
||||
public static Stat getByString(String type) {
|
||||
if (type.equals("SKIN")) {
|
||||
return SKIN;
|
||||
} else if (type.equals("FACE")) {
|
||||
@@ -25,7 +25,7 @@ package client.command.commands.gm2;
|
||||
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.MapleStat;
|
||||
import client.Stat;
|
||||
import client.command.Command;
|
||||
import config.YamlConfig;
|
||||
|
||||
@@ -45,8 +45,8 @@ public class MaxStatCommand extends Command {
|
||||
player.updateStrDexIntLuk(Short.MAX_VALUE);
|
||||
player.setFame(13337);
|
||||
player.updateMaxHpMaxMp(30000, 30000);
|
||||
player.updateSingleStat(MapleStat.LEVEL, 255);
|
||||
player.updateSingleStat(MapleStat.FAME, 13337);
|
||||
player.updateSingleStat(Stat.LEVEL, 255);
|
||||
player.updateSingleStat(Stat.FAME, 13337);
|
||||
player.yellowMessage("Stats maxed out.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ package client.command.commands.gm3;
|
||||
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.MapleStat;
|
||||
import client.Stat;
|
||||
import client.command.Command;
|
||||
import constants.inventory.ItemConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
@@ -52,7 +52,7 @@ public class FaceCommand extends Command {
|
||||
}
|
||||
|
||||
player.setFace(itemId);
|
||||
player.updateSingleStat(MapleStat.FACE, itemId);
|
||||
player.updateSingleStat(Stat.FACE, itemId);
|
||||
player.equipChanged();
|
||||
} else {
|
||||
int itemId = Integer.parseInt(params[1]);
|
||||
@@ -63,7 +63,7 @@ public class FaceCommand extends Command {
|
||||
Character victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim == null) {
|
||||
victim.setFace(itemId);
|
||||
victim.updateSingleStat(MapleStat.FACE, itemId);
|
||||
victim.updateSingleStat(Stat.FACE, itemId);
|
||||
victim.equipChanged();
|
||||
} else {
|
||||
player.yellowMessage("Player '" + params[0] + "' has not been found on this channel.");
|
||||
|
||||
@@ -25,7 +25,7 @@ package client.command.commands.gm3;
|
||||
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.MapleStat;
|
||||
import client.Stat;
|
||||
import client.command.Command;
|
||||
|
||||
public class FameCommand extends Command {
|
||||
@@ -44,7 +44,7 @@ public class FameCommand extends Command {
|
||||
Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
victim.setFame(Integer.parseInt(params[1]));
|
||||
victim.updateSingleStat(MapleStat.FAME, victim.getFame());
|
||||
victim.updateSingleStat(Stat.FAME, victim.getFame());
|
||||
player.message("FAME given.");
|
||||
} else {
|
||||
player.message("Player '" + params[0] + "' could not be found.");
|
||||
|
||||
@@ -25,7 +25,7 @@ package client.command.commands.gm3;
|
||||
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.MapleStat;
|
||||
import client.Stat;
|
||||
import client.command.Command;
|
||||
import constants.inventory.ItemConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
@@ -52,7 +52,7 @@ public class HairCommand extends Command {
|
||||
}
|
||||
|
||||
player.setHair(itemId);
|
||||
player.updateSingleStat(MapleStat.HAIR, itemId);
|
||||
player.updateSingleStat(Stat.HAIR, itemId);
|
||||
player.equipChanged();
|
||||
} else {
|
||||
int itemId = Integer.parseInt(params[1]);
|
||||
@@ -64,7 +64,7 @@ public class HairCommand extends Command {
|
||||
Character victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
victim.setHair(itemId);
|
||||
victim.updateSingleStat(MapleStat.HAIR, itemId);
|
||||
victim.updateSingleStat(Stat.HAIR, itemId);
|
||||
victim.equipChanged();
|
||||
} else {
|
||||
player.yellowMessage("Player '" + params[0] + "' has not been found on this channel.");
|
||||
|
||||
@@ -110,7 +110,7 @@ public class AssignAPProcessor {
|
||||
int prStat = 0, scStat = 0, trStat = 0, temp, tempAp = remainingAp, CAP;
|
||||
if (tempAp < 1) return;
|
||||
|
||||
MapleStat primary, secondary, tertiary = MapleStat.LUK;
|
||||
Stat primary, secondary, tertiary = Stat.LUK;
|
||||
switch(stance) {
|
||||
case MAGICIAN:
|
||||
CAP = 165;
|
||||
@@ -132,9 +132,9 @@ public class AssignAPProcessor {
|
||||
prStat += temp;
|
||||
}
|
||||
|
||||
primary = MapleStat.INT;
|
||||
secondary = MapleStat.LUK;
|
||||
tertiary = MapleStat.DEX;
|
||||
primary = Stat.INT;
|
||||
secondary = Stat.LUK;
|
||||
tertiary = Stat.DEX;
|
||||
|
||||
break;
|
||||
|
||||
@@ -158,8 +158,8 @@ public class AssignAPProcessor {
|
||||
prStat += temp;
|
||||
}
|
||||
|
||||
primary = MapleStat.DEX;
|
||||
secondary = MapleStat.STR;
|
||||
primary = Stat.DEX;
|
||||
secondary = Stat.STR;
|
||||
|
||||
break;
|
||||
|
||||
@@ -184,8 +184,8 @@ public class AssignAPProcessor {
|
||||
prStat += temp;
|
||||
}
|
||||
|
||||
primary = MapleStat.DEX;
|
||||
secondary = MapleStat.STR;
|
||||
primary = Stat.DEX;
|
||||
secondary = Stat.STR;
|
||||
|
||||
break;
|
||||
|
||||
@@ -243,9 +243,9 @@ public class AssignAPProcessor {
|
||||
prStat += temp;
|
||||
}
|
||||
|
||||
primary = MapleStat.LUK;
|
||||
secondary = MapleStat.DEX;
|
||||
tertiary = MapleStat.STR;
|
||||
primary = Stat.LUK;
|
||||
secondary = Stat.DEX;
|
||||
tertiary = Stat.STR;
|
||||
|
||||
break;
|
||||
|
||||
@@ -310,8 +310,8 @@ public class AssignAPProcessor {
|
||||
prStat += temp;
|
||||
}
|
||||
|
||||
primary = MapleStat.STR;
|
||||
secondary = MapleStat.DEX;
|
||||
primary = Stat.STR;
|
||||
secondary = Stat.DEX;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
@@ -350,7 +350,7 @@ public class AssignAPProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
gainStatByType(MapleStat.getBy5ByteEncoding(type), statGain, tempVal, statUpdate);
|
||||
gainStatByType(Stat.getBy5ByteEncoding(type), statGain, tempVal, statUpdate);
|
||||
}
|
||||
|
||||
chr.assignStrDexIntLuk(statGain[0], statGain[1], statGain[3], statGain[2]);
|
||||
@@ -365,11 +365,11 @@ public class AssignAPProcessor {
|
||||
return(statList.size() <= rank ? 0 : statList.get(rank));
|
||||
}
|
||||
|
||||
private static int gainStatByType(MapleStat type, int[] statGain, int gain, int[] statUpdate) {
|
||||
private static int gainStatByType(Stat type, int[] statGain, int gain, int[] statUpdate) {
|
||||
if(gain <= 0) return 0;
|
||||
|
||||
int newVal = 0;
|
||||
if (type.equals(MapleStat.STR)) {
|
||||
if (type.equals(Stat.STR)) {
|
||||
newVal = statUpdate[0] + gain;
|
||||
if (newVal > YamlConfig.config.server.MAX_AP) {
|
||||
statGain[0] += (gain - (newVal - YamlConfig.config.server.MAX_AP));
|
||||
@@ -378,7 +378,7 @@ public class AssignAPProcessor {
|
||||
statGain[0] += gain;
|
||||
statUpdate[0] = newVal;
|
||||
}
|
||||
} else if (type.equals(MapleStat.INT)) {
|
||||
} else if (type.equals(Stat.INT)) {
|
||||
newVal = statUpdate[3] + gain;
|
||||
if (newVal > YamlConfig.config.server.MAX_AP) {
|
||||
statGain[3] += (gain - (newVal - YamlConfig.config.server.MAX_AP));
|
||||
@@ -387,7 +387,7 @@ public class AssignAPProcessor {
|
||||
statGain[3] += gain;
|
||||
statUpdate[3] = newVal;
|
||||
}
|
||||
} else if (type.equals(MapleStat.LUK)) {
|
||||
} else if (type.equals(Stat.LUK)) {
|
||||
newVal = statUpdate[2] + gain;
|
||||
if (newVal > YamlConfig.config.server.MAX_AP) {
|
||||
statGain[2] += (gain - (newVal - YamlConfig.config.server.MAX_AP));
|
||||
@@ -396,7 +396,7 @@ public class AssignAPProcessor {
|
||||
statGain[2] += gain;
|
||||
statUpdate[2] = newVal;
|
||||
}
|
||||
} else if (type.equals(MapleStat.DEX)) {
|
||||
} else if (type.equals(Stat.DEX)) {
|
||||
newVal = statUpdate[1] + gain;
|
||||
if (newVal > YamlConfig.config.server.MAX_AP) {
|
||||
statGain[1] += (gain - (newVal - YamlConfig.config.server.MAX_AP));
|
||||
@@ -413,9 +413,9 @@ public class AssignAPProcessor {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static MapleStat getQuaternaryStat(Job stance) {
|
||||
if(stance != Job.MAGICIAN) return MapleStat.INT;
|
||||
return MapleStat.STR;
|
||||
private static Stat getQuaternaryStat(Job stance) {
|
||||
if(stance != Job.MAGICIAN) return Stat.INT;
|
||||
return Stat.STR;
|
||||
}
|
||||
|
||||
public static boolean APResetAction(Client c, int APFrom, int APTo) {
|
||||
|
||||
@@ -285,19 +285,19 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
|
||||
public void setHair(int hair) {
|
||||
getPlayer().setHair(hair);
|
||||
getPlayer().updateSingleStat(MapleStat.HAIR, hair);
|
||||
getPlayer().updateSingleStat(Stat.HAIR, hair);
|
||||
getPlayer().equipChanged();
|
||||
}
|
||||
|
||||
public void setFace(int face) {
|
||||
getPlayer().setFace(face);
|
||||
getPlayer().updateSingleStat(MapleStat.FACE, face);
|
||||
getPlayer().updateSingleStat(Stat.FACE, face);
|
||||
getPlayer().equipChanged();
|
||||
}
|
||||
|
||||
public void setSkin(int color) {
|
||||
getPlayer().setSkinColor(SkinColor.getById(color));
|
||||
getPlayer().updateSingleStat(MapleStat.SKIN, color);
|
||||
getPlayer().updateSingleStat(Stat.SKIN, color);
|
||||
getPlayer().equipChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class PacketCreator {
|
||||
|
||||
public static final List<Pair<MapleStat, Integer>> EMPTY_STATUPDATE = Collections.emptyList();
|
||||
public static final List<Pair<Stat, Integer>> EMPTY_STATUPDATE = Collections.emptyList();
|
||||
private final static long FT_UT_OFFSET = 116444736010800000L + (10000L * TimeZone.getDefault().getOffset(System.currentTimeMillis())); // normalize with timezone offset suggested by Ari
|
||||
private final static long DEFAULT_TIME = 150842304000000000L;//00 80 05 BB 46 E6 17 02
|
||||
public final static long ZERO_TIME = 94354848000000000L;//00 40 E0 FD 3B 37 4F 01
|
||||
@@ -951,14 +951,14 @@ public class PacketCreator {
|
||||
* @param chr The update target.
|
||||
* @return The stat update packet.
|
||||
*/
|
||||
public static Packet updatePlayerStats(List<Pair<MapleStat, Integer>> stats, boolean enableActions, Character chr) {
|
||||
public static Packet updatePlayerStats(List<Pair<Stat, Integer>> stats, boolean enableActions, Character chr) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.STAT_CHANGED);
|
||||
p.writeBool(enableActions);
|
||||
int updateMask = 0;
|
||||
for (Pair<MapleStat, Integer> statupdate : stats) {
|
||||
for (Pair<Stat, Integer> statupdate : stats) {
|
||||
updateMask |= statupdate.getLeft().getValue();
|
||||
}
|
||||
List<Pair<MapleStat, Integer>> mystats = stats;
|
||||
List<Pair<Stat, Integer>> mystats = stats;
|
||||
if (mystats.size() > 1) {
|
||||
mystats.sort((o1, o2) -> {
|
||||
int val1 = o1.getLeft().getValue();
|
||||
@@ -967,7 +967,7 @@ public class PacketCreator {
|
||||
});
|
||||
}
|
||||
p.writeInt(updateMask);
|
||||
for (Pair<MapleStat, Integer> statupdate : mystats) {
|
||||
for (Pair<Stat, Integer> statupdate : mystats) {
|
||||
if (statupdate.getLeft().getValue() >= 1) {
|
||||
if (statupdate.getLeft().getValue() == 0x1) {
|
||||
p.writeByte(statupdate.getRight().byteValue());
|
||||
@@ -4473,7 +4473,7 @@ public class PacketCreator {
|
||||
|
||||
final OutPacket p = OutPacket.create(SendOpcode.STAT_CHANGED);
|
||||
int mask = 0;
|
||||
mask |= MapleStat.PET.getValue();
|
||||
mask |= Stat.PET.getValue();
|
||||
p.writeByte(0);
|
||||
p.writeInt(mask);
|
||||
Pet[] pets = chr.getPets();
|
||||
|
||||
Reference in New Issue
Block a user