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

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2007, 05:26 PM
JrFaust
Sarnak
 
Join Date: Aug 2005
Location: Overthere
Posts: 82
Default Quest::Summon();

This is just an idea and a cut and paste job from the source code with minor edits. I think this would work to implement Perl quest summoning. But I've yet to master compiling so if any one has time and a strong heart and willing. Would you be so kind as to try this out?

I know that there are a few of us that would like to be able to summon via quests, and if we could get this in as custom or even offical code that would be great.
If by looking at the code you know it won't/can't work just let me know.


For questmgr.h
Code:
  void Summon(int entity_id);
For questmgr.ccp
Code:
void QuestManager::Summon(int target_id) {
	Mob *t;

	if(sep->arg[1][0] != 0)		// arg specified
	{
		Client* client = entity_list.GetClientByName(sep->arg[1]);
		if (client != 0)	// found player in zone
			t=client->CastToMob();
		else 
		{
			if (!worldserver.Connected())
				c->Message(0, "Error: World server disconnected.");
			else
			{ // player is in another zone
				// @merth: Taking this command out until we test the factor of 8 in ServerOP_ZonePlayer
				c->Message(0, "Summoning player from another zone not yet implemented.");
				return;

				ServerPacket* pack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct));
				ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer;
				strcpy(szp->adminname, c->GetName());
				szp->adminrank = c->Admin();
				szp->ignorerestrictions = 2;
				strcpy(szp->name, sep->arg[1]);
				strcpy(szp->zone, zone->GetShortName());
				szp->x_pos = c->GetX(); // @merth: May need to add a factor of 8 in here..
				szp->y_pos = c->GetY();
				szp->z_pos = c->GetZ();
				worldserver.SendPacket(pack);
				safe_delete(pack);
			}
			return;
		}
	}
	else if(c->GetTarget())		// have target
		t=c->GetTarget();
	else
	{
		if(c->Admin() < 150)
			c->Message(0, "You need a NPC/corpse target for this command");
		else
			c->Message(0, "Usage: #summon [charname] Either target or charname is required");
		return;
	}

	if (t->IsNPC())
	{ // npc target
		c->Message(0, "Summoning NPC %s to %1.1f, %1.1f, %1.1f", t->GetName(), c->GetX(), c->GetY(), c->GetZ());
		t->CastToNPC()->GMMove(c->GetX(), c->GetY(), c->GetZ(), c->GetHeading());
		t->CastToNPC()->SaveGuardSpot(true);
	}
	else if (t->IsCorpse())
	{ // corpse target
		c->Message(0, "Summoning corpse %s to %1.1f, %1.1f, %1.1f", t->GetName(), c->GetX(), c->GetY(), c->GetZ());
		t->CastToCorpse()->GMMove(c->GetX(), c->GetY(), c->GetZ(), c->GetHeading());
	}
	else if (t->IsClient())
	{
		if(c->Admin() < 150)
		{
			c->Message(0, "You may not summon a player.");
			return;
		}
		c->Message(0, "Summoning player %s to %1.1f, %1.1f, %1.1f", t->GetName(), c->GetX(), c->GetY(), c->GetZ());
		t->CastToClient()->MovePC(zone->GetZoneID(), c->GetX(), c->GetY(), c->GetZ(), 2, true);
	}
}
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 02:41 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