- Joined
- Dec 16, 2010
- Messages
- 304
- Reaction score
- 164
This is an updated version of the normal @str / @dex / @luk / @int commands for adding stats quickly. You can type @watk <amount>, and if your ap is 5x that amount, your current equipped weapon's weapon attack will be increased by the number, your character will be reloaded, so it will take effect, and you will get a nice little dropmessage saying your weapon has been upgraded by whatever weapon attack. If you have two equipped weapons (one regular, one nexon), the item id that is less will prevail and get the upgrade, so I suggest only having one weapon equipped when doing this.
First, add this to MapleCharacter.java (if you don't already have it):
Now this is the replacement @str / @dex / @luk / @int command, so put this in your Commands.java if your using Moople, and whatever your file for player commands is in other sources. If your using another source, use your head here, there will have to be some modifications.
And if you don't want to merge those commands, you can use this for an item upgrader or whatever, idc.
If you want to edit the ap requirement (5x the wep atk), modify the reqap variable.
Feel free to post your comments, flames, more efficient ways of doing this, whatever you'd like. If your missing any methods or have a question, just post it here. Have fun. :blink:
First, add this to MapleCharacter.java (if you don't already have it):
PHP:
public void reloadChar() {
getClient().getSession().write(MaplePacketCreator.getCharInfo(this));
getMap().removePlayer(this);
getMap().addPlayer(this);
}
Now this is the replacement @str / @dex / @luk / @int command, so put this in your Commands.java if your using Moople, and whatever your file for player commands is in other sources. If your using another source, use your head here, there will have to be some modifications.
PHP:
} else if (sub[0].equalsIgnoreCase("str") || sub[0].equalsIgnoreCase("int") || sub[0].equalsIgnoreCase("luk") || sub[0].equalsIgnoreCase("dex") || sub[0].equalsIgnoreCase("watk")) {
int amount = Integer.parseInt(sub[1]);
boolean str = sub[0].equalsIgnoreCase("str");
boolean Int = sub[0].equalsIgnoreCase("int");
boolean luk = sub[0].equalsIgnoreCase("luk");
boolean dex = sub[0].equalsIgnoreCase("dex");
boolean watk = sub[0].equalsIgnoreCase("watk");
if (amount > 0 && amount <= chr.getRemainingAp() && amount <= 29996 || amount < 0 && amount >= -29996 && Math.abs(amount) + chr.getRemainingAp() <= 29996) {
if (str && amount + chr.getStr() <= 30000 && amount + chr.getStr() >= 4) {
chr.setStr(chr.getStr() + amount);
chr.updateSingleStat(MapleStat.STR, chr.getStr());
chr.setRemainingAp(chr.getRemainingAp() - amount);
chr.updateSingleStat(MapleStat.AVAILABLEAP, chr.getRemainingAp());
} else if (Int && amount + chr.getInt() <= 30000 && amount + chr.getInt() >= 4) {
chr.setInt(chr.getInt() + amount);
chr.updateSingleStat(MapleStat.INT, chr.getInt());
chr.setRemainingAp(chr.getRemainingAp() - amount);
chr.updateSingleStat(MapleStat.AVAILABLEAP, chr.getRemainingAp());
} else if (luk && amount + chr.getLuk() <= 30000 && amount + chr.getLuk() >= 4) {
chr.setLuk(chr.getLuk() + amount);
chr.updateSingleStat(MapleStat.LUK, chr.getLuk());
chr.setRemainingAp(chr.getRemainingAp() - amount);
chr.updateSingleStat(MapleStat.AVAILABLEAP, chr.getRemainingAp());
} else if (dex && amount + chr.getDex() <= 30000 && amount + chr.getDex() >= 4) {
chr.setDex(chr.getDex() + amount);
chr.updateSingleStat(MapleStat.DEX, chr.getDex());
chr.setRemainingAp(chr.getRemainingAp() - amount);
chr.updateSingleStat(MapleStat.AVAILABLEAP, chr.getRemainingAp());
} else if (watk){
int wepatk = Integer.parseInt(sub[1]);
int reqap = wepatk * 5, itemid = 0;
for(IItem item : chr.getInventory(MapleInventoryType.EQUIPPED)) {
for(int i = 1302000; i < 1702251; i++) {
if(item.getItemId() == i){
itemid = i;
break;
}
}
}
Equip eItem = (Equip) chr.getInventory(MapleInventoryType.EQUIPPED).findById(itemid);
if(chr.getRemainingAp() >= reqap){
eItem.setWatk((short) (eItem.getWatk() + wepatk));
chr.setRemainingAp(chr.getRemainingAp() - reqap);
chr.reloadChar();
chr.dropMessage("You have successfully added "+ wepatk +" weapon attack to your currently equipped weapon.");
} else
chr.dropMessage("You need "+ reqap +" to add "+ wepatk +" to your equipped weapon.");
}
} else
chr.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4.");
}
And if you don't want to merge those commands, you can use this for an item upgrader or whatever, idc.
PHP:
} else if (sub[0].equals("upgradeweapon")){
int wepatk = Integer.parseInt(sub[1]);
int reqap = wepatk * 5, itemid = 0;
for(IItem item : chr.getInventory(MapleInventoryType.EQUIPPED)) {
for(int i = 1302000; i < 1702251; i++) {
if(item.getItemId() == i){
itemid = i;
break;
}
}
}
Equip eItem = (Equip) chr.getInventory(MapleInventoryType.EQUIPPED).findById(itemid);
if(chr.getRemainingAp() >= reqap){
eItem.setWatk((short) (eItem.getWatk() + wepatk));
chr.setRemainingAp(chr.getRemainingAp() - reqap);
chr.reloadChar();
chr.dropMessage("You have successfully added "+ wepatk +" weapon attack to your currently equipped weapon.");
} else
chr.dropMessage("You need "+ reqap +" to add "+ wepatk +" to your equipped weapon.");
}
If you want to edit the ap requirement (5x the wep atk), modify the reqap variable.
Feel free to post your comments, flames, more efficient ways of doing this, whatever you'd like. If your missing any methods or have a question, just post it here. Have fun. :blink:
Last edited by a moderator: