- Joined
- Apr 4, 2008
- Messages
- 185
- Reaction score
- 21
As you can see the fix that was provided here wasnt 100% GMS like the rank of the item can drop and the lines changes you cant use the magnifyingglass on the equipped window and the stats that you get has nothing to do with the rank of the item or the type of the item.
so here is the complete fix for all what i said above and the cubes will work GMS like the normal cube cant change lines and the premium cube can change them.
first go to MagnifyingGlassHandler.java and replace the whole code with
after this go to UseCashItemHandler.java and replace the whole code with
after this go to Equip.java and replace the whole code with
go to IEquip.java and replace it with
go to ItemFactory.java and replace all with
and finally run this SQL
*you will have to delete your char and open a new one after extracting this*
i did it all by myself took me ages to make the list of the correct bonus for every item and rank its still not 100% but its good enough the only thing that sucks is that sometimes you get the stat "Hidden Potential".
so here is the complete fix for all what i said above and the cubes will work GMS like the normal cube cant change lines and the premium cube can change them.
first go to MagnifyingGlassHandler.java and replace the whole code with
PHP:
package net.channel.handler;
import client.IEquip;
import client.IItem;
import client.MapleClient;
import client.MapleInventoryType;
import net.AbstractMaplePacketHandler;
import server.MapleInventoryManipulator;
import tools.MaplePacketCreator;
import tools.Randomizer;
import tools.data.input.SeekableLittleEndianAccessor;
public class MagnifyingGlassHandler extends AbstractMaplePacketHandler {
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
slea.readInt();
byte type = (byte) slea.readShort();
byte slot = (byte) slea.readShort();
IEquip item;
if (slot <= 0)
item = (IEquip) c.getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem(slot);
else
item = (IEquip) c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(slot);
IItem toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(type);
if (toUse.getItemId() != 2460000 && toUse.getItemId() != 2460001 && toUse.getItemId() != 2460002 && toUse.getItemId() != 2460003 || toUse.getQuantity() < 1 || item.getPotential() < 1 || item.getPotential() > 3) {
c.getSession().write(MaplePacketCreator.enableActions());
return;
}
int itemId = item.getItemId();
int rand = Randomizer.nextInt(100);
if (rand >= 90 || item.getRank() == 7) { // 10% chance for Unique
item.setPotential((byte) 7);
item.setRank((byte) 7);
item.setPotent1(getRandomPotentialStat(itemId, item));
item.setPotent2(getRandomPotentialStat(itemId, item));
if(rand >= 65 && item.getLines() != 2 || item.getLines() == 3) { // 35% to get 3rd line
item.setPotent3(getRandomPotentialStat(itemId, item));
item.setLines((byte)3);
}
else {
item.setLines((byte)2);
}
} else if (rand >= 80 || item.getRank() == 6) { // 20% chance for Epic
rand = Randomizer.nextInt(100);
item.setPotential((byte) 6);
item.setRank((byte) 6);
item.setPotent1(getRandomPotentialStat(itemId, item));
item.setPotent2(getRandomPotentialStat(itemId, item));
if(rand >= 80 && item.getLines() != 2 || item.getLines() == 3) { // 20% to get 3rd line
item.setPotent3(getRandomPotentialStat(itemId, item));
item.setLines((byte)3);
}
else {
item.setLines((byte)2);
}
} else { // 80% chance for Rare
rand = Randomizer.nextInt(100);
item.setPotential((byte) 5);
item.setRank((byte) 5);
item.setPotent1(getRandomPotentialStat(itemId, item));
item.setPotent2(getRandomPotentialStat(itemId, item));
if(rand >= 95 && item.getLines() != 2 || item.getLines() == 3) { // 5% to get 3rd line
item.setPotent3(getRandomPotentialStat(itemId, item));
item.setLines((byte)3);
}
else {
item.setLines((byte)2);
}
}
c.getPlayer().equipChanged();
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, type, (short) 1, false);
c.getSession().write(MaplePacketCreator.showMagnifyingEffect(1, slot));
c.getSession().write(MaplePacketCreator.updateEquipSlot(item));
c.getSession().write(MaplePacketCreator.enableActions());
}
private short getRandomPotentialStat(int itemId, IEquip item) {
int rand;
if (itemId >= 1000000 && itemId < 1010000) { // Hats
if (item.getRank() == 5) { // rare
short[] hats = {10081, 20086, 1, 2, 3, 4, 10041, 10042, 10043, 10044, 901, 902, 903, 904, 905, 7, 8, 10047, 10048, 13, 14, 10053, 10054, 10201, 10206, 20401, 20406, 20351, 9, 10};
rand = Randomizer.nextInt(hats.length);
return hats[rand];
} else if (item.getRank() == 6) { // epic
short[] hats = {10081, 30086, 10001, 10002, 10003, 10004, 20041, 20042, 20043 ,20044, 901, 902, 903, 904, 905, 10007, 10008, 20047, 20048, 10013, 10014, 20053, 20054, 20201, 20206, 20401, 20406, 20352, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(hats.length);
return hats[rand];
} else if (item.getRank() == 7) { // unique
short[] hats = {31002, 10081, 30086, 10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 901, 902, 903, 904, 905, 10007, 10008, 30047, 30048, 10013, 10014, 30053, 30054, 20201, 20206, 20401, 20406, 20353, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(hats.length);
return hats[rand];
}
} else if (itemId >= 1010000 && itemId < 1020000) { // Face accessory
if (item.getRank() == 5) { // rare
short[] face = {10041, 10042, 10043, 10044, 7, 8, 13, 14, 10053, 10054, 10151, 10156, 9, 10};
rand = Randomizer.nextInt(face.length);
return face[rand];
} else if (item.getRank() == 6) { // epic
short[] face = {20041, 20042, 20043, 20044, 10007, 10008, 10013, 10014, 20053, 20054, 10151, 10156, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(face.length);
return face[rand];
} else if (item.getRank() == 7) { // unique
short[] face = {30041, 30042, 30043, 30044, 10007, 10008, 10013, 10014, 30053, 30054, 10151, 10156, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(face.length);
return face[rand];
}
} else if (itemId >= 1020000 && itemId < 1032000) { // Eye accessory
if (item.getRank() == 5) { // rare
short[] eyes = {10041, 10042, 10043, 10044, 7, 8, 13, 14, 10053, 10054, 9, 10};
rand = Randomizer.nextInt(eyes.length);
return eyes[rand];
} else if (item.getRank() == 6) { // epic
short[] eyes = {20041, 20042, 20043, 20044, 10007, 10008, 10013, 10014, 20053, 20054, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(eyes.length);
return eyes[rand];
} else if (item.getRank() == 7) { // unique
short[] eyes = {30041, 30042, 30043, 30044, 10007, 10008, 10013, 10014, 30053, 30054, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(eyes.length);
return eyes[rand];
}
} else if (itemId >= 1040000 && itemId < 1050000) { // Tops
if (item.getRank() == 5) { // rare
short[] tops = {1, 2, 3, 4, 10041, 10042, 10043, 10044, 30371, 10201, 10206, 20401, 20406, 13, 14, 10053, 10054, 7, 8, 10047, 10048, 9, 10};
rand = Randomizer.nextInt(tops.length);
return tops[rand];
} else if (item.getRank() == 6) { // epic
short[] tops = {10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 30371, 20201, 20206 ,20401, 20406, 10013, 10014, 20053, 20054, 10007, 10008, 20047, 20048, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(tops.length);
return tops[rand];
} else if (item.getRank() == 7) { // unique
short[] tops = {10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 30371, 20201, 20206 ,20401, 20406, 10013, 10014, 30053, 30054, 10007, 10008, 30047, 30048, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(tops.length);
return tops[rand];
}
} else if (itemId >= 1060000 && itemId < 1070000) { // Bottoms
if (item.getRank() == 5) { // rare
short[] bottoms = {1, 2, 3, 4, 10041, 10042, 10043, 10044, 30371, 10201, 10206, 20401, 20406, 13, 14, 10053, 10054, 7, 8, 10047, 10048, 9, 10};
rand = Randomizer.nextInt(bottoms.length);
return bottoms[rand];
} else if (item.getRank() == 6) { // epic
short[] bottoms = {10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 30371, 20201, 20206 ,20401, 20406, 10013, 10014, 20053, 20054, 10007, 10008, 20047, 20048, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(bottoms.length);
return bottoms[rand];
} else if (item.getRank() == 7) { // unique
short[] bottoms = {31004, 10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 30371, 20201, 20206 ,20401, 20406, 10013, 10014, 30053, 30054, 10007, 10008, 30047, 30048, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(bottoms.length);
return bottoms[rand];
}
} else if (itemId >= 1050000 && itemId < 1060000) { // Overalls
if (item.getRank() == 5) { // rare
short[] overalls = {1, 2, 3, 4, 10041, 10042, 10043, 10044, 30371, 10201, 10206, 20401, 20406, 13, 14, 10053, 10054, 7, 8, 10047, 10048, 9, 10};
rand = Randomizer.nextInt(overalls.length);
return overalls[rand];
} else if (item.getRank() == 6) { // epic
short[] overalls = {10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 30371, 20201, 20206 ,20401, 20406, 10013, 10014, 20053, 20054, 10007, 10008, 20047, 20048, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(overalls.length);
return overalls[rand];
} else if (item.getRank() == 7) { // unique
short[] overalls = {10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 30371, 20201, 20206 ,20401, 20406, 10013, 10014, 30053, 30054, 10007, 10008, 30047, 30048, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(overalls.length);
return overalls[rand];
}
} else if (itemId >= 1070000 && itemId < 1080000) { // Shoes
if (item.getRank() == 5) { // rare
short[] shoes = {1, 2, 3, 4, 10041, 10042, 10043, 10044, 13, 14, 10053, 10054, 7, 8, 10047, 10048, 20351, 9, 10};
rand = Randomizer.nextInt(shoes.length);
return shoes[rand];
} else if (item.getRank() == 6) { // epic
short[] shoes = {10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 10013, 10014, 20053, 20054, 10007, 10008, 20047, 20048, 20352, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(shoes.length);
return shoes[rand];
} else if (item.getRank() == 7) { // unique
short[] shoes = {31001, 10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 10013, 10014, 30053, 30054, 10007, 10008, 30047, 30048, 20353, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(shoes.length);
return shoes[rand];
}
} else if (itemId >= 1080000 && itemId < 1090000) { // Gloves
if (item.getRank() == 5) { // rare
short[] gloves = {10041, 10042, 10043, 10044, 13, 14, 10053, 10054, 7, 8, 10047, 10048, 10201, 10206, 20401, 20406, 9, 10};
rand = Randomizer.nextInt(gloves.length);
return gloves[rand];
} else if (item.getRank() == 6) { // epic
short[] gloves = {20041, 20042, 20043, 20044, 10013, 10014, 20053, 20054, 10007, 10008, 20047, 20048, 20201, 20206, 20401, 20406, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(gloves.length);
return gloves[rand];
} else if (item.getRank() == 7) { // unique
short[] gloves = {31003, 30041, 30042, 30043, 30044, 10013, 10014, 30053, 30054, 10007, 10008, 30047, 30048, 20201, 20206, 20401, 20406, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(gloves.length);
return gloves[rand];
}
} else if (itemId >= 1102000 && itemId < 1103000) { // Capes
if (item.getRank() == 5) { // rare
short[] capes = {1, 2, 3, 4, 10041, 10042, 10043, 10044, 13, 14, 10053, 10054, 20351, 9, 10};
rand = Randomizer.nextInt(capes.length);
return capes[rand];
} else if (item.getRank() == 6) { // epic
short[] capes = {10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 10013, 10014, 20053, 20054, 20352, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(capes.length);
return capes[rand];
} else if (item.getRank() == 7) { // unique
short[] capes = {10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 10013, 10014, 30053, 30054, 20353, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(capes.length);
return capes[rand];
}
} else if (itemId >= 1032000 && itemId < 1122000) { // Earrings
if (item.getRank() == 5) { // rare
short[] earrings = {1, 2, 3, 4, 10041, 10042, 10043, 10044, 13, 14, 10053, 10054, 7, 8, 10047, 10048, 9, 10};
rand = Randomizer.nextInt(earrings.length);
return earrings[rand];
} else if (item.getRank() == 6) { // epic
short[] earrings = {10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 10013, 10014, 20053, 20054, 10007, 10008, 20047, 20048, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(earrings.length);
return earrings[rand];
} else if (item.getRank() == 7) { // unique
short[] earrings = {10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 10013, 10014, 30053, 30054, 10007, 10008, 30047, 30048, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(earrings.length);
return earrings[rand];
}
} else if (itemId >= 1132000 && itemId < 1140000) { // Belts
if (item.getRank() == 5) { // rare
short[] belts = {1, 2, 3, 4, 10041, 10042, 10043, 10044, 13, 14, 10053, 10054, 7, 8, 10047, 10048, 9, 10};
rand = Randomizer.nextInt(belts.length);
return belts[rand];
} else if (item.getRank() == 6) { // epic
short[] belts = {10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 10013, 10014, 20053, 20054, 10007, 10008, 20047, 20048, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(belts.length);
return belts[rand];
} else if (item.getRank() == 7) { // unique
short[] belts = {10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 10013, 10014, 30053, 30054, 10007, 10008, 30047, 30048, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(belts.length);
return belts[rand];
}
} else if (itemId >= 1112000 && itemId < 1120000) { // Rings
if (item.getRank() == 5) { // rare
short[] rings = {1, 2, 3, 4, 10041, 10042, 10043, 10044, 13, 14, 10053, 10054, 7, 8, 10047, 10048, 9, 10};
rand = Randomizer.nextInt(rings.length);
return rings[rand];
} else if (item.getRank() == 6) { // epic
short[] rings = {10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 10013, 10014, 20053, 20054, 10007, 10008, 20047, 20048, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(rings.length);
return rings[rand];
} else if (item.getRank() == 7) { // unique
short[] rings = {10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 10013, 10014, 30053, 30054, 10007, 10008, 30047, 30048, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(rings.length);
return rings[rand];
}
} else if (itemId >= 1300000 && itemId < 1800000) { // Weapons
if (item.getRank() == 5) { // rare
short[] weapons = {11, 12, 20051, 20052, 1, 2, 3, 4, 10041, 10042, 10043, 10044, 10070, 10291, 30601, 30602, 10201, 10206, 20401, 20406, 10055, 10221, 10226, 10231, 10236, 10241, 10246, 9, 10};
rand = Randomizer.nextInt(weapons.length);
return weapons[rand];
} else if (item.getRank() == 6) { // epic
short[] weapons = {10011, 10012, 30051, 30052, 10001, 10002, 10003, 10004, 20041, 20042, 20043, 20044, 20070, 20291, 30601, 30602, 20201, 20206, 20401, 20406, 20055, 10221, 10226, 10231, 10236, 10241, 10246, 10009, 10010, 20366, 20376, 20396, 20501, 20511, 20650, 20656};
rand = Randomizer.nextInt(weapons.length);
return weapons[rand];
} else if (item.getRank() == 7) { // unique
short[] weapons = {10011, 10012, 30051, 30052, 10001, 10002, 10003, 10004, 30041, 30042, 30043, 30044, 30070, 30291, 30601, 30602, 20201, 20206, 20401, 20406, 30055, 10221, 10226, 10231, 10236, 10241, 10246, 10009, 10010, 30106, 30107, 30366, 30376, 30501, 30511, 30551, 30656, 30701, 30702};
rand = Randomizer.nextInt(weapons.length);
return weapons[rand];
}
} else {
short[] potentials = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 10010, 10011, 10012, 10013, 10014, 10041, 10042, 10043, 10044, 10045, 10046, 10047, 10048, 10041, 10052, 10053, 10054, 10055, 10070, 10081, 10201, 10206, 10221, 10226, 10231, 10236, 10241, 10246, 10291, 20041, 20042, 20043, 20044, 20045, 20046, 20047, 20048, 20051, 20052, 20053, 20054, 20055, 20070, 20086, 20201, 20206, 20291, 20351, 20352, 20353, 20366, 20396, 20401, 20406, 20656, 30041, 30042, 30044, 30045, 30046, 30047, 30048, 30051, 30053, 30054, 30055, 30070, 30086, 30356, 30357, 30366, 30371, 30551, 30601, 30602, 31001, 31002, 31003, 31004};
rand = Randomizer.nextInt(potentials.length);
return potentials[rand];
}
return 1; // this will never happen
}
}
after this go to UseCashItemHandler.java and replace the whole code with
PHP:
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
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 <Licenses - GNU Project - Free Software Foundation (FSF)>.
*/
package net.channel.handler;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import constants.ExpTable;
import client.IEquip;
import client.IItem;
import client.ISkill;
import client.MapleCharacter;
import client.MapleClient;
import client.MapleInventoryType;
import client.MapleJob;
import client.MaplePet;
import client.MapleStat;
import client.SkillFactory;
import constants.ItemConstants;
import constants.SkillConstants.*;
import java.sql.SQLException;
import net.AbstractMaplePacketHandler;
import scripting.npc.NPCScriptManager;
import server.MapleInventoryManipulator;
import server.MapleItemInformationProvider;
import server.maps.MapleMap;
import server.maps.MapleTVEffect;
import tools.MaplePacketCreator;
import tools.Pair;
import tools.data.input.SeekableLittleEndianAccessor;
import tools.DatabaseConnection;
import java.sql.*;
public final class UseCashItemHandler extends AbstractMaplePacketHandler {
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
MapleCharacter player = c.getPlayer();
if (System.currentTimeMillis() - player.getLastUsedCashItem() < 3000) {
return;
}
player.setLastUsedCashItem(System.currentTimeMillis());
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
slea.readInt();//v97
slea.skip(2);//v97
int itemId = slea.readInt();
int itemType = itemId / 10000;
IItem toUse = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem(c.getPlayer().getInventory(MapleInventoryType.CASH).findById(itemId).getPosition());
String medal = "";
IItem medalItem = c.getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem((byte) -49);
if (medalItem != null) {
medal = "<" + ii.getName(medalItem.getItemId()) + "> ";
}
if (toUse == null || toUse.getItemId() != itemId || toUse.getQuantity() < 1) {
c.announce(MaplePacketCreator.enableActions());
return;
}
try {
if (itemType == 505) { // AP/SP reset
if (itemId > 5050000) {
int SPTo = slea.readInt();
int SPFrom = slea.readInt();
ISkill skillSPTo = SkillFactory.getSkill(SPTo);
ISkill skillSPFrom = SkillFactory.getSkill(SPFrom);
int curLevel = player.getSkillLevel(skillSPTo);
int curLevelSPFrom = player.getSkillLevel(skillSPFrom);
if ((curLevel < skillSPTo.getMaxLevel()) && curLevelSPFrom > 0) {
player.changeSkillLevel(skillSPFrom, (curLevelSPFrom - 1), player.getMasterLevel(skillSPFrom));
player.changeSkillLevel(skillSPTo, (curLevel + 1), player.getMasterLevel(skillSPTo));
/* if (SPFrom == Aran.) {
ISkill hidden1 = SkillFactory.getSkill(Aran.HIDDEN_FULL_DOUBLE);
ISkill hidden2 = SkillFactory.getSkill(Aran.HIDDEN_FULL_TRIPLE);
player.changeSkillLevel(hidden1, (byte) (curLevelSPFrom - 1), player.getMasterLevel(hidden1), -1);
player.changeSkillLevel(hidden2, (byte) (curLevelSPFrom - 1), player.getMasterLevel(hidden2), -1);
} else if (SPFrom == Aran.OVER_SWING) {
ISkill hidden1 = SkillFactory.getSkill(Aran.HIDDEN_OVER_DOUBLE);
ISkill hidden2 = SkillFactory.getSkill(Aran.HIDDEN_OVER_TRIPLE);
player.changeSkillLevel(hidden1, (byte) (curLevelSPFrom - 1), player.getMasterLevel(hidden1), -1);
player.changeSkillLevel(hidden2, (byte) (curLevelSPFrom - 1), player.getMasterLevel(hidden2), -1);
}*/
}
} else {
List<Pair<MapleStat, Integer>> statupdate = new ArrayList<Pair<MapleStat, Integer>>(2);
int APTo = slea.readInt();
int APFrom = slea.readInt();
switch (APFrom) {
case 64: // str
if (player.getStr() < 5) {
return;
}
player.addStat(1, -1);
break;
case 128: // dex
if (player.getDex() < 5) {
return;
}
player.addStat(2, -1);
break;
case 256: // int
if (player.getInt() < 5) {
return;
}
player.addStat(3, -1);
break;
case 512: // luk
if (player.getLuk() < 5) {
return;
}
player.addStat(4, -1);
break;
case 2048: // HP
if (player.getHpMpApUsed() < 1 || player.getHpMpApUsed() >= 10000) {
return;
}
break;
case 8192: // MP
if (player.getHpMpApUsed() <= 0 || player.getHpMpApUsed() >= 10000) {
return;
}
int mp = player.getMp();
int level = player.getLevel();
MapleJob job = player.getJob();
boolean canWash = true;
if (job.isA(MapleJob.SPEARMAN) && mp < 4 * level + 156) {
canWash = false;
} else if (job.isA(MapleJob.FIGHTER) && mp < 4 * level + 56) {
canWash = false;
} else if (job.isA(MapleJob.THIEF) && job.getId() % 100 > 0 && mp < level * 14 - 4) {
canWash = false;
} else if (mp < level * 14 + 148) {
canWash = false;
}
if (canWash) {
int minmp = 0;
if (job.isA(MapleJob.WARRIOR) || job.isA(MapleJob.DAWNWARRIOR1) || job.isA(MapleJob.ARAN1)) {
minmp += 4;
} else if (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.BLAZEWIZARD1)) {
minmp += 36;
} else if (job.isA(MapleJob.BOWMAN) || job.isA(MapleJob.WINDARCHER1) || job.isA(MapleJob.THIEF) || job.isA(MapleJob.NIGHTWALKER1)) {
minmp += 12;
} else if (job.isA(MapleJob.PIRATE) || job.isA(MapleJob.THUNDERBREAKER1)) {
minmp += 16;
} else {
minmp += 8;
}
player.setMp(player.getMp() - minmp);
} else {
c.announce(MaplePacketCreator.updatePlayerStats(MaplePacketCreator.EMPTY_STATUPDATE, true));
return;
}
break;
default:
c.announce(MaplePacketCreator.updatePlayerStats(MaplePacketCreator.EMPTY_STATUPDATE, true));
return;
}
DistributeAPHandler.addStat(c, APTo);
c.announce(MaplePacketCreator.updatePlayerStats(statupdate, true));
}
remove(c, itemId);
} else if (itemType == 506) {
IItem eq = null;
if (itemId == 5060000) { // Item tag.
int equipSlot = slea.readShort();
if (equipSlot == 0) {
return;
}
eq = player.getInventory(MapleInventoryType.EQUIPPED).getItem((byte) equipSlot);
eq.setOwner(player.getName());
} else if (itemId == 5062000) { // miracle cube
client.Equip equip = (client.Equip) player.getInventory(MapleInventoryType.EQUIP).getItem((byte) slea.readShort());
if (equip.getPotential() < 5) {
c.getSession().write(MaplePacketCreator.enableActions());
return;
}
if (!MapleInventoryManipulator.addById(c, 2430112, (short) 1)) {
c.getSession().write(MaplePacketCreator.enableActions());
c.getSession().write(MaplePacketCreator.serverNotice(1, "Please make room in your USE inventory."));
return;
}
equip.potential = (byte) 1;
equip.potent1 = (byte) 0;
equip.potent2 = (byte) 0;
equip.potent3 = (byte) 0;
c.getSession().write(MaplePacketCreator.enableActions());
c.getSession().write(MaplePacketCreator.showCubeEffect(itemId));
c.getSession().write(MaplePacketCreator.updateEquipSlot(equip));
remove(c, itemId);
return;
} else if (itemId == 5062001) { // premium miracle cube
client.Equip equip = (client.Equip) player.getInventory(MapleInventoryType.EQUIP).getItem((byte) slea.readShort());
if (equip.getPotential() < 5) {
c.getSession().write(MaplePacketCreator.enableActions());
return;
}
if (!MapleInventoryManipulator.addById(c, 2430112, (short) 1)) {
c.getSession().write(MaplePacketCreator.enableActions());
c.getSession().write(MaplePacketCreator.serverNotice(1, "Please make room in your USE inventory."));
return;
}
equip.lines = (byte) 0;
equip.potential = (byte) 1;
equip.potent1 = (byte) 0;
equip.potent2 = (byte) 0;
equip.potent3 = (byte) 0;
c.getSession().write(MaplePacketCreator.enableActions());
c.getSession().write(MaplePacketCreator.showCubeEffect(itemId));
c.getSession().write(MaplePacketCreator.updateEquipSlot(equip));
remove(c, itemId);
return;
} else if (itemId == 5060001 || itemId == 5061000 || itemId == 5061001 || itemId == 5061002 || itemId == 5061003) { // Sealing lock
MapleInventoryType type = MapleInventoryType.getByType((byte) slea.readInt());
IItem item = c.getPlayer().getInventory(type).getItem((byte) slea.readInt());
if (item == null) { //Check if the type is EQUIPMENT?
return;
}
byte flag = item.getFlag();
flag |= ItemConstants.LOCK;
if (item.getExpiration() > -1) {
return; //No perma items pls
}
item.setFlag(flag);
long period = 0;
if (itemId == 5061000) {
period = 7;
} else if (itemId == 5061001) {
period = 30;
} else if (itemId == 5061002) {
period = 90;
} else if (itemId == 5061003) {
period = 365;
}
if (period > 0) {
item.setExpiration(System.currentTimeMillis() + (period * 60 * 60 * 24 * 1000));
}
c.announce(MaplePacketCreator.updateSlot(item));
remove(c, itemId);
} else if (itemId == 5060002) { // Incubator
byte inventory2 = (byte) slea.readInt();
byte slot2 = (byte) slea.readInt();
IItem item2 = c.getPlayer().getInventory(MapleInventoryType.getByType(inventory2)).getItem(slot2);
if (item2 == null) // hacking
{
return;
}
if (getIncubatedItem(c, itemId)) {
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.getByType(inventory2), slot2, (short) 1, false);
remove(c, itemId);
}
return;
}
slea.readInt(); // time stamp
c.announce(MaplePacketCreator.updateSlot(eq));
remove(c, itemId);
} else if (itemType == 507) {
boolean whisper;
switch (itemId / 1000 % 10) {
case 1: // Megaphone
if (player.getLevel() > 9) {
if (!player.isBlockedFromSmega()) {
player.getClient().getChannelServer().broadcastMegaphones(MaplePacketCreator.serverNotice(2, medal + player.getName() + " : " + slea.readMapleAsciiString()));
} else {
player.dropMessage(" You are blocked from using smegas. ");
}
} else {
player.dropMessage(1, "You may not use this until you're level 10.");
}
break;
case 2: // Super megaphone
if (!player.isBlockedFromSmega()) {
player.getClient().getChannelServer().broadcastMegaphones(MaplePacketCreator.serverNotice(3, c.getChannel(), medal + player.getName() + " : " + slea.readMapleAsciiString(), (slea.readByte() != 0)));
} else {
player.dropMessage(" You are blocked from using smegas. ");
}
break;
case 5: // Maple TV
int tvType = itemId % 10;
boolean megassenger = false;
boolean ear = false;
MapleCharacter victim = null;
if (tvType != 1) {
if (tvType >= 3) {
megassenger = true;
if (tvType == 3) {
slea.readByte();
}
ear = 1 == slea.readByte();
} else if (tvType != 2) {
slea.readByte();
}
if (tvType != 4) {
victim = c.getChannelServer().getPlayerStorage().getCharacterByName(slea.readMapleAsciiString());
}
}
List<String> messages = new LinkedList<String>();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 5; i++) {
String message = slea.readMapleAsciiString();
if (megassenger) {
builder.append(" ").append(message);
}
messages.add(message);
}
slea.readInt();
if (megassenger) {
c.getChannelServer().getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(3, c.getChannel(), medal + player.getName() + " : " + builder.toString(), ear).getBytes());
}
if (!MapleTVEffect.isActive()) {
new MapleTVEffect(player, victim, messages, tvType);
remove(c, itemId);
} else {
player.dropMessage(1, "MapleTV is already in use.");
return;
}
break;
case 6: //item megaphone
String msg = medal + c.getPlayer().getName() + " : " + slea.readMapleAsciiString();
whisper = slea.readByte() == 1;
IItem item = null;
if (slea.readByte() == 1) { //item
item = c.getPlayer().getInventory(MapleInventoryType.getByType((byte) slea.readInt())).getItem((byte) slea.readInt());
if (item == null) //hack
{
return;
} else if (ii.isDropRestricted(item.getItemId())) { //Lol?
player.dropMessage(1, "You cannot trade this item.");
c.announce(MaplePacketCreator.enableActions());
return;
}
}
if (!player.isBlockedFromSmega()) {
player.getClient().getChannelServer().broadcastMegaphones(MaplePacketCreator.itemMegaphone(msg, whisper, c.getChannel(), item));
} else {
player.dropMessage(" You are blocked from using smegas. ");
}
break;
case 7: //triple megaphone
int lines = slea.readByte();
if (lines < 1 || lines > 3) //hack
{
return;
}
String[] msg2 = new String[lines];
for (int i = 0; i < lines; i++) {
msg2[i] = medal + c.getPlayer().getName() + " : " + slea.readMapleAsciiString();
}
whisper = slea.readByte() == 1;
if (!player.isBlockedFromSmega()) {
player.getClient().getChannelServer().broadcastMegaphones(MaplePacketCreator.getMultiMegaphone(msg2, c.getChannel(), whisper));
} else {
player.dropMessage(" You are blocked from using smegas. ");
}
break;
}
remove(c, itemId);
} else if (itemType == 508) { //graduation banner
slea.readMapleAsciiString(); // message, sepearated by 0A for lines
c.announce(MaplePacketCreator.enableActions());
} else if (itemType == 509) {
String sendTo = slea.readMapleAsciiString();
String msg = slea.readMapleAsciiString();
player.sendNote(sendTo, msg, (byte) 0);
remove(c, itemId);
} else if (itemType == 510) {
player.getMap().broadcastMessage(MaplePacketCreator.musicChange("Jukebox/Congratulation"));
remove(c, itemId);
} else if (itemType == 512) {
if (ii.getStateChangeItem(itemId) != 0) {
for (MapleCharacter mChar : c.getPlayer().getMap().getCharacters()) {
ii.getItemEffect(ii.getStateChangeItem(itemId)).applyTo(mChar);
}
}
player.getMap().startMapEffect(ii.getMsg(itemId).replaceFirst("%s", c.getPlayer().getName()).replaceFirst("%s", slea.readMapleAsciiString()), itemId);
remove(c, itemId);
} else if (itemType == 517) {
MaplePet pet = player.getPet(0);
if (pet == null) {
c.announce(MaplePacketCreator.enableActions());
return;
}
IItem item = player.getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
String newName = slea.readMapleAsciiString();
pet.setName(newName);
pet.saveToDb();
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE pets SET name = ? WHERE id = ?");
ps.setString(1, newName);
ps.setInt(2, pet.getPetId());
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
c.announce(MaplePacketCreator.updateSlot(item));
player.getMap().broadcastMessage(player, MaplePacketCreator.changePetName(player, newName, 1), true);
c.announce(MaplePacketCreator.enableActions());
remove(c, itemId);
} else if (itemType == 504) { // vip teleport rock
String error1 = "Either the player could not be found or you were trying to teleport to an illegal location.";
boolean vip = slea.readByte() == 1;
remove(c, itemId);
if (!vip) {
int mapId = slea.readInt();
if (c.getChannelServer().getMapFactory(c.getPlayer().getGMode()).getMap(mapId).getForcedReturnId() == 999999999) {
player.changeMap(c.getChannelServer().getMapFactory(c.getPlayer().getGMode()).getMap(mapId));
} else {
MapleInventoryManipulator.addById(c, itemId, (short) 1);
c.getPlayer().dropMessage(1, error1);
c.announce(MaplePacketCreator.enableActions());
}
} else {
String name = slea.readMapleAsciiString();
MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(name);
boolean success = false;
if (victim != null) {
MapleMap target = victim.getMap();
if (c.getChannelServer().getMapFactory(c.getPlayer().getGMode()).getMap(c.getChannelServer().getWorldInterface().getLocation(name).map).getForcedReturnId() == 999999999 || victim.getMapId() < 100000000) {
if (victim.gmLevel() <= player.gmLevel()) {
if (itemId == 5041000 || victim.getMapId() / player.getMapId() == 1) { //viprock & same continent
player.changeMap(target, target.findClosestSpawnpoint(victim.getPosition()));
success = true;
} else {
player.dropMessage(1, error1);
}
} else {
player.dropMessage(1, error1);
}
} else {
player.dropMessage(1, "You cannot teleport to this map.");
}
} else {
player.dropMessage(1, "Player could not be found in this channel.");
}
if (!success) {
MapleInventoryManipulator.addById(c, itemId, (short) 1);
c.announce(MaplePacketCreator.enableActions());
}
}
} else if (itemType == 506) {
byte slot = (byte) slea.readShort();
IEquip item = (IEquip) player.getInventory(MapleInventoryType.EQUIP).getItem(slot);
client.Equip eq = (client.Equip) item;
eq.potential = (byte) 1;
eq.potent1 = (byte) 0;
eq.potent2 = (byte) 0;
eq.potent3 = (byte) 0;
c.getSession().write(MaplePacketCreator.enableActions());
remove(c, itemId);
} else if (itemType == 520) {
player.gainMeso(ii.getMeso(itemId), true, false, true);
remove(c, itemId);
c.announce(MaplePacketCreator.enableActions());
} else if (itemType == 524) {
for (byte i = 0; i < 3; i++) {
MaplePet pet = player.getPet(i);
if (pet != null) {
if (pet.canConsume(itemId)) {
pet.setFullness(100);
if (pet.getCloseness() + 100 > 30000) {
pet.setCloseness(30000);
} else {
pet.gainCloseness(100);
}
while (pet.getCloseness() >= ExpTable.getClosenessNeededForLevel(pet.getLevel())) {
pet.setLevel((byte) (pet.getLevel() + 1));
byte index = player.getPetIndex(pet);
c.announce(MaplePacketCreator.showOwnPetLevelUp(index));
player.getMap().broadcastMessage(MaplePacketCreator.showPetLevelUp(c.getPlayer(), index));
}
IItem item = player.getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
c.announce(MaplePacketCreator.updateSlot(item));
player.getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.commandResponse(player.getId(), i, 1, true), true);
remove(c, itemId);
break;
}
} else {
break;
}
}
c.announce(MaplePacketCreator.enableActions());
} else if (itemType == 530) {
ii.getItemEffect(itemId).applyTo(player);
remove(c, itemId);
} else if (itemType == 533) {
NPCScriptManager.getInstance().start(c, 9010009, null, null);
} else if (itemType == 537) {
player.setChalkboard(slea.readMapleAsciiString());
player.getMap().broadcastMessage(MaplePacketCreator.useChalkboard(player, false));
player.getClient().announce(MaplePacketCreator.enableActions());
} else if (itemType == 539) {
List<String> lines = new LinkedList<String>();
if (itemId == 5390009) { // friendfinder
lines.add("Hi, I am looking for friends!! Add me to your buddylist!");
}
for (int i = 0; i < 4; i++) {
lines.add(slea.readMapleAsciiString());
}
if (!player.isBlockedFromSmega()) {
player.getClient().getChannelServer().broadcastMegaphones(MaplePacketCreator.getAvatarMega(c.getPlayer(), medal, c.getChannel(), itemId, lines, (slea.readByte() != 0)));
remove(c, itemId);
} else {
player.dropMessage("You cannot use megaphones since you are muted from using them.");
}
} else if (itemType == 545) { // MiuMiu's travel store
//Code the npc
c.announce(MaplePacketCreator.enableActions());
} else if (itemType == 550) { //Extend item expiration
c.announce(MaplePacketCreator.enableActions());
} else if (itemType == 552) {
MapleInventoryType type = MapleInventoryType.getByType((byte) slea.readInt());
byte slot = (byte) slea.readInt();
IItem item = c.getPlayer().getInventory(type).getItem(slot);
if (item == null || item.getQuantity() <= 0 || (item.getFlag() & ItemConstants.KARMA) > 0 && ii.isKarmaAble(item.getItemId())) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (type.equals(MapleInventoryType.USE)) {
item.setFlag((byte) ItemConstants.SPIKES);
} else {
item.setFlag((byte) ItemConstants.KARMA);
}
c.getPlayer().forceUpdateItem(type, item);
remove(c, itemId);
c.announce(MaplePacketCreator.enableActions());
} else if (itemType == 552) { //DS EGG THING
c.announce(MaplePacketCreator.enableActions());
} else if (itemType == 557) {
slea.readInt();
int itemSlot = slea.readInt();
slea.readInt();
final IEquip equip = (IEquip) c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) itemSlot);
if (equip.getVicious() == 2 || c.getPlayer().getInventory(MapleInventoryType.CASH).findById(5570000) == null) {
return;
}
equip.setVicious(equip.getVicious() + 1);
equip.setUpgradeSlots(equip.getUpgradeSlots() + 1);
remove(c, itemId);
c.announce(MaplePacketCreator.enableActions());
c.announce(MaplePacketCreator.sendHammerData(equip.getVicious()));
c.announce(MaplePacketCreator.hammerItem(equip));
} else if (itemType == 561) { //VEGA'S SPELL
c.announce(MaplePacketCreator.enableActions());
} else {
System.out.println("NEW CASH ITEM: " + itemType + "\n" + slea.toString());
c.announce(MaplePacketCreator.enableActions());
}
} catch (Exception e) {
}
}
private static void remove(MapleClient c, int itemId) {
MapleInventoryManipulator.removeById(c, MapleInventoryType.CASH, itemId, 1, true, false);
}
private static boolean getIncubatedItem(MapleClient c, int id) {
final int[] ids = {1012070, 1302049, 1302063, 1322027, 2000004, 2000005, 2020013, 2020015, 2040307, 2040509, 2040519, 2040521, 2040533, 2040715, 2040717, 2040810, 2040811, 2070005, 2070006, 4020009,};
final int[] quantitys = {1, 1, 1, 1, 240, 200, 200, 200, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3};
int amount = 0;
for (int i = 0; i < ids.length; i++) {
if (i == id) {
amount = quantitys[i];
}
}
if (c.getPlayer().getInventory(MapleInventoryType.getByType((byte) (id / 1000000))).isFull()) {
return false;
}
MapleInventoryManipulator.addById(c, id, (short) amount);
return true;
}
}
after this go to Equip.java and replace the whole code with
PHP:
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
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 <Licenses - GNU Project - Free Software Foundation (FSF)>.
*/
package client;
import java.util.LinkedList;
import java.util.List;
import server.MapleItemInformationProvider;
import tools.MaplePacketCreator;
import tools.Pair;
public class Equip extends Item implements IEquip {
private byte upgradeSlots;
private byte level, flag, itemLevel;
private short str, dex, _int, luk, hp, mp, watk, matk, wdef, mdef, acc, avoid, hands, speed, jump, vicious;
private float itemExp;
private int ringid = -1;
private boolean wear = false;
private int skill0, skill1, skill2, skill3;
public byte stars, potential, rank, lines;
public short potent1;
public short potent2;
public short potent3;
public Equip(int id, byte position) {
super(id, position, (short) 1);
this.itemExp = 0;
this.itemLevel = 1;
}
public Equip(int id, byte position, byte potential) {
super(id, position, (short) 1);
this.itemExp = 0;
this.itemLevel = 0;
this.ringid = -1;
if(potential > 1) {
this.potential = (byte) (potential + 4); // 1 =5, 2 = 6, etc
} else {
this.potential = potential;
}
}
public Equip(int id, byte position, int slots) {
super(id, position, (short) 1);
this.upgradeSlots = (byte) slots;
this.itemExp = 0;
this.itemLevel = 1;
}
public byte getStars() {
return stars;
}
public void setStars(byte i) {
this.stars = i;
}
@Override
public IItem copy() {
Equip ret = new Equip(getItemId(), getPosition(), getUpgradeSlots());
ret.str = str;
ret.dex = dex;
ret._int = _int;
ret.luk = luk;
ret.hp = hp;
ret.mp = mp;
ret.matk = matk;
ret.mdef = mdef;
ret.watk = watk;
ret.wdef = wdef;
ret.acc = acc;
ret.avoid = avoid;
ret.hands = hands;
ret.speed = speed;
ret.jump = jump;
ret.flag = flag;
ret.vicious = vicious;
ret.upgradeSlots = upgradeSlots;
ret.itemLevel = itemLevel;
ret.itemExp = itemExp;
ret.level = level;
ret.potential = potential;
ret.rank = rank;
ret.lines = lines;
ret.stars = stars;
ret.potent1 = potent1;
ret.potent2 = potent2;
ret.potent3 = potent3;
ret.log = new LinkedList<String>(log);
ret.setOwner(getOwner());
ret.setQuantity(getQuantity());
ret.setExpiration(getExpiration());
ret.setGiftFrom(getGiftFrom());
return ret;
}
@Override
public byte getFlag() {
return flag;
}
@Override
public byte getType() {
return IItem.EQUIP;
}
public byte getUpgradeSlots() {
return upgradeSlots;
}
public short getStr() {
return str;
}
public short getDex() {
return dex;
}
public short getInt() {
return _int;
}
public short getLuk() {
return luk;
}
public short getHp() {
return hp;
}
public short getMp() {
return mp;
}
public short getWatk() {
return watk;
}
public short getMatk() {
return matk;
}
public short getWdef() {
return wdef;
}
public short getMdef() {
return mdef;
}
public short getAcc() {
return acc;
}
public short getAvoid() {
return avoid;
}
public short getHands() {
return hands;
}
public short getSpeed() {
return speed;
}
public short getJump() {
return jump;
}
public short getVicious() {
return vicious;
}
public byte getPotential() {
return potential;
}
public byte getRank() {
return rank;
}
public byte getLines() {
return lines;
}
public short getPotent1() {
return potent1;
}
public short getPotent2() {
return potent2;
}
public short getPotent3() {
return potent3;
}
@Override
public void setFlag(byte flag) {
this.flag = flag;
}
public void setStr(short str) {
this.str = str;
}
public void setDex(short dex) {
this.dex = dex;
}
public void setInt(short _int) {
this._int = _int;
}
public void setLuk(short luk) {
this.luk = luk;
}
public void setHp(short hp) {
this.hp = hp;
}
public void setMp(short mp) {
this.mp = mp;
}
public void setWatk(short watk) {
this.watk = watk;
}
public void setMatk(short matk) {
this.matk = matk;
}
public void setWdef(short wdef) {
this.wdef = wdef;
}
public void setMdef(short mdef) {
this.mdef = mdef;
}
public void setAcc(short acc) {
this.acc = acc;
}
public void setAvoid(short avoid) {
this.avoid = avoid;
}
public void setHands(short hands) {
this.hands = hands;
}
public void setSpeed(short speed) {
this.speed = speed;
}
public void setJump(short jump) {
this.jump = jump;
}
public void setVicious(short vicious) {
this.vicious = vicious;
}
public void setUpgradeSlots(byte upgradeSlots) {
this.upgradeSlots = upgradeSlots;
}
public byte getLevel() {
return level;
}
public void setLevel(byte level) {
this.level = level;
}
public void setPotential(byte potent) {
this.potential = potent;
}
public void setRank(byte rank) {
this.rank = rank;
}
public void setLines(byte lines) {
this.lines = lines;
}
public void setPotent1(short potent) {
this.potent1 = potent;
}
public void setPotent2(short potent) {
this.potent2 = potent;
}
public void setPotent3(short potent) {
this.potent3 = potent;
}
public void gainLevel(MapleClient c, boolean timeless) {
List<Pair<String, Integer>> stats = MapleItemInformationProvider.getInstance().getItemLevelupStats(getItemId(), itemLevel, timeless);
for (Pair<String, Integer> stat : stats) {
if (stat.getLeft().equals("incDEX"))
dex += stat.getRight();
else if (stat.getLeft().equals("incSTR"))
str += stat.getRight();
else if (stat.getLeft().equals("incINT"))
_int += stat.getRight();
else if (stat.getLeft().equals("incLUK"))
luk += stat.getRight();
else if (stat.getLeft().equals("incMHP"))
hp += stat.getRight();
else if (stat.getLeft().equals("incMMP"))
mp += stat.getRight();
else if (stat.getLeft().equals("incPAD"))
watk += stat.getRight();
else if (stat.getLeft().equals("incMAD"))
matk += stat.getRight();
else if (stat.getLeft().equals("incPDD"))
wdef += stat.getRight();
else if (stat.getLeft().equals("incMDD"))
mdef += stat.getRight();
else if (stat.getLeft().equals("incEVA"))
avoid += stat.getRight();
else if (stat.getLeft().equals("incACC"))
acc += stat.getRight();
else if (stat.getLeft().equals("incSpeed"))
speed += stat.getRight();
else if (stat.getLeft().equals("incJump"))
jump += stat.getRight();
else if (stat.getLeft().equals("Skill0"))
skill0 = stat.getRight();
else if (stat.getLeft().equals("Skill1"))
skill1 = stat.getRight();
else if (stat.getLeft().equals("Skill2"))
skill2 = stat.getRight();
else if (stat.getLeft().equals("Skill3"))
skill3 = stat.getRight();
}
this.itemLevel++;
c.announce(MaplePacketCreator.showEquipmentLevelUp());
c.getPlayer().getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.showForeignEffect(c.getPlayer().getId(), 15));
c.getPlayer().forceUpdateItem(MapleInventoryType.EQUIPPED, this);
}
public int getItemExp() {
return (int) itemExp;
}
public void gainItemExp(MapleClient c, int gain, boolean timeless) {
int expneeded = timeless ? (10 * itemLevel + 70) : (5 * itemLevel + 65);
float modifier = 364 / expneeded;
float exp = (expneeded / (1000000 * modifier * modifier)) * gain;
itemExp += exp;
if (itemExp >= 364) {
itemExp = (itemExp - 364);
gainLevel(c, timeless);
} else
c.getPlayer().forceUpdateItem(MapleInventoryType.EQUIPPED, this);
}
public void setItemExp(int exp) {
this.itemExp = exp;
}
public void setItemLevel(byte level) {
this.itemLevel = level;
}
@Override
public void setQuantity(short quantity) {
if (quantity < 0 || quantity > 1) {
throw new RuntimeException("Setting the quantity to " + quantity + " on an equip (itemid: " + getItemId() + ")");
}
super.setQuantity(quantity);
}
public void setUpgradeSlots(int i) {
this.upgradeSlots = (byte) i;
}
public void setVicious(int i) {
this.vicious = (short) i;
}
public int getRingId() {
return ringid;
}
public void setRingId(int id) {
this.ringid = id;
}
public boolean isWearing() {
return wear;
}
public void wear(boolean yes) {
wear = yes;
}
public byte getItemLevel() {
return itemLevel;
}
}
go to IEquip.java and replace it with
PHP:
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
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 <Licenses - GNU Project - Free Software Foundation (FSF)>.
*/
package client;
public interface IEquip extends IItem {
public enum ScrollResult {
SUCCESS, FAIL, CURSE
}
public void setUpgradeSlots(int i);
public void setVicious(int i);
byte getUpgradeSlots();
byte getLevel();
public byte getFlag();
public short getStr();
public short getDex();
public short getInt();
public short getLuk();
public short getHp();
public short getMp();
public short getWatk();
public short getMatk();
public short getWdef();
public short getMdef();
public short getAcc();
public short getAvoid();
public short getHands();
public short getSpeed();
public short getJump();
public short getVicious();
public int getItemExp();
public byte getItemLevel();
public int getRingId();
public void setRingId(int id);
public boolean isWearing();
public void wear(boolean yes);
public void setPotential(byte potent);
public void setRank(byte rank);
public void setLines(byte lines);
public void setPotent1(short potent);
public void setPotent2(short potent);
public void setPotent3(short potent);
public void setStars(byte i);
public byte getPotential();
public byte getRank();
public byte getLines();
public short getPotent1();
public short getPotent2();
public short getPotent3();
public byte getStars();
}
go to ItemFactory.java and replace all with
PHP:
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License 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 <Licenses - GNU Project - Free Software Foundation (FSF)>.
*/
package client;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import tools.DatabaseConnection;
import tools.Pair;
/**
*
* @author Flav
*/
public enum ItemFactory {
INVENTORY(1, false),
STORAGE(2, true),
CASH_EXPLORER(3, true),
CASH_CYGNUS(4, false),
CASH_ARAN(5, false),
MERCHANT(6, false),
ELSE(7, false);
private int value;
private boolean account;
private ItemFactory(int value, boolean account) {
this.value = value;
this.account = account;
}
public int getValue() {
return value;
}
public List<Pair<IItem, MapleInventoryType>> loadItems(int id, boolean login) throws SQLException {
List<Pair<IItem, MapleInventoryType>> items = new ArrayList<Pair<IItem, MapleInventoryType>>();
StringBuilder query = new StringBuilder();
query.append("SELECT * FROM `inventoryitems` LEFT JOIN `inventoryequipment` USING(`inventoryitemid`) WHERE `type` = ? AND `");
query.append(account ? "accountid" : "characterid");
query.append("` = ?");
if (login) {
query.append(" AND `inventorytype` = ");
query.append(MapleInventoryType.EQUIPPED.getType());
}
PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement(query.toString());
ps.setInt(1, value);
ps.setInt(2, id);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
MapleInventoryType mit = MapleInventoryType.getByType(rs.getByte("inventorytype"));
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"));
equip.setOwner(rs.getString("owner"));
equip.setQuantity((short) rs.getInt("quantity"));
equip.setAcc((short) rs.getInt("acc"));
equip.setAvoid((short) rs.getInt("avoid"));
equip.setDex((short) rs.getInt("dex"));
equip.setHands((short) rs.getInt("hands"));
equip.setHp((short) rs.getInt("hp"));
equip.setInt((short) rs.getInt("int"));
equip.setJump((short) rs.getInt("jump"));
equip.setVicious((short) rs.getInt("vicious"));
equip.setFlag((byte) rs.getInt("flag"));
equip.setLuk((short) rs.getInt("luk"));
equip.setMatk((short) rs.getInt("matk"));
equip.setMdef((short) rs.getInt("mdef"));
equip.setMp((short) rs.getInt("mp"));
equip.setSpeed((short) rs.getInt("speed"));
equip.setStr((short) rs.getInt("str"));
equip.setWatk((short) rs.getInt("watk"));
equip.setWdef((short) rs.getInt("wdef"));
equip.setUpgradeSlots((byte) rs.getInt("upgradeslots"));
equip.setLevel((byte) rs.getByte("level"));
equip.setItemExp(rs.getInt("itemexp"));
equip.setItemLevel(rs.getByte("itemlevel"));
equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom"));
equip.setRingId(rs.getInt("ringid"));
equip.setLines(rs.getByte("lines"));
equip.setRank(rs.getByte("rank"));
equip.setPotent1(rs.getShort("potent1"));
equip.setPotent2(rs.getShort("potent2"));
equip.setPotent3(rs.getShort("potent3"));
equip.stars = rs.getByte("stars");
equip.setPotential(rs.getByte("potential"));
items.add(new Pair<IItem, MapleInventoryType>(equip, mit));
} else {
Item item = new Item(rs.getInt("itemid"), (byte) rs.getInt("position"), (short) rs.getInt("quantity"), rs.getInt("petid"));
item.setOwner(rs.getString("owner"));
item.setExpiration(rs.getLong("expiration"));
item.setGiftFrom(rs.getString("giftFrom"));
item.setFlag((byte) rs.getInt("flag"));
items.add(new Pair<IItem, MapleInventoryType>(item, mit));
}
}
rs.close();
ps.close();
return items;
}
public synchronized void saveItems(List<Pair<IItem, MapleInventoryType>> items, int id) throws SQLException {
StringBuilder query = new StringBuilder();
query.append("DELETE FROM `inventoryitems` WHERE `type` = ? AND `");
query.append(account ? "accountid" : "characterid");
query.append("` = ?");
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement(query.toString());
ps.setInt(1, value);
ps.setInt(2, id);
ps.executeUpdate();
ps.close();
ps = con.prepareStatement("INSERT INTO `inventoryitems` VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
PreparedStatement pse = con.prepareStatement("INSERT INTO `inventoryequipment` VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
for (Pair<IItem, MapleInventoryType> pair : items) {
IItem item = pair.getLeft();
MapleInventoryType mit = pair.getRight();
ps.setInt(1, value);
ps.setString(2, account ? null : String.valueOf(id));
ps.setString(3, account ? String.valueOf(id) : null);
ps.setInt(4, item.getItemId());
ps.setInt(5, mit.getType());
ps.setInt(6, item.getPosition());
ps.setInt(7, item.getQuantity());
ps.setString(8, item.getOwner());
ps.setInt(9, item.getPetId());
ps.setInt(10, item.getFlag());
ps.setLong(11, item.getExpiration());
ps.setString(12, item.getGiftFrom());
ps.executeUpdate();
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
ResultSet rs = ps.getGeneratedKeys();
if (!rs.next())
throw new RuntimeException("Inserting item failed.");
pse.setInt(1, rs.getInt(1));
rs.close();
IEquip equip = (IEquip) item;
pse.setInt(2, equip.getUpgradeSlots());
pse.setInt(3, equip.getLevel());
pse.setInt(4, equip.getStr());
pse.setInt(5, equip.getDex());
pse.setInt(6, equip.getInt());
pse.setInt(7, equip.getLuk());
pse.setInt(8, equip.getHp());
pse.setInt(9, equip.getMp());
pse.setInt(10, equip.getWatk());
pse.setInt(11, equip.getMatk());
pse.setInt(12, equip.getWdef());
pse.setInt(13, equip.getMdef());
pse.setInt(14, equip.getAcc());
pse.setInt(15, equip.getAvoid());
pse.setInt(16, equip.getHands());
pse.setInt(17, equip.getSpeed());
pse.setInt(18, equip.getJump());
pse.setInt(19, 0);
pse.setInt(20, equip.getVicious());
pse.setInt(21, equip.getItemLevel());
pse.setInt(22, equip.getItemExp());
pse.setInt(23, equip.getRingId());
pse.setByte(24, equip.getLines());
pse.setByte(25, equip.getRank());
pse.setShort(26, equip.getPotent1());
pse.setShort(27, equip.getPotent2());
pse.setShort(28, equip.getPotent3());
pse.setInt(29, equip.getStars());
pse.setByte(30, equip.getPotential());
pse.executeUpdate();
}
}
pse.close();
ps.close();
}
}
and finally run this SQL
PHP:
--
-- Definition of table `inventoryequipment`
--
DROP TABLE IF EXISTS `inventoryequipment`;
CREATE TABLE `inventoryequipment` (
`inventoryequipmentid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`inventoryitemid` int(10) unsigned NOT NULL DEFAULT '0',
`upgradeslots` int(11) NOT NULL DEFAULT '0',
`level` int(11) NOT NULL DEFAULT '0',
`str` int(11) NOT NULL DEFAULT '0',
`dex` int(11) NOT NULL DEFAULT '0',
`int` int(11) NOT NULL DEFAULT '0',
`luk` int(11) NOT NULL DEFAULT '0',
`hp` int(11) NOT NULL DEFAULT '0',
`mp` int(11) NOT NULL DEFAULT '0',
`watk` int(11) NOT NULL DEFAULT '0',
`matk` int(11) NOT NULL DEFAULT '0',
`wdef` int(11) NOT NULL DEFAULT '0',
`mdef` int(11) NOT NULL DEFAULT '0',
`acc` int(11) NOT NULL DEFAULT '0',
`avoid` int(11) NOT NULL DEFAULT '0',
`hands` int(11) NOT NULL DEFAULT '0',
`speed` int(11) NOT NULL DEFAULT '0',
`jump` int(11) NOT NULL DEFAULT '0',
`locked` int(11) NOT NULL DEFAULT '0',
`vicious` int(11) unsigned NOT NULL DEFAULT '0',
`itemlevel` int(11) NOT NULL DEFAULT '1',
`itemexp` int(11) unsigned NOT NULL DEFAULT '0',
`ringid` int(11) NOT NULL DEFAULT '-1',
`lines` tinyint(4) NOT NULL DEFAULT '0',
`rank` tinyint(4) NOT NULL DEFAULT '0',
`potent1` int(11) NOT NULL DEFAULT '0',
`potent2` int(11) NOT NULL DEFAULT '0',
`potent3` int(11) NOT NULL DEFAULT '0',
`stars` int(11) NOT NULL DEFAULT '0',
`potential` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`inventoryequipmentid`),
KEY `inventoryitemid` (`inventoryitemid`),
CONSTRAINT `inventoryequipment_ibfk_1` FOREIGN KEY (`inventoryitemid`) REFERENCES `inventoryitems` (`inventoryitemid`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `inventoryequipment`
--
/*!40000 ALTER TABLE `inventoryequipment` DISABLE KEYS */;
INSERT INTO `inventoryequipment` (`inventoryequipmentid`,`inventoryitemid`,`upgradeslots`,`level`,`str`,`dex`,`int`,`luk`,`hp`,`mp`,`watk`,`matk`,`wdef`,`mdef`,`acc`,`avoid`,`hands`,`speed`,`jump`,`locked`,`vicious`,`itemlevel`,`itemexp`,`ringid`,`lines`,`rank`,`potent1`,`potent2`,`potent3`,`stars`,`potential`) VALUES
(5,9,7,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(6,10,7,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(7,11,7,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(8,12,7,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(17,24,7,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(18,25,7,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(19,26,7,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(20,27,7,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(21,29,7,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(22,30,7,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(23,31,7,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(24,32,7,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(25,34,7,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(26,35,7,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(27,36,7,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0),
(28,37,7,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0);
/*!40000 ALTER TABLE `inventoryequipment` ENABLE KEYS */;
i did it all by myself took me ages to make the list of the correct bonus for every item and rank its still not 100% but its good enough the only thing that sucks is that sometimes you get the stat "Hidden Potential".
Last edited: