ZnoteAAC icon indicating copy to clipboard operation
ZnoteAAC copied to clipboard

Character Position (characterprofile.php + config.php)

Open deviljin112 opened this issue 5 years ago • 2 comments

Characterprofile.php

<!-- Player Position -->
<?php if ($profile_data['group_id'] > 1): ?>
	<tr>
		<td>Position</td>
		<td><?php echo group_id_to_name($profile_data['group_id']); ?></td>
	</tr>
<?php endif; ?>

Prints out the character's position based on characters group_id in DB. Character is "GOD" in-game but profile states "Senior Tutor" because of comparison to config.php

	$config['ingame_positions'] = array(
		1 => 'Player',
		2 => 'Tutor',
		3 => 'Senior Tutor',
		4 => 'Gamemaster',
		5 => 'Community Manager',
		6 => 'God',
	);

Because TFS only has 3 rankings for in-game position (groups.xml) at least mine does, I cant actually set it to 6 to have it match the config.php.

TLDR; Account position's (account db => type) matches exactly to config.php but character db => group_id does not.

deviljin112 avatar Mar 23 '20 14:03 deviljin112

The problem here is that this system differs between TFS 0.2, TFS 0.3/4 and TFS 1.x. If we correct it for one version, it easily breaks for another.

You can read more about it in #70

We might need to setup the config differently based on TFS version.

Znote avatar Mar 23 '20 22:03 Znote

Temporary Solution

config.php line 726 add:

$config['TFS10_ingame_positions'] = array(
	1 => 'Player',
	2 => 'Gamemaster',
	3 => 'God',
);

general.php line 346 add:

function group_id_to_name_TFS10($id) {
	$positions = config('TFS10_ingame_positions');
	return ($positions[$id] >= 0) ? $positions[$id] : false;
}

characterprofile.php replace line 84 to line 90:

<!-- Player Position -->
<?php if ($profile_data['group_id'] > 1): ?>
		<?php if ($config['ServerEngine'] == 'TFS_10'): ?>
			<tr>
				<td>Position</td>
				<td><?php echo group_id_to_name_TFS10($profile_data['group_id']); ?></td>
			</tr>
		<?php else: ?>
			<tr>
				<td>Position</td>
				<td><?php echo group_id_to_name($profile_data['group_id']); ?></td>
			</tr>
		<?php endif; ?>
<?php endif; ?>

This may not be an ideal solution but it solves the above issue perfectly without affecting non TFS 1.x

EDIT: Only works with 1 character. I've read the post you sent above, and realised this would not be viable for multiple characters on one account with different ranks.

deviljin112 avatar Mar 24 '20 02:03 deviljin112