Experienced Elementalist
- Joined
- Jul 26, 2008
- Messages
- 280
- Reaction score
- 0
I've been working on this project of reducing ap with @str @int @dex @luk commands lately and i've got the basic idea of how it should work. However, I wasn't successful because it is almost impossible to combine the resetting ap command and the adding ap command together. I have given up hope on this one, so, here is where I stopped. For those of you who want to further improve this command feel free to but remember to give me credits for the base script.
How this works? It is an add-on to the @str @int @dex @luk command, except this one enables you to do @str -5 @int -192 @dex -54 @luk -73 and etc to reset stats. But this one is abit buggy because it can make you have negative stats and ap which I have no idea how to fix -.- So feel free to improve this to those who want to. I still recommend my previous version of it. Heres the other version of it. It is basically a separate command since I can't combine it together.
*EDIT* PARTIALLY FIXED. Changing || to && fixes the negative stats problem somehow.. However you still can get negative ap.
Code:
} else if (splitted[0].equals("@str")) {
int up;
up = Integer.parseInt(splitted[1]);
if (up > 0 && player.getRemainingAp() >= up && player.getRemainingAp() > 0 && player.getStr() < 31000) {
player.setStr(player.getStr() + up);
player.setRemainingAp(player.getRemainingAp() - up);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
player.updateSingleStat(MapleStat.STR, player.getStr());
} else {
mc.dropMessage("Insufficient AP or above the 31000 limit");
if ( up < 0 && player.getStr() >= 4 && player.getStr() + up >= 4 && player.getStr() > -up) {
player.setStr(player.getStr() + up);
player.setRemainingAp(player.getRemainingAp() -up);
player.updateSingleStat(MapleStat.STR, player.getStr());
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else {
mc.dropMessage("Not enough str to reset or reached minimum str.");
}
}
}else if (splitted[0].equals("@int")) {
int up;
up = Integer.parseInt(splitted[1]);
if (up > 0 && player.getRemainingAp() >= up && player.getRemainingAp() > 0 && player.getInt() < 31000) {
player.setInt(player.getInt() + up);
player.setRemainingAp(player.getRemainingAp() - up);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
player.updateSingleStat(MapleStat.INT, player.getInt());
} else {
mc.dropMessage("Insufficient AP or above the 31000 limit");
if ( up < 0 && player.getInt() >= 4 && player.getInt() + up >= 4 && player.getInt() > -up) {
player.setInt(player.getInt() + up);
player.setRemainingAp(player.getRemainingAp() -up);
player.updateSingleStat(MapleStat.INT, player.getInt());
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else {
mc.dropMessage("Not enough int to reset or reached minimum int.");
}
}
//DEX
}else if (splitted[0].equals("@dex")) {
int up;
up = Integer.parseInt(splitted[1]);
if (up > 0 && player.getRemainingAp() >= up && player.getRemainingAp() > 0 && player.getDex() < 31000) {
player.setDex(player.getDex() + up);
player.setRemainingAp(player.getRemainingAp() - up);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
player.updateSingleStat(MapleStat.DEX, player.getDex());
} else {
mc.dropMessage("Insufficient AP or above the 31000 limit");
if ( up < 0 && player.getDex() >= 4 && player.getDex() + up >= 4 && player.getDex() > -up) {
player.setDex(player.getDex() + up);
player.setRemainingAp(player.getRemainingAp() -up);
player.updateSingleStat(MapleStat.DEX, player.getDex());
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else {
mc.dropMessage("Not enough dex to reset or reached minimum dex.");
}
}
//LUCK
}else if (splitted[0].equals("@luk")) {
int up;
up = Integer.parseInt(splitted[1]);
if (up > 0 && player.getRemainingAp() >= up && player.getRemainingAp() > 0 && player.getLuk() < 31000) {
player.setLuk(player.getLuk() + up);
player.setRemainingAp(player.getRemainingAp() - up);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
player.updateSingleStat(MapleStat.LUK, player.getLuk());
} else {
mc.dropMessage("Insufficient AP or above the 31000 limit");
if ( up < 0 && player.getLuk() >= 4 && player.getLuk() + up >= 4 && player.getLuk() > -up) {
player.setLuk(player.getLuk() + up);
player.setRemainingAp(player.getRemainingAp() -up);
player.updateSingleStat(MapleStat.LUK, player.getLuk());
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else {
mc.dropMessage("Not enough luk to reset or reached minimum luk.");
}
}
}
Code:
} else if (splitted[0].equals("@resetstr")) {
int down;
down = Integer.parseInt(splitted[1]);
if ( player.getStr() < 4 || player.getStr() - down <= 4) {
mc.dropMessage("Reached minimum str.");
} else if ( player.getStr() < down) {
mc.dropMessage("Not enough str to reset");
} else {
player.setStr(player.getStr() - down);
player.setRemainingAp(player.getRemainingAp() + down);
player.updateSingleStat(MapleStat.STR, player.getStr());
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
}
//INT
}else if (splitted[0].equals("@resetint")) {
int down;
down = Integer.parseInt(splitted[1]);
if ( player.getInt() < 4 || player.getInt() - down <= 4) {
mc.dropMessage("Reached minimum int.");
} else if ( player.getInt() < down) {
mc.dropMessage("Not enough int to reset");
} else {
player.setInt(player.getInt() - down);
player.setRemainingAp(player.getRemainingAp() + down);
player.updateSingleStat(MapleStat.INT, player.getInt());
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
}
//DEX
}else if (splitted[0].equals("@resetdex")) {
int down;
down = Integer.parseInt(splitted[1]);
if ( player.getDex() < 4 || player.getDex() - down <= 4) {
mc.dropMessage("Reached minimum dex.");
} else if ( player.getDex() < down) {
mc.dropMessage("Not enough dex to reset");
} else {
player.setDex(player.getDex() - down);
player.setRemainingAp(player.getRemainingAp() + down);
player.updateSingleStat(MapleStat.DEX, player.getDex());
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
}
//LUCK
}else if (splitted[0].equals("@resetluk")) {
int down;
down = Integer.parseInt(splitted[1]);
if ( player.getLuk() < 4 || player.getLuk() - down <= 4) {
mc.dropMessage("Reached minimum luk.");
} else if ( player.getLuk() < down) {
mc.dropMessage("Not enough luk to reset");
} else {
player.setLuk(player.getLuk() - down);
player.setRemainingAp(player.getRemainingAp() + down);
player.updateSingleStat(MapleStat.LUK, player.getLuk());
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
}