Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-29-2002, 06:09 PM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default Getting rid of the 0 in npc names

I made a separate function that gets rid of the 0 is an npcs name when it is needed. I made added this because I didnt really like the way it was displaying the npc's name. Useful for quests and such that you dont want the name to be Priest of Discord0 says. blah blah blah.... anyways here it is:
Add the following to entity.h:
Code:
void	NPCMessage(Mob* sender, bool skipsender, float dist, int32 type, const char* message, ...);
Add this to entity.cpp:
Code:
void EntityList::NPCMessage(Mob* sender, bool skipsender, float dist, int32 type, const char* message, ...) {
	va_list argptr;
	char buffer[4096];
	char *findzero;
    int  stripzero;
	va_start(argptr, message);
	vsnprintf(buffer, 4095, message, argptr);
	va_end(argptr);
    findzero = strstr( buffer, "0" );
    stripzero = (int)(findzero - buffer + 2);
	if (stripzero > 2) //Incase its not an npc, you dont want to crash the zone
		strncpy(buffer + stripzero," ",1);
	float dist2 = dist * dist; //pow(dist, 2);
	
	LinkedListIterator<Entity*> iterator(list);
	
	cout << "Message:" << buffer << endl;
	if (dist2==0) { //If 0 then send to the whole zone
		iterator.Reset();
		while(iterator.MoreElements())
		{
			if (iterator.GetData()->IsClient())
			{
				Client* client = iterator.GetData()->CastToClient();
					client->Message(type, buffer);
			}
			iterator.Advance();
		}
	}
	else {
		iterator.Reset();
		while(iterator.MoreElements())
		{
			if (iterator.GetData()->IsClient() && iterator.GetData()->CastToClient()->DistNoRoot(sender) <= dist2 && (!skipsender || iterator.GetData() != sender)) {
				iterator.GetData()->CastToClient()->Message(type, buffer);
			}
			iterator.Advance();
		}
	}
}
after you do that just call this function instead of MessageClose or Message. IE in Wesquest.cpp change:

Code:
else if (strstr(command,"SAY") != NULL) {
			entity_list.MessageClose(this, false, 400, 0, "%s says, '%s'", other->GetName(), nmessage);
			ps = true;
		}
to:

Code:
else if (strstr(command,"SAY") != NULL) {
			entity_list.NPCMessage(this, false, 400, 0, "%s says, '%s'", other->GetName(), nmessage);
			ps = true;
		}
This will cause strip the 0 from the end of the npcs name.

Another example, change:
Code:
	else if (strstr(command,"SHOUT") != NULL) {
			entity_list.Message(0, 0, "%s shouts, '%s'", other->GetName(), nmessage);
			ps = true;
		}
to:
Code:
else if (strstr(command,"SHOUT") != NULL) {
			entity_list.NPCMessage(this,false,0,13, "%s shouts, '%s'", other->GetName(), nmessage);
			ps = true;
		}
The 0 in this is what makes this displayed to the whole zone. (Substitute a 0 in for the distance variable to send to the zone). Hope this helps someone. :P -LethalEncounter
Reply With Quote
  #2  
Old 12-29-2002, 10:16 PM
steve
Discordant
 
Join Date: Jan 2002
Posts: 305
Default

Does this revert it back to using just two digits for NPCs? Or just hide the third digit?

EQEmu is going non-standard, using 3 digits. It was stated in a previous thread that EQLive uses 3 now. However, it does not. It only uses 2 digits, even in Planes of Power.
Reply With Quote
  #3  
Old 12-30-2002, 01:27 AM
Zafar
Sarnak
 
Join Date: Oct 2002
Posts: 50
Default I just came from EQLive in South Karana a couple hours ago.

I was in South Karana with my mage for the heck of it, putting the beat down on the gnolls and I've seen the gnolls go after my pet and seeing:

A Tesch Mas Gnoll00 says, 'I'll teach you to mess with, yada yada, Gerber00.'

I don't know why ever EQEmu uses or has 3 digits. What is the purpose other than having a bunch of mobs running around in a zone? I never in my life with EQEmuing, seen a server with more than maybe 70-95 of the same mob. Then again, I may have over lookd something somewhere.

Quote:
Originally Posted by steve
Does this revert it back to using just two digits for NPCs? Or just hide the third digit?

EQEmu is going non-standard, using 3 digits. It was stated in a previous thread that EQLive uses 3 now. However, it does not. It only uses 2 digits, even in Planes of Power.
Reply With Quote
  #4  
Old 12-30-2002, 06:04 AM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default

The above just hides the 0 so that it isnt displayed when an npc says something. Its still there but this just hides it from being displayed.
Reply With Quote
  #5  
Old 12-30-2002, 08:21 AM
steve
Discordant
 
Join Date: Jan 2002
Posts: 305
Default

Ok, thanks! Now what we need is a patch to get rid of the redundant 0.

Zafar, yep, I'm a mage too. I can verify with 200% certainty that EQLive only uses two digits. I'm sure we could have some ex-GM/Guides back this up as well.

Just as you said, there would NOT be over 99 NPCs of the exact same named NPC in a zone. Maybe 99 white bunnies and 99 brown bunnies. But not 200 black bunnies. And it makes sense too, no one wants to see that many hundreds of the exact same mob.
Reply With Quote
  #6  
Old 12-30-2002, 10:43 AM
Baron Sprite's Avatar
Baron Sprite
Dragon
 
Join Date: Jan 2002
Posts: 708
Default

EQEMu supports 000.
__________________
Waking up in the morgue is pretty harsh, but it beats being dead.
Begun, this irc stat war has.
Reply With Quote
  #7  
Old 01-02-2003, 04:30 AM
DeletedUser
Fire Beetle
 
Join Date: Sep 2002
Posts: 0
Default

Plz cry some more
Reply With Quote
  #8  
Old 01-02-2003, 06:08 AM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default

Wahhhh :*(
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:30 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3