Level/exp on all equips + Player stats overhaul + Chair handler patch
Implemented a massive overhaul on Character.wz, adding in equipment level-related nodes in order to make equipments level/EXP info available for anyone to check. Implemented a major overhaul on the player stat management throughout the source, properly encapsulating and concurrency protecting it's mechanics. Reviewed several MoveLifeHandler aspects, some of them trying to prevent mobs from falling from footholds in certain circumstances. Fixed MP Recovery instant killing players when they run out of HP to use. Fixed some chairs arbitrarily disconnecting players upon HP/MP recovery. Fixed Puppets sticking to maps in certain scenarios. Cached data and added concurrency protection for EXP gain on equipments. Reworked Chair Mastery skill, now with recovering amounts based on a player's base HP/MP pool. Fixed several deadlock issues revolving rate coupons and character inventory. Improved overall autopot handler performance. Reworked door bosses (such as Crocell), now spawning each 3 hours instead of upon player's demand. Fixed alliances not saving rank names on DB at creation time. Fixed alliances retaining disbanded guild info on DB. Added Mystic Door support for the Mushroom Castle area.
This commit is contained in:
30
src/client/AbstractCharacterListener.java
Normal file
30
src/client/AbstractCharacterListener.java
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package client;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public interface AbstractCharacterListener {
|
||||
public void onHpChanged(int oldHp);
|
||||
public void onHpmpPoolUpdate();
|
||||
public void onAnnounceStatPoolUpdate();
|
||||
}
|
||||
712
src/client/AbstractMapleCharacterObject.java
Normal file
712
src/client/AbstractMapleCharacterObject.java
Normal file
@@ -0,0 +1,712 @@
|
||||
/*
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package client;
|
||||
|
||||
import constants.GameConstants;
|
||||
import constants.ServerConstants;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantReadWriteLock;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import server.maps.AbstractAnimatedMapleMapObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMapleMapObject {
|
||||
protected int str, dex, luk, int_, hp, maxhp, mp, maxmp;
|
||||
protected int hpMpApUsed, remainingAp;
|
||||
protected int[] remainingSp = new int[10];
|
||||
protected transient int clientmaxhp, clientmaxmp, localmaxhp = 50, localmaxmp = 5;
|
||||
|
||||
private AbstractCharacterListener listener = null;
|
||||
protected Map<MapleStat, Integer> statUpdates = new HashMap<>();
|
||||
|
||||
protected Lock effLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EFF, true);
|
||||
protected ReadLock statRlock;
|
||||
protected WriteLock statWlock;
|
||||
|
||||
protected AbstractMapleCharacterObject() {
|
||||
ReentrantReadWriteLock locks = new MonitoredReentrantReadWriteLock(MonitoredLockType.CHARACTER_STA, true);
|
||||
statRlock = locks.readLock();
|
||||
statWlock = locks.writeLock();
|
||||
|
||||
for (int i = 0; i < remainingSp.length; i++) {
|
||||
remainingSp[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected void setListener(AbstractCharacterListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public int getStr() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return str;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getDex() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return dex;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return int_;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getLuk() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return luk;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getRemainingAp() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return remainingAp;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
protected int getRemainingSp(int jobid) {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return remainingSp[GameConstants.getSkillBook(jobid)];
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getRemainingSps() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return Arrays.copyOf(remainingSp, remainingSp.length);
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getHpMpApUsed() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return hpMpApUsed;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAlive() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return hp > 0;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getHp() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return hp;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getMp() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return mp;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxHp() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return maxhp;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxMp() {
|
||||
statRlock.lock();
|
||||
try {
|
||||
return maxmp;
|
||||
} finally {
|
||||
statRlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getClientMaxHp() {
|
||||
return clientmaxhp;
|
||||
}
|
||||
|
||||
public int getClientMaxMp() {
|
||||
return clientmaxmp;
|
||||
}
|
||||
|
||||
public int getCurrentMaxHp() {
|
||||
return localmaxhp;
|
||||
}
|
||||
|
||||
public int getCurrentMaxMp() {
|
||||
return localmaxmp;
|
||||
}
|
||||
|
||||
private void setHpMpApUsed(int mpApUsed) {
|
||||
this.hpMpApUsed = mpApUsed;
|
||||
}
|
||||
|
||||
private void dispatchHpChanged(int oldHp) {
|
||||
listener.onHpChanged(oldHp);
|
||||
}
|
||||
|
||||
private void dispatchHpmpPoolUpdated() {
|
||||
listener.onHpmpPoolUpdate();
|
||||
}
|
||||
|
||||
private void dispatchStatPoolUpdateAnnounced() {
|
||||
listener.onAnnounceStatPoolUpdate();
|
||||
}
|
||||
|
||||
protected void setHp(int newHp) {
|
||||
int oldHp = hp;
|
||||
|
||||
int thp = newHp;
|
||||
if (thp < 0) {
|
||||
thp = 0;
|
||||
} else if (thp > localmaxhp) {
|
||||
thp = localmaxhp;
|
||||
}
|
||||
this.hp = thp;
|
||||
|
||||
dispatchHpChanged(oldHp);
|
||||
}
|
||||
|
||||
protected void setMp(int newMp) {
|
||||
int tmp = newMp;
|
||||
if (tmp < 0) {
|
||||
tmp = 0;
|
||||
} else if (tmp > localmaxmp) {
|
||||
tmp = localmaxmp;
|
||||
}
|
||||
this.mp = tmp;
|
||||
}
|
||||
|
||||
private void setRemainingAp(int remainingAp) {
|
||||
this.remainingAp = remainingAp;
|
||||
}
|
||||
|
||||
private void setRemainingSp(int remainingSp, int skillbook) {
|
||||
this.remainingSp[skillbook] = remainingSp;
|
||||
}
|
||||
|
||||
protected void setMaxHp(int hp_) {
|
||||
this.maxhp = hp_;
|
||||
this.clientmaxhp = Math.min(30000, hp_);
|
||||
}
|
||||
|
||||
protected void setMaxMp(int mp_) {
|
||||
this.maxmp = mp_;
|
||||
this.clientmaxmp = Math.min(30000, mp_);
|
||||
}
|
||||
|
||||
private static long calcStatPoolNode(long v, int displacement) {
|
||||
if (v > Short.MAX_VALUE) {
|
||||
v = Short.MAX_VALUE;
|
||||
} else if (v < Short.MIN_VALUE) {
|
||||
v = Short.MIN_VALUE;
|
||||
}
|
||||
|
||||
return ((v & 0x0FFFF) << displacement);
|
||||
}
|
||||
|
||||
private static long calcStatPoolLong(int v1, int v2, int v3, int v4) {
|
||||
long ret = 0;
|
||||
|
||||
ret |= calcStatPoolNode(v1, 48);
|
||||
ret |= calcStatPoolNode(v2, 32);
|
||||
ret |= calcStatPoolNode(v3, 16);
|
||||
ret |= calcStatPoolNode(v4, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void changeStatPool(Long hpMpPool, Long strDexIntLuk, Long newSp, int newAp, boolean silent) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
statUpdates.clear();
|
||||
boolean poolUpdate = false;
|
||||
|
||||
if (hpMpPool != null) {
|
||||
short newHp = (short) (hpMpPool >> 48);
|
||||
short newMp = (short) (hpMpPool >> 32);
|
||||
short newMaxHp = (short) (hpMpPool >> 16);
|
||||
short newMaxMp = (short) (hpMpPool.shortValue());
|
||||
|
||||
if (newMaxHp != Short.MIN_VALUE) {
|
||||
if (newMaxHp < 50) {
|
||||
newMaxHp = 50;
|
||||
}
|
||||
|
||||
poolUpdate = true;
|
||||
setMaxHp(newMaxHp);
|
||||
statUpdates.put(MapleStat.MAXHP, clientmaxhp);
|
||||
statUpdates.put(MapleStat.HP, hp);
|
||||
}
|
||||
|
||||
if (newHp != Short.MIN_VALUE) {
|
||||
setHp(newHp);
|
||||
statUpdates.put(MapleStat.HP, hp);
|
||||
}
|
||||
|
||||
if (newMaxMp != Short.MIN_VALUE) {
|
||||
if (newMaxMp < 5) {
|
||||
newMaxMp = 5;
|
||||
}
|
||||
|
||||
poolUpdate = true;
|
||||
setMaxMp(newMaxMp);
|
||||
statUpdates.put(MapleStat.MAXMP, clientmaxmp);
|
||||
statUpdates.put(MapleStat.MP, mp);
|
||||
}
|
||||
|
||||
if (newMp != Short.MIN_VALUE) {
|
||||
setMp(newMp);
|
||||
statUpdates.put(MapleStat.MP, mp);
|
||||
}
|
||||
}
|
||||
|
||||
if (strDexIntLuk != null) {
|
||||
short newStr = (short) (strDexIntLuk >> 48);
|
||||
short newDex = (short) (strDexIntLuk >> 32);
|
||||
short newInt = (short) (strDexIntLuk >> 16);
|
||||
short newLuk = (short) (strDexIntLuk.shortValue());
|
||||
|
||||
if (newStr >= 4) {
|
||||
setStr(newStr);
|
||||
statUpdates.put(MapleStat.STR, str);
|
||||
}
|
||||
|
||||
if (newDex >= 4) {
|
||||
setDex(newDex);
|
||||
statUpdates.put(MapleStat.DEX, dex);
|
||||
}
|
||||
|
||||
if (newInt >= 4) {
|
||||
setInt(newInt);
|
||||
statUpdates.put(MapleStat.INT, int_);
|
||||
}
|
||||
|
||||
if (newLuk >= 4) {
|
||||
setLuk(newLuk);
|
||||
statUpdates.put(MapleStat.LUK, luk);
|
||||
}
|
||||
|
||||
if (newAp >= 0) {
|
||||
setRemainingAp(newAp);
|
||||
statUpdates.put(MapleStat.AVAILABLEAP, remainingAp);
|
||||
}
|
||||
|
||||
poolUpdate = true; // recalc stats
|
||||
}
|
||||
|
||||
if (newSp != null) {
|
||||
short sp = (short) (newSp >> 16);
|
||||
short skillbook = (short) (newSp.shortValue());
|
||||
|
||||
setRemainingSp(sp, skillbook);
|
||||
statUpdates.put(MapleStat.AVAILABLESP, remainingSp[skillbook]);
|
||||
}
|
||||
|
||||
if (!statUpdates.isEmpty()) {
|
||||
if (poolUpdate) {
|
||||
dispatchHpmpPoolUpdated();
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
dispatchStatPoolUpdateAnnounced();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void healHpMp() {
|
||||
updateHpMp(30000);
|
||||
}
|
||||
|
||||
public void updateHpMp(int x) {
|
||||
updateHpMp(x, x);
|
||||
}
|
||||
|
||||
public void updateHpMp(int newhp, int newmp) {
|
||||
changeHpMp(newhp, newmp, false);
|
||||
}
|
||||
|
||||
protected void changeHpMp(int newhp, int newmp, boolean silent) {
|
||||
changeHpMpPool(newhp, newmp, Short.MIN_VALUE, Short.MIN_VALUE, silent);
|
||||
}
|
||||
|
||||
private void changeHpMpPool(int hp, int mp, int maxhp, int maxmp, boolean silent) {
|
||||
long hpMpPool = calcStatPoolLong(hp, mp, maxhp, maxmp);
|
||||
changeStatPool(hpMpPool, null, null, -1, silent);
|
||||
}
|
||||
|
||||
public void updateHp(int hp) {
|
||||
updateHpMaxHp(hp, Short.MIN_VALUE);
|
||||
}
|
||||
|
||||
public void updateMaxHp(int maxhp) {
|
||||
updateHpMaxHp(Short.MIN_VALUE, maxhp);
|
||||
}
|
||||
|
||||
public void updateHpMaxHp(int hp, int maxhp) {
|
||||
changeHpMpPool(hp, Short.MIN_VALUE, maxhp, Short.MIN_VALUE, false);
|
||||
}
|
||||
|
||||
public void updateMp(int mp) {
|
||||
updateMpMaxMp(mp, Short.MIN_VALUE);
|
||||
}
|
||||
|
||||
public void updateMaxMp(int maxmp) {
|
||||
updateMpMaxMp(Short.MIN_VALUE, maxmp);
|
||||
}
|
||||
|
||||
public void updateMpMaxMp(int mp, int maxmp) {
|
||||
changeHpMpPool(Short.MIN_VALUE, mp, Short.MIN_VALUE, maxmp, false);
|
||||
}
|
||||
|
||||
public void updateMaxHpMaxMp(int maxhp, int maxmp) {
|
||||
changeHpMpPool(Short.MIN_VALUE, Short.MIN_VALUE, maxhp, maxmp, false);
|
||||
}
|
||||
|
||||
protected void enforceMaxHpMp() {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
if (mp > localmaxmp || hp > localmaxhp) {
|
||||
changeHpMp(hp, mp, false);
|
||||
}
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int safeAddHP(int delta) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
if (hp + delta <= 0) {
|
||||
delta = -hp + 1;
|
||||
}
|
||||
|
||||
addHP(delta);
|
||||
return delta;
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void addHP(int delta) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
updateHp(hp + delta);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void addMP(int delta) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
updateMp(mp + delta);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void addMPHP(int hpDelta, int mpDelta) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
updateHpMp(hp + hpDelta, mp + mpDelta);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
protected void addMaxMPMaxHP(int hpdelta, int mpdelta, boolean silent) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
changeHpMpPool(Short.MIN_VALUE, Short.MIN_VALUE, maxhp + hpdelta, maxmp + mpdelta, silent);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void addMaxHP(int delta) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
updateMaxHp(maxhp + delta);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void addMaxMP(int delta) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
updateMaxMp(maxmp + delta);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void setStr(int str) {
|
||||
this.str = str;
|
||||
}
|
||||
|
||||
private void setDex(int dex) {
|
||||
this.dex = dex;
|
||||
}
|
||||
|
||||
private void setInt(int int_) {
|
||||
this.int_ = int_;
|
||||
}
|
||||
|
||||
private void setLuk(int luk) {
|
||||
this.luk = luk;
|
||||
}
|
||||
|
||||
public boolean assignStr(int x) {
|
||||
return assignStrDexIntLuk(x, Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE);
|
||||
}
|
||||
|
||||
public boolean assignDex(int x) {
|
||||
return assignStrDexIntLuk(Short.MIN_VALUE, x, Short.MIN_VALUE, Short.MIN_VALUE);
|
||||
}
|
||||
|
||||
public boolean assignInt(int x) {
|
||||
return assignStrDexIntLuk(Short.MIN_VALUE, Short.MIN_VALUE, x, Short.MIN_VALUE);
|
||||
}
|
||||
|
||||
public boolean assignLuk(int x) {
|
||||
return assignStrDexIntLuk(Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE, x);
|
||||
}
|
||||
|
||||
public boolean assignHP(int deltaHP, int deltaAp) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
if (remainingAp - deltaAp < 0 || hpMpApUsed + deltaAp < 0 || maxhp >= 30000) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long hpMpPool = calcStatPoolLong(Short.MIN_VALUE, Short.MIN_VALUE, maxhp + deltaHP, maxmp);
|
||||
long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk);
|
||||
|
||||
changeStatPool(hpMpPool, strDexIntLuk, null, remainingAp - deltaAp, false);
|
||||
setHpMpApUsed(hpMpApUsed + deltaAp);
|
||||
return true;
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean assignMP(int deltaMP, int deltaAp) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
if (remainingAp - deltaAp < 0 || hpMpApUsed + deltaAp < 0 || maxmp >= 30000) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long hpMpPool = calcStatPoolLong(Short.MIN_VALUE, Short.MIN_VALUE, maxhp, maxmp + deltaMP);
|
||||
long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk);
|
||||
|
||||
changeStatPool(hpMpPool, strDexIntLuk, null, remainingAp - deltaAp, false);
|
||||
setHpMpApUsed(hpMpApUsed + deltaAp);
|
||||
return true;
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private static int apAssigned(int x) {
|
||||
return x != Short.MIN_VALUE ? x : 0;
|
||||
}
|
||||
|
||||
public boolean assignStrDexIntLuk(int deltaStr, int deltaDex, int deltaInt, int deltaLuk) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
int apUsed = apAssigned(deltaStr) + apAssigned(deltaDex) + apAssigned(deltaInt) + apAssigned(deltaLuk);
|
||||
if (apUsed > remainingAp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int newStr = str + deltaStr, newDex = dex + deltaDex, newInt = int_ + deltaInt, newLuk = luk + deltaLuk;
|
||||
if (newStr < 4 && deltaStr != Short.MIN_VALUE || newStr > ServerConstants.MAX_AP) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newDex < 4 && deltaDex != Short.MIN_VALUE || newDex > ServerConstants.MAX_AP) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newInt < 4 && deltaInt != Short.MIN_VALUE || newInt > ServerConstants.MAX_AP) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newLuk < 4 && deltaLuk != Short.MIN_VALUE || newLuk > ServerConstants.MAX_AP) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int newAp = remainingAp - apUsed;
|
||||
updateStrDexIntLuk(newStr, newDex, newInt, newLuk, newAp);
|
||||
return true;
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStrDexIntLuk(int x) {
|
||||
updateStrDexIntLuk(x, x, x, x, -1);
|
||||
}
|
||||
|
||||
public void changeRemainingAp(int x, boolean silent) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
changeStrDexIntLuk(str, dex, int_, luk, x, silent);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void gainAp(int deltaAp, boolean silent) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
changeRemainingAp(Math.max(0, remainingAp + deltaAp), silent);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateStrDexIntLuk(int str, int dex, int int_, int luk, int remainingAp) {
|
||||
changeStrDexIntLuk(str, dex, int_, luk, remainingAp, false);
|
||||
}
|
||||
|
||||
private void changeStrDexIntLuk(int str, int dex, int int_, int luk, int remainingAp, boolean silent) {
|
||||
long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk);
|
||||
changeStatPool(null, strDexIntLuk, null, remainingAp, silent);
|
||||
}
|
||||
|
||||
private void changeStrDexIntLukSp(int str, int dex, int int_, int luk, int remainingAp, int remainingSp, int skillbook, boolean silent) {
|
||||
long strDexIntLuk = calcStatPoolLong(str, dex, int_, luk);
|
||||
long sp = calcStatPoolLong(0, 0, remainingSp, skillbook);
|
||||
changeStatPool(null, strDexIntLuk, sp, remainingAp, silent);
|
||||
}
|
||||
|
||||
protected void updateStrDexIntLukSp(int str, int dex, int int_, int luk, int remainingAp, int remainingSp, int skillbook) {
|
||||
changeStrDexIntLukSp(str, dex, int_, luk, remainingAp, remainingSp, skillbook, false);
|
||||
}
|
||||
|
||||
protected void setRemainingSp(int[] sps) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
System.arraycopy(sps, 0, remainingSp, 0, sps.length);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateRemainingSp(int remainingSp, int skillbook) {
|
||||
changeRemainingSp(remainingSp, skillbook, false);
|
||||
}
|
||||
|
||||
protected void changeRemainingSp(int remainingSp, int skillbook, boolean silent) {
|
||||
long sp = calcStatPoolLong(0, 0, remainingSp, skillbook);
|
||||
changeStatPool(null, null, sp, Short.MIN_VALUE, silent);
|
||||
}
|
||||
|
||||
public void gainSp(int deltaSp, int skillbook, boolean silent) {
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
try {
|
||||
changeRemainingSp(Math.max(0, remainingSp[skillbook] + deltaSp), skillbook, silent);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -886,7 +886,7 @@ public class MapleClient {
|
||||
final MapleGuild guild = player.getGuild();
|
||||
|
||||
player.cancelMagicDoor();
|
||||
|
||||
|
||||
final World wserv = getWorldServer(); // obviously wserv is NOT null if this player was online on it
|
||||
try {
|
||||
removePlayer(wserv);
|
||||
@@ -1028,7 +1028,7 @@ public class MapleClient {
|
||||
}
|
||||
|
||||
public void pongReceived() {
|
||||
lastPong = System.currentTimeMillis();
|
||||
lastPong = Server.getInstance().getCurrentTime();
|
||||
}
|
||||
|
||||
public void testPing(long timeThen) {
|
||||
@@ -1381,12 +1381,7 @@ public class MapleClient {
|
||||
player.cancelQuestExpirationTask();
|
||||
//Cancelling magicdoor? Nope
|
||||
//Cancelling mounts? Noty
|
||||
if (player.getBuffedValue(MapleBuffStat.PUPPET) != null) {
|
||||
player.cancelEffectFromBuffStat(MapleBuffStat.PUPPET);
|
||||
}
|
||||
if (player.getBuffedValue(MapleBuffStat.COMBO) != null) {
|
||||
player.cancelEffectFromBuffStat(MapleBuffStat.COMBO);
|
||||
}
|
||||
|
||||
player.getInventory(MapleInventoryType.EQUIPPED).checked(false); //test
|
||||
player.getMap().removePlayer(player);
|
||||
player.clearBanishPlayerData();
|
||||
|
||||
@@ -91,7 +91,6 @@ public class AutobanManager {
|
||||
* Timestamp checker
|
||||
*
|
||||
* <code>type</code>:<br>
|
||||
* 0: HealOverTime<br>
|
||||
* 1: Pet Food<br>
|
||||
* 2: InventoryMerge<br>
|
||||
* 3: InventorySort<br>
|
||||
@@ -99,6 +98,8 @@ public class AutobanManager {
|
||||
* 5: UseCatchItem<br>
|
||||
* 6: Item Drop<br>
|
||||
* 7: Chat<br>
|
||||
* 8: HealOverTimeHP<br>
|
||||
* 9: HealOverTimeMP<br>
|
||||
*
|
||||
* @param type type
|
||||
* @return Timestamp checker
|
||||
@@ -108,7 +109,7 @@ public class AutobanManager {
|
||||
this.timestampcounter[type]++;
|
||||
if (this.timestampcounter[type] >= times) {
|
||||
chr.getClient().disconnect(false, false);
|
||||
//System.out.println("Same timestamp for type: " + type + "; Character: " + chr);
|
||||
FilePrinter.print(FilePrinter.EXPLOITS, "Player " + chr + " was caught spamming TYPE " + type + " and has been disconnected.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -23,14 +23,16 @@
|
||||
*/
|
||||
package client.command;
|
||||
|
||||
import client.command.commands.gm0.*;
|
||||
import client.command.commands.gm1.*;
|
||||
import client.command.commands.gm2.*;
|
||||
import client.command.commands.gm3.*;
|
||||
import client.command.commands.gm4.*;
|
||||
import client.command.commands.gm5.*;
|
||||
import client.command.commands.gm6.*;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.command.commands.v0.*;
|
||||
import client.command.commands.v1.*;
|
||||
import client.command.commands.v2.*;
|
||||
import client.command.commands.v3.*;
|
||||
import client.command.commands.v4.*;
|
||||
import client.command.commands.v5.*;
|
||||
import client.command.commands.v6.*;
|
||||
|
||||
import tools.FilePrinter;
|
||||
import tools.Pair;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
@@ -21,12 +21,12 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import constants.ServerConstants;
|
||||
|
||||
public class StatDexCommand extends Command {
|
||||
{
|
||||
@@ -38,20 +38,9 @@ public class StatDexCommand extends Command {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
int remainingAp = player.getRemainingAp();
|
||||
|
||||
int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : remainingAp;
|
||||
if (amount > 0 && amount <= remainingAp && amount <= 32763) {
|
||||
int playerStat = player.getDex();
|
||||
|
||||
if (amount + playerStat <= 32767 && amount + playerStat >= 4) {
|
||||
player.setDex(playerStat + amount);
|
||||
player.updateSingleStat(MapleStat.DEX, playerStat);
|
||||
player.setRemainingAp(remainingAp - amount);
|
||||
player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp);
|
||||
} else {
|
||||
player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4.");
|
||||
}
|
||||
} else {
|
||||
player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute.");
|
||||
int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : Math.min(remainingAp, ServerConstants.MAX_AP - player.getDex());
|
||||
if (!player.assignDex(amount)) {
|
||||
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,12 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
import constants.ServerConstants;
|
||||
|
||||
public class StatIntCommand extends Command {
|
||||
{
|
||||
@@ -38,20 +38,9 @@ public class StatIntCommand extends Command {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
int remainingAp = player.getRemainingAp();
|
||||
|
||||
int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : remainingAp;
|
||||
if (amount > 0 && amount <= remainingAp && amount <= 32763) {
|
||||
int playerStat = player.getInt();
|
||||
|
||||
if (amount + playerStat <= 32767 && amount + playerStat >= 4) {
|
||||
player.setInt(playerStat + amount);
|
||||
player.updateSingleStat(MapleStat.INT, playerStat);
|
||||
player.setRemainingAp(remainingAp - amount);
|
||||
player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp);
|
||||
} else {
|
||||
player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4.");
|
||||
}
|
||||
} else {
|
||||
player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute.");
|
||||
int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : Math.min(remainingAp, ServerConstants.MAX_AP - player.getInt());
|
||||
if (!player.assignInt(amount)) {
|
||||
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,12 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import constants.ServerConstants;
|
||||
|
||||
public class StatLukCommand extends Command {
|
||||
{
|
||||
@@ -38,20 +38,9 @@ public class StatLukCommand extends Command {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
int remainingAp = player.getRemainingAp();
|
||||
|
||||
int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : remainingAp;
|
||||
if (amount > 0 && amount <= remainingAp && amount <= 32763) {
|
||||
int playerStat = player.getLuk();
|
||||
|
||||
if (amount + playerStat <= 32767 && amount + playerStat >= 4) {
|
||||
player.setLuk(playerStat + amount);
|
||||
player.updateSingleStat(MapleStat.LUK, playerStat);
|
||||
player.setRemainingAp(remainingAp - amount);
|
||||
player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp);
|
||||
} else {
|
||||
player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4.");
|
||||
}
|
||||
} else {
|
||||
player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute.");
|
||||
int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : Math.min(remainingAp, ServerConstants.MAX_AP - player.getLuk());
|
||||
if (!player.assignLuk(amount)) {
|
||||
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,12 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
import constants.ServerConstants;
|
||||
|
||||
public class StatStrCommand extends Command {
|
||||
{
|
||||
@@ -37,21 +37,10 @@ public class StatStrCommand extends Command {
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
int remainingAp = player.getRemainingAp();
|
||||
|
||||
int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : remainingAp;
|
||||
if (amount > 0 && amount <= remainingAp && amount <= 32763) {
|
||||
int playerStat = player.getStr();
|
||||
|
||||
if (amount + playerStat <= 32767 && amount + playerStat >= 4) {
|
||||
player.setStr(playerStat + amount);
|
||||
player.updateSingleStat(MapleStat.STR, playerStat);
|
||||
player.setRemainingAp(remainingAp - amount);
|
||||
player.updateSingleStat(MapleStat.AVAILABLEAP, remainingAp);
|
||||
} else {
|
||||
player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4.");
|
||||
}
|
||||
} else {
|
||||
player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute.");
|
||||
int amount = (params.length > 0) ? Math.min(Integer.parseInt(params[0]), remainingAp) : Math.min(remainingAp, ServerConstants.MAX_AP - player.getStr());
|
||||
|
||||
if (!player.assignStr(amount)) {
|
||||
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v0;
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v1;
|
||||
package client.command.commands.gm1;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,10 +21,9 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v1;
|
||||
package client.command.commands.gm1;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleStat;
|
||||
import client.SkillFactory;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -42,9 +41,6 @@ public class BuffMeCommand extends Command {
|
||||
SkillFactory.getSkill(1301007).getEffect(SkillFactory.getSkill(1301007).getMaxLevel()).applyTo(player);
|
||||
SkillFactory.getSkill(2301004).getEffect(SkillFactory.getSkill(2301004).getMaxLevel()).applyTo(player);
|
||||
SkillFactory.getSkill(1005).getEffect(SkillFactory.getSkill(1005).getMaxLevel()).applyTo(player);
|
||||
player.setHp(player.getMaxHp());
|
||||
player.updateSingleStat(MapleStat.HP, player.getMaxHp());
|
||||
player.setMp(player.getMaxMp());
|
||||
player.updateSingleStat(MapleStat.MP, player.getMaxMp());
|
||||
player.healHpMp();
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v1;
|
||||
package client.command.commands.gm1;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v1;
|
||||
package client.command.commands.gm1;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v1;
|
||||
package client.command.commands.gm1;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v1;
|
||||
package client.command.commands.gm1;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,9 +21,8 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
@@ -47,8 +46,7 @@ public class ApCommand extends Command {
|
||||
if (newAp < 0) newAp = 0;
|
||||
else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP;
|
||||
|
||||
player.setRemainingAp(newAp);
|
||||
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
|
||||
player.changeRemainingAp(newAp, false);
|
||||
} else {
|
||||
MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
@@ -56,8 +54,7 @@ public class ApCommand extends Command {
|
||||
if (newAp < 0) newAp = 0;
|
||||
else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP;
|
||||
|
||||
victim.setRemainingAp(newAp);
|
||||
victim.updateSingleStat(MapleStat.AVAILABLEAP, victim.getRemainingAp());
|
||||
victim.changeRemainingAp(newAp, false);
|
||||
} else {
|
||||
player.message("Player '" + params[0] + "' could not be found on this channel.");
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.SkillFactory;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.SkillFactory;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -35,7 +35,7 @@ public class HealCommand extends Command {
|
||||
@Override
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
player.setHpMp(30000);
|
||||
player.healHpMp();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.SkillFactory;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.MapleJob;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.*;
|
||||
import client.command.Command;
|
||||
@@ -21,13 +21,12 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
import client.command.CommandsExecutor;
|
||||
import constants.ServerConstants;
|
||||
|
||||
public class MaxStatCommand extends Command {
|
||||
@@ -43,21 +42,11 @@ public class MaxStatCommand extends Command {
|
||||
player.resetPlayerRates();
|
||||
if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
|
||||
player.setWorldRates();
|
||||
player.setStr(Short.MAX_VALUE);
|
||||
player.setDex(Short.MAX_VALUE);
|
||||
player.setInt(Short.MAX_VALUE);
|
||||
player.setLuk(Short.MAX_VALUE);
|
||||
player.updateSingleStat(MapleStat.STR, Short.MAX_VALUE);
|
||||
player.updateSingleStat(MapleStat.DEX, Short.MAX_VALUE);
|
||||
player.updateSingleStat(MapleStat.INT, Short.MAX_VALUE);
|
||||
player.updateSingleStat(MapleStat.LUK, Short.MAX_VALUE);
|
||||
player.updateStrDexIntLuk(Short.MAX_VALUE);
|
||||
player.setFame(13337);
|
||||
player.setMaxHp(30000);
|
||||
player.setMaxMp(30000);
|
||||
player.updateMaxHpMaxMp(30000, 30000);
|
||||
player.updateSingleStat(MapleStat.LEVEL, 255);
|
||||
player.updateSingleStat(MapleStat.FAME, 13337);
|
||||
player.updateSingleStat(MapleStat.MAXHP, 30000);
|
||||
player.updateSingleStat(MapleStat.MAXMP, 30000);
|
||||
player.yellowMessage("Stats maxed out.");
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.*;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
@@ -41,23 +41,13 @@ public class SetStatCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
int x;
|
||||
try {
|
||||
x = Integer.parseInt(params[0]);
|
||||
int x = Integer.parseInt(params[0]);
|
||||
|
||||
if (x > Short.MAX_VALUE) x = Short.MAX_VALUE;
|
||||
else if (x < 0) x = 0;
|
||||
|
||||
player.setStr(x);
|
||||
player.setDex(x);
|
||||
player.setInt(x);
|
||||
player.setLuk(x);
|
||||
player.updateSingleStat(MapleStat.STR, x);
|
||||
player.updateSingleStat(MapleStat.DEX, x);
|
||||
player.updateSingleStat(MapleStat.INT, x);
|
||||
player.updateSingleStat(MapleStat.LUK, x);
|
||||
|
||||
} catch (NumberFormatException nfe) {
|
||||
}
|
||||
player.updateStrDexIntLuk(x);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,8 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
@@ -47,8 +46,7 @@ public class SpCommand extends Command {
|
||||
if (newSp < 0) newSp = 0;
|
||||
else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP;
|
||||
|
||||
player.setRemainingSp(newSp);
|
||||
player.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp());
|
||||
player.updateRemainingSp(newSp);
|
||||
} else {
|
||||
MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
@@ -56,8 +54,7 @@ public class SpCommand extends Command {
|
||||
if (newSp < 0) newSp = 0;
|
||||
else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP;
|
||||
|
||||
victim.setRemainingSp(newSp);
|
||||
victim.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp());
|
||||
victim.updateRemainingSp(newSp);
|
||||
|
||||
player.dropMessage(5, "SP given.");
|
||||
} else {
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.SkillFactory;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v2;
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleBuffStat;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleDisease;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
@@ -38,10 +38,7 @@ public class HealMapCommand extends Command {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
for (MapleCharacter mch : player.getMap().getCharacters()) {
|
||||
if (mch != null) {
|
||||
mch.setHp(mch.getMaxHp());
|
||||
mch.updateSingleStat(MapleStat.HP, mch.getMaxHp());
|
||||
mch.setMp(mch.getMaxMp());
|
||||
mch.updateSingleStat(MapleStat.MP, mch.getMaxMp());
|
||||
mch.healHpMp();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
@@ -38,10 +38,7 @@ public class HealPersonCommand extends Command {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
victim.setHp(victim.getMaxHp());
|
||||
victim.updateSingleStat(MapleStat.HP, victim.getMaxHp());
|
||||
victim.setMp(victim.getMaxMp());
|
||||
victim.updateSingleStat(MapleStat.MP, victim.getMaxMp());
|
||||
victim.healHpMp();
|
||||
} else {
|
||||
player.message("Player '" + params[0] + "' could not be found on this channel.");
|
||||
}
|
||||
@@ -21,9 +21,8 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
@@ -49,12 +48,7 @@ public class HpMpCommand extends Command {
|
||||
}
|
||||
|
||||
if (victim != null) {
|
||||
victim.setHp(statUpdate);
|
||||
victim.setMp(statUpdate);
|
||||
victim.updateSingleStat(MapleStat.HP, statUpdate);
|
||||
victim.updateSingleStat(MapleStat.MP, statUpdate);
|
||||
|
||||
victim.checkBerserk(victim.isHidden());
|
||||
victim.updateHpMp(statUpdate);
|
||||
} else {
|
||||
player.message("Player '" + params[0] + "' could not be found on this world.");
|
||||
}
|
||||
@@ -21,9 +21,8 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
@@ -38,8 +37,7 @@ public class HurtCommand extends Command {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
victim.setHp(1);
|
||||
victim.updateSingleStat(MapleStat.HP, 1);
|
||||
victim.updateHp(1);
|
||||
} else {
|
||||
player.message("Player '" + params[0] + "' could not be found on this channel.");
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -44,7 +44,7 @@ public class KillCommand extends Command {
|
||||
|
||||
MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
victim.setHpMp(0);
|
||||
victim.updateHpMp(0);
|
||||
Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(5, player.getName() + " used !kill on " + victim.getName()));
|
||||
} else {
|
||||
player.message("Player '" + params[0] + "' could not be found on this channel.");
|
||||
@@ -21,9 +21,8 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
@@ -37,8 +36,7 @@ public class KillMapCommand extends Command {
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
for (MapleCharacter mch : player.getMap().getCharacters()) {
|
||||
mch.setHp(0);
|
||||
mch.updateSingleStat(MapleStat.HP, 0);
|
||||
mch.updateHp(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,16 +21,11 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.MapleStat;
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
public class MaxHpMpCommand extends Command {
|
||||
{
|
||||
@@ -41,37 +36,25 @@ public class MaxHpMpCommand extends Command {
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
MapleCharacter victim = player;
|
||||
|
||||
int statUpdate = 1;
|
||||
|
||||
if (params.length >= 2) {
|
||||
victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
statUpdate = Math.max(1, Integer.valueOf(params[1]));
|
||||
statUpdate = Integer.valueOf(params[1]);
|
||||
} else if (params.length == 1) {
|
||||
statUpdate = Math.max(1, Integer.valueOf(params[0]));
|
||||
statUpdate = Integer.valueOf(params[0]);
|
||||
} else {
|
||||
player.yellowMessage("Syntax: !maxhpmp [<playername>] <value>");
|
||||
}
|
||||
|
||||
|
||||
if (victim != null) {
|
||||
List<Pair<MapleStat, Integer>> statup = new ArrayList<>(4);
|
||||
|
||||
if (victim.getHp() > statUpdate) {
|
||||
victim.setHp(statUpdate);
|
||||
statup.add(new Pair<>(MapleStat.HP, statUpdate));
|
||||
}
|
||||
statup.add(new Pair<>(MapleStat.MAXHP, statUpdate));
|
||||
int extraHp = victim.getCurrentMaxHp() - victim.getClientMaxHp();
|
||||
int extraMp = victim.getCurrentMaxMp() - victim.getClientMaxMp();
|
||||
statUpdate = Math.max(1 + Math.max(extraHp, extraMp), statUpdate);
|
||||
|
||||
if (victim.getMp() > statUpdate) {
|
||||
victim.setMp(statUpdate);
|
||||
statup.add(new Pair<>(MapleStat.MP, statUpdate));
|
||||
}
|
||||
statup.add(new Pair<>(MapleStat.MAXMP, statUpdate));
|
||||
c.announce(MaplePacketCreator.updatePlayerStats(statup, victim));
|
||||
|
||||
victim.setMaxHp(statUpdate);
|
||||
victim.setMaxMp(statUpdate);
|
||||
|
||||
victim.checkBerserk(victim.isHidden());
|
||||
int maxhpUpdate = statUpdate - extraHp;
|
||||
int maxmpUpdate = statUpdate - extraMp;
|
||||
victim.updateMaxHpMaxMp(maxhpUpdate, maxmpUpdate);
|
||||
} else {
|
||||
player.message("Player '" + params[0] + "' could not be found on this world.");
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.v3;
|
||||
package client.command.commands.gm3;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user