Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2008, 11:29 PM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default [wip] detailed exp gain

getting xp was a fabled thing those days i was playing. ya never knew how much you get, never knew how much to be done.. so here you go with some detailed xp.

description:
after "you gain experience/group xp" line you get line for xp and if needed aa xp. you get info that what kind of xp it is (normal or aa) then the amount then how much you are to do to gain a level and then how much of this exp gain you need to do the level.

example:
you gain experience!
normal: 10 (to go: 20 (2 from this)) - means you got 10 xp and you are to get 2 times 10 xp more to do the level.

Code:
			//we get xp or group xp, so we set up message
			if(this->IsGrouped())
				this->Message_StringID(15,GAIN_GROUPXP);
			else
				this->Message_StringID(15,GAIN_XP);


********* start



			//and we continue with some details..
			char szoveg [256];
			if (set_exp>m_pp.exp)
			{
				char ding [128];
				int togo = GetEXPForLevel(GetLevel()+1)-set_exp;
				//gain of normal xp
				if (togo<0) 
				{
					snprintf(ding,128,"%s","DING!"); 
				} else {
					if (togo/(set_exp-m_pp.exp)<10000)
					{
						snprintf(ding,128,"to go: %i (%i from this)",togo,togo/(set_exp-m_pp.exp));
					} else {
						snprintf(ding,128,"to go: %i (way to go)",togo);
					}
				}
				//no ding on max level - replace 65 with the function
				if (GetLevel()!=65)
				{
					snprintf(szoveg,256,"Normal: %i(%s)",set_exp-m_pp.exp,(char*)ding);
					Message(15,(char*)szoveg);
				}
			}
			if (set_aaxp>m_pp.expAA)
			{
				char ding2 [128];
				int togo2 = max_AAXP-set_aaxp;
				//gain of aa xp
				if (togo2<0) 
				{
					snprintf(ding2,128,"%s","DING!"); 
				} else { 
					if (togo2/(set_aaxp-m_pp.expAA)<10000)
					{
						snprintf(ding2,128,"to go: %i (%i from this)",togo2,togo2/(set_aaxp-m_pp.expAA));
					} else {
						snprintf(ding2,128,"to go: %i (way to go)",togo2);
					}
				}
				snprintf(szoveg,256,"AA: %i(%s)",set_aaxp-m_pp.expAA,(char*)ding2);
				Message(15,(char*)szoveg);
			}
		}
	}


******** end


	else if((set_exp + set_aaxp) < (m_pp.exp+m_pp.expAA)){ //only loss message if you lose exp, no message if you gained/lost nothing.
		Message(15, "You have lost experience.");
	}
my questions - in what i like to get help:
- how to get the level cap? (what function?) i placed a simple 65 into code
- just my second code in c, so ... dumb newbie question: how to round UP numbers? if you see the code you will see that the (from this) values are rounded down - so you may get message 10xp "(to go: 1 (0 from this))"
Reply With Quote
  #2  
Old 01-12-2008, 08:37 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

You can get the level cap:

make sure #include "../common/rulesys.h" is part of the file, very likely if it's exp code.

Then you can call: RuleI(Character, MaxLevel)
Reply With Quote
  #3  
Old 01-12-2008, 11:05 AM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default

thank you for your help - worked very well
Reply With Quote
  #4  
Old 01-12-2008, 12:06 PM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default

had no better idea for rounding up allways.. but this may work

Code:
						int ad=0; if (togo/(set_exp-m_pp.exp)!=(int)(togo/(set_exp-m_pp.exp))) ad=1;
						snprintf(ding,128,"to go: %i (%i from this)",togo,ad+(togo/(set_exp-m_pp.exp)));
and for aa exp

Code:
						int ad2=0; if (togo2/(set_aaxp-m_pp.expAA)!=(int)(togo2/(set_aaxp-m_pp.expAA))) ad2=1;
						snprintf(ding2,128,"to go: %i (%i from this)",togo2,ad2+togo2/(set_aaxp-m_pp.expAA));
Reply With Quote
  #5  
Old 01-13-2008, 05:15 AM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default

previous code did not work and was not even a good shot.. here is a better one.. tested, working:

Code:
int ad=0; if (togo % (set_exp-m_pp.exp)!= 0) ad=1;
goes for both, so do same with ad2 too..
Reply With Quote
  #6  
Old 03-19-2008, 02:36 PM
Sabyre's Avatar
Sabyre
Sarnak
 
Join Date: Jun 2003
Location: Maine, USA
Posts: 88
Default

Hungry Dev Newb Question: Which file would this code be inserted?
__________________
.......
...
.
"We are the music makers and we are the dreamers of the dreams" - Willy Wonka
Reply With Quote
  #7  
Old 03-19-2008, 11:04 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Quote:
Originally Posted by zeiksz2 View Post
getting xp was a fabled thing those days i was playing. ya never knew how much you get, never knew how much to be done..
Probably a dumb question, but I wonder if you meant EqLive or EqEMu? Cause I remember playing on live all night, then sending tells to my friends on how happy I was to get a "sliver" of yellow on my exp bar. Blue bar didn't exist, they later made that so you think you were getting better exp).
Reply With Quote
  #8  
Old 06-02-2008, 08:19 PM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default

eqlive - but btw i did not saw any of servers telling how much xp you get, etc.. so i can mean eqemu too - i think
Reply With Quote
  #9  
Old 06-02-2008, 08:21 PM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default

Quote:
Originally Posted by Sabyre View Post
Hungry Dev Newb Question: Which file would this code be inserted?
EQEmu-0.7.0-1070\SOURCE\zone\exp.cpp(134)
Reply With Quote
  #10  
Old 06-03-2008, 06:37 PM
BatCountry
Fire Beetle
 
Join Date: Mar 2006
Posts: 24
Default

Quote:
Originally Posted by zeiksz2 View Post
had no better idea for rounding up allways.. but this may work
The ceil() function will round up always. It's in math.h
Reply With Quote
  #11  
Old 06-05-2008, 04:34 PM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default

Quote:
Originally Posted by BatCountry View Post
The ceil() function will round up always. It's in math.h
thank you very much
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:39 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3