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
  #25  
Old 03-01-2008, 09:39 PM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default World Hooks

Here is my code for the hero_world.dll library (hero_world_Hooks.cpp) :
#include "../common/debug.h"
#include "../common/default_Hooks.h"
#include "../common/classes.h"
#include "../common/races.h"


#ifdef WIN32
#define exportfunc extern "C" __declspec(dllexport)
#else
#define exportfunc extern "C"
#endif


/** Makes all newly-created characters Rangers - It is the class chosen for heroes as it can cast spells
* and have dual-wield. After all, aren't all rangers heroes ?
*/
exportfunc void hero_world_CharacterCreation_ChangeCreationInfo(Ch arCreate_Struct *cc)
{ cc->class_ = RANGER;

/* Adjust the stats to provide a similar amount of points per race.
* Good or neutral races get 535 points total, evil races 555.
*/
switch(cc->race)
{ case BARBARIAN: break;
case DARK_ELF: cc->CHA += 23; break;
case DWARF: cc->CHA += 7; break;
case ERUDITE: cc->CHA += 5; break;
case FROGLOK: cc->CHA -= 15; break;
case GNOME: cc->CHA += 10; break;
case HALF_ELF: cc->CHA += 10; break;
case HALFLING: cc->CHA += 3; break;
case HIGH_ELF: cc->AGI -= 7; break;
case HUMAN: cc->CHA += 10; break;
case IKSAR: break;
case OGRE: cc->CHA += 1; break;
case TROLL: cc->DEX += 10; cc->STA += 18; break;
case VAHSHIR: cc->DEX += 10; break;
case WOOD_ELF: break;
default: printf("unknown race %d\n", cc->race);
}
}
CheckHookSignature(CharacterCreation, ChangeCreationInfo, hero_world_CharacterCreation_ChangeCreationInfo);

Enlarge one column in the database to allow specifying looong values :
ALTER TABLE rule_values MODIFY rule_value VARCHAR(256);

The hook is activated with the following SQL query in the database :
INSERT INTO rule_values VALUES ('1','(world) CharacterCreation:ChangeCreationInfo','hero_world: hero_world_CharacterCreation_ChangeCreationInfo');

The entry name is of the form "(world) <hook>" for world hooks. The value is the name of the shared library (no extension, for Unix compatibility) then the name of the function implementing the hook.
Reply With Quote
 

Thread Tools
Display Modes

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 03:02 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