• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Feature Level ranks

can I add LUA for tfs 0.2?
how can I add the setplayerdescription for 0.2 by source edit?
 
Not working - The c++ code.
I don't get any errors. I game it is the same as normal:
You see yourself. You are a paladin. You are a memeber of blalbla guild.. No more.
 
Not working - The c++ code.
I don't get any errors. I game it is the same as normal:
You see yourself. You are a paladin. You are a memeber of blalbla guild.. No more.

In player.cpp
above:
PHP:
std::string Player::getDescription(int32_t lookDistance) const

add:
PHP:
std::string Player::getPVPRank(uint32_t level) const
{
        std::string ranga = "Newbie";
        if(level >= 20 && level <= 25)
        {
            ranga = "Player";
        }
        else if(level > 25 && level <= 30)
        {
            ranga = "Regular";
        }
        else if(level > 30 && level <= 50)
        {
            ranga = "Hunter";
        }
        else if(level > 50 && level <= 100)
        {
            ranga = "Demon";
        }
        else if(level > 100)
        {
            ranga = "Master";
        }
        return ranga;

search for:
PHP:
std::string Player::getDescription(int32_t lookDistance) const
change whole lookDistance function for this:

PHP:
std::string Player::getDescription(int32_t lookDistance) const
{
	std::stringstream s;
	std::string str;

	if(lookDistance == -1)
	{
		s << "yourself.";
		if(accessLevel != 0)
			s << " You are " << groupName << ".";
		else if(vocation_id != VOCATION_NONE)
			s << " You are " << vocation->getVocDescription() << ".";
		else
			s << " You have no vocation.";


            s << " Rank: ";
            std::string rank = Player::getPVPRank(level);
            s << rank << ".";
	}
	else
	{
		s << name;
		if(accessLevel == 0)
			s << " (Level " << level << ")";
		s << ".";

        if(sex == PLAYERSEX_FEMALE)
            {
                s << " She";
            }
            else
            {
                s << " He";
            }

		if(accessLevel != 0)
			s << " is " << groupName << ".";
		else if(vocation_id != VOCATION_NONE)
			s << " is " << vocation->getVocDescription() << ".";
		else
			s << " has no vocation.";


            s << " Rank: ";
            std::string rank = Player::getPVPRank(level); //rangi
            s << rank << ".";
     }

	if(guildId)
	{
		if(lookDistance == -1)
			s << " You are ";
		else
		{
			if(sex == PLAYERSEX_FEMALE)
				s << " She is ";
			else
				s << " He is ";
		}
		if(guildRank.length())
			s << guildRank;
		else
			s << "a member";
		s << " of the " << guildName;
		if(guildNick.length())
			s << " (" << guildNick << ")";
		s << ".";
	}
	str = s.str();
	return str;
}

in player.h after:
PHP:
virtual std::string getDescription(int32_t lookDistance) const;
add
PHP:
virtual std::string getPVPRank(uint32_t level) const; //rangi

Works when you look at yourself and when you look at other players. Tested on TFS 0.2.11pl2.
All credits goes to creator of this thread.
 
Back
Top