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

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-10-2006, 10:07 AM
aza77
Hill Giant
 
Join Date: Dec 2004
Posts: 126
Default setstat + incstat

i missed a tool to set the stats of a character to a specific value. i needed it for a quest and as a result i got a command for guides/gms too. the old setstats is now incstats and still works like it did before. with these changes you can use quest::setstat(type,value) for example quest::setstat(0,80) would set the strength to 80. quest::incstat(type,value) for example quest::incstat(0, would raise the strength by 16. #setstat and #incstat work the same. oh and don't forget to add the incstat to addon.ini. the version 728 at the diff file is the updated 767.

diff -u -r EQEmu-0.6.6-767/zone/client.cpp EQEmu-0.6.6-728/zone/client.cpp
--- EQEmu-0.6.6-767/zone/client.cpp 2006-04-10 18:46:14.000000000 +0200
+++ EQEmu-0.6.6-728/zone/client.cpp 2006-04-10 22:52:52.000000000 +0200
@@ -1063,7 +1063,7 @@
UpdateWho();
}

-void Client::SetStats(int8 type,sint16 increase_val){ //changed the command to set the given skillpoints aza
+void Client::SetStats(int8 type,sint16 set_val){ //changed the command to set the given skillpoints
if(type>STAT_DISEASE){
printf("Error in Client::SetStats, received invalid type of: %i\n",type);
return;
@@ -1072,74 +1072,74 @@
IncreaseStat_Struct* iss=(IncreaseStat_Struct*)outapp->pBuffer;
switch(type){
case STAT_STR:
- if(increase_val>0)
- iss->str=increase_val;
- if((increase_val)<0)
+ if(set_val>0)
+ iss->str=set_val;
+ if(set_val<0)
m_pp.STR=0;
- else if((increase_val)>255)
+ else if(set_val>255)
m_pp.STR=255;
else
- m_pp.STR=increase_val;
+ m_pp.STR=set_val;
break;
case STAT_STA:
- if(increase_val>0)
- iss->sta=increase_val;
- if((increase_val)<0)
+ if(set_val>0)
+ iss->sta=set_val;
+ if(set_val<0)
m_pp.STA=0;
- else if((increase_val)>255)
+ else if(set_val>255)
m_pp.STA=255;
else
- m_pp.STA=increase_val;
+ m_pp.STA=set_val;
break;
case STAT_AGI:
- if(increase_val>0)
- iss->agi=increase_val;
- if((increase_val)<0)
+ if(set_val>0)
+ iss->agi=set_val;
+ if(set_val<0)
m_pp.AGI=0;
- else if((increase_val)>255)
+ else if(set_val>255)
m_pp.AGI=255;
else
- m_pp.AGI=increase_val;
+ m_pp.AGI=set_val;
break;
case STAT_DEX:
- if(increase_val>0)
- iss->dex=increase_val;
- if((increase_val)<0)
+ if(set_val>0)
+ iss->dex=set_val;
+ if(set_val<0)
m_pp.DEX=0;
- else if((increase_val)>255)
+ else if(set_val>255)
m_pp.DEX=255;
else
- m_pp.DEX=increase_val;
+ m_pp.DEX=set_val;
break;
case STAT_INT:
- if(increase_val>0)
- iss->int_=increase_val;
- if((increase_val)<0)
+ if(set_val>0)
+ iss->int_=set_val;
+ if(set_val<0)
m_pp.INT=0;
- else if((increase_val)>255)
+ else if(set_val>255)
m_pp.INT=255;
else
- m_pp.INT=increase_val;
+ m_pp.INT=set_val;
break;
case STAT_WIS:
- if(increase_val>0)
- iss->wis=increase_val;
- if((increase_val)<0)
+ if(set_val>0)
+ iss->wis=set_val;
+ if(set_val<0)
m_pp.WIS=0;
- else if((increase_val)>255)
+ else if(set_val>255)
m_pp.WIS=255;
else
- m_pp.WIS=increase_val;
+ m_pp.WIS=set_val;
break;
case STAT_CHA:
- if(increase_val>0)
- iss->cha=increase_val;
- if((increase_val)<0)
+ if(set_val>0)
+ iss->cha=set_val;
+ if(set_val<0)
m_pp.CHA=0;
- else if((increase_val)>255)
+ else if(set_val>255)
m_pp.CHA=255;
else
- m_pp.CHA=increase_val;
+ m_pp.CHA=set_val;
break;
}
QueuePacket(outapp);
@@ -1148,7 +1148,7 @@

void Client::IncStats(int8 type,sint16 increase_val){
if(type>STAT_DISEASE){
- printf("Error in Client::SetStats, received invalid type of: %i\n",type);
+ printf("Error in Client::IncStats, received invalid type of: %i\n",type);
return;
}
EQZonePacket* outapp = new EQZonePacket(OP_IncreaseStats,sizeof(IncreaseStat_ Struct));


diff -u -r EQEmu-0.6.6-767/zone/client.h EQEmu-0.6.6-728/zone/client.h
--- EQEmu-0.6.6-767/zone/client.h 2006-04-10 18:46:13.000000000 +0200
+++ EQEmu-0.6.6-728/zone/client.h 2006-04-10 22:55:25.000000000 +0200
@@ -597,7 +597,7 @@
void PutLootInInventory(sint16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0);
bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0);
void SummonItem(uint32 item_id, sint8 charges = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
- void SetStats(int8 type,sint16 increase_val);
+ void SetStats(int8 type,sint16 set_val);
void IncStats(int8 type,sint16 increase_val);
void DropItem(sint16 slot_id);
void SendItemLink(const ItemInst* inst, bool sendtoall=false);

diff -u -r EQEmu-0.6.6-767/zone/perl_client.cpp EQEmu-0.6.6-728/zone/perl_client.cpp
--- EQEmu-0.6.6-767/zone/perl_client.cpp 2006-04-10 18:47:29.000000000 +0200
+++ EQEmu-0.6.6-728/zone/perl_client.cpp 2006-04-10 22:54:28.000000000 +0200
@@ -2561,7 +2561,7 @@
{
dXSARGS;
if (items != 3)
- Perl_croak(aTHX_ "Usage: Client::SetStats(THIS, type, increase_val)");
+ Perl_croak(aTHX_ "Usage: Client::SetStats(THIS, type, set_val)");
{
Client * THIS;
int8 type = (intSvUV(ST(1));
@@ -2582,7 +2582,7 @@
}

XS(XS_Client_IncStats); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Client_IncStats)
+XS(XS_Client_IncStats) //old setstat command aza
{
dXSARGS;
if (items != 3)
@@ -2601,7 +2601,7 @@
if(THIS == NULL)
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");

- THIS->SetStats(type, increase_val);
+ THIS->IncStats(type, increase_val);
}
XSRETURN_EMPTY;
}
@@ -3417,6 +3417,7 @@
newXSproto(strcpy(buf, "DeleteItemInInventory"), XS_Client_DeleteItemInInventory, file, "$$;$$");
newXSproto(strcpy(buf, "SummonItem"), XS_Client_SummonItem, file, "$$;$");
newXSproto(strcpy(buf, "SetStats"), XS_Client_SetStats, file, "$$$");
+ newXSproto(strcpy(buf, "IncStats"), XS_Client_IncStats, file, "$$$");
newXSproto(strcpy(buf, "DropItem"), XS_Client_DropItem, file, "$$");
newXSproto(strcpy(buf, "BreakInvis"), XS_Client_BreakInvis, file, "$");
newXSproto(strcpy(buf, "GetGroup"), XS_Client_GetGroup, file, "$");
Reply With Quote
 


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 01:30 PM.


 

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