Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Add-On] Item Upgrader || @watk with @str / @dex / @int / @luk

Skilled Illusionist
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):
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:
Legendary Battlemage
Loyal Member
Joined
Dec 13, 2010
Messages
649
Reaction score
140
Good Job Chris, we should have gone with one of my idea's though :'<
 
Legendary Battlemage
Loyal Member
Joined
Sep 28, 2008
Messages
600
Reaction score
291
This will ruin the economy =( sobbed
 
Legendary Battlemage
Loyal Member
Joined
Dec 13, 2010
Messages
649
Reaction score
140
I didn't mean clicking the "like" button. I meant you go around and look at every single release and praise it o-O.
 
Skilled Illusionist
Joined
Dec 16, 2010
Messages
304
Reaction score
164
Thanks guys! If anyone has something they want me to code and release, I'll think about it. Post it here.
 
Joined
Nov 27, 2009
Messages
442
Reaction score
230
Here you go Chris :p

PHP:
        } else if (sub[0].equals("upgradeweapon")){
            int wepatk = Integer.parseInt(sub[1]);
            int reqap = wepatk * 5, itemid = 0;
            Equip eItem = (Equip) player.getInventory(MapleInventoryType.EQUIPPED).getItem((byte)-11);
            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.");
}
 
Skilled Illusionist
Joined
Dec 16, 2010
Messages
304
Reaction score
164
Here you go Chris :p

PHP:
        } else if (sub[0].equals("upgradeweapon")){
            int wepatk = Integer.parseInt(sub[1]);
            int reqap = wepatk * 5, itemid = 0;
            Equip eItem = (Equip) player.getInventory(MapleInventoryType.EQUIPPED).getItem((byte)-11);
            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.");
}
Somebody's earned a gold star :8: Thanks Kevin


Umm...Infection system that affects players depending on the clan they're in. Pretty much forcing them to pick a side.

Like Zombies vs Survivors (yes I'm still stuck on zombies)
That's too specific for anybody else to use. =/ Or you could click on the "Need some Code Boosting?" link in my sig. Upgraded to vB forums ;)
 
Last edited:
Back
Top