From f23371f5637ac558092a2a0b66f1aa75748cc95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=AA=E9=A3=8E?= <1213457484@qq.com> Date: Wed, 19 Mar 2025 11:39:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E6=AE=B5=E5=A4=9A?= =?UTF-8?q?=E5=80=8D=E5=88=87=E5=89=B2=E7=9A=84=E8=BF=90=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/inventory/Equip.java | 100 ++++++++++++++++++ .../data/MaplePacketLittleEndianWriter.java | 1 + 2 files changed, 101 insertions(+) diff --git a/src/client/inventory/Equip.java b/src/client/inventory/Equip.java index 82edcbe..861ca2b 100644 --- a/src/client/inventory/Equip.java +++ b/src/client/inventory/Equip.java @@ -384,6 +384,7 @@ public class Equip extends Item implements IEquip, Serializable { } + public void setdd(String dd) { BigInteger bigInteger = new BigInteger(dd); if (bigInteger.compareTo(BigInteger.ZERO) < 0) { @@ -391,6 +392,41 @@ public class Equip extends Item implements IEquip, Serializable { } this.dd = dd; } + public void addDd(String num) { + BigInteger bigIntegernum = new BigInteger(num); + BigInteger bigIntegerdd = new BigInteger(this.dd); + BigInteger add = bigIntegerdd.add(bigIntegernum); + if (add.compareTo(BigInteger.ZERO) < 0) { + add = BigInteger.ZERO; + } + this.dd = add.toString(); + } + + public void multiplyDd(String num) { + BigInteger bigIntegernum = new BigInteger(num); + BigInteger bigIntegerdd = new BigInteger(this.dd); + BigInteger product = bigIntegerdd.multiply(bigIntegernum); + if (product.compareTo(BigInteger.ZERO) < 0) { + product = BigInteger.ZERO; + } + this.dd = product.toString(); + } + + public void divideDd(String num) { + BigInteger bigIntegernum = new BigInteger(num); + if (bigIntegernum.equals(BigInteger.ZERO)) { + throw new ArithmeticException("除数不能为零"); + } + BigInteger bigIntegerdd = new BigInteger(this.dd); + BigInteger quotient = bigIntegerdd.divide(bigIntegernum); + if (quotient.compareTo(BigInteger.ZERO) < 0) { + quotient = BigInteger.ZERO; + } + this.dd = quotient.toString(); + } + + + public void setdb(String db) { BigInteger bigInteger = new BigInteger(db); @@ -407,7 +443,71 @@ public class Equip extends Item implements IEquip, Serializable { } this.qg = qg; } + public void addDb(String num) { + BigInteger bigIntegernum = new BigInteger(num); + BigInteger bigIntegerdb = new BigInteger(this.db); + BigInteger add = bigIntegerdb.add(bigIntegernum); + if (add.compareTo(BigInteger.ZERO) < 0) { + add = BigInteger.ZERO; + } + this.db = add.toString(); + } + public void multiplyDb(String num) { + BigInteger bigIntegernum = new BigInteger(num); + BigInteger bigIntegerdb = new BigInteger(this.db); + BigInteger product = bigIntegerdb.multiply(bigIntegernum); + if (product.compareTo(BigInteger.ZERO) < 0) { + product = BigInteger.ZERO; + } + this.db = product.toString(); + } + + public void divideDb(String num) { + BigInteger bigIntegernum = new BigInteger(num); + if (bigIntegernum.equals(BigInteger.ZERO)) { + throw new ArithmeticException("除数不能为零"); + } + BigInteger bigIntegerdb = new BigInteger(this.db); + BigInteger quotient = bigIntegerdb.divide(bigIntegernum); + if (quotient.compareTo(BigInteger.ZERO) < 0) { + quotient = BigInteger.ZERO; + } + this.db = quotient.toString(); + } + + public void addQg(String num) { + BigInteger bigIntegernum = new BigInteger(num); + BigInteger bigIntegerqg = new BigInteger(this.qg); + BigInteger add = bigIntegerqg.add(bigIntegernum); + if (add.compareTo(BigInteger.ZERO) < 0) { + add = BigInteger.ZERO; + } + this.qg = add.toString(); + } + + public void multiplyQg(String num) { + BigInteger bigIntegernum = new BigInteger(num); + BigInteger bigIntegerqg = new BigInteger(this.qg); + BigInteger product = bigIntegerqg.multiply(bigIntegernum); + if (product.compareTo(BigInteger.ZERO) < 0) { + product = BigInteger.ZERO; + } + this.qg = product.toString(); + } + + public void divideQg(String num) { + BigInteger bigIntegernum = new BigInteger(num); + if (bigIntegernum.equals(BigInteger.ZERO)) { + throw new ArithmeticException("除数不能为零"); + } + BigInteger bigIntegerqg = new BigInteger(this.qg); + BigInteger quotient = bigIntegerqg.divide(bigIntegernum); + if (quotient.compareTo(BigInteger.ZERO) < 0) { + quotient = BigInteger.ZERO; + } + this.qg = quotient.toString(); + } public void setUpgradeSlots(final byte upgradeSlots) { this.upgradeSlots = upgradeSlots; diff --git a/src/tools/data/MaplePacketLittleEndianWriter.java b/src/tools/data/MaplePacketLittleEndianWriter.java index 4b7399f..0911787 100644 --- a/src/tools/data/MaplePacketLittleEndianWriter.java +++ b/src/tools/data/MaplePacketLittleEndianWriter.java @@ -106,6 +106,7 @@ public class MaplePacketLittleEndianWriter { if (s == null ||s.isEmpty()){ s = "0"; } + this.writeShort((int) (short)s.getBytes(StandardCharsets.UTF_8).length); this.write(s.getBytes(StandardCharsets.UTF_8)); }