Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Quests

Archive::Quests Archive area for Quests's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2004, 12:38 AM
KhaN's Avatar
KhaN
Dragon
 
Join Date: Mar 2004
Location: France, Bordeaux.
Posts: 677
Default Function : SetStat

Add this to embperl.cpp
Code:
"sub setstat{push(@cmd_queue,{func=>'setstat',args=>join(',',@_)});}"
Command example :
Code:
quest::setstat(6,1);
This will increase your CHA by 2.

I made first this perl command because i need to way to edit stats ... sad thing, i didnt realise setstats was only increase/decrease command. Note you cant decrease your base stats (dont know why).

Im looking for a way to change stats via a PERL command, or a way to reload baseracestats, if someone has an idea ...
__________________

Reply With Quote
  #2  
Old 05-17-2004, 02:52 AM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

to change stats via perl command:

add this to client.cpp:
Code:
void Client::SetStat(int8 type,sint16 number){
        // Cofruben: Setstat function
        if(type>STAT_DISEASE){
                printf("Error in Client::SetStat, received invalid type of: %i\n",type);
                return;
        }
        switch(type){
                case STAT_STR:
                        m_pp.STR=number;
                        break;
                case STAT_STA:
                        m_pp.STA=number;
                        break;
                case STAT_AGI:
                        m_pp.AGI=number;
                        break;
                case STAT_DEX:
                        m_pp.DEX=number;
                        break;
                case STAT_INT:
                        m_pp.INT=number;
                        break;
                case STAT_WIS:
                        m_pp.WIS=number;
                        break;
                case STAT_CHA:
                        m_pp.CHA=number;
                        break;
        }
}
add this to client.h
Code:
void    SetStat(int8 type,sint16 number); //cofruben:-For setting stats.
now,you can make a perl command that calls that client function.For example add this to a perl command.
mob->CastToClient()->SetStat(0,70); //sets 70 to STR
or
mob->CastToClient()->SetStat(1,65); //sets 65 to STA.
Reply With Quote
  #3  
Old 05-18-2004, 12:40 PM
KhaN's Avatar
KhaN
Dragon
 
Join Date: Mar 2004
Location: France, Bordeaux.
Posts: 677
Default Im getting mad *sight*

I added your suggestion Cofruben but look like there is a little problem (From me, for sure).

I added this to code.
CLIENT.CPP, 2084
Code:
void Client::SetStat(int8 type,sint16 number){ 
        // Cofruben: Setstat function 
        if(type>STAT_DISEASE){ 
                printf("Error in Client::SetStat, received invalid type of: %i\n",type); 
                return; 
        } 
        switch(type){ 
                case STAT_STR: 
                        m_pp.STR=number; 
                        break; 
                case STAT_STA: 
                        m_pp.STA=number; 
                        break; 
                case STAT_AGI: 
                        m_pp.AGI=number; 
                        break; 
                case STAT_DEX: 
                        m_pp.DEX=number; 
                        break; 
                case STAT_INT: 
                        m_pp.INT=number; 
                        break; 
                case STAT_WIS: 
                        m_pp.WIS=number; 
                        break; 
                case STAT_CHA: 
                        m_pp.CHA=number; 
                        break; 
        } 
}
CLIENT.H, line 387
Code:
	void    BaseStat(int8 type,sint16 number); //cofruben:-For setting stats.
PARSER.CPP, line 966.
Code:
         else if (!strcmp(strlwr(command),"permarace")) {//Cofruben:-Makes the client the race specified 
            switch(atoi(arglist[0])){ 
            case 1: 
               mob->CastToClient()->SetStat(0,80); 
               mob->CastToClient()->SetStat(1,80); 
               mob->CastToClient()->SetStat(2,80); 
               mob->CastToClient()->SetStat(3,80); 
               mob->CastToClient()->SetStat(4,80); 
               mob->CastToClient()->SetStat(5,80); 
               mob->CastToClient()->SetStat(6,80); 
               break; 
            case 2: 
               mob->CastToClient()->SetStat(0,100); 
               mob->CastToClient()->SetStat(1,100); 
               mob->CastToClient()->SetStat(2,75); 
               mob->CastToClient()->SetStat(3,75); 
               mob->CastToClient()->SetStat(4,80); 
               mob->CastToClient()->SetStat(5,60); 
               mob->CastToClient()->SetStat(6,70); 
               break; 
            case 3: 
               mob->CastToClient()->SetStat(0,65); 
               mob->CastToClient()->SetStat(1,75); 
               mob->CastToClient()->SetStat(2,70); 
               mob->CastToClient()->SetStat(3,70); 
               mob->CastToClient()->SetStat(4,90); 
               mob->CastToClient()->SetStat(5,120); 
               mob->CastToClient()->SetStat(6,70); 
               break; 
            case 4: 
               mob->CastToClient()->SetStat(0,65); 
               mob->CastToClient()->SetStat(1,65); 
               mob->CastToClient()->SetStat(2,95); 
               mob->CastToClient()->SetStat(3,95); 
               mob->CastToClient()->SetStat(4,95); 
               mob->CastToClient()->SetStat(5,65); 
               mob->CastToClient()->SetStat(6,80); 
               break; 
            case 5: 
               mob->CastToClient()->SetStat(0,50); 
               mob->CastToClient()->SetStat(1,60); 
               mob->CastToClient()->SetStat(2,85); 
               mob->CastToClient()->SetStat(3,60); 
               mob->CastToClient()->SetStat(4,120); 
               mob->CastToClient()->SetStat(5,110); 
               mob->CastToClient()->SetStat(6,100); 
               break; 
            case 6: 
               mob->CastToClient()->SetStat(0,70); 
               mob->CastToClient()->SetStat(1,70); 
               mob->CastToClient()->SetStat(2,80); 
               mob->CastToClient()->SetStat(3,80); 
               mob->CastToClient()->SetStat(4,100); 
               mob->CastToClient()->SetStat(5,100); 
               mob->CastToClient()->SetStat(6,60); 
               break; 
            case 7: 
               mob->CastToClient()->SetStat(0,75); 
               mob->CastToClient()->SetStat(1,75); 
               mob->CastToClient()->SetStat(2,90); 
               mob->CastToClient()->SetStat(3,90); 
               mob->CastToClient()->SetStat(4,80); 
               mob->CastToClient()->SetStat(5,70); 
               mob->CastToClient()->SetStat(6,80); 
               break; 
            case 8: 
               mob->CastToClient()->SetStat(0,95); 
               mob->CastToClient()->SetStat(1,95); 
               mob->CastToClient()->SetStat(2,70); 
               mob->CastToClient()->SetStat(3,90); 
               mob->CastToClient()->SetStat(4,100); 
               mob->CastToClient()->SetStat(5,60); 
               mob->CastToClient()->SetStat(6,50); 
               break; 
            case 9: 
               mob->CastToClient()->SetStat(0,105); 
               mob->CastToClient()->SetStat(1,120); 
               mob->CastToClient()->SetStat(2,75); 
               mob->CastToClient()->SetStat(3,75); 
               mob->CastToClient()->SetStat(4,80); 
               mob->CastToClient()->SetStat(5,60); 
               mob->CastToClient()->SetStat(6,45); 
               break; 
            case 10: 
               mob->CastToClient()->SetStat(0,130); 
               mob->CastToClient()->SetStat(1,130); 
               mob->CastToClient()->SetStat(2,75); 
               mob->CastToClient()->SetStat(3,75); 
               mob->CastToClient()->SetStat(4,60); 
               mob->CastToClient()->SetStat(5,50); 
               mob->CastToClient()->SetStat(6,40); 
               break; 
            case 11: 
               mob->CastToClient()->SetStat(0,70); 
               mob->CastToClient()->SetStat(1,80); 
               mob->CastToClient()->SetStat(2,90); 
               mob->CastToClient()->SetStat(3,90); 
               mob->CastToClient()->SetStat(4,90); 
               mob->CastToClient()->SetStat(5,60); 
               mob->CastToClient()->SetStat(6,80); 
               break; 
            case 12: 
               mob->CastToClient()->SetStat(0,65); 
               mob->CastToClient()->SetStat(1,75); 
               mob->CastToClient()->SetStat(2,80); 
               mob->CastToClient()->SetStat(3,70); 
               mob->CastToClient()->SetStat(4,100); 
               mob->CastToClient()->SetStat(5,100); 
               mob->CastToClient()->SetStat(6,60); 
               break; 
            case 128: 
               mob->CastToClient()->SetStat(0,70); 
               mob->CastToClient()->SetStat(1,90); 
               mob->CastToClient()->SetStat(2,100); 
               mob->CastToClient()->SetStat(3,90); 
               mob->CastToClient()->SetStat(4,90); 
               mob->CastToClient()->SetStat(5,70); 
               mob->CastToClient()->SetStat(6,50); 
               break; 
            case 130: 
               mob->CastToClient()->SetStat(0,65); 
               mob->CastToClient()->SetStat(1,65); 
               mob->CastToClient()->SetStat(2,110); 
               mob->CastToClient()->SetStat(3,110); 
               mob->CastToClient()->SetStat(4,60); 
               mob->CastToClient()->SetStat(5,70); 
               mob->CastToClient()->SetStat(6,80); 
               break; 
            case 330: 
               mob->CastToClient()->SetStat(0,75); 
               mob->CastToClient()->SetStat(1,85); 
               mob->CastToClient()->SetStat(2,100); 
               mob->CastToClient()->SetStat(3,100); 
               mob->CastToClient()->SetStat(4,80); 
               mob->CastToClient()->SetStat(5,70); 
               mob->CastToClient()->SetStat(6,50); 
               break; 
            case 69: 
               mob->CastToClient()->SetStat(0,10); 
               mob->CastToClient()->SetStat(1,10); 
               mob->CastToClient()->SetStat(2,10); 
               mob->CastToClient()->SetStat(3,10); 
               mob->CastToClient()->SetStat(4,10); 
               mob->CastToClient()->SetStat(5,10); 
               mob->CastToClient()->SetStat(6,10); 
               break; 
            case 176: 
               mob->CastToClient()->SetStat(0,255); 
               mob->CastToClient()->SetStat(1,255); 
               mob->CastToClient()->SetStat(2,255); 
               mob->CastToClient()->SetStat(3,255); 
               mob->CastToClient()->SetStat(4,255); 
               mob->CastToClient()->SetStat(5,255); 
               mob->CastToClient()->SetStat(6,255); 
               break; 
            } 

            mob->CastToClient()->SetBaseRace(atoi(arglist[0]));  
            mob->CastToClient()->Save(2); 
            mob->CastToClient()->Kick(); 
         }
And i use this, as command in PERL script.
Code:
quest::permarace(1)
I just changed command name, i use permarace instead of permaclass and changed SetBaseClass to SetBaseRace.
Its true im not a C++ guru, but i have some logic and i just dont understand why it dont work.

I would like to thanks you for all your answer in my post
Thanks / KhaN
__________________

Reply With Quote
  #4  
Old 05-19-2004, 03:14 AM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

Code:
         else if (!strcmp(strlwr(command),"BaseStat")) {//Cofruben:-Makes the client the gender specified 
            mob->CastToClient()->BaseStat(atoi(arglist[0]),atoi(arglist[1])); 
	    mob->CastToClient()->Save(2);
	    mob->CastToClient()->Kick();
         }
try this
Reply With Quote
  #5  
Old 05-19-2004, 03:35 AM
KhaN's Avatar
KhaN
Dragon
 
Join Date: Mar 2004
Location: France, Bordeaux.
Posts: 677
Default

Made changes you submited, im not kicked to char screen, maybe a problem with command being reconized. Also, the idea is to add this command to your $permarace command, this way, you will fully change the race, not only the model graph
__________________

Reply With Quote
  #6  
Old 05-19-2004, 05:26 AM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

this is the code I used in my server I hope it helps you.
Code:
			else if (!strcmp(strlwr(command),"permaclass")) {//Cofruben:-Makes the client the class specified
				switch(atoi(arglist[0])){
				case 1:
					mob->CastToClient()->SetStat(0,70);
					mob->CastToClient()->SetStat(1,75);
					mob->CastToClient()->SetStat(2,95);
					mob->CastToClient()->SetStat(3,75);
					mob->CastToClient()->SetStat(4,83);
					mob->CastToClient()->SetStat(5,99);
					mob->CastToClient()->SetStat(6,60);
					break;
				case 2:
					mob->CastToClient()->SetStat(0,60);
					mob->CastToClient()->SetStat(1,70);
					mob->CastToClient()->SetStat(2,85);
					mob->CastToClient()->SetStat(3,70);
					mob->CastToClient()->SetStat(4,105);
					mob->CastToClient()->SetStat(5,92);
					mob->CastToClient()->SetStat(6,80);
					break;
				case 3:
					mob->CastToClient()->SetStat(0,70);
					mob->CastToClient()->SetStat(1,70);
					mob->CastToClient()->SetStat(2,85);
					mob->CastToClient()->SetStat(3,75);
					mob->CastToClient()->SetStat(4,95);
					mob->CastToClient()->SetStat(5,92);
					mob->CastToClient()->SetStat(6,85);
					break;
				case 11:
					mob->CastToClient()->SetStat(0,60);
					mob->CastToClient()->SetStat(1,65);
					mob->CastToClient()->SetStat(2,90);
					mob->CastToClient()->SetStat(3,85);
					mob->CastToClient()->SetStat(4,83);
					mob->CastToClient()->SetStat(5,109);
					mob->CastToClient()->SetStat(6,60);
					break;
				case 14:
					mob->CastToClient()->SetStat(0,55);
					mob->CastToClient()->SetStat(1,65);
					mob->CastToClient()->SetStat(2,85);
					mob->CastToClient()->SetStat(3,70);
					mob->CastToClient()->SetStat(4,95);
					mob->CastToClient()->SetStat(5,102);
					mob->CastToClient()->SetStat(6,90);
					break;
				}

				mob->CastToClient()->SetBaseClass(atoi(arglist[0]));
				//mob->CastToClient()->UnscribeSpellALL(true);
				mob->CastToClient()->Save(2);
				mob->CastToClient()->Kick();
			}
Reply With Quote
  #7  
Old 05-19-2004, 05:59 AM
m0oni9
Hill Giant
 
Join Date: Dec 2003
Posts: 166
Default

Instead of a new function, maybe just modify SetStats (and those using it) to take an additional argument. Something more along the lines of:

void Client::SetStats (int8 type, sint16 val, int flags)

where flags may be of some define'd/enum'd value, ie: STAT_INCREASE, STAT_SET, ...

(As an alternative, maybe zero out all stats -- is there a function like this? -- and call SetStats as-is to increase them.)

Also, would recommend using STAT_STR, STAT_STA, etc. in place of hard-coded values in your command.
Reply With Quote
  #8  
Old 05-19-2004, 08:25 AM
KhaN's Avatar
KhaN
Dragon
 
Join Date: Mar 2004
Location: France, Bordeaux.
Posts: 677
Default

The question is, isnt settats used for something else then #setstat ?

Code:
void Client::SetStats (int8 type, sint16 val, int flags) 

where flags may be of some define'd/enum'd value, ie: STAT_INCREASE, STAT_SET, ... 

(As an alternative, maybe zero out all stats -- is there a function like this? -- and call SetStats as-is to increase them.) 

Also, would recommend using STAT_STR, STAT_STA, etc. in place of hard-coded values in your command.
I will answer this in 2 days, when i will have assimilate and understand it
__________________

Reply With Quote
  #9  
Old 05-19-2004, 11:34 AM
m0oni9
Hill Giant
 
Join Date: Dec 2003
Posts: 166
Default

Right now there are some things defined as such:
Code:
#define STAT_STR 0
#define STAT_STA 1
#define STAT_AGI 2
etc..
So instead of
Code:
mob->CastToClient()->SetStat(0,70); 
mob->CastToClient()->SetStat(1,75);
Use
Code:
mob->CastToClient()->SetStat(STAT_STR,70); 
mob->CastToClient()->SetStat(STAT_STA,75);
IMO those defines should be changed to use an enum (assuming they are just used for internal purposes). ie:
Code:
enum {
  STAT_STR,
  STAT_STA,
  etc...,
  STAT_MAX
};
I was just mentioning flags in case someone wanted to rewrite SetStat(). Normally, flags are done using bitwise operations. They tell the function to perform certain operations, return certain values, etc. Normally they are done like this:
Code:
#define FLAG1 0x01
#define FLAG2 0x02
#define FLAG3 0x04
Then, within some function..
Code:
if (flags & FLAG1)
  ... code ...
if (flags & FLAG2)
  ... code ...
if (flags & FLAG3)
  ... code ...
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 04: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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3