Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-03-2008, 08:56 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default Quest Commands for Temp Race, Texture, Size and Gender Changes

As you can see in the post, this was actually submitted by Striat in this thread:

http://www.eqemulator.net/forums/sho...573#post147573

I take no credit for this code, but I figured that if he posted it openly on the forums that he would have no problems if it was to be added to the source. I think these quest commands could be very useful and could be used to make some creative and fun new quests and events.

As far as I know, there is no way to do any of this with the currently available commands. If so, then, there is obviously no need for this to be added, but if not, then I think this would be a great addition to quest commands.

The names of the commands and the actual way it works are probably all ok to be adjusted however needed.


It might not be a bad idea to reduce this all down into just 1 command with a few options as stated by Striat in the quote below. It could be something like this:
Code:
quest::setillusion(<$mobid or $userid>,<illusion type option>,<Illusion ID#>);
So, and example of using that format would be:

Code:
quest::setillusion($userid,race,123);
And that line would set the player to the race of Innoruuk until they zone.

A second example using this possible format would be:

Code:
quest::setillusion($mobid,texture,3);
And that would set the quest giving NPC to texture 3 so that they would be wearing plate armor, or whatever texture that race of NPC has for 3.

Quote:
Originally Posted by Striat View Post
Also, can use SendWearChange I believe. I did add these commands to my server. I broke them down to 8 commands to keep things easier. Could also easily do it as one command. But, here is what we have:

Add to perlparser.cpp
Code:
XS(XS__npcrace);
XS(XS__npcrace)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: npcrace(race_id)");

	int	race_id = (int)SvIV(ST(0));

	quest_manager.npcrace(race_id);

	XSRETURN_EMPTY;
}

XS(XS__npcgender);
XS(XS__npcgender)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: npcgender(gender_id)");

	int	gender_id= (int)SvIV(ST(0));

	quest_manager.npcgender(gender_id);

	XSRETURN_EMPTY;
}

XS(XS__npcsize);
XS(XS__npcsize)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: npcsize(newsize)");

	int	newsize = (int)SvIV(ST(0));

	quest_manager.npcsize(newsize);

	XSRETURN_EMPTY;
}

XS(XS__npctexture);
XS(XS__npctexture)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: npctexture(newtexture)");

	int	newtexture = (int)SvIV(ST(0));

	quest_manager.npctexture(newtexture);

	XSRETURN_EMPTY;
}

XS(XS__playerrace);
XS(XS__playerrace)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: playerrace(race_id)");

	int	race_id = (int)SvIV(ST(0));

	quest_manager.playerrace(race_id);

	XSRETURN_EMPTY;
}

XS(XS__playergender);
XS(XS__playergender)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: playergender(gender_id)");

	int	gender_id= (int)SvIV(ST(0));

	quest_manager.playergender(gender_id);

	XSRETURN_EMPTY;
}

XS(XS__playersize);
XS(XS__playersize)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: playersize(newsize)");

	int	newsize = (int)SvIV(ST(0));

	quest_manager.playersize(newsize);

	XSRETURN_EMPTY;
}

XS(XS__playertexture);
XS(XS__playertexture)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: playertexture(newtexture)");

	int	newtexture = (int)SvIV(ST(0));

	quest_manager.playertexture(newtexture);

	XSRETURN_EMPTY;
}
And also add to perlparser.cpp
Code:
		newXS(strcpy(buf, "npcrace"), XS__npcrace, file);
		newXS(strcpy(buf, "npcgender"), XS__npcgender, file);
		newXS(strcpy(buf, "npcsize"), XS__npcsize, file);
		newXS(strcpy(buf, "npctexture"), XS__npctexture, file);
		newXS(strcpy(buf, "playerrace"), XS__playerrace, file);
		newXS(strcpy(buf, "playergender"), XS__playergender, file);
		newXS(strcpy(buf, "playersize"), XS__playersize, file);
		newXS(strcpy(buf, "playertexture"), XS__playertexture, file);
Now, add to questmgr.cpp
Code:
void QuestManager::npcrace(int race_id)
{
		owner->SendIllusionPacket(race_id);
}

void QuestManager::npcgender(int gender_id)
{
		owner->SendIllusionPacket(owner->GetRace(), gender_id);
}
void QuestManager::npcsize(int newsize)
{
				owner->ChangeSize(newsize, true);
}
void QuestManager::npctexture(int newtexture)
{
			owner->SendIllusionPacket(owner->GetRace(), 0xFF, newtexture);
}

void QuestManager::playerrace(int race_id)
{
			initiator->SendIllusionPacket(race_id);
}

void QuestManager::playergender(int gender_id)
{
			initiator->SendIllusionPacket(initiator->GetRace(), gender_id);
}
void QuestManager::playersize(int newsize)
{
			initiator->ChangeSize(newsize, true);
}
void QuestManager::playertexture(int newtexture)
{
			initiator->SendIllusionPacket(initiator->GetRace(), 0xFF, newtexture);
}
And finally add to questmgr.h
Code:
	void npcrace(int race_id);
	void npcgender(int gender_id);
	void npcsize(int newsize);
	void npctexture(int newtexture);
	void playerrace(int race_id);
	void playergender(int gender_id);
	void playersize(int newsize);
	void playertexture(int newtexture);
Now, usage from our Edone.pl npc:
Code:
sub EVENT_SAY {   
if($text=~/hail/i) {
	quest::say("As you wish!");
}
if($text=~/race/i) {
	quest::say("As you wish!");
	quest::npcrace(217);
	quest::playerrace(217);
}
if($text=~/gender/i) {
	quest::say("As you wish!");
	quest::npcgender(1);
	quest::playergender(1);
}
if($text=~/size/i) {
	quest::say("As you wish!");
	quest::npcsize(20);
	quest::playersize(20);
}
if($text=~/texture/i) {
	quest::say("As you wish!");
	quest::npctexture(22);
	quest::playertexture(15);
}
}
If you do not know how to compile these changes, see http://www.eqemulator.net/wiki/wikka...a=DevVSExpress.
Also, if you have any questions, feel free to PM me or look for me on irc as Striat.

I will probably try to adjust this where I think it is needed and try it out on my server. I am sure I can get the commands renamed, but I am not so sure that I can figure out how to make them all do it in 1 single command like I posted above. It isn't quite necessary to have them all in 1 command, but I think it might make it cleaner and simpler to use.

And, Striat, if you have any problems with me posting this, or this going into the code, let me know. I am sure you would be credited for it 100% if so. I certainly don't deserve or want credit for it. I just thought it looked really cool and is a shame to let it go to waste!
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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 02:07 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