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
  #8  
Old 09-23-2008, 02:13 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by ChaosSlayer View Post
but of course this wasnt what i was refering to - I want actual npc rogues =)
Here's how the server handles Hide when the client sends the OP_Hide packet:
zone/client_packet.cpp
Code:
void Client::Handle_OP_Hide(const EQApplicationPacket *app)
{
	if(!HasSkill(HIDE)) {
		return; //You cannot hide if you do not have hide
	}
	
	if(!p_timers.Expired(&database, pTimerHide, false)) {
		Message(13,"Ability recovery time not yet met.");
		return;
	}
	int reuse = HideReuseTime - GetAA(209);
	p_timers.Start(pTimerHide, reuse-1);
	
	float hidechance = ((GetSkill(HIDE)/250.0f) + .25) * 100;
	float random = MakeRandomFloat(0, 100);
	CheckIncreaseSkill(HIDE,15);					
	if (random < hidechance) {
		EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
		SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer;
		sa_out->spawn_id = GetID();
		sa_out->type = 0x03;
		sa_out->parameter = 1;
		entity_list.QueueClients(this, outapp, true);
		safe_delete(outapp);
		if(GetAA(aaShroudofStealth)){
			improved_hidden = true;
			hidden = true;
		}
		else
			hidden = true;
	}
	if(GetClass() == ROGUE){
		EQApplicationPacket *outapp = new EQApplicationPacket(OP_SimpleMessage,sizeof(SimpleMessage_Struct));
		SimpleMessage_Struct *msg=(SimpleMessage_Struct *)outapp->pBuffer;
		msg->color=0x010E;
		if (!auto_attack && entity_list.Fighting(this)) {
			if (MakeRandomInt(0, 300) < (int)GetSkill(HIDE)) {
				msg->string_id=343;
				entity_list.Evade(this); 
			} else {
				msg->string_id=344;
			}
		} else {
			if (hidden){
				msg->string_id=346;
			}
			else {
				msg->string_id=345;
			}
		}
		FastQueuePacket(&outapp);
	}
	return;
}
The code below the blue text is just the evasion code for rogues, which we don't really need to worry about.

Looking at the code, it looks like all that's done is, when the client hides, it sends out a SpawnAppearance packet. It uses a type of 0x03, which is visibility, and a paramater of 1 for hidden, 0 for not hidden. Elsewhere in the code, if you do something to break invis, it will send 0, otherwise it'll continue to stay 1. In the case of a Rogue NPC, you should be able to do the same thing, you just have to figure out how to trigger it in the first place, which would probably be on spawning, but also maybe with a variable, just in case you don't want rogues to hide on you. The unhide would more than likely come into the aggro or attack code (probably attack if memory serves me on how it worked in Live, but it also depends if your NPCs are Hiding & Sneaking at the same time). In addition, if you want to create NPCs, like the spiders in Crystal Caverns whose invis isn't removed on aggro, combat, moving, etc, you just wouldn't send the packet removing invis.

I know it's not the code to actually get it working, but hopefully this points someone in the right direction.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
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 05:15 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