Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Guide] [Development] J3lackSwOrD's Rank/Hall Of Fame

Status
Not open for further replies.
Newbie Spellweaver
Joined
Jun 29, 2011
Messages
70
Reaction score
94
Hello RageZone!!,
As i promised i will do my best to create all the scripts required for any Kalonline website, This is the first script which is players Rank/Hall Of Fame, and i'm selling it fo....naah just kidding, Its Free/Open-Source as usual :p:

==================
Threat Index:
- Boring intro.
- Image Preview
- Rank Features.
- Downloads.
- How to install.
- Settings tutorial.
- Advanced stuff for developers.
- Much More boring end.
===================

When i started developing that script, i was thinking -which is something good- why i create only one design/theme for it, Why i don't make the main script and the visual design separated, So any designer can create his own theme which fit in his own website, and also any developer can easily add more features!
Live Preview: since i don't have running server, Kallyanna Promised to create live preview -which is very kind-, and as soon as its ready will include the link here.
And Please if anybody got better idea or feature, tell me about it to add it!
I'm going to explain feature and how to edit the settings so please everybody set-down and stop talking ..... Hey you back there stop talking, I SEE YOU! :<:

=====================
Image Preview:

Default Theme:


Flat Theme:


4Dynasty Theme:(Design copyrights back to 4dynasty owners/designers, i just created it with the same style)

=====================
Rank Features:
- Soft&Live change between rank types (Normal all, Reborn all, Knights-only, Mages-only, Archers-only, etc)
- Add your own custom rank type for Item (Geon bags, golden coins,..or any other item by its index) OR Column (Kills, PVP,...or any other column by its name)
- Ability to change/add themes without stuck in the development parts (currently included 3 themes)
- Enable/Disable Reborn columns (if disabled, the script won't try to fetch it from the database to avoid errors)
- Hide/Show columns to display (rank, country flag, online status, guild, class, speciality,...etc)
- Change the Class/Specialty Names/Colors (Archer => Hunter, Mage => Wizard,...etc) (Archer => Green, Mage => Blue, Knight => Red,..etc)
- Switch between Exp displays, bars_template => 10bars and 100% bar, percent_template => one big 100% bar
- Control how many players to display in the rank (default is 100)
and that's all i can remember :laugh:

=====================
Downloads:
-
-
-
-
-
=====================
Updates:
- Rank V1.0.1: View attachment [RageZone] Rank by J3lackSwOrD V1.0.1 .rar
- Fixing 4dynasty's level column CSS bug.
=====================
How to install:
- Download the included .rar file and send it to developer you trust, so u make sure no backdoors included :huh:
- Extract the .rar file into your system32 folder TO START THE VIRUS NIAHAHA...just kidding, extract it into your website folder :lol:
- Open rank/config.php and edit your database connections.
- Change the settings if you want to
- Choose between 3 themes:
|- default
|- flat
|- 4dynasty (Design copyrights back to 4dynasty owners/designers, i just created it with the same style.)
- open the rank by going to yourdomain.com/rank.php

=====================
Settings tutorial:
All the tutorial in this section included also in the config.php
PHP:
  /*****************************************/
 /************ Rank Settings **************/
/*****************************************/

/* Some parts of this settings will be ignored if the template contain rank_settings.php file with that part.*/

$top_number = 100;					// number of players in rank
$is_reborn = true;					// There is reborn system in your server? (true/false) 
$header = 'Hall Of Fame';			// Rank header, Feel free to change it.
$title = 'Hall Of Fame';			// Page title, Which appear in the browser's tab, won't appear if you're using iframe.
$showheader = true;					// Show rank header? (true/false)
$experror = true;					//show error if the current exp > the required exp in exp_table (true/false)
$barserror = 10;					//If experror is false and player got more than 10 bars (bugged), how many bars u wanna show?

$show_top3 = true;					//Show Top 3 header.
$top3_order = array('archer', 'mage', 'knight'); //order of the top three preview

$show_titles = true;				// Show titles like (Rank, Name, Level, ..etc).

$show_rank = true;					// Show Rank Column.
$show_country = true;				// Show Country Flag Column.
$show_name = true;					// Show Name Column.
$show_class = true;					// Show Class Column.
$show_specialty = true;			// Show Speciality Column.
$show_level = true;				// Show Level Column.
$show_reborn = true;				// Show Reborn Column, Will be ignored if $is_reborn = false.
$show_guild = true;					// Show Guild Column.
$show_exp = true;					// Show Levelprogress Column
$show_status = true;				// Show Online/Offline Status Column.

$rank_theme = 'flat';			//Theme's folder name, which should be small without anyspaces or symbols or slashs
$exp_style = 'bars_template';	// Which style the exp area will be? (percent_template / bars_template)

  /*****************************************/
 /******* Class & Speciality Settings *****/
/*****************************************/

/**
/* Edit the lines below for class/specialty name and color
/* Template: 'Class/Speciality name' => 'Color hex'
/* For color's hex visit: http://www.colorpicker.com/
/* DON'T Remove or add lines or any of the symbols, Just edit the Speciality_name/Color_hex
/* This part of the settings will be ignored if the template contain job_settings.php file, with the same structure.
**/
$job_settings = array(
					//Class's
					'Knight'				=> '910404',
					'Mage'					=> '0E42B3',
					'Archer'				=> '0D910D',
					//Knight
					'Wondering Knight'		=> '940D00',
					'Apprentice Knight'		=> '940D00',
					'Vagabond'				=> '940D00',
					'Commander'				=> '940D00',
					'General'				=> '940D00',
					'God Of Sword'			=> '940D00',
					
					//Mage
					'Scholar'				=> '0E69B3',
					'Literary Person'		=> '0E69B3',
					'Hermit'				=> '0E69B3',
					'CJB'					=> '0E69B3',
					'Military Adviser'		=> '0E69B3',
					'Ascetic'				=> '0E69B3',
					
					//Archer
					'Wondering Archer'		=> '1BD11B',
					'Apprentice Archer'		=> '1BD11B',
					'Expert Archer'			=> '1BD11B',
					'Imperial Commander'	=> '1BD11B',
					'Imperial General'		=> '1BD11B',
					'God Of Bow'			=> '1BD11B'
					);
  /*****************************************/
 /********* Default Rank Settings **********/
/*****************************************/

$default_rank[] = array('all','Normal');
if($is_reborn){$default_rank[] = array('reborn','Reborn');}
$default_rank[] = array('knight','Knights');
$default_rank[] = array('mage','Mages');
$default_rank[] = array('archer','Archers');

  /*****************************************/
 /********* Custom Rank Settings **********/
/*****************************************/
/**
/* For each custom rank add new row here with the templates,
/* $custom_rank[] = array('item','ITEM_INDEX','ITEM_TITLE');
/*  For item ranks (like moneybags), ITEM_INDEX => Item index & ITEM_TITLE => Tab title in the rank.
/*
/* if column rank (pvp, reborn, any other column in the players table):
/* $custom_rank[] = array('column','COLUMN_NAME', 'COLUMN_TITLE');
/* and replace COLUMN_NAME = name of the column you wanna sort by, COLUMN_TITLE = tab title in the rank.
/*
/* Notice: custom column will replace the Guild column in the rank
/* Notice: Item rank: only the players that have this item will be shown
**/

$custom_rank[] = array('item','31','Geons');
$custom_rank[] = array('item','447','Speed Med.');
$custom_rank[] = array('column','Killed', 'Kills');
$custom_rank[] = array('column','SUPoint', 'State Points');

===============================
Advanced stuff for developers
Hello Developers!
I'm going to talk about the rank script in two parts, the visual/design part and the back-script/functions part,

I believe your thinking now about (OMG he change the rank order and type by only pressing one button, that's very complicated!) .. sorry to disappoint you, but its very much simpler than that ^^.
I'm sure you all know the jQuery how its tabs-slider, yup simple and easy tabs:
The organic tabs script contain two sections the nav/menu and the divs that change, when the page load, all the rank types is created in divs, but they all hidden but the first one, and by clicking the nav tabs you're telling the jQuery to hide the current div and show the targeted div with smooth and soft animation, that's all O.O

The 2nd part is the development, and as i said in the last threat we have problem in the rank which is every type of the ranks require its own query, but creating function to generate that query will be faster and easier, Also there is many parts of the script is repeated, like the job detector (class/specialty) or the exp calculator,
So i developed J3lackSwOrD's Class including function for each one of those,
PHP:
class J3lackSwOrD{
	public static function SelectRankQuery($type,$top_number, $is_reborn, $custom_type = NULL, $custom_data = NULL, $custom_name = NULL){
		//Is the settings correct?
		if($type == 'reborn' && !$is_reborn){die("ERROR: You can't display reborn rank in server that doesn't have reborn system!");}
		//Which type to fetch?
		switch($type){
			case 'knight':
			case 'top_knight':
			$class = 0;
			break;
			
			case 'mage':
			case 'top_mage':
			$class = 1;
			break;
			
			case 'archer':
			case 'top_archer':
			$class = 2;
			break;
		}
		
		//Generate top value
		switch($type){
			case 'top_knight':
			case 'top_mage':
			case 'top_archer':
				$top = 1;
			break;
			
			default:
				$top = $top_number;
		}
		
		//Generate query
		switch($type){
			case 'custom':
				if($custom_type == 'item'){
					$query = 'SELECT TOP '.$top.'
					Player.UID, Player.PID, Player.GID, Player.Level, Player.Class, Player.Specialty, Player.Name, Player.Killed, Player.Exp';
					if($is_reborn == 1){$query .= ', Player.Reborn';}
					$query .= ', Item.Num FROM Player  LEFT JOIN Item ON Player.PID=Item.PID
					WHERE 
					[Index] = ';
					$query .= $custom_data;
					$query .= ' AND Player.Admin = 0 ORDER BY Item.Num DESC'; 
				}elseif($custom_type == 'column'){
					$query = 'SELECT TOP '.$top.'
					Player.UID, Player.PID, Player.GID, Player.Level, Player.Class, Player.Specialty, Player.Name, Player.Killed, Player.Exp';
					$query .= ', Player.'.$custom_data;
					if($is_reborn == 1){$query .= ', Player.Reborn';}
					$query .= ', Guild.Name AS GuildName FROM Player LEFT JOIN Guild ON Guild.GID = Player.GID
					WHERE Admin = 0';
					$query .= ' ORDER BY ';
					if($type == 'reborn'){$query .= 'Reborn DESC,';}
					$query .= 'Player.'.$custom_data.' DESC';
				}
			break;
			
			default:
				$query = 'SELECT TOP '.$top.'
				Player.UID, Player.PID, Player.GID, Player.Level, Player.Class, Player.Specialty, Player.Name, Player.Killed, Player.Exp';
				if($is_reborn == 1){$query .= ', Player.Reborn';}
				$query .= ', Guild.Name AS GuildName FROM Player LEFT JOIN Guild ON Guild.GID = Player.GID
				WHERE Admin = 0';
				if(isset($class)){$query .= ' AND Class = '.$class;}
				$query .= ' ORDER BY ';
				if($type == 'reborn'){$query .= 'Reborn DESC,';}
				$query .= 'Level DESC,Player.Exp DESC';
		}

		
		
		
		

			
		return array (
			'type' => $type,
			'custom_type' => $custom_type,
			'custom_name' => $custom_name,
			'custom_data' => $custom_data,
			'query' => $query
		);
	}
	
	public static function ExpBarsGenerator($currentlevel, $currentexp){
		include('rank/lib/exp_table.php');
		$nextlevel = $currentlevel + 1;
		$fullexp = $level[$nextlevel];
		$requiredexp = $fullexp - $currentexp;
		$total_percent = ($currentexp/$fullexp)*100;
		$total_percent = number_format($total_percent, 0, '.', '');
		$barexp = $level[$nextlevel] / 10;
		if($currentexp >= $barexp){
			$bars = intval($currentexp / $barexp);
			}
		else{
			$bars = 0;
			}
		$barsexp = $bars*$barexp;
		$remainexp = $currentexp - $barsexp;
		$remainexppercent = number_format(($remainexp / $barexp)*100, 2);
		if($currentexp > $fullexp && $experror == 1){
			echo '<b style="font-size:10px;">Error: Current Exp Higher Than Required Exp, Please update the exp table</b>';}
		else{
			if($bars >= 10){$bars = $barserror;}
			$bars_template = '<div id="bars_template"><div id="bars">';
			for($i = 1; $i<= $bars; $i++){
				$bars_template .= '<div id="bar"></div>';
			}
		$bars_template .= '</div>';
		$bars_template .= '<div id="percent"><div id="innerpercent" style="width:'.$remainexppercent.'%;"><div id="percenttext">'.$remainexppercent.'%</div></div></div></div>';
		$percent_template = '<div id="percent_template"><div id="total_percent"><div id="innerpercent" style="width:'.$total_percent.'%;"><div id="percenttext">'.$total_percent.'%</div></div></div></div>';
		}
		
		return array(
			'bars' => $bars,
			'remain_percent' => $remainexppercent,
			'total_percent' => $total_percent,
			'bars_template' => $bars_template,
			'percent_template' => $percent_template
		);
		}

		public static function JobDetector($class, $specialty, $job_setting){
			$jobs = array(
				0 => $job_setting['knight'],
				1 => $job_setting['mage'],
				2 => $job_setting['archer']
			);
			$specialties = array(
				//Knight
				0 =>array(
					1 => $job_setting['wondering_knight'],
					3 => $job_setting['apprentice_knight'],
					7 => $job_setting['vagabond'],
					11 => $job_setting['commander'],
					43 => $job_setting['general'],
					23 => $job_setting['god_of_sword']
				),
				//Mage
				1 =>array(
					1 => $job_setting['scholar'],
					3 => $job_setting['literary_person'],
					7 => $job_setting['hermit'],
					11 => $job_setting['cjb'],
					43 => $job_setting['military_adviser'],
					23 => $job_setting['ascetic']
				),
				//Archer
				2 =>array(
					1 => $job_setting['wondering_archer'],
					3 => $job_setting['apprentice_archer'],
					7 => $job_setting['expert_archer'],
					11 => $job_setting['imperial_commander'],
					43 => $job_setting['imperial_general'],
					23 => $job_setting['god_of_bow']
				)
			);
			
			if( isset ($jobs[$class]) ){
				if( isset ($specialties[$class][$specialty]) ){
					$job = array($jobs[$class], $specialties[$class][$specialty]);
				}else{$job = array($jobs[$class],'Unknown Specialty');}
			}else{$job = array('Unknown Class','');}
			
			return $job;
		}
}

And if you read every function you will figure out how it works! each function require parameters, and return some data depends on those parameters, Since its not the final function and i still got some ideas to enchant them, i wont waste much time talking about those and i hope i find the required time to enchant it and make threat about it.

======================================
Much More boring end:
This rank script won't be the last script -as i hope- But if you have any better idea for the rank script, or any other scripts i will be happy to develop it,
Also i will work on those scripts to enchant them more so it become easy to any html/css designer to create his own themes, for any of the scripts.
Goodluck and have fun!

Best regards,
J3lackSwOrD
 

Attachments

You must be registered for see attachments list
Last edited:
Experienced Elementalist
Joined
Oct 4, 2013
Messages
225
Reaction score
73
Re: [Guide] [Development] J3lackSwOrD's Rank

good job :):thumbup1:
 
Helper for everyone
Joined
Oct 30, 2010
Messages
1,181
Reaction score
228
is there any screenshoot how it looking=?
 
Skilled Illusionist
Joined
May 24, 2012
Messages
333
Reaction score
28
Very good job nice !!!! a new userpanel would be nice !
omg your rank is just awsome !
 
Last edited:
Legendary Battlemage
Joined
Oct 4, 2011
Messages
617
Reaction score
8
i got problem on 4dynasty rank check SS please
thx
rank - [Guide] [Development] J3lackSwOrD's Rank/Hall Of Fame - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Mar 29, 2013
Messages
76
Reaction score
28
You should use bitmasks for jobs... i think it was 0 = nothing. 1 = first job, 2 = second job, 4 = attacker , 8 = defender, 16 = attacker 3rd job, 32 = defender 3rd job.
maybe attacker & defender must be switched, can't remember it anymore...
for example 3rd job GoS:
0 + 1 + 2 + 4 + 16
23 should be the value in your db.
General:
0 + 1 + 2 + 8 + 32
43 should be the val.
 
Newbie Spellweaver
Joined
Jun 29, 2011
Messages
70
Reaction score
94

Attachments

You must be registered for see attachments list
Status
Not open for further replies.
Back
Top