v117 system potential ! Help

Results 1 to 2 of 2
  1. #1
    Apprentice Madrobot is offline
    MemberRank
    Mar 2014 Join Date
    17Posts

    v117 system potential ! Help

    i'm test souce ViciousMS

    when i use Potent or miracle cube i got 0 line - 3 line
    < 0 line - 3 line >
    -Premium Miracle Cube
    -Sper Miracle Cube
    -Revolutionary Miracle Cube
    -Enlightening Miracle Cube

    and if i use Potent 100% i got Item Epic all time and i never see item higher Epic

    Where should focus !? Equip ?

    /*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 ~ 2010 Patrick Huy <patrick.huy@frz.cc>
    Matthias Butz <matze@odinms.de>
    Jan Christian Meyer <vimes@odinms.de>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
    */
    package client.inventory;

    import constants.GameConstants;
    import java.io.Serializable;
    import java.util.Random;
    import server.Randomizer;

    import static java.lang.System.out;

    public class Equip extends Item implements Serializable {

    public static enum ScrollResult {

    SUCCESS, FAIL, CURSE
    }
    public static final int ARMOR_RATIO = 350000;
    public static final int WEAPON_RATIO = 700000;
    //charm: -1 = has not been initialized yet, 0 = already been worn, >0 = has teh charm exp
    private byte upgradeSlots = 0, level = 0, vicioushammer = 0, enhance = 0;
    private short str = 0, dex = 0, _int = 0, luk = 0, hp = 0, mp = 0, watk = 0, matk = 0, wdef = 0, mdef = 0, acc = 0, avoid = 0, hands = 0, speed = 0, jump = 0, charmExp = 0, pvpDamage = 0;
    private int itemEXP = 0, durability = -1, incSkill = -1, potential1 = 0, potential2 = 0, potential3 = 0, potential4 = 0, potential5 = 0, socket1 = -1, socket2 = -1, socket3 = -1;
    private int maxSlotUpgrades = 0;
    private MapleRing ring = null;
    private MapleAndroid android = null;

    public Equip(int id, short position, byte flag) {
    super(id, position, (short) 1, flag);
    }

    public Equip(int id, short position, int uniqueid, short flag) {
    super(id, position, (short) 1, flag, uniqueid);
    }

    @Override
    public Item copy() {
    Equip ret = new Equip(getItemId(), getPosition(), getUniqueId(), getFlag());
    ret.str = str;
    ret.dex = dex;
    ret._int = _int;
    ret.luk = luk;
    ret.hp = hp;
    ret.mp = mp;
    ret.matk = matk;
    ret.mdef = mdef;
    ret.watk = watk;
    ret.wdef = wdef;
    ret.acc = acc;
    ret.avoid = avoid;
    ret.hands = hands;
    ret.speed = speed;
    ret.jump = jump;
    ret.enhance = enhance;
    ret.upgradeSlots = upgradeSlots;
    ret.level = level;
    ret.itemEXP = itemEXP;
    ret.durability = durability;
    ret.vicioushammer = vicioushammer;
    ret.potential1 = potential1;
    ret.potential2 = potential2;
    ret.potential3 = potential3;
    ret.potential4 = potential4;
    ret.potential5 = potential5;
    ret.socket1 = socket1;
    ret.socket2 = socket2;
    ret.socket3 = socket3;
    ret.charmExp = charmExp;
    ret.pvpDamage = pvpDamage;
    ret.incSkill = incSkill;
    ret.maxSlotUpgrades = maxSlotUpgrades;
    ret.setGiftFrom(getGiftFrom());
    ret.setOwner(getOwner());
    ret.setQuantity(getQuantity());
    ret.setExpiration(getExpiration());
    return ret;
    }

    @Override
    public byte getType() {
    return 1;
    }

    public byte getUpgradeSlots() {
    return upgradeSlots;
    }

    public int getMaxSlotUpgrades() {
    return maxSlotUpgrades;
    }

    public short getStr() {
    return str;
    }

    public short getDex() {
    return dex;
    }

    public short getInt() {
    return _int;
    }

    public short getLuk() {
    return luk;
    }

    public short getHp() {
    return hp;
    }

    public short getMp() {
    return mp;
    }

    public short getWatk() {
    return watk;
    }

    public short getMatk() {
    return matk;
    }

    public short getWdef() {
    return wdef;
    }

    public short getMdef() {
    return mdef;
    }

    public short getAcc() {
    return acc;
    }

    public short getAvoid() {
    return avoid;
    }

    public short getHands() {
    return hands;
    }

    public short getSpeed() {
    return speed;
    }

    public short getJump() {
    return jump;
    }

    public void setStr(short str) {
    if (str < 0) {
    str = 0;
    }
    this.str = str;
    }

    public void setDex(short dex) {
    if (dex < 0) {
    dex = 0;
    }
    this.dex = dex;
    }

    public void setInt(short _int) {
    if (_int < 0) {
    _int = 0;
    }
    this._int = _int;
    }

    public void setLuk(short luk) {
    if (luk < 0) {
    luk = 0;
    }
    this.luk = luk;
    }

    public void setHp(short hp) {
    if (hp < 0) {
    hp = 0;
    }
    this.hp = hp;
    }

    public void setMp(short mp) {
    if (mp < 0) {
    mp = 0;
    }
    this.mp = mp;
    }

    public void setWatk(short watk) {
    if (watk < 0) {
    watk = 0;
    }
    this.watk = watk;
    }

    public void setMatk(short matk) {
    if (matk < 0) {
    matk = 0;
    }
    this.matk = matk;
    }

    public void setWdef(short wdef) {
    if (wdef < 0) {
    wdef = 0;
    }
    this.wdef = wdef;
    }

    public void setMaxSlotUpgrades(int u) {
    this.maxSlotUpgrades = u;
    }

    public void setMdef(short mdef) {
    if (mdef < 0) {
    mdef = 0;
    }
    this.mdef = mdef;
    }

    public void setAcc(short acc) {
    if (acc < 0) {
    acc = 0;
    }
    this.acc = acc;
    }

    public void setAvoid(short avoid) {
    if (avoid < 0) {
    avoid = 0;
    }
    this.avoid = avoid;
    }

    public void setHands(short hands) {
    if (hands < 0) {
    hands = 0;
    }
    this.hands = hands;
    }

    public void setSpeed(short speed) {
    if (speed < 0) {
    speed = 0;
    }
    this.speed = speed;
    }

    public void setJump(short jump) {
    if (jump < 0) {
    jump = 0;
    }
    this.jump = jump;
    }

    public void setUpgradeSlots(byte upgradeSlots) {
    this.upgradeSlots = upgradeSlots;
    }

    public byte getLevel() {
    return level;
    }

    public void setLevel(byte level) {
    this.level = level;
    }

    public byte getViciousHammer() {
    return vicioushammer;
    }

    public void setViciousHammer(byte ham) {
    vicioushammer = ham;
    }

    public int getItemEXP() {
    return itemEXP;
    }

    public void setItemEXP(int itemEXP) {
    if (itemEXP < 0) {
    itemEXP = 0;
    }
    this.itemEXP = itemEXP;
    }

    public int getEquipExp() {
    if (itemEXP <= 0) {
    return 0;
    }
    //aproximate value
    if (GameConstants.isWeapon(getItemId())) {
    return itemEXP / WEAPON_RATIO;
    } else {
    return itemEXP / ARMOR_RATIO;
    }
    }

    public int getEquipExpForLevel() {
    if (getEquipExp() <= 0) {
    return 0;
    }
    int expz = getEquipExp();
    for (int i = getBaseLevel(); i <= GameConstants.getMaxLevel(getItemId()); i++) {
    if (expz >= GameConstants.getExpForLevel(i, getItemId())) {
    expz -= GameConstants.getExpForLevel(i, getItemId());
    } else { //for 0, dont continue;
    break;
    }
    }
    return expz;
    }

    public int getExpPercentage() {
    if (getEquipLevel() < getBaseLevel() || getEquipLevel() > GameConstants.getMaxLevel(getItemId()) || GameConstants.getExpForLevel(getEquipLevel(), getItemId()) <= 0) {
    return 0;
    }
    return getEquipExpForLevel() * 100 / GameConstants.getExpForLevel(getEquipLevel(), getItemId());
    }

    public int getEquipLevel() {
    if (GameConstants.getMaxLevel(getItemId()) <= 0) {
    return 0;
    } else if (getEquipExp() <= 0) {
    return getBaseLevel();
    }
    int levelz = getBaseLevel();
    int expz = getEquipExp();
    for (int i = levelz; (GameConstants.getStatFromWeapon(getItemId()) == null ? (i <= GameConstants.getMaxLevel(getItemId())) : (i < GameConstants.getMaxLevel(getItemId()))); i++) {
    if (expz >= GameConstants.getExpForLevel(i, getItemId())) {
    levelz++;
    expz -= GameConstants.getExpForLevel(i, getItemId());
    } else { //for 0, dont continue;
    break;
    }
    }
    return levelz;
    }

    public int getBaseLevel() {
    return (GameConstants.getStatFromWeapon(getItemId()) == null ? 1 : 0);
    }

    @Override
    public void setQuantity(short quantity) {
    if (quantity < 0 || quantity > 1) {
    throw new RuntimeException("Setting the quantity to " + quantity + " on an equip (itemid: " + getItemId() + ")");
    }
    super.setQuantity(quantity);
    }

    public int getDurability() {
    return durability;
    }

    public void setDurability(final int dur) {
    this.durability = dur;
    }

    public byte getEnhance() {
    return enhance;
    }

    public void setEnhance(final byte en) {
    this.enhance = en;
    }

    public int getPotential1() {
    return potential1;
    }

    public void setPotential1(final int en) {
    this.potential1 = en;
    }

    public int getPotential2() {
    return potential2;
    }

    public void setPotential2(final int en) {
    this.potential2 = en;
    }

    public int getPotential3() {
    return potential3;
    }

    public void setPotential3(final int en) {
    this.potential3 = en;
    }

    public int getPotential4() {
    return potential4;
    }

    public void setPotential4(final int en) {
    this.potential4 = en;
    }

    public int getPotential5() {
    return potential5;
    }

    public void setPotential5(final int en) {
    this.potential5 = en;
    }

    public byte getState() {
    final int pots = potential1 + potential2 + potential3 + potential4 + potential5;
    //if (potential1 >= 60000 || potential2 >= 60000 || potential3 >= 60000 || potential4 >= 60000 || potential5 >= 60000) {
    // return 21; // special
    //} else
    if (potential1 >= 40000 || potential2 >= 40000 || potential3 >= 40000 || potential4 >= 40000 || potential5 >= 40000) {
    return 20; // legendary
    } else if (potential1 >= 30000 || potential2 >= 30000 || potential3 >= 30000 || potential4 >= 30000 || potential5 >= 30000) {
    return 19; // unique
    } else if (potential1 >= 20000 || potential2 >= 20000 || potential3 >= 20000 || potential4 >= 20000 || potential5 >= 20000) {
    return 18; // epic
    } else if (pots >= 1) {
    return 17; // rare
    } else if (pots < 0) {
    return 1; // hidden
    }
    return 0;
    }

    public void resetPotential_Fuse(boolean half, int potentialState) { //maker skill - equip first receive
    //no legendary, 0.16% chance unique, 4% chance epic, else rare
    potentialState = -potentialState;
    if (Randomizer.nextInt(100) < 4) {
    potentialState -= Randomizer.nextInt(100) < 4 ? 2 : 1;
    }
    setPotential1(potentialState);
    setPotential2((Randomizer.nextInt(half ? 5 : 10) == 0 ? potentialState : 0)); //1/10 chance of 3 line
    setPotential3(0); //just set it theoretically
    setPotential4(0); //just set it theoretically
    setPotential5(0); //just set it theoretically
    }

    public void resetPotential() { //equip first one, scroll hidden on it
    //no legendary, 0.16% chance unique, 4% chance epic, else rare
    final int rank = Randomizer.nextInt(100) < 4 ? (Randomizer.nextInt(100) < 4 ? -19 : -18) : -17;
    setPotential1(rank);
    setPotential2((Randomizer.nextInt(10) == 0 ? rank : 0)); //1/10 chance of 3 line
    setPotential3(0); //just set it theoretically
    setPotential4(0); //just set it theoretically
    setPotential5(0); //just set it theoretically
    }

    public void renewPotential(int type) { // 0 = normal miracle cube, 1 = premium, 2 = epic pot scroll, 3 = super, 5 = enlightening
    Random rand = new Random();
    //final int rank = type == 2 ? -18 : type == 5 ? (Randomizer.nextInt(100) < 3 && getState() != 20 ? -20 : Randomizer.nextInt(100) < 10 && getState() != 20 ? -(getState() + 1) : -(getState())) : (Randomizer.nextInt(100) < 4 && getState() != (type == 3 ? 20 : 19) ? -(getState() + 1) : -(getState())); // 4 % chance to up 1 tier
    final int rank = type == 2 ? -18 : (Randomizer.nextInt(100) < 4 && getState() != (type == 3 ? 20 : 19) ? -(getState() + 1) : -(getState())); // 4 % chance to up 1 tier
    setPotential1(getState() == 20 && rand.nextInt(100) <= 1 ? 60002 : rank);
    if (getPotential3() > 0) {
    setPotential2(getState() == 20 && rand.nextInt(100) <= 1 ? 60002 :rank); // put back old 3rd line
    } else {
    switch (type) {
    case 1: // premium-> suppose to be 25%
    setPotential2(Randomizer.nextInt(10) == 0 ? rank : 0); //1/10 chance of 3 line
    break;
    case 2: // epic pot
    setPotential2(Randomizer.nextInt(10) >= 1 ? rank : 0); //2/10 chance of 3 line
    break;
    case 3: // super
    setPotential2(getState() == 20 && rand.nextInt(100) <= 1 ? 60002 : Randomizer.nextInt(10) <= 2 ? rank : 0); //3/10 chance of 3 line
    break;
    case 4: // revolutionary
    setPotential2(getState() == 20 && rand.nextInt(100) <= 1 ? 60002 : Randomizer.nextInt(10) <= 3 ? rank : 0); //4/10 chance of 3 line
    break;
    case 5: // enlightening
    setPotential2(getState() == 20 && rand.nextInt(100) <= 1 ? 60002 : Randomizer.nextInt(10) <= 2 ? rank : 0); //3/10 chance of 3 line
    break;
    default:
    setPotential2(0);
    break;
    }
    }
    if (getPotential4() > 0) {
    setPotential3(getState() == 20 && rand.nextInt(100) <= 1 ? 60002 : rank); // put back old 4th line
    } else if (type == 3) { // super
    setPotential3(getState() == 20 && rand.nextInt(100) <= 1 ? 60002 : Randomizer.nextInt(100) <= 2 ? rank : 0); // 3/100 to get 4 lines
    } else { // premium cannot get 3 lines.
    setPotential3(0); //just set it theoretically
    }
    if (getPotential5() > 0) {
    setPotential4(getState() == 20 && rand.nextInt(100) <= 1 ? 60002 :rank); // put back old 5th line
    } else if (type == 3) { // super
    setPotential4(getState() == 20 && rand.nextInt(100) <=1 ? 60002 : Randomizer.nextInt(100) <= 1 ? rank : 0); // 2/100 to get 5 lines
    } else {
    setPotential4(0); //just set it theoretically
    }
    setPotential5(0); //just set it theoretically
    }

    public int getIncSkill() {
    return incSkill;
    }

    public void setIncSkill(int inc) {
    this.incSkill = inc;
    }

    public short getCharmEXP() {
    return charmExp;
    }

    public short getPVPDamage() {
    return pvpDamage;
    }

    public void setCharmEXP(short s) {
    this.charmExp = s;
    }

    public void setPVPDamage(short p) {
    this.pvpDamage = p;
    }

    public MapleRing getRing() {
    if (!GameConstants.isEffectRing(getItemId()) || getUniqueId() <= 0) {
    return null;
    }
    if (ring == null) {
    ring = MapleRing.loadFromDb(getUniqueId(), getPosition() < 0);
    }
    return ring;
    }

    public void setRing(MapleRing ring) {
    this.ring = ring;
    }

    public MapleAndroid getAndroid() {
    if (getItemId() / 10000 != 166 || getUniqueId() <= 0) {
    return null;
    }
    if (android == null) {
    android = MapleAndroid.loadFromDb(getItemId(), getUniqueId());
    }
    return android;
    }

    public void setAndroid(MapleAndroid ring) {
    this.android = ring;
    }

    public short getSocketState() {
    int flag = 0;
    if (socket1 != -1 || socket2 != -1 || socket3 != -1) { // Got empty sockets show msg
    flag |= SocketFlag.DEFAULT.getValue();
    }
    if (socket1 != -1) {
    flag |= SocketFlag.SOCKET_BOX_1.getValue();
    }
    if (socket1 > 0) {
    flag |= SocketFlag.USED_SOCKET_1.getValue();
    }
    if (socket2 != -1) {
    flag |= SocketFlag.SOCKET_BOX_2.getValue();
    }
    if (socket2 > 0) {
    flag |= SocketFlag.USED_SOCKET_2.getValue();
    }
    if (socket3 != -1) {
    flag |= SocketFlag.SOCKET_BOX_3.getValue();
    }
    if (socket3 > 0) {
    flag |= SocketFlag.USED_SOCKET_3.getValue();
    }
    return (short) flag;
    }

    public int getSocket1() {
    return socket1;
    }

    public void setSocket1(int socket1) {
    this.socket1 = socket1;
    }

    public int getSocket2() {
    return socket2;
    }

    public void setSocket2(int socket2) {
    this.socket2 = socket2;
    }

    public int getSocket3() {
    return socket3;
    }

    public void setSocket3(int socket3) {
    this.socket3 = socket3;
    }
    }


  2. #2
    Member divinesam is offline
    MemberRank
    May 2004 Join Date
    singaporeLocation
    97Posts

    Re: v117 system potential ! Help

    I advise you not to use ViciousMS source if you do not know what you are doing

    Read the help section from page 1-50.
    Your answer can be found somewhere within the section.



Advertisement