View Single Post
  #3  
Old 09-24-2014, 02:05 AM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

Edit: Drajor posted while I was writing the following. I didn't know that /who was done client-side. But perhaps zerjz3 wanted to change that function for some other reason? I'm reaching.

You would need to change the if statements to something more complicated. The problem is that GetEQClassName() currently depends only on class and level. You would need to add another parameter to the function.

Now the easiest way to do this is place the new parameter at the end, and assign a default value. However... GetEQClassName already has an optional parameter: level. You could require a level be passed everywhere you want the new titles, or for about the same amount of work you could just pass in a new parameter. A pointer to a Client would seem a reasonable choice.

That isn't such a tough problem. We can (under Linux) use find and grep to search for usage. Visual Studio can do the same thing under Windows. Now while there are advanced regular expressions in grep, I'm lazy and like to stick with the simple stuff. So, in your eqemu directory:

find . -exec grep GetEQClassName {} /dev/null \; 2> /dev/null | grep -v Binary

give us:

Code:
./common/classes.h:const char* GetEQClassName(uint8 class_, uint8 level = 0);
./common/classes.cpp:const char* GetEQClassName(uint8 class_, uint8 level) {
./zone/embparser.cpp:           ExportVar(package_name.c_str(), "class", GetEQClassName(mob->GetClass()));
./zone/client.cpp:      Message(0,"Your target is a level %i %s. It appears %s and %s for its level. It seems %s",who->GetLevel(),GetEQClassName(who->GetClass(),1),dmg,hitpoints,resists);
./zone/bot.cpp:         GetBotOwner()->Message(15, "A %s - %s bot was detected. Is this Race/Class combination allowed?.", GetRaceName(GetRace()), GetEQClassName(GetClass(), GetLevel()));
./world/client.cpp:     clog(WORLD__CLIENT,"Name approval request. Name=%s, race=%s, class=%s",char_name,GetRaceName(race),GetEQClassName(clas));
./world/clientlist.cpp:                                 sprintf(line, "  %s[RolePlay %i %s] %s (%s)%s zone: %s%s%s", tmpgm, cle->level(), GetEQClassName(cle->class_(),cle->level()), cle->name(), GetRaceName(cle->race()), tmpguild, tmpZone, LFG, accinfo);
./world/clientlist.cpp:                                 sprintf(line, "  %s[ANON %i %s] %s (%s)%s zone: %s%s%s", tmpgm, cle->level(), GetEQClassName(cle->class_(),cle->level()), cle->name(), GetRaceName(cle->race()), tmpguild, tmpZone, LFG, accinfo);
./world/clientlist.cpp:                         sprintf(line, "  %s[%i %s] %s (%s)%s zone: %s%s%s", tmpgm, cle->level(), GetEQClassName(cle->class_(),cle->level()), cle->name(), GetRaceName(cle->race()), tmpguild, tmpZone, LFG, accinfo);
./world/eqw.cpp:        res["class"] = GetEQClassName(cle->class_());
There are 7 calls to this function. Easily fixed. If you don't have a pointer to the Client handy, pass in a NULL and revert to the default behavior. It is late, and this is off the top of my head:

Code:
if ((level >= 70) 
{
    if ((client) && (client -> GetInv().HasItem(itemID, 0, 0xff)))
    {
            return "UberWarlord";
    }
    else
    {
            return "Warlord";
    }
}
Reply With Quote