Equip stat gain optimization + New commands
New optimization on stat gain methods, further improving server performance on equip levelups. Added new commands for GMs/admins.
This commit is contained in:
@@ -91,9 +91,9 @@ public class SkillFactory {
|
||||
private static MapleDataProvider datasource = MapleDataProviderFactory.getDataProvider(MapleDataProviderFactory.fileInWZPath("Skill.wz"));
|
||||
|
||||
public static Skill getSkill(int id) {
|
||||
if (!skills.isEmpty()) {
|
||||
return skills.get(Integer.valueOf(id));
|
||||
}
|
||||
if (!skills.isEmpty()) {
|
||||
return skills.get(Integer.valueOf(id));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ import client.MapleStat;
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.MaplePet;
|
||||
import constants.GameConstants;
|
||||
@@ -306,6 +308,23 @@ public class Commands {
|
||||
gotomaps.put("ht", 240050400);
|
||||
gotomaps.put("fm", 910000000);
|
||||
}
|
||||
|
||||
private static void hardsetItemStats(Equip equip, short stat) {
|
||||
equip.setStr(stat);
|
||||
equip.setDex(stat);
|
||||
equip.setInt(stat);
|
||||
equip.setLuk(stat);
|
||||
equip.setMatk(stat);
|
||||
equip.setWatk(stat);
|
||||
equip.setAcc(stat);
|
||||
equip.setAvoid(stat);
|
||||
equip.setJump(stat);
|
||||
equip.setSpeed(stat);
|
||||
equip.setWdef(stat);
|
||||
equip.setMdef(stat);
|
||||
equip.setHp(stat);
|
||||
equip.setMp(stat);
|
||||
}
|
||||
|
||||
public static boolean executePlayerCommand(MapleClient c, String[] sub, char heading) {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
@@ -748,11 +767,129 @@ public class Commands {
|
||||
victim.setRemainingAp(Integer.parseInt(sub[2]));
|
||||
victim.updateSingleStat(MapleStat.AVAILABLEAP, victim.getRemainingAp());
|
||||
}
|
||||
} else if (sub[0].equals("buffme")) {
|
||||
final int[] array = {9001000, 9101002, 9101003, 9101008, 2001002, 1101007, 1005, 2301003, 5121009, 1111002, 4111001, 4111002, 4211003, 4211005, 1321000, 2321004, 3121002};
|
||||
} else if (sub[0].equals("empowerme")) {
|
||||
final int[] array = {9001000, 9001001, 9101002, 9101003, 9101008, 2001002, 1101007, 1005, 2301003, 5121009, 1111002, 4111001, 4111002, 4211003, 4211005, 1321000, 2321004, 3121002};
|
||||
for (int i : array) {
|
||||
SkillFactory.getSkill(i).getEffect(SkillFactory.getSkill(i).getMaxLevel()).applyTo(player);
|
||||
}
|
||||
|
||||
} else if (sub[0].equals("buffme")) {
|
||||
//GM Skills : Haste(Super) - Holy Symbol - Bless - Hyper Body - Echo of Hero
|
||||
SkillFactory.getSkill(9101001).getEffect(SkillFactory.getSkill(9101001).getMaxLevel()).applyTo(player);
|
||||
SkillFactory.getSkill(9101002).getEffect(SkillFactory.getSkill(9101002).getMaxLevel()).applyTo(player);
|
||||
SkillFactory.getSkill(9101003).getEffect(SkillFactory.getSkill(9101003).getMaxLevel()).applyTo(player);
|
||||
SkillFactory.getSkill(9101008).getEffect(SkillFactory.getSkill(9101008).getMaxLevel()).applyTo(player);
|
||||
SkillFactory.getSkill(1005).getEffect(SkillFactory.getSkill(1005).getMaxLevel()).applyTo(player);
|
||||
player.setHp(player.getMaxHp());
|
||||
player.updateSingleStat(MapleStat.HP, player.getMaxHp());
|
||||
player.setMp(player.getMaxMp());
|
||||
player.updateSingleStat(MapleStat.MP, player.getMaxMp());
|
||||
} else if (sub[0].equals("buffmap")) {
|
||||
for (MapleCharacter chr : player.getMap().getCharacters()){
|
||||
//GM Skills : Haste(Super) - Holy Symbol - Bless - Hyper Body - Echo of Hero
|
||||
SkillFactory.getSkill(9101001).getEffect(SkillFactory.getSkill(9101001).getMaxLevel()).applyTo(chr);
|
||||
SkillFactory.getSkill(9101002).getEffect(SkillFactory.getSkill(9101002).getMaxLevel()).applyTo(chr);
|
||||
SkillFactory.getSkill(9101003).getEffect(SkillFactory.getSkill(9101003).getMaxLevel()).applyTo(chr);
|
||||
SkillFactory.getSkill(9101008).getEffect(SkillFactory.getSkill(9101008).getMaxLevel()).applyTo(chr);
|
||||
SkillFactory.getSkill(1005).getEffect(SkillFactory.getSkill(1005).getMaxLevel()).applyTo(chr);
|
||||
chr.setHp(chr.getMaxHp());
|
||||
chr.updateSingleStat(MapleStat.HP, chr.getMaxHp());
|
||||
chr.setMp(chr.getMaxMp());
|
||||
chr.updateSingleStat(MapleStat.MP, chr.getMaxMp());
|
||||
}
|
||||
} else if (sub[0].equals("buff")) {
|
||||
if (sub.length < 2){
|
||||
player.yellowMessage("Syntax: !buff <buffid>");
|
||||
return true;
|
||||
}
|
||||
int skillid=Integer.parseInt(sub[1]);
|
||||
|
||||
Skill skill = SkillFactory.getSkill(skillid);
|
||||
if(skill != null) skill.getEffect(skill.getMaxLevel()).applyTo(player);
|
||||
} else if (sub[0].equals("proitem")) {
|
||||
if (sub.length < 3) {
|
||||
player.dropMessage("Syntax: !proitem <itemid> <statvalue>");
|
||||
return true;
|
||||
}
|
||||
|
||||
int itemid = 0;
|
||||
short multiply = 0;
|
||||
|
||||
itemid = Integer.parseInt(sub[1]);
|
||||
multiply = Short.parseShort(sub[2]);
|
||||
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
Item item = ii.getEquipById(itemid);
|
||||
MapleInventoryType type = ii.getInventoryType(itemid);
|
||||
if (type.equals(MapleInventoryType.EQUIP)) {
|
||||
hardsetItemStats((Equip) item, multiply);
|
||||
MapleInventoryManipulator.addFromDrop(c, item);
|
||||
|
||||
} else {
|
||||
player.dropMessage("Make sure it's an equippable item.");
|
||||
}
|
||||
|
||||
} else if (sub[0].equals("seteqstat")) {
|
||||
if (sub.length < 2) {
|
||||
player.dropMessage("Syntax: !seteqstat <statvalue>");
|
||||
return true;
|
||||
}
|
||||
|
||||
int val = Integer.parseInt(sub[1]);
|
||||
|
||||
MapleInventory equip = player.getInventory(MapleInventoryType.EQUIP);
|
||||
for (byte i = 0; i < 101; i++) {
|
||||
try {
|
||||
Equip eu = (Equip) equip.getItem(i);
|
||||
int item = equip.getItem(i).getItemId();
|
||||
short hand = eu.getHands();
|
||||
byte level = eu.getLevel();
|
||||
Equip nItem = new Equip(item, i);
|
||||
nItem.setStr(eu.getStr()); // STR
|
||||
nItem.setDex(eu.getDex()); // DEX
|
||||
nItem.setInt(eu.getInt()); // INT
|
||||
nItem.setLuk(eu.getLuk()); //LUK
|
||||
nItem.setWatk(eu.getWatk()); //WA
|
||||
|
||||
//All Previous stats excluding the top 5
|
||||
nItem.setWdef(eu.getWdef());
|
||||
nItem.setAcc(eu.getHands());
|
||||
nItem.setAvoid(eu.getAvoid());
|
||||
nItem.setExpiration(eu.getExpiration());
|
||||
nItem.setJump(eu.getJump());
|
||||
nItem.setLevel(eu.getLevel());
|
||||
nItem.setMatk(eu.getMatk());
|
||||
nItem.setMdef(eu.getMdef());
|
||||
nItem.setMp(eu.getMp());
|
||||
nItem.setOwner(eu.getOwner());
|
||||
nItem.setSpeed(eu.getSpeed());
|
||||
nItem.setUpgradeSlots((byte) eu.getUpgradeSlots());
|
||||
nItem.setHands(eu.getHands());
|
||||
nItem.setLevel(eu.getLevel());
|
||||
short incval= (short)val;
|
||||
nItem.setWdef(incval);
|
||||
nItem.setAcc(incval);
|
||||
nItem.setAvoid(incval);
|
||||
nItem.setJump(incval);
|
||||
nItem.setMatk(incval);
|
||||
nItem.setMdef(incval);
|
||||
nItem.setMp(incval);
|
||||
nItem.setSpeed(incval);
|
||||
nItem.setUpgradeSlots((byte) eu.getUpgradeSlots());
|
||||
nItem.setHands(incval);
|
||||
nItem.setWatk(incval);
|
||||
nItem.setDex(incval);
|
||||
nItem.setInt(incval);
|
||||
nItem.setStr(incval);
|
||||
nItem.setLuk(incval);
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte)i, tempItem.getQuantity(), false, true);
|
||||
player.getInventory(MapleInventoryType.EQUIP).addFromDB(nItem);
|
||||
} catch(Exception e){}
|
||||
}
|
||||
c.getSession().write(MaplePacketCreator.getCharInfo(player));
|
||||
//player.getMap().removePlayer(player);
|
||||
//player.getMap().addPlayer(player);
|
||||
} else if (sub[0].equals("spawn")) {
|
||||
if (sub.length < 2) {
|
||||
player.yellowMessage("Syntax: !spawn <mobid>");
|
||||
|
||||
@@ -288,30 +288,19 @@ public class Equip extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
private int randomizeStatUpgrade(int limit) {
|
||||
Map<Integer, Integer> pool = new HashMap<>();
|
||||
|
||||
int top = Math.min(limit, ServerConstants.MAX_EQUIPMNT_LVLUP_STAT_GAIN);
|
||||
pool.put(0, top);
|
||||
for(int i = 1; i <= top; i++) {
|
||||
pool.put(i, top - i + 1);
|
||||
}
|
||||
|
||||
int poolCount = 0;
|
||||
for(Integer i: pool.values()) {
|
||||
poolCount += i;
|
||||
}
|
||||
private int randomizeStatUpgrade(int top) {
|
||||
int limit = Math.min(top, ServerConstants.MAX_EQUIPMNT_LVLUP_STAT_GAIN);
|
||||
|
||||
int poolCount = (limit * (limit + 1) / 2) + limit;
|
||||
int rnd = Randomizer.rand(0, poolCount);
|
||||
|
||||
int stat = 0;
|
||||
for(Integer i: pool.values()) {
|
||||
if(rnd < i) break;
|
||||
|
||||
stat++;
|
||||
rnd -= i;
|
||||
if(rnd >= limit) {
|
||||
rnd -= limit;
|
||||
stat = 1 + (int)Math.floor((-1 + Math.sqrt((8 * rnd) + 1)) / 2);
|
||||
}
|
||||
|
||||
return(stat);
|
||||
return stat;
|
||||
}
|
||||
|
||||
private void getUnitStatUpgrade(List<Pair<StatUpgrade, Integer>> stats, StatUpgrade name, int curStat, boolean isAttribute) {
|
||||
|
||||
@@ -8,9 +8,9 @@ import constants.skills.Aran;
|
||||
*/
|
||||
public class GameConstants {
|
||||
// Ronan's rates upgrade system
|
||||
private static final int[] DROP_RATE_GAIN = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
|
||||
private static final int[] MESO_RATE_GAIN = {1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66};
|
||||
private static final int[] EXP_RATE_GAIN = {1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144}; //fibonacci :3
|
||||
private static final int[] DROP_RATE_GAIN = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
|
||||
private static final int[] MESO_RATE_GAIN = {1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105};
|
||||
private static final int[] EXP_RATE_GAIN = {1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610}; //fibonacci :3
|
||||
|
||||
public static int getPlayerBonusMesoRate(int slot) {
|
||||
return(MESO_RATE_GAIN[slot]);
|
||||
|
||||
@@ -32,6 +32,7 @@ public class ServerConstants {
|
||||
|
||||
//Gameplay Configuration
|
||||
public static final boolean USE_CUSTOM_KEYSET = true;
|
||||
public static final boolean USE_MAXRANGE_ECHO_OF_HERO = true;
|
||||
public static final boolean USE_MAXRANGE = true; //Will send and receive packets from all events of a map, rather than those of only view range.
|
||||
public static final boolean USE_DEBUG = true; //Will enable some text prints and new commands in the client oriented for debugging.
|
||||
public static final boolean USE_DEBUG_SHOW_RCVD_PACKET = false; //Prints on the cmd all received packet ids.
|
||||
|
||||
@@ -143,6 +143,10 @@ public class MapleInventoryManipulator {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean addFromDrop(MapleClient c, Item item) {
|
||||
return addFromDrop(c, item, true);
|
||||
}
|
||||
|
||||
public static boolean addFromDrop(MapleClient c, Item item, boolean show) {
|
||||
return addFromDrop(c, item, show, -1);
|
||||
}
|
||||
|
||||
@@ -228,6 +228,11 @@ public class MapleStatEffect {
|
||||
if (ltd != null) {
|
||||
ret.lt = (Point) ltd.getData();
|
||||
ret.rb = (Point) source.getChildByPath("rb").getData();
|
||||
|
||||
if(ServerConstants.USE_MAXRANGE_ECHO_OF_HERO && (sourceid == Beginner.ECHO_OF_HERO || sourceid == Noblesse.ECHO_OF_HERO || sourceid == Legend.ECHO_OF_HERO || sourceid == Evan.ECHO_OF_HERO)) {
|
||||
ret.lt = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
ret.rb = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
int x = MapleDataTool.getInt("x", source, 0);
|
||||
@@ -703,7 +708,7 @@ public class MapleStatEffect {
|
||||
AutobanFactory.MPCON.addPoint(applyfrom.getAutobanManager(), "mpCon hack for skill:" + sourceid + "; Player MP: " + applyto.getMp() + " MP Needed: " + getMpCon());
|
||||
} */
|
||||
if (hpchange != 0) {
|
||||
if (hpchange < 0 && (-hpchange) > applyto.getHp() && !applyto.hasDisease(MapleDisease.ZOMBIFY)) {
|
||||
if (hpchange < 0 && (-hpchange) >= applyto.getHp() && (!applyto.hasDisease(MapleDisease.ZOMBIFY) || hpCon == 0)) {
|
||||
applyto.getClient().announce(MaplePacketCreator.enableActions());
|
||||
return false;
|
||||
}
|
||||
@@ -1053,6 +1058,7 @@ public class MapleStatEffect {
|
||||
hpchange += makeHealHP(hp / 100.0, applyfrom.getTotalMagic(), 3, 5);
|
||||
if (applyfrom.hasDisease(MapleDisease.ZOMBIFY)) {
|
||||
hpchange = -hpchange;
|
||||
hpCon = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ public class MobSkill {
|
||||
disease = MapleDisease.CONFUSE;
|
||||
break;
|
||||
case 133: // zombify
|
||||
disease = MapleDisease.ZOMBIFY;
|
||||
break;
|
||||
case 140:
|
||||
if (makeChanceResult() && !monster.isBuffed(MonsterStatus.MAGIC_IMMUNITY)) {
|
||||
@@ -199,21 +200,21 @@ public class MobSkill {
|
||||
}
|
||||
break;
|
||||
case 143: // Weapon Reflect
|
||||
stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
|
||||
reflection.add(x);
|
||||
stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
|
||||
reflection.add(x);
|
||||
break;
|
||||
case 144: // Magic Reflect
|
||||
stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
|
||||
reflection.add(x);
|
||||
stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
|
||||
reflection.add(x);
|
||||
break;
|
||||
case 145: // Weapon / Magic reflect
|
||||
stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
|
||||
reflection.add(x);
|
||||
stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
|
||||
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
|
||||
reflection.add(x);
|
||||
break;
|
||||
case 154: // accuracy up
|
||||
case 155: // avoid up
|
||||
|
||||
Reference in New Issue
Block a user