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:
ronancpl
2017-06-04 22:59:28 -03:00
parent 809d90564c
commit 9d00f33783
22 changed files with 187 additions and 41 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#Sat, 03 Jun 2017 19:45:04 -0300 #Sun, 04 Jun 2017 22:54:17 -0300
C\:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2= C\:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2=
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+7 -1
View File
@@ -284,4 +284,10 @@ Adicionado funcionalidade USE_ULTRA_THREE_SNAILS. Valor mostrado n
Sistema de PIN agora completamente funcional. Sistema de PIN agora completamente funcional.
Corrigido sistema de ranking para agora mostrar player rankings de acordo com o mundo que ele se encontra. Corrigido sistema de ranking para agora mostrar player rankings de acordo com o mundo que ele se encontra.
Adicionado barra de HP para o boss da BalrogPQ. Adicionado barra de HP para o boss da BalrogPQ.
Equips apenas cosméticos (sem stats e/ou possibilidade de melhorar) não mais ganham EXP e, consequentemente, nivelam. Equips apenas cosméticos (sem stats e/ou possibilidade de melhorar) não mais ganham EXP e, consequentemente, nivelam.
04 Junho 2017,
Otimizados o método de ganho de stats de equips ao nivelar.
Diversos ajustes finos nos comandos existentes.
Adicionados novos comandos: proitem, seteqstats, buffme, buffmap.
Vários ajustes finos
+2
View File
@@ -17,8 +17,10 @@
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleStat.java</file> <file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleStat.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/MapleServerHandler.java</file> <file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/MapleServerHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/command/Commands.java</file> <file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/command/Commands.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/MapleStatEffect.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/Item.java</file> <file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/Item.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/constants/ServerConstants.java</file> <file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/constants/ServerConstants.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/life/MobSkill.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleCharacter.java</file> <file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleCharacter.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleMap.java</file> <file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleMap.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/MapleItemInformationProvider.java</file> <file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/MapleItemInformationProvider.java</file>
+3 -3
View File
@@ -91,9 +91,9 @@ public class SkillFactory {
private static MapleDataProvider datasource = MapleDataProviderFactory.getDataProvider(MapleDataProviderFactory.fileInWZPath("Skill.wz")); private static MapleDataProvider datasource = MapleDataProviderFactory.getDataProvider(MapleDataProviderFactory.fileInWZPath("Skill.wz"));
public static Skill getSkill(int id) { public static Skill getSkill(int id) {
if (!skills.isEmpty()) { if (!skills.isEmpty()) {
return skills.get(Integer.valueOf(id)); return skills.get(Integer.valueOf(id));
} }
return null; return null;
} }
+139 -2
View File
@@ -92,6 +92,8 @@ import client.MapleStat;
import client.Skill; import client.Skill;
import client.SkillFactory; import client.SkillFactory;
import client.inventory.Item; import client.inventory.Item;
import client.inventory.Equip;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType; import client.inventory.MapleInventoryType;
import client.inventory.MaplePet; import client.inventory.MaplePet;
import constants.GameConstants; import constants.GameConstants;
@@ -306,6 +308,23 @@ public class Commands {
gotomaps.put("ht", 240050400); gotomaps.put("ht", 240050400);
gotomaps.put("fm", 910000000); 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) { public static boolean executePlayerCommand(MapleClient c, String[] sub, char heading) {
MapleCharacter player = c.getPlayer(); MapleCharacter player = c.getPlayer();
@@ -748,11 +767,129 @@ public class Commands {
victim.setRemainingAp(Integer.parseInt(sub[2])); victim.setRemainingAp(Integer.parseInt(sub[2]));
victim.updateSingleStat(MapleStat.AVAILABLEAP, victim.getRemainingAp()); victim.updateSingleStat(MapleStat.AVAILABLEAP, victim.getRemainingAp());
} }
} else if (sub[0].equals("buffme")) { } else if (sub[0].equals("empowerme")) {
final int[] array = {9001000, 9101002, 9101003, 9101008, 2001002, 1101007, 1005, 2301003, 5121009, 1111002, 4111001, 4111002, 4211003, 4211005, 1321000, 2321004, 3121002}; 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) { for (int i : array) {
SkillFactory.getSkill(i).getEffect(SkillFactory.getSkill(i).getMaxLevel()).applyTo(player); 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")) { } else if (sub[0].equals("spawn")) {
if (sub.length < 2) { if (sub.length < 2) {
player.yellowMessage("Syntax: !spawn <mobid>"); player.yellowMessage("Syntax: !spawn <mobid>");
+8 -19
View File
@@ -288,30 +288,19 @@ public class Equip extends Item {
} }
} }
private int randomizeStatUpgrade(int limit) { private int randomizeStatUpgrade(int top) {
Map<Integer, Integer> pool = new HashMap<>(); int limit = Math.min(top, ServerConstants.MAX_EQUIPMNT_LVLUP_STAT_GAIN);
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;
}
int poolCount = (limit * (limit + 1) / 2) + limit;
int rnd = Randomizer.rand(0, poolCount); int rnd = Randomizer.rand(0, poolCount);
int stat = 0; int stat = 0;
for(Integer i: pool.values()) { if(rnd >= limit) {
if(rnd < i) break; rnd -= limit;
stat = 1 + (int)Math.floor((-1 + Math.sqrt((8 * rnd) + 1)) / 2);
stat++;
rnd -= i;
} }
return(stat); return stat;
} }
private void getUnitStatUpgrade(List<Pair<StatUpgrade, Integer>> stats, StatUpgrade name, int curStat, boolean isAttribute) { private void getUnitStatUpgrade(List<Pair<StatUpgrade, Integer>> stats, StatUpgrade name, int curStat, boolean isAttribute) {
+3 -3
View File
@@ -8,9 +8,9 @@ import constants.skills.Aran;
*/ */
public class GameConstants { public class GameConstants {
// Ronan's rates upgrade system // 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[] 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}; 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}; //fibonacci :3 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) { public static int getPlayerBonusMesoRate(int slot) {
return(MESO_RATE_GAIN[slot]); return(MESO_RATE_GAIN[slot]);
+1
View File
@@ -32,6 +32,7 @@ public class ServerConstants {
//Gameplay Configuration //Gameplay Configuration
public static final boolean USE_CUSTOM_KEYSET = true; 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_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 = 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. 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; 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) { public static boolean addFromDrop(MapleClient c, Item item, boolean show) {
return addFromDrop(c, item, show, -1); return addFromDrop(c, item, show, -1);
} }
+7 -1
View File
@@ -228,6 +228,11 @@ public class MapleStatEffect {
if (ltd != null) { if (ltd != null) {
ret.lt = (Point) ltd.getData(); ret.lt = (Point) ltd.getData();
ret.rb = (Point) source.getChildByPath("rb").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); 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()); AutobanFactory.MPCON.addPoint(applyfrom.getAutobanManager(), "mpCon hack for skill:" + sourceid + "; Player MP: " + applyto.getMp() + " MP Needed: " + getMpCon());
} */ } */
if (hpchange != 0) { 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()); applyto.getClient().announce(MaplePacketCreator.enableActions());
return false; return false;
} }
@@ -1053,6 +1058,7 @@ public class MapleStatEffect {
hpchange += makeHealHP(hp / 100.0, applyfrom.getTotalMagic(), 3, 5); hpchange += makeHealHP(hp / 100.0, applyfrom.getTotalMagic(), 3, 5);
if (applyfrom.hasDisease(MapleDisease.ZOMBIFY)) { if (applyfrom.hasDisease(MapleDisease.ZOMBIFY)) {
hpchange = -hpchange; hpchange = -hpchange;
hpCon = 0;
} }
} }
} }
+12 -11
View File
@@ -187,6 +187,7 @@ public class MobSkill {
disease = MapleDisease.CONFUSE; disease = MapleDisease.CONFUSE;
break; break;
case 133: // zombify case 133: // zombify
disease = MapleDisease.ZOMBIFY;
break; break;
case 140: case 140:
if (makeChanceResult() && !monster.isBuffed(MonsterStatus.MAGIC_IMMUNITY)) { if (makeChanceResult() && !monster.isBuffed(MonsterStatus.MAGIC_IMMUNITY)) {
@@ -199,21 +200,21 @@ public class MobSkill {
} }
break; break;
case 143: // Weapon Reflect case 143: // Weapon Reflect
stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x)); stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x)); stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
reflection.add(x); reflection.add(x);
break; break;
case 144: // Magic Reflect case 144: // Magic Reflect
stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x)); stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x)); stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
reflection.add(x); reflection.add(x);
break; break;
case 145: // Weapon / Magic reflect case 145: // Weapon / Magic reflect
stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x)); stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x)); stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x)); stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x)); stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
reflection.add(x); reflection.add(x);
break; break;
case 154: // accuracy up case 154: // accuracy up
case 155: // avoid up case 155: // avoid up