EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   WesQuests.cpp Utils, Changes, Etc (https://www.eqemulator.org/forums/showthread.php?t=3542)

Xarslik 10-22-2002 01:20 AM

WesQuests.cpp Utils, Changes, Etc
 
Going to edit this post as I add more changes etc.

I was bored, and I noticed when using the quest functions SAY, SHOUT, EMOTE etc... NPCs name's have 0 appended to them.
This is due to the fact that EQLive only uses 2 digits for their NPC numbering (eg. a_shadow_wolf01), while EQEmu uses 3 (a_shadow_wolf001). Therefore when processed, I'm assuming the EQClient automatically removes 2 digits from the end of the name. However, because of EQEmu's 3, you're left with "a shadow wolf0 says, "Hi there, Soandso!". Anyway, I added the following code snippets to WesQuests.cpp and client.h that effectively remove any 0's through 9's and replace them with a null character.

client.h
I added this after the "char * strreplace" line, in the public section of class Client.
Code:

char * stripNumFromStr( const char* strToStrip );
WesQuests.cpp
I added this after the method "Client::strreplace".
(Originally it was editing the NPC's actual Name, which is very very bad. Changed it to store it in a static char once I found out the max length for a name)
Code:

char* Client::stripNumFromStr ( const char* strToStrip )
{
        static char tempStr[30];
        strcpy(tempStr, strToStrip);
        int a;
        for(a=0;a<strlen(strToStrip);a++)
        {
                if(tempStr[a] >= 48 && tempStr[a] <= 57)
                        tempStr[a] = '\0';
        }

        return tempStr;
}

WesQuests.cpp
Now simply wrap the "this->target->GetName()" call inside a call to stripNumFromStr.

Here is SAY (modified):
Code:

entity_list.Message(0, MT_Say, "%s says, %s", [b]stripNumFromStr( this->target->GetName() )[/b], nmessage);
Here is EMOTE (modified):
Code:

entity_list.Message(0, MT_Emote, "%s %s", stripNumFromStr( this->target->GetName() ), nmessage);
Here is SHOUT (modified):
Code:

entity_list.Message(0, MT_Shout, "%s shouts, %s", stripNumFromStr( this->target->GetName() ), nmessage);
(NOTE: I noticed that including the apostrophe's surrounding what the mob is saying\shouting, causes some kind of problem with the EntityList::Message function. The message will appear with a line break before the last apostrophe. To remedy this, I removed them and in my qst file added them manually. So instead of SAY:Hail, %CHARNAME%. I'd have SAY:'Hail, %CHARNAME%.')

irageon 11-28-2002 03:49 AM

can you post here your version of wesquest.cpp ?

quester 11-28-2002 05:09 AM

The better solution here is to simply pull off the trailing character if indeed the emu uses 3 instead of 2 id digits.

The problem with your code is that if the npc's name has any digits in it, anywhere in the name, they get striped.

"Clockwork Model 8", "D7 Scavenger", "Obsolete Model 4", would be butchered.

steve 11-28-2002 04:46 PM

The real question is, why are we bothering to use three digits? Change it to only allow 2.

The devs are constantly complaining that we don't have as much CPU power as the real EQ servers use, so by no means will we be having 100+ of an NPC with the exact same name in a zone.

devn00b 11-29-2002 10:12 AM

steve you are wrong. what if somone wants to have a special event where say orcs invade Gfay. there could easly be 100+ orc cents.
Quote:

The devs are constantly complaining that we don't have as much CPU power as the real EQ servers use
this is in regards to pathing. pathing would take 10x the ram. so say insted of a pc running 10 zones yer down to 1. as we all know that would just plain suck.

steve 11-29-2002 11:57 AM

Quote:

Originally Posted by /dev/n00b
steve you are wrong. what if somone wants to have a special event where say orcs invade Gfay. there could easly be 100+ orc cents.

Tell them they're stupid? Use 99 cents and 99 legionnaires. 100+ of the same exact NPC is not only lame, but makes no sense.

Quote:

[b]this is in regards to pathing. pathing would take 10x the ram. so say insted of a pc running 10 zones yer down to 1. as we all know that would just plain suck.
So make the pathing an optional ./configure script parameter. That is, after it's woking. There are those of us with better computers than a 400mhz, 128mb ram.

I'm not sure what you expect from the EMU, but most people are looking forward towards pathing, and having the NPCs more lifelike. The farther along we get by adding more features, the less and less people that will be able to run their own server. I don't think this is a bad thing. You can always play on an emulated server instead of running your own.

Besides, if you don't have the CPU/RAM to be running a zone with pathing, the server will never amount to anything more than an interactive item creator/zone explorer. The best solution is to make the higher intensive CPU functions defineable in the makefile, so that if you can't support it, it doesn't try to use it.

DeletedUser 12-10-2002 08:59 AM

There are enough NPCs in certain zones to exceed 99 of a unique mob. Esp. Luclin

steve 12-10-2002 12:29 PM

EQLive uses only two digits for mob names, even in PoP. Luclin zones would be fine. If it goes over 99, then that's the DB fault for having 20+ duplicates of the same NPC ;p

/shrug

DeletedUser 12-10-2002 12:53 PM

Last I checked, they use three.

Wiz 12-10-2002 11:53 PM

Three digits, nowadays.

Used to be two.


All times are GMT -4. The time now is 02:17 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.