增加多段多倍切割的运算
This commit is contained in:
parent
e491d2a2d6
commit
f23371f563
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue