Negative Exp Fix (ODIN)

Page 1 of 5 12345 LastLast
Results 1 to 15 of 73
  1. #1
    Account Upgraded | Title Enabled! airflow0 is offline
    MemberRank
    Sep 2006 Join Date
    600Posts

    Negative Exp Fix (ODIN)

    This will fix negative exp.

    Add to MapleCharacter.java
    After public int getExp() {}
    Code:
            public void setExp(int amount) {
                    exp.set(amount);
            }
    Add to MapleClient.java
    At public void disconnect() {
    Change
    Code:
    chr.saveToDB(true);
    to
    Code:
                            //fix negative exp on logout
                            if (chr.getExp() < 0) {
                                    chr.setExp(0);
                            }
    			chr.saveToDB(true);
    Alternative method would be to set the players exp to 0 if its under 0 when the player gains exp again. In MapleCharacter.java add this in public void gainExp.
    Code:
                    if (this.getExp() < 0) {
                            this.setExp(0);
                    }
    *MULTI LEVEL VERSION*
    Another method would be to set the players exp to positive then issue a levelup if the players new positive exp is greater than or equal to the the required exp to levelup.
    Code:
                    //if the player has negative exp while gaining exp convert to absolute value and levelup if value is greater than exp needed for level
    		if (getExp() < 0) {
    			   setExp(Math.abs(getExp()));
    			   while (level < 200 && getExp() >= ExpTable.getExpNeededForLevel(level + 1)) {
    					  levelUp();
    			   }
    		}
    *SINGLE LEVEL VERSION*
    Set the players exp to positive then issue a levelup if the players new positive exp is greater than or equal to the the required exp to levelup then set it to 0 after one level.
    Code:
                    //if the player has negative exp while gaining exp convert to absolute value and levelup if value is greater than exp needed for level
    		if (getExp() < 0) {
    			   setExp(Math.abs(getExp()));
    			   if (level < 200 && getExp() >= ExpTable.getExpNeededForLevel(level + 1)) {
    					  levelUp();
    					  setExp(0);
    			   }
    		}
    Last edited by airflow0; 12-07-08 at 02:56 PM.


  2. #2
    Account Upgraded | Title Enabled! HELOHELO is offline
    MemberRank
    May 2008 Join Date
    SingaporeLocation
    341Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    HEY I need negative exp bar for titan thanks

  3. #3
    Account Upgraded | Title Enabled! airflow0 is offline
    MemberRank
    Sep 2006 Join Date
    600Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    I don't know how exp is handled in titan, if you post the gainExp handler I'll fix it for titan as well..

  4. #4
    Enthusiast freedomVON is offline
    MemberRank
    Jun 2008 Join Date
    46Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    hmm u sure it works?

  5. #5
    Account Upgraded | Title Enabled! airflow0 is offline
    MemberRank
    Sep 2006 Join Date
    600Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    It should.

  6. #6
    Apprentice andyw is offline
    MemberRank
    Jun 2008 Join Date
    22Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    I usually do this.

    MapleCharacter.java

    public void gainExp(int gain, boolean show, boolean inChat, boolean white) {
    if (getLevel() < 200) { // lv200 is max and has 0 exp required to level
    int newexp = this.exp.addAndGet(gain);
    if (exp.get() < 0) //This give the user level up only 1 level if happen to have negative exp
    {
    exp.set(ExpTable.getExpNeededForLevel(level + 1));
    levelUp();
    }
    updateSingleStat(MapleStat.EXP, newexp);
    }
    if (show) { // still show the expgain even if it's not there
    client.getSession().write(MaplePacketCreator.getShowExpGain(gain, inChat, white));
    }
    if (level < 200 && exp.get() >= ExpTable.getExpNeededForLevel(level + 1)) {
    levelUp();
    }
    }

  7. #7
    Apprentice andyw is offline
    MemberRank
    Jun 2008 Join Date
    22Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    Add this to the levelUp module if you want to restrict the user to have mass-level. This will only level up the user 1 level + max his/her exp to 99.99%.
    if (exp.get() >= ExpTable.getExpNeededForLevel(level + 1))
    {
    exp.set(ExpTable.getExpNeededForLevel(level + 1) - 1);
    }

  8. #8
    Account Upgraded | Title Enabled! airflow0 is offline
    MemberRank
    Sep 2006 Join Date
    600Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    Giving a player a free levelup for negative exp might be a bad idea because you could kill one bugged monster and gain a free levelup..

  9. #9
    'b' for boy b0ib0ii is offline
    MemberRank
    Apr 2008 Join Date
    I'm in RaGEZONELocation
    470Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    does this changes the exp to 0? or it only delete the ' - ' sign in the database?

  10. #10
    Account Upgraded | Title Enabled! airflow0 is offline
    MemberRank
    Sep 2006 Join Date
    600Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    It resets the exp to 0 if it goes negative.

  11. #11
    'b' for boy b0ib0ii is offline
    MemberRank
    Apr 2008 Join Date
    I'm in RaGEZONELocation
    470Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    It resets the exp to 0 if it goes negative.
    Is there a way i can make it minus the ' - ' sign only in the database using this?

  12. #12
    GoldMember XkelvinchiaX is offline
    MemberRank
    Sep 2006 Join Date
    MalaysiaLocation
    286Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    this thing can cause the error 38 mah?

  13. #13
    Apprentice andyw is offline
    MemberRank
    Jun 2008 Join Date
    22Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    I assume only those exp value more than 2 power 32 will go to negative.

  14. #14
    Account Upgraded | Title Enabled! Sengi is offline
    MemberRank
    Apr 2008 Join Date
    Behind You xDLocation
    272Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    imma try it thx xD

  15. #15
    Valued Member zeally is offline
    MemberRank
    Jun 2008 Join Date
    123Posts

    Re: [RELEASE] Negative Exp Fix (ODIN)

    any idea how to allow multi leveling ?



Page 1 of 5 12345 LastLast

Advertisement