You are Unregistered, please register to gain Full access.
    


RaGEZONE sponsored advertisment:

Dragonica Image
The free 3D side scrolling MMORPG.

 
 
LinkBack (2) Thread Tools
Old 07-05-2008   2 links from elsewhere to this Post. Click to view. #1 (permalink)
Account Upgraded | Title Enabled!
 
airflow0's Avatar
 
Rank: Member +
Join Date: Sep 2006
Posts: 648
Thanked 0 Times in 0 Posts

[RELEASE] Negative Exp Fix (ODIN)

Your Ad Here
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; 07-12-2008 at 01:56 PM.
airflow0 is offline   Reply With Quote

RaGEZONE sponsored advertisment:
Old 07-05-2008   #2 (permalink)
Account Upgraded | Title Enabled!
 
Rank: Member +
Join Date: May 2008
Posts: 277
Thanked 1 Time in 1 Post

Re: [RELEASE] Negative Exp Fix (ODIN)

HEY I need negative exp bar for titan thanks
HELOHELO is offline   Reply With Quote

Endorsement
Old 07-05-2008   #3 (permalink)
Account Upgraded | Title Enabled!
 
airflow0's Avatar
 
Rank: Member +
Join Date: Sep 2006
Posts: 648
Thanked 0 Times in 0 Posts

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..
airflow0 is offline   Reply With Quote

Endorsement

Old 07-05-2008   #4 (permalink)
Member
 
Rank: Hobbit
Join Date: Jun 2008
Posts: 46
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

hmm u sure it works?
freedomVON is offline   Reply With Quote
Old 07-05-2008   #5 (permalink)
Account Upgraded | Title Enabled!
 
airflow0's Avatar
 
Rank: Member +
Join Date: Sep 2006
Posts: 648
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

It should.
airflow0 is offline   Reply With Quote
Old 07-05-2008   #6 (permalink)
Member
 
Rank: Hobbit
Join Date: Jun 2008
Posts: 31
Thanked 0 Times in 0 Posts

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.getSh owExpGain(gain, inChat, white));
}
if (level < 200 && exp.get() >= ExpTable.getExpNeededForLevel(level + 1)) {
levelUp();
}
}
andyw is offline   Reply With Quote
Old 07-05-2008   #7 (permalink)
Member
 
Rank: Hobbit
Join Date: Jun 2008
Posts: 31
Thanked 0 Times in 0 Posts

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);
}
andyw is offline   Reply With Quote
Old 07-05-2008   #8 (permalink)
Account Upgraded | Title Enabled!
 
airflow0's Avatar
 
Rank: Member +
Join Date: Sep 2006
Posts: 648
Thanked 0 Times in 0 Posts

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..
airflow0 is offline   Reply With Quote
Old 07-05-2008   #9 (permalink)
b0ib0ii!
 
Rank: Member +
Join Date: Apr 2008
Location: I'm in RaGEZONE
Posts: 273
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

does this changes the exp to 0? or it only delete the ' - ' sign in the database?
b0ib0ii is offline   Reply With Quote
Old 07-05-2008   #10 (permalink)
Account Upgraded | Title Enabled!
 
airflow0's Avatar
 
Rank: Member +
Join Date: Sep 2006
Posts: 648
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

It resets the exp to 0 if it goes negative.
airflow0 is offline   Reply With Quote
Old 07-05-2008   #11 (permalink)
b0ib0ii!
 
Rank: Member +
Join Date: Apr 2008
Location: I'm in RaGEZONE
Posts: 273
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

Quote:
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?
b0ib0ii is offline   Reply With Quote
Old 07-05-2008   #12 (permalink)
GoldMember
 
XkelvinchiaX's Avatar
 
Rank: Member +
Join Date: Sep 2006
Location: Earth
Posts: 312
Thanked 2 Times in 2 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

this thing can cause the error 38 mah?
XkelvinchiaX is offline   Reply With Quote
Old 07-05-2008   #13 (permalink)
Member
 
Rank: Hobbit
Join Date: Jun 2008
Posts: 31
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

I assume only those exp value more than 2 power 32 will go to negative.
andyw is offline   Reply With Quote
Old 07-05-2008   #14 (permalink)
BlizzardStory Owner
 
Sengi's Avatar
 
Rank: Member +
Join Date: Apr 2008
Location: Behind You xD
Posts: 278
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

imma try it thx xD
Sengi is offline   Reply With Quote
Old 07-05-2008   #15 (permalink)
Ultimate Member
 
zeally's Avatar
 
Rank: Member
Join Date: Jun 2008
Posts: 151
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

any idea how to allow multi leveling ?
__________________
There is no signature here.
zeally is offline   Reply With Quote
Old 07-05-2008   #16 (permalink)
Alpha
 
Rank: Member
Join Date: Jun 2008
Posts: 141
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

Getting 1 compiling error when using andyw's method
wly3298456 is offline   Reply With Quote
Old 07-05-2008   #17 (permalink)
I Don't Own A Server
 
thegamer1907's Avatar
 
Rank: Member +
Join Date: May 2008
Location: Singapore
Posts: 469
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

will this work? :

Code:
if (chr.getExp() < 0) {
                                chr.setExp(Exp - Exp);
                        }
			chr.saveToDB(true);
what im trying to do is set the exp to non negative instead of 0
thegamer1907 is offline   Reply With Quote
Old 07-05-2008   #18 (permalink)
Account Upgraded | Title Enabled!
 
airflow0's Avatar
 
Rank: Member +
Join Date: Sep 2006
Posts: 648
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

You would have to do this to set a negative to positive. Though if the players max exp is higher than the positive amount it will go negative again so you will need to issue a levelup. You'll probably want to loop it as well just to be on the positive side, this will keep leveling up the player if the exp is negative and the players max exp is equal to or less than the new absolute value.

Code is in main post now.

Last edited by airflow0; 07-06-2008 at 02:49 AM.
airflow0 is offline   Reply With Quote
Old 07-05-2008   #19 (permalink)
Member
 
Rank: Hobbit
Join Date: Jun 2008
Posts: 41
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

haha thanks for the scripts. it works really well ^.^

good job!
Ownecl is offline   Reply With Quote
Old 07-06-2008   #20 (permalink)
Custom title shit.
 
Rank: Member +
Join Date: May 2008
Location: New york
Posts: 525
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

Love it.
xkush is offline   Reply With Quote
Old 07-06-2008   #21 (permalink)
Account Upgraded | Title Enabled!
 
airflow0's Avatar
 
Rank: Member +
Join Date: Sep 2006
Posts: 648
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

I updated the second alternative method and added a third method.
airflow0 is offline   Reply With Quote
Old 07-06-2008   #22 (permalink)
Moderator
 
ch1nkayy's Avatar
 
Rank: Moderator
Join Date: Apr 2008
Posts: 2,508
Thanked 24 Times in 13 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

implanted in my server. works nicely (: props.
ch1nkayy is offline   Reply With Quote
Old 07-06-2008   #23 (permalink)
Account Upgraded | Title Enabled!
 
Rank: Member +
Join Date: May 2008
Location: Her heart :)
Posts: 299
Thanked 2 Times in 2 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

//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);
}
}



where can i edit this file ? O.o i cant find it.
lxCrAzYsEl is offline   Reply With Quote
Old 07-06-2008   #24 (permalink)
Account Upgraded | Title Enabled!
 
airflow0's Avatar
 
Rank: Member +
Join Date: Sep 2006
Posts: 648
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

You put it in MapleCharacter.java under the gainExp function.
airflow0 is offline   Reply With Quote
Old 07-06-2008   #25 (permalink)
I Don't Own A Server
 
thegamer1907's Avatar
 
Rank: Member +
Join Date: May 2008
Location: Singapore
Posts: 469
Thanked 0 Times in 0 Posts

Re: [RELEASE] Negative Exp Fix (ODIN)

thanks, its very helpful.
thegamer1907 is offline   Reply With Quote
 

Bookmarks

Thread Tools


LinkBacks (?)
LinkBack to this Thread: http://forum.ragezone.com/f427/release-negative-exp-fix-odin-425739/
Posted By For Type Date
OdinMS Source Releases,Guides,Repacks,Revs,Tutorials,HTML-PHP,Tools,Handbook - GameCheetah This thread Refback 05-16-2009 12:25 PM
[OdinMS]Releases,Guides,Repacks,Revs,orials,HTML-PHP,Tools,Handbook - Maplestory Releases - ServerFiles.org This thread Refback 03-27-2009 11:22 AM



Translated by Google
Albanian Arabic Belarusian Bulgarian Catalan Chinese Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician German Greek Hebrew Hindi Hungarian Icelandic Indonesian Italian Japanese Korean Latvian Lithuanian Maltese Norwegian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swedish Taiwanese Thai Turkish Ukrainian Vietnamese
no new posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274