Vegas's spell + pet/mounts schedule revamp + CafePQ

Added Vega's Spell feature. Refactored mounts and pets schedules (now
one thread runs globally updating stats). Fixed Pet Ignore now saving to
DB. Fixed Flash Jump animation not appearing for other players just
after changing jobs. Fixed 3rd job, now as a proper event with timeout.
Introducing Brand-new PQ: CafePQ.
This commit is contained in:
ronancpl
2017-09-08 14:36:58 -03:00
parent 74b4ca4132
commit e064d5cbfa
210 changed files with 35387 additions and 46797 deletions

View File

@@ -115,6 +115,7 @@ import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import client.inventory.MapleWeaponType;
import client.inventory.ModifyInventory;
import client.inventory.PetDataFactory;
import constants.ExpTable;
import constants.GameConstants;
import constants.ItemConstants;
@@ -254,8 +255,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
private ScheduledFuture<?> pendantOfSpirit = null; //1122017
private List<ScheduledFuture<?>> timers = new ArrayList<>();
private Lock chrLock = new ReentrantLock();
private Lock petLock = new ReentrantLock();
private NumberFormat nf = new DecimalFormat("#,###,###,###");
private ArrayList<Integer> excluded = new ArrayList<>();
private Map<Integer, Set<Integer>> excluded = new LinkedHashMap<>();
private Set<Integer> excludedItems = new LinkedHashSet<>();
private List<MapleRing> crushRings = new ArrayList<>();
private List<MapleRing> friendshipRings = new ArrayList<>();
private static String[] ariantroomleader = new String[3];
@@ -266,6 +269,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
private Map<Short, String> area_info = new LinkedHashMap<>();
private AutobanManager autoban;
private boolean isbanned = false;
private boolean blockCashShop = false;
private byte pendantExp = 0, lastmobcount = 0, doorSlot = -1;
private List<Integer> trockmaps = new ArrayList<>();
private List<Integer> viptrockmaps = new ArrayList<>();
@@ -479,10 +483,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
}
public void addExcluded(int x) {
excluded.add(x);
}
public void addFame(int famechange) {
this.fame += famechange;
}
@@ -513,11 +513,16 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
public void addPet(MaplePet pet) {
for (int i = 0; i < 3; i++) {
if (pets[i] == null) {
pets[i] = pet;
return;
petLock.lock();
try {
for (int i = 0; i < 3; i++) {
if (pets[i] == null) {
pets[i] = pet;
return;
}
}
} finally {
petLock.unlock();
}
}
@@ -775,6 +780,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
public void setLastMobCount(byte count) {
lastmobcount = count;
}
public boolean cannotEnterCashShop() {
return blockCashShop;
}
public void toggleBlockCashShop() {
blockCashShop = !blockCashShop;
}
public void newClient(MapleClient c) {
this.loggedIn = true;
@@ -895,7 +908,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
if (effect.isMonsterRiding()) {
if (effect.getSourceId() != Corsair.BATTLE_SHIP) {
this.getMount().cancelSchedule();
this.getClient().getWorldServer().unregisterMountHunger(this);
this.getMount().setActive(false);
}
}
@@ -962,12 +975,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
Hide(!isHidden());
}
private void cancelFullnessSchedule(int petSlot) {
if (fullnessSchedule[petSlot] != null) {
fullnessSchedule[petSlot].cancel(false);
}
}
public void cancelMagicDoor() {
List<MapleBuffStatValueHolder> mbsvhList;
@@ -1028,7 +1035,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
public void setMasteries(int jobId) {
int[] skills = new int[4];
for (int i = 0; i > skills.length; i++) {
skills[i] = 0; //that initalization meng
skills[i] = 0; //that initialization meng
}
if (jobId == 112) {
skills[0] = Hero.ACHILLES;
@@ -1094,6 +1101,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
for (Integer skillId : skills) {
if (skillId != 0) {
Skill skill = SkillFactory.getSkill(skillId);
final int skilllevel = getSkillLevel(skill);
if(skilllevel > 0) continue;
changeSkillLevel(skill, (byte) 0, 10, -1);
}
}
@@ -1161,7 +1171,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
setMasteries(this.job.getId());
guildUpdate();
getMap().broadcastMessage(this, MaplePacketCreator.removePlayerFromMap(this.getId()), false);
getMap().broadcastMessage(this, MaplePacketCreator.spawnPlayerMapobject(this), false);
getMap().broadcastMessage(this, MaplePacketCreator.showForeignEffect(getId(), 8), false);
if (GameConstants.hasSPTable(newJob) && newJob.getId() != 2001) {
if (getBuffedValue(MapleBuffStat.MONSTER_RIDING) != null) {
cancelBuffStats(MapleBuffStat.MONSTER_RIDING);
@@ -1205,7 +1219,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
return new Pair<>(this.banishMap, this.banishSp);
}
private void clearBanishPlayerData() {
public void clearBanishPlayerData() {
this.banishMap = -1;
this.banishSp = -1;
this.banishTime = 0;
@@ -1316,7 +1330,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
if(mbs.getKey() == MapleBuffStat.MAP_PROTECTION) {
byte value = (byte)mbs.getValue().value;
if(value == 1 && thisMap.getReturnMapId() == 211000000) return true; //protection from cold
if(value == 1 && (thisMap.getReturnMapId() == 211000000 || thisMap.getReturnMapId() == 193000000)) return true; //protection from cold
else if(value == 2 && (thisMap.getReturnMapId() == 211000000 || thisMap.getReturnMapId() == 230000000)) return true; //breathing underwater
else return false;
}
@@ -2738,8 +2752,86 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
return eventInstance;
}
public ArrayList<Integer> getExcluded() {
return excluded;
public void resetExcluded(int petId) {
chrLock.lock();
try {
Set<Integer> petExclude = excluded.get(petId);
if(petExclude != null) petExclude.clear();
else excluded.put(petId, new LinkedHashSet<Integer>());
} finally {
chrLock.unlock();
}
}
public void addExcluded(int petId, int x) {
chrLock.lock();
try {
excluded.get(petId).add(x);
} finally {
chrLock.unlock();
}
}
public void commitExcludedItems() {
Map<Integer, Set<Integer>> petExcluded = this.getExcluded();
chrLock.lock();
try {
excludedItems.clear();
} finally {
chrLock.unlock();
}
for(Map.Entry<Integer, Set<Integer>> pe : petExcluded.entrySet()) {
byte petIndex = this.getPetIndex(pe.getKey());
if(petIndex < 0) continue;
Set<Integer> exclItems = pe.getValue();
if (!exclItems.isEmpty()) {
client.announce(MaplePacketCreator.loadExceptionList(this.getId(), pe.getKey(), petIndex, new ArrayList<>(exclItems)));
chrLock.lock();
try {
for(Integer itemid: exclItems) {
excludedItems.add(itemid);
}
} finally {
chrLock.unlock();
}
}
}
}
public void exportExcludedItems(MapleClient c) {
Map<Integer, Set<Integer>> petExcluded = this.getExcluded();
for(Map.Entry<Integer, Set<Integer>> pe : petExcluded.entrySet()) {
byte petIndex = this.getPetIndex(pe.getKey());
if(petIndex < 0) continue;
Set<Integer> exclItems = pe.getValue();
if (!exclItems.isEmpty()) {
c.announce(MaplePacketCreator.loadExceptionList(this.getId(), pe.getKey(), petIndex, new ArrayList<>(exclItems)));
}
}
}
public Map<Integer, Set<Integer>> getExcluded() {
chrLock.lock();
try {
return Collections.unmodifiableMap(excluded);
} finally {
chrLock.unlock();
}
}
public Set<Integer> getExcludedItems() {
chrLock.lock();
try {
return Collections.unmodifiableSet(excludedItems);
} finally {
chrLock.unlock();
}
}
public int getExp() {
@@ -3177,22 +3269,32 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
public int getNextEmptyPetIndex() {
for (int i = 0; i < 3; i++) {
if (pets[i] == null) {
return i;
petLock.lock();
try {
for (int i = 0; i < 3; i++) {
if (pets[i] == null) {
return i;
}
}
return 3;
} finally {
petLock.unlock();
}
return 3;
}
public int getNoPets() {
int ret = 0;
for (int i = 0; i < 3; i++) {
if (pets[i] != null) {
ret++;
petLock.lock();
try {
int ret = 0;
for (int i = 0; i < 3; i++) {
if (pets[i] != null) {
ret++;
}
}
return ret;
} finally {
petLock.unlock();
}
return ret;
}
public int getNumControlledMonsters() {
@@ -3345,33 +3447,55 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
public MaplePet[] getPets() {
return pets;
petLock.lock();
try {
return Arrays.copyOf(pets, pets.length);
} finally {
petLock.unlock();
}
}
public MaplePet getPet(int index) {
return pets[index];
if(index < 0) return null;
petLock.lock();
try {
return pets[index];
} finally {
petLock.unlock();
}
}
public byte getPetIndex(int petId) {
for (byte i = 0; i < 3; i++) {
if (pets[i] != null) {
if (pets[i].getUniqueId() == petId) {
return i;
petLock.lock();
try {
for (byte i = 0; i < 3; i++) {
if (pets[i] != null) {
if (pets[i].getUniqueId() == petId) {
return i;
}
}
}
return -1;
} finally {
petLock.unlock();
}
return -1;
}
public byte getPetIndex(MaplePet pet) {
for (byte i = 0; i < 3; i++) {
if (pets[i] != null) {
if (pets[i].getUniqueId() == pet.getUniqueId()) {
return i;
petLock.lock();
try {
for (byte i = 0; i < 3; i++) {
if (pets[i] != null) {
if (pets[i].getUniqueId() == pet.getUniqueId()) {
return i;
}
}
}
return -1;
} finally {
petLock.unlock();
}
return -1;
}
public int getPossibleReports() {
@@ -4404,6 +4528,29 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
}
}
PreparedStatement ps2;
ResultSet rs2;
for(byte i = 0; i < 3; i++) {
MaplePet pet = ret.getPet(i);
if(pet == null) continue;
int petId = pet.getUniqueId();
ps2 = con.prepareStatement("SELECT itemid FROM petignores WHERE petid = ?"); // Get pet details..
ps2.setInt(1, petId);
ret.resetExcluded(petId);
rs2 = ps2.executeQuery();
while(rs2.next()) {
ret.addExcluded(petId, rs2.getInt("itemid"));
}
ps2.close();
rs2.close();
}
ret.commitExcludedItems();
if (channelserver) {
MapleMapFactory mapFactory = client.getChannelServer().getMapFactory();
ret.map = mapFactory.getMap(ret.mapid);
@@ -5124,26 +5271,31 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
public void removePet(MaplePet pet, boolean shift_left) {
int slot = -1;
for (int i = 0; i < 3; i++) {
if (pets[i] != null) {
if (pets[i].getUniqueId() == pet.getUniqueId()) {
pets[i] = null;
slot = i;
break;
}
}
}
if (shift_left) {
if (slot > -1) {
for (int i = slot; i < 3; i++) {
if (i != 2) {
pets[i] = pets[i + 1];
} else {
petLock.lock();
try {
int slot = -1;
for (int i = 0; i < 3; i++) {
if (pets[i] != null) {
if (pets[i].getUniqueId() == pet.getUniqueId()) {
pets[i] = null;
slot = i;
break;
}
}
}
if (shift_left) {
if (slot > -1) {
for (int i = slot; i < 3; i++) {
if (i != 2) {
pets[i] = pets[i + 1];
} else {
pets[i] = null;
}
}
}
}
} finally {
petLock.unlock();
}
}
@@ -5484,11 +5636,34 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
if (updateRows < 1) {
throw new RuntimeException("Character not in database (" + id + ")");
}
for (int i = 0; i < 3; i++) {
if (pets[i] != null) {
pets[i].saveToDb();
petLock.lock();
try {
for (int i = 0; i < 3; i++) {
if (pets[i] != null) {
pets[i].saveToDb();
}
}
} finally {
petLock.unlock();
}
for(Entry<Integer, Set<Integer>> es: getExcluded().entrySet()) {
try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM petignores WHERE petid=?")) {
ps2.setInt(1, es.getKey());
ps2.executeUpdate();
}
try (PreparedStatement ps2 = con.prepareStatement("INSERT INTO petignores (petid, itemid) VALUES (?, ?)")) {
ps2.setInt(1, es.getKey());
for(Integer x: es.getValue()) {
ps2.setInt(2, x);
ps2.addBatch();
}
ps2.executeBatch();
}
}
deleteWhereCharacterId(con, "DELETE FROM keymap WHERE characterid = ?");
ps = con.prepareStatement("INSERT INTO keymap (characterid, `key`, `type`, `action`) VALUES (?, ?, ?, ?)");
ps.setInt(1, id);
@@ -6212,10 +6387,15 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
}
public void shiftPetsRight() {
if (pets[2] == null) {
pets[2] = pets[1];
pets[1] = pets[0];
pets[0] = null;
petLock.lock();
try {
if (pets[2] == null) {
pets[2] = pets[1];
pets[1] = pets[0];
pets[0] = null;
}
} finally {
petLock.unlock();
}
}
@@ -6297,32 +6477,37 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
return coolDowns.containsKey(Integer.valueOf(skillId));
}
public void startFullnessSchedule(final int decrease, final MaplePet pet, int petSlot) {
if(isGM() && ServerConstants.GM_PETS_NEVER_HUNGRY || ServerConstants.PETS_NEVER_HUNGRY) {
return;
}
public void runFullnessSchedule(int petSlot) {
MaplePet pet = getPet(petSlot);
if(pet == null) return;
ScheduledFuture<?> schedule;
schedule = TimerManager.getInstance().register(new Runnable() {
@Override
public void run() {
int newFullness = pet.getFullness() - decrease;
if (newFullness <= 5) {
pet.setFullness(15);
pet.saveToDb();
unequipPet(pet, true);
} else {
pet.setFullness(newFullness);
pet.saveToDb();
Item petz = getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
if (petz != null) {
forceUpdateItem(petz);
}
}
int newFullness = pet.getFullness() - PetDataFactory.getHunger(pet.getItemId());
if (newFullness <= 5) {
pet.setFullness(15);
pet.saveToDb();
unequipPet(pet, true);
dropMessage(6, "Your pet grew hungry! Treat it some pet food to keep it healthy!");
} else {
pet.setFullness(newFullness);
pet.saveToDb();
Item petz = getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
if (petz != null) {
forceUpdateItem(petz);
}
}, 180000, 18000);
fullnessSchedule[petSlot] = schedule;
}
}
public void runTirednessSchedule() {
if(maplemount != null) {
int tiredness = maplemount.incrementAndGetTiredness();
this.getMap().broadcastMessage(MaplePacketCreator.updateMount(this.getId(), maplemount, false));
if (tiredness > 99) {
maplemount.setTiredness(99);
this.dispelSkill(this.getJobType() * 10000000 + 1004);
this.dropMessage(6, "Your mount grew tired! Treat it some revitalizer before riding it again!");
}
}
}
public void startMapEffect(String msg, int itemId) {
@@ -6346,8 +6531,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
public void unequipAllPets() {
for (int i = 0; i < 3; i++) {
if (pets[i] != null) {
unequipPet(pets[i], true);
MaplePet pet = getPet(i);
if (pet != null) {
unequipPet(pet, true);
}
}
}
@@ -6361,11 +6547,13 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
this.getPet(this.getPetIndex(pet)).setSummoned(false);
this.getPet(this.getPetIndex(pet)).saveToDb();
}
cancelFullnessSchedule(getPetIndex(pet));
this.getClient().getWorldServer().unregisterPetHunger(this, getPetIndex(pet));
getMap().broadcastMessage(this, MaplePacketCreator.showPet(this, pet, true, hunger), true);
removePet(pet, shift_left);
client.announce(MaplePacketCreator.petStatUpdate(this));
client.announce(MaplePacketCreator.enableActions());
removePet(pet, shift_left);
}
public void updateMacros(int position, SkillMacro updateMacro) {
@@ -6832,6 +7020,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
public void showAllEquipFeatures() {
MapleItemInformationProvider mii = MapleItemInformationProvider.getInstance();
String showMsg = "";
for (Item item : getInventory(MapleInventoryType.EQUIPPED).list()) {
Equip nEquip = (Equip) item;
@@ -6840,7 +7029,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
continue;
}
nEquip.showEquipFeatures(client);
showMsg += nEquip.showEquipFeatures(client);
}
if(!showMsg.isEmpty()) {
this.showHint("#ePLAYER EQUIPMENTS:#n\r\n\r\n" + showMsg);
}
}

View File

@@ -154,7 +154,7 @@ public class MapleClient {
}
public void sendCharList(int server) {
this.session.write(MaplePacketCreator.getCharList(this, server));
this.announce(MaplePacketCreator.getCharList(this, server));
}
public List<MapleCharacter> loadCharacters(int serverId) {
@@ -1318,6 +1318,7 @@ public class MapleClient {
}
player.getInventory(MapleInventoryType.EQUIPPED).checked(false); //test
player.getMap().removePlayer(player);
player.clearBanishPlayerData();
player.getClient().getChannelServer().removePlayer(player);
player.getClient().updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
try {

View File

@@ -21,10 +21,6 @@
*/
package client;
import java.util.concurrent.ScheduledFuture;
import server.TimerManager;
import tools.MaplePacketCreator;
/**
* @author PurpleMadness Patrick :O
*/
@@ -34,7 +30,6 @@ public class MapleMount {
private int tiredness;
private int exp;
private int level;
private ScheduledFuture<?> tirednessSchedule;
private MapleCharacter owner;
private boolean active;
@@ -95,21 +90,10 @@ public class MapleMount {
tiredness = 0;
}
}
private void increaseTiredness() {
if(owner != null) {
this.tiredness++;
owner.getMap().broadcastMessage(MaplePacketCreator.updateMount(owner.getId(), this, false));
if (tiredness > 99) {
this.tiredness = 99;
owner.dispelSkill(owner.getJobType() * 10000000 + 1004);
owner.dropMessage(6, "Your mount grew tired! Treat it some revitalizer before riding it again!");
}
} else {
if(this.tirednessSchedule != null) {
this.tirednessSchedule.cancel(false);
}
}
public int incrementAndGetTiredness() {
this.tiredness++;
return this.tiredness;
}
public void setExp(int newexp) {
@@ -124,21 +108,6 @@ public class MapleMount {
this.itemid = newitemid;
}
public void startSchedule() {
this.tirednessSchedule = TimerManager.getInstance().register(new Runnable() {
@Override
public void run() {
increaseTiredness();
}
}, 60000, 60000);
}
public void cancelSchedule() {
if (this.tirednessSchedule != null) {
this.tirednessSchedule.cancel(false);
}
}
public void setActive(boolean set) {
this.active = set;
}
@@ -148,8 +117,7 @@ public class MapleMount {
}
public void empty() {
cancelSchedule();
this.tirednessSchedule = null;
if(owner != null) owner.getClient().getWorldServer().unregisterMountHunger(owner);
this.owner = null;
}
}

View File

@@ -489,42 +489,41 @@ public class Commands {
case "equiplv":
player.showAllEquipFeatures();
break;
case "rates":
//c.resetVoteTime();
player.yellowMessage("BOSSDROP RATE");
player.message(">>Total BOSSDROP Rate: " + c.getWorldServer().getBossDropRate() + "x");
player.message(">>------------------------------------------------");
case "showrates":
String showMsg = "#eEXP RATE#n" + "\r\n";
showMsg += "Server EXP Rate: #k" + c.getWorldServer().getExpRate() + "x#k" + "\r\n";
showMsg += "Player EXP Rate: #k" + player.getRawExpRate() + "x#k" + "\r\n";
if(player.getCouponExpRate() != 1) showMsg += "Coupon EXP Rate: #k" + player.getCouponExpRate() + "x#k" + "\r\n";
showMsg += "EXP Rate: #e#b" + player.getExpRate() + "x#k#n" + "\r\n";
player.yellowMessage("DROP RATE");
player.message(">>Base DROP Rate: " + c.getWorldServer().getDropRate() + "x");
player.message(">>Your DROP Rate: " + player.getRawDropRate() + "x");
if(player.getCouponDropRate() != 1) player.message(">>Your Coupon DROP Rate: " + player.getCouponDropRate() + "x");
player.message(">>------------------------------------------------");
player.message(">>Total DROP Rate: " + player.getDropRate() + "x");
player.yellowMessage("MESO RATE");
player.message(">>Base MESO Rate: " + c.getWorldServer().getMesoRate() + "x");
player.message(">>Your MESO Rate: " + player.getRawMesoRate() + "x");
if(player.getCouponMesoRate() != 1) player.message(">>Your Coupon MESO Rate: " + player.getCouponMesoRate() + "x");
player.message(">>------------------------------------------------");
player.message(">>Total MESO Rate: " + player.getMesoRate() + "x");
player.yellowMessage("EXP RATE");
player.message(">>Base EXP Rate: " + c.getWorldServer().getExpRate() + "x");
player.message(">>Your EXP Rate: " + player.getRawExpRate() + "x");
if(player.getCouponExpRate() != 1) player.message(">>Your Coupon EXP Rate: " + player.getCouponExpRate() + "x");
player.message(">>------------------------------------------------");
player.message(">>Total EXP Rate: " + player.getExpRate() + "x");
/*if(c.getWorldServer().getExpRate() > ServerConstants.EXP_RATE) {
player.message(">>Event EXP bonus: " + (c.getWorldServer().getExpRate() - ServerConstants.EXP_RATE) + "x");
}
player.message(">>Voted EXP bonus: " + (c.hasVotedAlready() ? "1x" : "0x (If you vote now, you will earn an additional 1x EXP!)"));
if (player.getLevel() < 10) {
player.message("Players under level 10 always have 1x exp.");
}*/
break;
showMsg += "\r\n" + "#eMESO RATE#n" + "\r\n";
showMsg += "Server MESO Rate: #k" + c.getWorldServer().getMesoRate() + "x#k" + "\r\n";
showMsg += "Player MESO Rate: #k" + player.getRawMesoRate() + "x#k" + "\r\n";
if(player.getCouponMesoRate() != 1) showMsg += "Coupon MESO Rate: #k" + player.getCouponMesoRate() + "x#k" + "\r\n";
showMsg += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n";
showMsg += "\r\n" + "#eDROP RATE#n" + "\r\n";
showMsg += "Server DROP Rate: #k" + c.getWorldServer().getDropRate() + "x#k" + "\r\n";
showMsg += "Player DROP Rate: #k" + player.getRawDropRate() + "x#k" + "\r\n";
if(player.getCouponDropRate() != 1) showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n";
showMsg += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n";
showMsg += "\r\n" + "#eBOSSDROP RATE#n" + "\r\n";
showMsg += "Server BOSSDROP Rate: #e#b" + c.getWorldServer().getBossDropRate() + "x#k#n" + "\r\n";
player.showHint(showMsg);
break;
case "rates":
String showMsg_ = "#eCHARACTER RATES#n" + "\r\n\r\n";
showMsg_ += "EXP Rate: #e#b" + player.getExpRate() + "x#k#n" + "\r\n";
showMsg_ += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n";
showMsg_ += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n";
showMsg_ += "BOSSDROP Rate: #e#b" + c.getWorldServer().getBossDropRate() + "x#k#n" + "\r\n";
player.showHint(showMsg_);
break;
case "online":
for (Channel ch : Server.getInstance().getChannelsFromWorld(player.getWorld())) {
@@ -788,13 +787,21 @@ public class Commands {
}
if (sub.length == 2) {
player.setRemainingSp(Integer.parseInt(sub[1]));
int newSp = Integer.parseInt(sub[1]);
if(newSp < 0) newSp = 0;
else if(newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP;
player.setRemainingSp(newSp);
player.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp());
} else {
victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]);
if(victim != null) {
victim.setRemainingSp(Integer.parseInt(sub[2]));
int newSp = Integer.parseInt(sub[2]);
if(newSp < 0) newSp = 0;
else if(newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP;
victim.setRemainingSp(newSp);
victim.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp());
player.dropMessage(5, "SP given.");
@@ -809,15 +816,23 @@ public class Commands {
player.yellowMessage("Syntax: !ap [<playername>] <newap>");
break;
}
if (sub.length < 3) {
player.setRemainingAp(Integer.parseInt(sub[1]));
int newAp = Integer.parseInt(sub[1]);
if(newAp < 0) newAp = 0;
else if(newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP;
player.setRemainingAp(newAp);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else {
victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]);
if(victim != null) {
victim.setRemainingAp(Integer.parseInt(sub[2]));
int newAp = Integer.parseInt(sub[2]);
if(newAp < 0) newAp = 0;
else if(newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP;
victim.setRemainingAp(newAp);
victim.updateSingleStat(MapleStat.AVAILABLEAP, victim.getRemainingAp());
} else {
player.message("Player '" + sub[1] + "' could not be found on this channel.");
@@ -1181,15 +1196,28 @@ public class Commands {
break;
case "setstat":
final int x = Short.parseShort(sub[1]);
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);
if (sub.length < 2){
player.yellowMessage("Syntax: !setstat <newstat>");
break;
}
int x;
try {
x = Integer.parseInt(sub[1]);
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) {}
break;
case "maxstat":
@@ -2278,14 +2306,14 @@ public class Commands {
player.getMap().broadcastMessage(MaplePacketCreator.customPacket(joinStringFrom(sub, 1)));
break;
case "debugnearestportal":
case "debugportal":
MaplePortal portal = player.getMap().findClosestPortal(player.getPosition());
if(portal != null) player.dropMessage(6, "Closest portal: " + portal.getId() + " '" + portal.getName() + "' Type: " + portal.getType() + " --> toMap: " + portal.getTargetMapId() + " scriptname: '" + portal.getScriptName() + "' state: " + portal.getPortalState() + ".");
else player.dropMessage(6, "There is no portal on this map.");
break;
case "debugnearestspawnpoint":
case "debugspawnpoint":
SpawnPoint sp = player.getMap().findClosestSpawnpoint(player.getPosition());
if(sp != null) player.dropMessage(6, "Closest mob spawn point: " + " Position: x " + sp.getPosition().getX() + " y " + sp.getPosition().getY() + " Spawns mobid: '" + sp.getMonsterId() + "' --> canSpawn: " + !sp.getDenySpawn() + " canSpawnRightNow: " + sp.shouldSpawn() + ".");
else player.dropMessage(6, "There is no mob spawn point on this map.");
@@ -2381,8 +2409,8 @@ public class Commands {
target.setGMLevel(newLevel);
target.getClient().setGMLevel(newLevel);
target.dropMessage("You are now a level " + newLevel + " GM");
player.dropMessage(target + " is now a level " + newLevel + " GM");
target.dropMessage("You are now a level " + newLevel + " GM. See @commands for a list of available commands.");
player.dropMessage(target + " is now a level " + newLevel + " GM.");
} else {
player.dropMessage("Player '"+ sub[1] +"' was not found on this channel.");
}

View File

@@ -542,14 +542,14 @@ public class Equip extends Item {
return true;
}
public void showEquipFeatures(MapleClient c) {
public String showEquipFeatures(MapleClient c) {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
if(!ii.isUpgradeable(this.getItemId())) return;
if(!ii.isUpgradeable(this.getItemId())) return "";
String eqpName = ii.getName(getItemId());
String eqpInfo = reachedMaxLevel(eqpName) ? " - MAX LEVEL" : (" EXP: " + itemExp + " / " + ExpTable.getEquipExpNeededForLevel(itemLevel));
String eqpInfo = reachedMaxLevel(eqpName) ? " #e#rMAX LEVEL#k#n" : (" EXP: #e#b" + (int)itemExp + "#k#n / " + ExpTable.getEquipExpNeededForLevel(itemLevel));
c.getPlayer().dropMessage(5, "'" + eqpName + "' -> Level: " + itemLevel + eqpInfo);
return "'" + eqpName + "' -> LV: #e#b" + itemLevel + "#k#n " + eqpInfo + "\r\n";
}
public final void showLevelupMessage(String msg, MapleClient c) {