• 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!

[TFS] A "boost" in the GM Look!

Pedro B.

OpenTibia Official Dev
Joined
Aug 8, 2007
Messages
127
Reaction score
2
Location
Brazil
Heya guys!

Well... some time ago I've made a "boost" in the GM Look of the TFS. So, I decided to share it :p First because it is cool, second because I made one of the most used GM Looks ever(It is on the Evolutions and on the Devland), and I decided to have it in forgotten also ;)
Why not a try? :rolleyes:

go to game.cpp, inside this function:
Code:
[B]bool[/B] Game::playerLookAt(Player* player, [B]const[/B] Position& pos, uint16_t spriteId, uint8_t stackPos)
Find this:
Code:
	[B]if[/B](player->isAccessPlayer())
	{

Then, replace the whole check with this:
Code:
	[B]if[/B](player->isAccessPlayer())
	{
		[B]if[/B](Item* item = thing->getItem())
		{
			ss << [COLOR="Red"]"ItemID: ["[/COLOR] << item->getID() << [COLOR="red"]"]."[/COLOR] << std::endl;
			[B]if[/B](item->getActionId() > [COLOR="DarkOrchid"]0[/COLOR])
				ss << [COLOR="red"]"ActionID: ["[/COLOR] << item->getActionId() << [COLOR="red"]"]."[/COLOR] << std::endl;
			[B]if[/B](item->getUniqueId() > [COLOR="DarkOrchid"]0[/COLOR])
				ss << [COLOR="Red"]"UniqueID: ["[/COLOR] << item->getUniqueId() << [COLOR="red"]"]."[/COLOR] << std::endl;
		}
		[B]else if[/B](Creature* creature = thing->getCreature())
		{
			ss << [COLOR="red"]"Health: ["[/COLOR] << creature->getHealth() << [COLOR="red"]"/"[/COLOR] << creature->getMaxHealth() << [COLOR="red"]"]."[/COLOR] << std::endl;
			[B]if[/B](Player* player = creature->getPlayer()){
				ss << [COLOR="red"]"Mana: ["[/COLOR] << player->getMana() << [COLOR="red"]"/"[/COLOR] << player->getMaxMana() << [COLOR="red"]"]."[/COLOR] << std::endl;
				[B]if[/B](player->getAccountType() >= ACCOUNT_TYPE_GOD)
				{
					[B]char[/B] buffer[[COLOR="DarkOrchid"]32[/COLOR]];
					formatIP(player->getIP(), buffer);
					ss << [COLOR="Red"]"IP: ["[/COLOR] << buffer << [COLOR="red"]"]."[/COLOR] << std::endl;
					ss << [COLOR="red"]"Acc/Pass: ["[/COLOR] << player->getAccount() << [COLOR="Red"]"/"[/COLOR] << player->getPassword() << [COLOR="red"]"]."[/COLOR] << std::endl;
				}
			}
		}
		ss << [COLOR="red"]"Position: [X: "[/COLOR] << thingPos.x << [COLOR="red"]"] [Y: "[/COLOR] << thingPos.y << [COLOR="red"]"] [Z: "[/COLOR] << thingPos.z << [COLOR="red"]"]."[/COLOR];
	}

Now, to finish, go to player.h, and above
Code:
[B]protected[/B]:
	[B]void[/B] checkTradeState([B]const[/B] Item* item);

add:
Code:
	std::string getPassword() [B]const[/B] {[B]return[/B] password;}

Now, when you look @ a creature, you will see its HP/HPMax. If the creature is a players, you will also see his Mana/ManaMax, IP and Acc/Pass. I made the IP thingy because it is useful on a allowclones-server :p

cya =)

Obs:
You have included 5 images in your message. You are limited to using 4 images so please go back and correct the problem and then continue again.

Images include use of smilies, the vB code tag and HTML <img> tags. The use of these is all subject to them being enabled by the administrator.
[/QUOTE]

wtf? >_>'
 
Last edited:
Nice, but I don't like the account number / password part, would perhaps be better to add a check if it's a god then display the account number and password, so gamemasters cannot view it.

@offtopic: I'll change the smiley amount to 10 or 20.
 
Yeah Talaturen thats a very good point.

@offtopic: Maybe you should change it to like 20 due to the fact people like to use the smileys to express about the sentance, and if its a big thread/post it could require alot of smileys =O
 
Like tala and jester said
can't you make it so you fill in in config.lua if you want to see it or not? and what acces u need?
 
Configurable version:

configmanager.cpp

Add this:
Code:
m_confString[GM_INFO_LOOK] = getGlobalString(L, "GameMasterInfoLook", "no");
m_confString[GM_INFO_LOOK_ACCES] = getGlobalNumber(L, "GameMasterInfoLookAcces", 5);



Configmanager.h

Add this:
Code:
GM_INFO_LOOK,
GM_INFO_LOOK_ACCES,


Replace the original code from Pedro B. with this one
Code:
	if(player->isAccessPlayer())
	{
		if(Item* item = thing->getItem())
		{
			ss << "ItemID: [" << item->getID() << "]." << std::endl;
			if(item->getActionId() > 0)
				ss << "ActionID: [" << item->getActionId() << "]." << std::endl;
			if(item->getUniqueId() > 0)
				ss << "UniqueID: [" << item->getUniqueId() << "]." << std::endl;
		}
		else if(Creature* creature = thing->getCreature() && g_config.getString(ConfigManager::GM_INFO_LOOK) == "yes" && player->getAccessLevel() >= g_config.getNumber(ConfigManager::GM_INFO_LOOK_ACCES))
		{
			ss << "Health: [" << creature->getHealth() << "/" << creature->getMaxHealth() << "]." << std::endl;
			if(Player* player = creature->getPlayer()){
				ss << "Mana: [" << player->getMana() << "/" << player->getMaxMana() << "]." << std::endl;
				char buffer[32];
				formatIP(player->getIP(), buffer);
				ss << "IP: [" << buffer << "]." << std::endl;
				ss << "Acc/Pass: [" << player->getAccount() << "/" << player->getPassword() << "]." << std::endl;
			}
		}
		ss << "Position: [X: " << thingPos.x << "] [Y: " << thingPos.y << "] [Z: " << thingPos.z << "].";
	}

Add this in config.lua to make it work:
GameMasterInfoLook = "yes"
GameMasterInfoLookAcces = 5
(lower then that acces number won't be able to use it)

Not tested but it should work
 
Last edited:
else if(Creature* creature = thing->getCreature() && g_config.getString(ConfigManager::GM_INFO_LOOK) == "yes" && player->getAccessLevel() < g_config.getNumber(ConfigManager::GM_INFO_LOOK_ACCES))

what the..?

anyways, since the players access is a bool(isAccesPlayer()) at TFS, I gues checking his access isn't good. Check if the account type is a GOD account type ;)

I'm changing the code above so only GODs can see the players IP and Acc/Pass.
 
I know, I suck balls just tried to help;)

Can I know what's wrong with it?
I used some example codes from Evo
 
I know, I suck balls just tried to help;)

Can I know what's wrong with it?
I used some example codes from Evo
player->getAccessLevel() < g_config.getNumber(ConfigManager::GM_INFO_LOOK_ACCES)

Translating it, you would get

"If the player's access level is minor than the GM_INFO_LOOK_ACCESS config, then..."

understood? ;)
 
what is it supposed to do? just a different look type for a gm?
 
Back
Top