diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index e76524c..39cef58 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -22,6 +22,7 @@ import tools.MockIOSession; import client.inventory.MapleInventoryIdentifier; import server.maps.MapleFoothold; +import java.math.BigInteger; import java.util.Comparator; import client.inventory.MapleRing.RingComparator; @@ -6916,6 +6917,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject implements Se return this.stats.dropMod; } + public int getBs() { + return this.stats.bs; + } + + public double getDropm() { return this.stats.dropm; } @@ -11884,37 +11890,45 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject implements Se return re; } + - - public int getQG() { - int re = 0; + public BigInteger getQG() { + BigInteger re = BigInteger.ZERO; JSONObject qgbb = Start.ConfigValuesJson.getJSONObject("qgbb"); JSONObject qgzb = Start.ConfigValuesJson.getJSONObject("qgzb"); - if ((qgbb == null && qgzb == null) || Start.ConfigValuesJson.getInteger("isqg") == 0) return 0; + if ((qgbb == null && qgzb == null) || Start.ConfigValuesJson.getInteger("isqg") == 0) { + return BigInteger.ZERO; + } + if (qgbb != null) { Set strings = qgbb.keySet(); for (String string : strings) { boolean b = this.haveItem(Integer.parseInt(string)); if (b) { int itemNum = getItemNum(Integer.parseInt(string)); - re += (qgbb.getInteger(string))*itemNum; + BigInteger qgbbValue = new BigInteger(qgbb.getInteger(string).toString()); + BigInteger itemNumBigInt = new BigInteger(Integer.toString(itemNum)); + re = re.add(qgbbValue.multiply(itemNumBigInt)); } } } + if (qgzb != null) { Set strings = qgzb.keySet(); for (String string : strings) { boolean b = this.hasEquipped(Integer.parseInt(string)); if (b) { - re += qgzb.getInteger(string); + BigInteger qgzbValue = new BigInteger(qgzb.getInteger(string).toString()); + re = re.add(qgzbValue); } } } List equList = this.getEquList(); for (Equip equip : equList) { - re += equip.getqg(); + BigInteger equipQG = new BigInteger(Integer.toString(equip.getqg())); + re = re.add(equipQG); } return re; diff --git a/src/client/PlayerStats.java b/src/client/PlayerStats.java index 6ed9f65..a420e89 100644 --- a/src/client/PlayerStats.java +++ b/src/client/PlayerStats.java @@ -1,20 +1,18 @@ package client; import client.inventory.Item; +import gui.tw.BlConfig; import tools.data.MaplePacketLittleEndianWriter; import client.inventory.MapleWeaponType; import client.inventory.ModifyInventory; import server.MapleInventoryManipulator; import tools.MaplePacketCreator; -import java.util.Collection; +import java.util.*; import server.MapleStatEffect; import server.StructSetItem; -import java.util.Iterator; -import java.util.Calendar; - import server.StructSetItem.SetItem; import java.util.Map.Entry; @@ -28,14 +26,10 @@ import client.inventory.MapleInventoryType; import constants.GameConstants; import server.MapleItemInformationProvider; -import java.util.HashMap; -import java.util.ArrayList; import java.util.concurrent.locks.ReentrantLock; import client.inventory.Equip; -import java.util.List; -import java.util.Map; import java.lang.ref.WeakReference; import java.io.Serializable; @@ -82,6 +76,7 @@ public class PlayerStats implements Serializable { public transient int expMod; public transient int dropMod; public transient int cashMod; + public transient int bs; public transient int levelBonus; public transient double expBuff; public transient double dropBuff; @@ -575,23 +570,21 @@ public class PlayerStats implements Serializable { } else if (this.expMod < 2 && (item2.getItemId() == 5210000 || item2.getItemId() == 5210001) && ((hour >= 10 && hour <= 22 && weekDay >= 2 && weekDay <= 6) || weekDay == 1 || weekDay == 7)) { this.expMod = 2; } - if (this.dropMod == 1) { - if (item2.getItemId() == 5360015 || item2.getItemId() == 5360014 || item2.getItemId() == 5360016) { - this.dropMod = 2; - } else if (item2.getItemId() == 5360018 && hour >= 0 && hour <= 24) { //10倍爆率卡 - this.dropMod = 10; - } else if (item2.getItemId() == 5360000 && hour >= 0 && hour <= 6) { - this.dropMod = 2; - } else if (item2.getItemId() == 5360001 && hour >= 6 && hour <= 12) { - this.dropMod = 2; - } else if (item2.getItemId() == 5360002 && hour >= 12 && hour <= 18) { - this.dropMod = 2; - } else if (item2.getItemId() == 5360003 && hour >= 18 && hour <= 24) { - this.dropMod = 2; - } - - - } +// if (this.dropMod == 1) { +// if (item2.getItemId() == 5360015 || item2.getItemId() == 5360014 || item2.getItemId() == 5360016) { +// this.dropMod = 2; +// } else if (item2.getItemId() == 5360018 && hour >= 0 && hour <= 24) { //10倍爆率卡 +// this.dropMod = 10; +// } else if (item2.getItemId() == 5360000 && hour >= 0 && hour <= 6) { +// this.dropMod = 2; +// } else if (item2.getItemId() == 5360001 && hour >= 6 && hour <= 12) { +// this.dropMod = 2; +// } else if (item2.getItemId() == 5360002 && hour >= 12 && hour <= 18) { +// this.dropMod = 2; +// } else if (item2.getItemId() == 5360003 && hour >= 18 && hour <= 24) { +// this.dropMod = 2; +// } +// } if (item2.getItemId() == 5650000) { this.hasPartyBonus = true; } else if (item2.getItemId() == 5590001) { @@ -603,6 +596,35 @@ public class PlayerStats implements Serializable { this.levelBonus = 5; } } + + double bl = 0; + double jb = 0; + if (Start.blkg == 1){ + for (BlConfig blConfig : Start.BLlist) { + if (blConfig.isInTimeRange()){ + boolean b = chra.haveItem(blConfig.getItem_id()); + if (b) { + int itemNum = 1; + if (blConfig.getStackableNum()== 1) { + itemNum = chra.getItemNum(blConfig.getItem_id()); + } + if (Start.bldj == 1) { + bl += (blConfig.getItem_rate() * itemNum); + jb += (blConfig.getGold_rate() * itemNum); + }else { + bl = bl>= (blConfig.getItem_rate() * itemNum)? bl : blConfig.getItem_rate() * itemNum; + jb = jb>= (blConfig.getGold_rate() * itemNum)? jb : blConfig.getGold_rate() * itemNum; + } + } + } + } + } + this.dropMod+= bl; + this.cashMod+= jb; + + + + for (final IItem item2 : chra.getInventory(MapleInventoryType.ETC)) { switch (item2.getItemId()) { case 5062000: { diff --git a/src/gui/Start.java b/src/gui/Start.java index 842f5ee..2698988 100644 --- a/src/gui/Start.java +++ b/src/gui/Start.java @@ -10,6 +10,7 @@ import client.inventory.IItem; import cn.hutool.core.io.file.FileReader; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import gui.tw.BlConfig; import server.MapleInventoryManipulator; import client.inventory.Equip; import handling.world.World.Broadcast; @@ -96,6 +97,12 @@ public class Start { public static JSONObject ConfigValuesJson; public static Map> ConfigItemJson = new HashMap<>(); + public static List BLlist = new ArrayList<>(); + public static int blkg = 0; + public static int bldj = 0; + + + public static ArrayList 公告列表; public static List> exptable; diff --git a/src/gui/tw/BlConfig.java b/src/gui/tw/BlConfig.java new file mode 100644 index 0000000..687e048 --- /dev/null +++ b/src/gui/tw/BlConfig.java @@ -0,0 +1,89 @@ +package gui.tw; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; + +public class BlConfig { + int item_id; + double gold_rate; + double item_rate; + + String time_range; + + int stackableNum; + + + public int getItem_id() { + return item_id; + } + + public void setItem_id(int item_id) { + this.item_id = item_id; + } + + public double getGold_rate() { + return gold_rate; + } + + public void setGold_rate(double gold_rate) { + this.gold_rate = gold_rate; + } + + public double getItem_rate() { + return item_rate; + } + + public void setItem_rate(double item_rate) { + this.item_rate = item_rate; + } + + public String getTime_range() { + return time_range; + } + + public void setTime_range(String time_range) { + this.time_range = time_range; + } + + public int getStackableNum() { + return stackableNum; + } + + public void setStackable(int stackable) { + this.stackableNum = stackable; + } + + + public boolean isInTimeRange() { + DateTime time = DateUtil.date(); + + String[] range = time_range.split("-"); + if (range.length != 2) { + throw new IllegalArgumentException("时间格式不正确,应为 HH:mm-HH:mm"); + } + + + String endTimeStr = range[1]; + if ("24:00".equals(endTimeStr)) { + endTimeStr = "00:00"; + } + + DateTime startTime = DateUtil.parseTimeToday(range[0]); + DateTime endTime = DateUtil.parseTimeToday(endTimeStr); + + if ("24:00".equals(range[1])) { + + endTime = endTime.offset(DateField.DAY_OF_YEAR, 1); + } + + if (startTime.isBeforeOrEquals(endTime)) { + + return !time.isBefore(startTime) && !time.isAfter(endTime); + } else { + + return !time.isBefore(startTime) || !time.isAfter(endTime); + } + } + +} diff --git a/src/gui/特殊控制台.java b/src/gui/特殊控制台.java index 7f1a0aa..2507296 100644 --- a/src/gui/特殊控制台.java +++ b/src/gui/特殊控制台.java @@ -29,6 +29,7 @@ import java.awt.event.FocusAdapter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import gui.tw.BlConfig; import org.netbeans.lib.awtextra.AbsoluteConstraints; import java.awt.Component; @@ -1022,6 +1023,15 @@ public class 特殊控制台 extends JFrame { Start.ConfigItemJson.put(key, intList); } + + fileReader = new FileReader(property + "\\配置文件\\多倍爆率.ini"); + String result3 = fileReader.readString(); + //转json + JSONObject jsonObject1 = JSONObject.parseObject(result3); + Start.blkg = jsonObject1.getInteger("open"); + Start.bldj = jsonObject1.getInteger("stackable"); + Start.BLlist = jsonObject1.getJSONArray("gold_and_item_drop_rates").toJavaList(BlConfig.class); + } diff --git a/src/handling/channel/handler/DamageParse.java b/src/handling/channel/handler/DamageParse.java index 25f9523..60d554a 100644 --- a/src/handling/channel/handler/DamageParse.java +++ b/src/handling/channel/handler/DamageParse.java @@ -1,5 +1,8 @@ package handling.channel.handler; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.RoundingMode; import java.util.*; import java.sql.ResultSet; import java.sql.PreparedStatement; @@ -433,23 +436,23 @@ public class DamageParse { if (attack.skill != 1221011) { long newDamage = 0L; - newtotDamageToOneMonster = TWgetNewtotDamageToOneMonster(attack, player, newtotDamageToOneMonster, monster); + BigInteger bigInteger1 = TWgetNewtotDamageToOneMonster(attack, player, newtotDamageToOneMonster, monster); - monster.damage(player, newtotDamageToOneMonster, true, attack.skill); - if (monster.getHp() > 0) { - long hp = monster.getHp(); + monster.damage(player, bigInteger1, true, attack.skill); + if (monster.getHp() > 0 ) { + BigInteger bigInteger = monster.getbigHp(); - long mobMaxHp = monster.getMaxHP(); - if (mobMaxHp == 0){ - mobMaxHp = monster.getMobMaxHp(); + BigInteger mobMaxHp = monster.getMaxHP(); + if (mobMaxHp == null){ + mobMaxHp = BigInteger.valueOf(monster.getMobMaxHp()); } - - double percentage = ((double) hp / mobMaxHp) * 100; // 显式转换为浮点数并计算百分比‌:ml-citation{ref="1,3" data="citationList"} + BigDecimal bdMobHp = new BigDecimal(bigInteger.multiply(BigInteger.valueOf(100))); + BigDecimal bdMobMaxHp = new BigDecimal(mobMaxHp); + double percentage = (bdMobHp.divide(bdMobMaxHp, 2, BigDecimal.ROUND_HALF_UP).doubleValue() ); String result = String.format("%.2f%%", percentage); - - - double l = (double) hp / mobMaxHp; - player.dropMessage(-1, "当前怪物血量为:" +hp +" "+result); + String bighpStr = bigInteger.toString(); + bighpStr = process(bighpStr); + player.dropMessage(-1, "当前怪物血量为:" +bighpStr +" "+result); } } else { monster.damage(player, monster.getStats().isBoss() ? 500000L : (monster.getHp() - 1L), true, attack.skill); @@ -645,87 +648,93 @@ public class DamageParse { } } - private static long TWgetNewtotDamageToOneMonster(AttackInfo attack, MapleCharacter player, long newtotDamageToOneMonster, MapleMonster monster) { - newtotDamageToOneMonster += 额外伤害(player, newtotDamageToOneMonster, monster, true); - //计算段数和倍率 - double[] 额外段数 = 额外段数(player, monster, true, attack.skill); - - double[] 额外伤害倍率 = 额外伤害倍率(player, newtotDamageToOneMonster, monster, true, attack.skill); + private static BigInteger TWgetNewtotDamageToOneMonster(AttackInfo attack, MapleCharacter player, long newtotDamageToOneMonster, MapleMonster monster) { + newtotDamageToOneMonster = 伤害减伤(monster.getId(), newtotDamageToOneMonster); + double[] ewds = ewds(player, monster, true, attack.skill); + double[] ewbl = ewbl(player, monster, true, attack.skill); String a = ""; String b = ""; String c = ""; String d = ""; String e = ""; + BigInteger ewzs = ewzs(player, monster, true, attack.skill); - //获得未减伤之前的真实伤害 - long 额外真伤 = 额外真伤(player, newtotDamageToOneMonster, monster, true, attack.skill); - - long v = 0; - if (额外段数[0] > 0.0) { - v = (long) (newtotDamageToOneMonster * (额外段数[0] * 额外段数[1]) / attack.hits); - newtotDamageToOneMonster += (long) v; + BigInteger newtotDamage = BigInteger.valueOf(newtotDamageToOneMonster); + BigInteger v = BigInteger.ZERO; + if (ewds[0] > 0.0) { + BigDecimal ewds0 = BigDecimal.valueOf(ewds[0]); + BigDecimal ewds1 = BigDecimal.valueOf(ewds[1]); + BigDecimal product = ewds0.multiply(ewds1); + BigDecimal newtotDamageBD = new BigDecimal(newtotDamage); + BigDecimal result = newtotDamageBD.multiply(product); + result = result.divide(BigDecimal.valueOf(attack.hits), RoundingMode.HALF_UP); + v = result.toBigInteger(); + newtotDamage = newtotDamage.add(v); } - if (额外伤害倍率[0] > 0.0) { - newtotDamageToOneMonster += newtotDamageToOneMonster * (额外伤害倍率[0] / 100.0); - a = "伤害加成 #b" + (int) 额外伤害倍率[0] + "%#k"; + if (ewbl[0] > 0.0) { + BigInteger damageIncrease = newtotDamage.multiply(BigInteger.valueOf((long) (ewbl[0] * 100))).divide(BigInteger.valueOf(100)); + newtotDamage = newtotDamage.add(damageIncrease); + a = "伤害加成 #b" + (int) ewbl[0] + "%#k"; } - if (额外段数[0] > 0.0) { - b = "额外段伤 #b" + (int) 额外段数[0] + "段#k"; - String s = convertNumber(v); + + if (ewds[0] > 0.0) { + b = "额外段伤 #b" + (int) ewds[0] + "段#k"; + String s = process(v.toString()); c = "段伤伤害 #b" + s + "#k"; } - if (额外真伤 > 0) { - String s = convertNumber(额外真伤); + if (ewzs != null) { + String s = process(ewzs.toString()); d = "切割伤害 #b" + s + "#k"; + newtotDamage = newtotDamage.add(ewzs); } - newtotDamageToOneMonster = 伤害减伤(monster.getId(), newtotDamageToOneMonster); - //将计算完减伤之后的伤害加上真实伤害 - newtotDamageToOneMonster += 额外真伤; - String s2 = convertNumber(newtotDamageToOneMonster); + + String s2 = process(newtotDamage.toString()); e = "伤害统计 #r" + s2 + "#k"; int length = e.length(); + + int targetWidth = length; if (!a.isEmpty()) { - a = String.format("%-" + length + "s", a) ; + a = String.format("%-" + length + "s", a); + if (a.length()>targetWidth)targetWidth = a.length(); } if (!b.isEmpty()) { - b = String.format("%-" + (length) + "s", b) ; + b = String.format("%-" + length + "s", b); + if (b.length()>targetWidth)targetWidth = b.length(); } if (!c.isEmpty()) { - c = String.format("%-" + length + "s", c) ; + c = String.format("%-" + length + "s", c); + if (c.length()>targetWidth)targetWidth = c.length(); } if (!d.isEmpty()) { - d = String.format("%-" + length + "s", d) ; + d = String.format("%-" + length + "s", d); + if (d.length()>targetWidth)targetWidth = d.length(); } - - int targetWidth = e.length()+10; // 目标显示宽度(半角字符数) + targetWidth +=6; String f = ""; String[] strs = {a, b, c, d, e}; for (String s : strs) { - if (s.isEmpty())continue; + if (s.isEmpty()) continue; int currentWidth = getDisplayWidth(s); int spacesNeeded = (currentWidth >= targetWidth) ? 1 : (targetWidth - currentWidth); - // 填充空格并截断‌:ml-citation{ref="2,3" data="citationList"} - s= String.format("%s%" + spacesNeeded + "s", s, "").substring(0, Math.min(s.length() + spacesNeeded, s.length() + targetWidth)) ; - s+="\r\n"; - f +=s; -// System.out.println("|" + aligned + "|"); + // 填充空格并截断 + s = String.format("%s%" + spacesNeeded + "s", s, "").substring(0, Math.min(s.length() + spacesNeeded, s.length() + targetWidth)); + s += "\r\n"; + f += s; } - e = a + b + c + d + e; - - player.showInstruction(f, 130, 10); - return newtotDamageToOneMonster; + player.showInstruction(f, targetWidth*6, 10); + return newtotDamage; } public static final void applyAttackMagic(final AttackInfo attack, final ISkill theSkill, final MapleCharacter player, final MapleStatEffect effect) { @@ -999,23 +1008,23 @@ public class DamageParse { } final tzjc t = new tzjc(); long newDamage = 0L; - newtotDamageToOneMonster = TWgetNewtotDamageToOneMonster(attack, player, newtotDamageToOneMonster, monster); + BigInteger bigInteger1 = TWgetNewtotDamageToOneMonster(attack, player, newtotDamageToOneMonster, monster); - monster.damage(player, newtotDamageToOneMonster, true, attack.skill); - if (monster.getHp() > 0) { - long hp = monster.getHp(); + monster.damage(player, bigInteger1, true, attack.skill); + if (monster.getHp() > 0 ) { + BigInteger bigInteger = monster.getbigHp(); - long mobMaxHp = monster.getMaxHP(); - if (mobMaxHp == 0) { - mobMaxHp = monster.getMobMaxHp(); + BigInteger mobMaxHp = monster.getMaxHP(); + if (mobMaxHp == null){ + mobMaxHp = BigInteger.valueOf(monster.getMobMaxHp()); } - - double percentage = ((double) hp / mobMaxHp) * 100; // 显式转换为浮点数并计算百分比‌:ml-citation{ref="1,3" data="citationList"} + BigDecimal bdMobHp = new BigDecimal(bigInteger); + BigDecimal bdMobMaxHp = new BigDecimal(mobMaxHp); + double percentage = (bdMobHp.divide(bdMobMaxHp, 2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100); String result = String.format("%.2f%%", percentage); - - - double l = (double) hp / mobMaxHp; - player.dropMessage(-1, "当前怪物血量为:" + hp + " " + result); + String bighpStr = bigInteger.toString(); + bighpStr = process(bighpStr); + player.dropMessage(-1, "当前怪物血量为:" +bighpStr +" "+result); } if (monster.isBuffed(MonsterStatus.MAGIC_DAMAGE_REFLECT)) { @@ -1725,7 +1734,7 @@ public class DamageParse { return 数值; } - public static double[] 额外段数(final MapleCharacter play, final MapleMonster monster, boolean mag, int skillId) { + public static double[] ewds(final MapleCharacter play, final MapleMonster monster, boolean mag, int skillId) { double Magnification = 0.0; if (Start.ConfigValuesJson == null) return new double[]{0.0, 0.0}; @@ -1744,7 +1753,7 @@ public class DamageParse { return new double[]{Magnification, ddxs/100.0}; } - public static double[] 额外伤害倍率(final MapleCharacter play, long damage, final MapleMonster monster, boolean mag, int skillId) { + public static double[] ewbl(final MapleCharacter play, final MapleMonster monster, boolean mag, int skillId) { double Magnification = 0.0; Magnification = play.getDB(); @@ -1758,22 +1767,25 @@ public class DamageParse { return new double[]{Magnification, dbxs/100.0}; } - public static long 额外真伤(final MapleCharacter play, long damage, final MapleMonster monster, boolean mag, int skillId) { - double Magnification = 0.0; + public static BigInteger ewzs(final MapleCharacter play, final MapleMonster monster, boolean mag, int skillId) { + BigInteger Magnification ; Magnification = play.getQG(); Integer qgxs = Start.ConfigValuesJson.getJSONObject("qgxs").getInteger(String.valueOf(skillId)); if (qgxs == null) { - return 0; - } - if (Magnification > 0) { - return (long) ((Magnification * (qgxs/100.0))); - } else { - return 0; + return null; } + if (Magnification.compareTo(BigInteger.ZERO) > 0) { + BigInteger qgxsBigInt = new BigInteger(qgxs.toString()); + + BigInteger result = Magnification.multiply(qgxsBigInt).divide(BigInteger.valueOf(100)); + return result; + } else { + return null; + } } @@ -1897,22 +1909,42 @@ public class DamageParse { } public static String convertNumber(long number) { - if (number < 10000) { - // 数字小于 10000,直接返回原数字 - return String.valueOf(number); - } else if (number < 100000000) { - // 数字大于等于 10000 且小于 1 亿,转换为以“万”为单位 - double result = (double) number / 10000; - return String.format("%.0f万", result); - } else if (number < 10000000000000000L) { - // 数字大于等于 1 亿 且小于 1 京,转换为以“亿”为单位 - double result = (double) number / 100000000; - return String.format("%.0f亿", result); - } else { - // 数字大于等于 1 京,转换为以“京”为单位 - double result = (double) number / 10000000000000000L; - return String.format("%.0f京", result); - } + String[] a = {"万", "亿", "兆", "京", "垓","秭", "穰", "沟", "涧", "正", "载", "极","恒河沙", "阿僧祇", "那由他", "不可思议", "无量", "古戈尔","频菠萝", "矜羯罗","不可说不可说转","超限数", + "绝对无限","绝对无量","绝对小数","绝对大数","绝对超限数"}; + + String b = String.valueOf(number); + int len = b.length(); + if (len <= 4) return b; + + int k = (len - 1) / 4; + int deleteDigits = 4 * k; + int index = k - 1; + + if (index < 0 || index >= a.length) return b; + + int prefixLen = len - deleteDigits; + String prefix = b.substring(0, prefixLen); + return prefix + a[index]; + } + + + public static String process( String b) { + String[] a = {"万", "亿", "兆", "京", "垓","秭", "穰", "沟", "涧", "正", "载", "极","恒河沙", "阿僧祇", "那由他", "不可思议", "无量", "古戈尔","频菠萝", "矜羯罗","不可说不可说转","超限数", + "绝对无限","绝对无量","绝对小数","绝对大数","绝对超限数"}; + + + int len = b.length(); + if (len <= 4) return b; + + int k = (len - 1) / 4; + int deleteDigits = 4 * k; + int index = k - 1; + + if (index < 0 || index >= a.length) return b; + + int prefixLen = len - deleteDigits; + String prefix = b.substring(0, prefixLen); + return prefix + a[index]; } diff --git a/src/handling/channel/handler/PlayersHandler.java b/src/handling/channel/handler/PlayersHandler.java index 4c21dd6..2c6196a 100644 --- a/src/handling/channel/handler/PlayersHandler.java +++ b/src/handling/channel/handler/PlayersHandler.java @@ -142,7 +142,7 @@ public class PlayersHandler { string += "#d贪玩冒险岛\r\n"; string += "经验 " + Math.round((float) 人物经验) * MapleParty.活动经验倍率 + "倍,物品 " + Math.round((float) 人物物品爆率) + "倍, 金币 " + Math.round((float) 人物金币爆率) + "倍,\r\n\r\n"; string += "#b个人倍率\r\n"; - string += "经验 " + (long) (Math.round((float) c.getPlayer().getEXPMod()) * 100) * Math.round(c.getPlayer().getStat().expBuff / 100.0) + "%, 爆率 " + (long) (Math.round((float) c.getPlayer().getDropMod()) * 100) * Math.round(c.getPlayer().getStat().dropBuff / 100.0) + "%, 金币 " + Math.round(c.getPlayer().getStat().mesoBuff / 100.0) * 100L + "%\r\n\r\n"; + string += "经验 " + (long) (Math.round((float) c.getPlayer().getEXPMod()) * 100) * Math.round(c.getPlayer().getStat().expBuff / 100.0) + "%, 爆率 " + (long) (Math.round((float) c.getPlayer().getDropMod()) * 100) * Math.round(c.getPlayer().getStat().dropBuff / 100.0) + "%, 金币 " +(long) (Math.round((float) c.getPlayer().getCashMod()) * 100) * Math.round(c.getPlayer().getStat().mesoBuff / 100.0) * 100L + "%\r\n\r\n"; string += "#r个人资产\r\n"; string += "拥有:" + c.getPlayer().getCSPoints(1) + " 点劵\r\n\r\n"; string += "延迟 " + c.getPlayer().getClient().getLatency() + " 毫秒\r\n"; diff --git a/src/scripting/AbstractPlayerInteraction.java b/src/scripting/AbstractPlayerInteraction.java index b9646f6..bb3709a 100644 --- a/src/scripting/AbstractPlayerInteraction.java +++ b/src/scripting/AbstractPlayerInteraction.java @@ -447,6 +447,12 @@ public abstract class AbstractPlayerInteraction { } } + public final void spawnMobOnMap(final int id, final int qty, final int x, final int y, final int map, final String hp) { + for (int i = 0; i < qty; ++i) { + this.getMap(map).spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(id), new Point(x, y), hp); + } + } + public final void spawnMob(final int id, final int qty, final int x, final int y) { this.spawnMob(id, qty, new Point(x, y)); } diff --git a/src/server/life/MapleMonster.java b/src/server/life/MapleMonster.java index 6b4a9c9..a12ae56 100644 --- a/src/server/life/MapleMonster.java +++ b/src/server/life/MapleMonster.java @@ -8,6 +8,7 @@ import client.inventory.Equip; import client.inventory.MapleInventoryType; import server.Randomizer; +import java.math.BigInteger; import java.util.Collections; import handling.world.MapleParty; @@ -65,8 +66,11 @@ public class MapleMonster extends AbstractLoadedMapleLife { private MapleMonsterStats stats; private OverrideMonsterStats ostats; private long hp; + private BigInteger bigIntHp; - private long hpmax ; + private int bs = 1; + + private BigInteger hpmax ; private long nextKill; private int mp; private byte venom_counter; @@ -191,10 +195,28 @@ public class MapleMonster extends AbstractLoadedMapleLife { public final void setHp(final long hp) { this.hp = hp; } - public final void setmaxHp(final long maxhp) { - this.hpmax = maxhp; + + public final void setHpMax(final BigInteger hp) { + this.hpmax = hp; } - public final long getMaxHP() { + public final void setHp(final String bigIntHpstr) { + this.bigIntHp = new BigInteger(bigIntHpstr); + int i1 = bigIntHp.compareTo(new BigInteger("9223372036854775807")); + this.hpmax = this.bigIntHp; + + if (i1 > 0) { + int i = bigIntHpstr.length() - 18; + bs = (int) Math.pow(10, i - 1); + BigInteger divide = bigIntHp.divide(BigInteger.valueOf(bs)); + hp = divide.longValue(); + }else { + setHp(Long.parseLong(bigIntHpstr)); + } + + } + + + public final BigInteger getMaxHP() { return this.hpmax; } @@ -203,6 +225,13 @@ public class MapleMonster extends AbstractLoadedMapleLife { return this.hp; } + public final BigInteger getbigHp() { + if (bigIntHp == null){ + return BigInteger.valueOf(this.getHp()); + } + return this.bigIntHp; + } + public final long getMobMaxHp() { if (this.ostats != null) { return this.ostats.getHp(); @@ -273,6 +302,35 @@ public class MapleMonster extends AbstractLoadedMapleLife { this.damage(from, damage, updateAttackTime, 0); } + + + // 最大生命值获取方法 + public BigInteger getMobMaxHpBigInteger() { + return BigInteger.valueOf(this.getMobMaxHp()); // 假设原getMobMaxHp()返回long‌:ml-citation{ref="1,3" data="citationList"} + } + + + public final void damage(final MapleCharacter from, final BigInteger damage, + final boolean updateAttackTime, final int lastSkill) { + if (bigIntHp != null) { + bigIntHp = bigIntHp.subtract(damage); + } + + BigInteger divide = damage.divide(BigInteger.valueOf(bs)); + int i1 = divide.compareTo(new BigInteger("9223372036854775807")); + if (i1 > 0){ + divide =new BigInteger("9223372036854775806"); + } + damage(from,divide.longValue()+1,updateAttackTime,lastSkill); + +// if (bigIntHp.compareTo(new BigInteger("0")) <= 0 &&hp>0){ +// damage(from,divide.longValue(),updateAttackTime,lastSkill); +// } + } + + + + public final void damage(final MapleCharacter from, final long damage, final boolean updateAttackTime, final int lastSkill) { if (from == null || damage <= 0L || !this.isAlive()) { return; diff --git a/src/server/maps/MapleMap.java b/src/server/maps/MapleMap.java index a0bf231..e9f456b 100644 --- a/src/server/maps/MapleMap.java +++ b/src/server/maps/MapleMap.java @@ -5,6 +5,7 @@ import server.MapleCarnivalFactory.MCSkill; import server.MapleCarnivalFactory; import tools.Pair; +import java.math.BigInteger; import java.sql.PreparedStatement; import java.sql.Connection; @@ -1034,6 +1035,9 @@ public final class MapleMap { } } this.dropFromMonster(drop, monster); + int bs = chr.getBs(); + + } monster.setController(null); monster.setControllerHasAggro(false); @@ -1896,18 +1900,30 @@ public final class MapleMap { this.spawnMonster(mob, spawnType); } + public final void spawnMonster_sSack(final MapleMonster mob, final Point pos, final int spawnType, final String hp) { + final Point spos = this.calcPointBelow(new Point(pos.x, pos.y - 1)); + mob.setPosition(spos); + mob.setHp(hp); + this.spawnMonster(mob, spawnType); + } + public final void spawnMonster_sSack(final MapleMonster mob, final Point pos, final int spawnType, final long hp) { final Point spos = this.calcPointBelow(new Point(pos.x, pos.y - 1)); mob.setPosition(spos); mob.setHp(hp); - mob.setmaxHp(hp); + mob.setHpMax(BigInteger.valueOf(hp)); this.spawnMonster(mob, spawnType); } + public final void spawnMonsterOnGroundBelow(final MapleMonster mob, final Point pos, final long hp) { this.spawnMonster_sSack(mob, pos, -2, hp); } + public final void spawnMonsterOnGroundBelow(final MapleMonster mob, final Point pos, final String hp) { + this.spawnMonster_sSack(mob, pos, -2, hp); + } + public final void spawnMonsterOnGroundBelow(final MapleMonster mob, final Point pos) { this.spawnMonster_sSack(mob, pos, -2); } @@ -2290,7 +2306,7 @@ public final class MapleMap { } } }, null); - if (((Integer) Start.ConfigValuesMap.get("特殊宠物吸取开关")).intValue() > 0 && ((Integer) Start.ConfigValuesMap.get("特殊宠物吸物开关")).intValue() > 0 && chr.getEventInstance() == null && !mob.getStats().isBoss()) { + if (((Integer) Start.ConfigValuesMap.get("特殊宠物吸取开关")).intValue() > 0 && ((Integer) Start.ConfigValuesMap.get("特殊宠物吸物开关")).intValue() > 0 && chr.getEventInstance() == null ) { boolean 吸物状态 = false; int 宠物数据库ID = 0; if (chr.getId() == mdrop.character_ownerid) { @@ -2328,6 +2344,11 @@ public final class MapleMap { } } } + if (吸物状态 && mob.getStats().isBoss() && Start.ConfigValuesMap.get("boss吸物品开关") !=1){ + 吸物状态 = false; + } + + if (吸物状态 && mdrop.getItem().getItemId() != 0 && MapleInventoryManipulator.checkSpace(chr.getClient(), mdrop.getItemId(), (int) mdrop.getItem().getQuantity(), mdrop.getItem().getOwner())) { final byte petz = chr.getPetIndex(宠物数据库ID); InventoryHandler.removeItemPet(chr, mdrop, (int) petz);