cofruben
04-25-2004, 04:03 AM
I've done the following perl functions:permaclass(class),permarace(race),permag ender(gender),surname("surname") and scribespells().Scribespells scribes all spells to the user,up to his level,so if the user is lvl 9,he will get all spells up to 9.I am adding more functions at the moment,so look here sometimes.Be sure to use correct ID's,and strings(like surname,cannot be number).
This goes into parser.cpp,for example by line 800:
else if (!strcmp(strlwr(command),"addldonpoint")) {
if (mob && mob->IsClient())
mob->CastToClient()->UpdateLDoNPoints(atoi(arglist[0]),atoi(arglist[1]) );
}
else if (!strcmp(strlwr(command),"surname")) { //Cofruben:-Changes the last name.
if (mob && mob->IsClient())
{
mob->CastToClient()->ChangeLastName(arglist[0]);
mob->CastToClient()->Message(15,"Your surname has been changed/set to: %s",arglist[0]);
}
else
mob->CastToClient()->Message(15,"Error changing/setting surname");
}
else if (!strcmp(strlwr(command),"permaclass")) {//Cofruben:-Makes the client the class specified
mob->CastToClient()->SetBaseClass(atoi(arglist[0]));
mob->CastToClient()->Save(2);
mob->CastToClient()->Kick();
}
else if (!strcmp(strlwr(command),"permarace")) {//Cofruben:-Makes the client the race specified
mob->CastToClient()->SetBaseRace(atoi(arglist[0]));
mob->CastToClient()->Save(2);
mob->CastToClient()->Kick();
}
else if (!strcmp(strlwr(command),"permagender")) {//Cofruben:-Makes the client the gender specified
mob->CastToClient()->SetBaseGender(atoi(arglist[0]));
mob->CastToClient()->Save(2);
mob->CastToClient()->Kick();
}
else if (!strcmp(strlwr(command),"scribespells")) {//Cofruben:-Scribe spells for user up to his actual level.
int book_slot;
int16 curspell;
for(curspell = 0, book_slot = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++)
{
if
(
spells[curspell].classes[WARRIOR] != 0 &&
spells[curspell].classes[mob->CastToClient()->GetPP().class_-1] <= mob->CastToClient()->GetLevel() &&
spells[curspell].skill != 52
)
{
mob->CastToClient()->ScribeSpell(curspell, book_slot++);
}
}
}
else if (!strcmp(strlwr(command),"changedeity")) { //Cofruben:-Changes the deity.
if (mob && mob->IsClient())
{
mob->CastToClient()->SetDeity(atoi(arglist[0]));
mob->CastToClient()->Message(15,"Your Deity has been changed/set to: %i",arglist[0]);
mob->CastToClient()->Save(1);
mob->CastToClient()->Kick();
}
else
mob->CastToClient()->Message(15,"Error changing Deity");
}
this goes to embparser.cpp,before myra comment for example(line ~412):
"sub permagender{push(@cmd_queue,{func=>'permagender',args=>join(',',@_)});}"//Cofruben:-New perma functions
"sub permarace{push(@cmd_queue,{func=>'permarace',args=>join(',',@_)});}"
"sub scribespells{push(@cmd_queue,{func=>'scribespells',args=>join(',',@_)});}"
"sub permaclass{push(@cmd_queue,{func=>'permaclass',args=>join(',',@_)});}"
"sub surname{push(@cmd_queue,{func=>'surname',args=>join(',',@_)});}"
"sub addldonpoint{push(@cmd_queue,{func=>'addldonpoint',args=>join(',',@_)});}"
"sub changedeity{push(@cmd_queue,{func=>'changedeity',args=>join(',',@_)});}"
add this in client.h,for deity change:
inline void SetDeity(uint32 i) {m_pp.deity=i;}
Hope it helps.
This goes into parser.cpp,for example by line 800:
else if (!strcmp(strlwr(command),"addldonpoint")) {
if (mob && mob->IsClient())
mob->CastToClient()->UpdateLDoNPoints(atoi(arglist[0]),atoi(arglist[1]) );
}
else if (!strcmp(strlwr(command),"surname")) { //Cofruben:-Changes the last name.
if (mob && mob->IsClient())
{
mob->CastToClient()->ChangeLastName(arglist[0]);
mob->CastToClient()->Message(15,"Your surname has been changed/set to: %s",arglist[0]);
}
else
mob->CastToClient()->Message(15,"Error changing/setting surname");
}
else if (!strcmp(strlwr(command),"permaclass")) {//Cofruben:-Makes the client the class specified
mob->CastToClient()->SetBaseClass(atoi(arglist[0]));
mob->CastToClient()->Save(2);
mob->CastToClient()->Kick();
}
else if (!strcmp(strlwr(command),"permarace")) {//Cofruben:-Makes the client the race specified
mob->CastToClient()->SetBaseRace(atoi(arglist[0]));
mob->CastToClient()->Save(2);
mob->CastToClient()->Kick();
}
else if (!strcmp(strlwr(command),"permagender")) {//Cofruben:-Makes the client the gender specified
mob->CastToClient()->SetBaseGender(atoi(arglist[0]));
mob->CastToClient()->Save(2);
mob->CastToClient()->Kick();
}
else if (!strcmp(strlwr(command),"scribespells")) {//Cofruben:-Scribe spells for user up to his actual level.
int book_slot;
int16 curspell;
for(curspell = 0, book_slot = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++)
{
if
(
spells[curspell].classes[WARRIOR] != 0 &&
spells[curspell].classes[mob->CastToClient()->GetPP().class_-1] <= mob->CastToClient()->GetLevel() &&
spells[curspell].skill != 52
)
{
mob->CastToClient()->ScribeSpell(curspell, book_slot++);
}
}
}
else if (!strcmp(strlwr(command),"changedeity")) { //Cofruben:-Changes the deity.
if (mob && mob->IsClient())
{
mob->CastToClient()->SetDeity(atoi(arglist[0]));
mob->CastToClient()->Message(15,"Your Deity has been changed/set to: %i",arglist[0]);
mob->CastToClient()->Save(1);
mob->CastToClient()->Kick();
}
else
mob->CastToClient()->Message(15,"Error changing Deity");
}
this goes to embparser.cpp,before myra comment for example(line ~412):
"sub permagender{push(@cmd_queue,{func=>'permagender',args=>join(',',@_)});}"//Cofruben:-New perma functions
"sub permarace{push(@cmd_queue,{func=>'permarace',args=>join(',',@_)});}"
"sub scribespells{push(@cmd_queue,{func=>'scribespells',args=>join(',',@_)});}"
"sub permaclass{push(@cmd_queue,{func=>'permaclass',args=>join(',',@_)});}"
"sub surname{push(@cmd_queue,{func=>'surname',args=>join(',',@_)});}"
"sub addldonpoint{push(@cmd_queue,{func=>'addldonpoint',args=>join(',',@_)});}"
"sub changedeity{push(@cmd_queue,{func=>'changedeity',args=>join(',',@_)});}"
add this in client.h,for deity change:
inline void SetDeity(uint32 i) {m_pp.deity=i;}
Hope it helps.