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

[Gesior AAC] Guild statisctic + extras

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
I decided to release my sample guilds modification. Rep me if you use it. Or get lost:eek:

Open Guilds.php

1) Search for (aprox. 100-120 line)

PHP:
//-----------------------------------------------------------------------------
//show guild page

2) And select all text(above the line) - But without it!

PHP:
include('pot/InvitesDriver.php');

3) And replace it with

PHP:
//show guild page
if($action == 'show')
{
	$guild_id = (int) $_REQUEST['guild'];
	$guild_name = $guild_id;
	$guild = $ots->createObject('Guild');
	$guild->load($guild_id);
	if(!$guild->isLoaded())
		$guild_errors[] = 'Guild with ID <b>'.$guild_id.'</b> doesn\'t exist.';
	if(!empty($guild_errors))
	{
		//show errors
		$main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
		foreach($guild_errors as $guild_error)
			$main_content .= '<li>'.$guild_error;
		//errors and back button
		$main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
	}
	else
	{
		//check is it vice or/and leader account (leader has vice + leader rights)
		$guild_leader_char = $guild->getOwner();
		$rank_list = $guild->getGuildRanksList();
		$rank_list->orderBy('level', POT::ORDER_DESC);
		$guild_leader = FALSE;
		$guild_vice = FALSE;
		if($logged)
		{
			$account_players = $account_logged->getPlayers();
			foreach($account_players as $player)
			{
				$players_from_account_ids[] = $player->getId();
				$player_rank = $player->getRank();
				if(!empty($player_rank))
					foreach($rank_list as $rank_in_guild)
						if($rank_in_guild->getId() == $player_rank->getId())
						{
							$players_from_account_in_guild[] = $player->getName();
							if($player_rank->getLevel() > 1)
							{
								$guild_vice = TRUE;
								$level_in_guild = $player_rank->getLevel();
							}
							if($guild->getOwner()->getId() == $player->getId())
							{
								$guild_vice = TRUE;
								$guild_leader = TRUE;
							}
						}
			}
		}
		//show guild page
		$guild_logo = $guild->getCustomField('logo_gfx_name');
		if(empty($guild_logo) || !file_exists("guilds/".$guild_logo))
			$guild_logo = "default_logo.gif";
		$description = $guild->getCustomField('description');
		$newlines   = array("\r\n", "\n", "\r");
		$description_with_lines = str_replace($newlines, '<br />', $description, $count);
		if($count < $config['site']['guild_description_lines_limit'])
			$description = $description_with_lines;
		$guild_owner = $guild->getOwner();
		if($guild_owner->isLoaded())
			$guild_owner = $guild_owner->getName();
		$main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR>
		<TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD>
		<TABLE BORDER=0 WIDTH=100%>
		<TR><TD WIDTH=64><IMG SRC="guilds/'.$guild_logo.'" WIDTH=64 HEIGHT=64></TD>
		<TD ALIGN=center WIDTH=100%><H1>'.$guild->getName().'</H1></TD>
		<TD WIDTH=64><IMG SRC="guilds/'.$guild_logo.'" WIDTH=64 HEIGHT=64></TD></TR>
		</TABLE><BR>'.$description.'<BR><BR><a href="?subtopic=characters&name='.urlencode($guild_owner).'"><b>'.$guild_owner.'</b></a> is guild leader of <b>'.$guild->getName().'</b>.<BR>The guild was founded on '.$config['server']['serverName'].' on '.date("j F Y", $guild->getCreationData()).'.';
		if($guild_leader)
			$main_content .= '&nbsp;&nbsp;&nbsp;<a href="?subtopic=guilds&action=manager&guild='.$guild_name.'"><IMG SRC="'.$layout_name.'/images/buttons/sbutton_manageguild.png" BORDER=0 WIDTH=120 HEIGHT=18 alt="Manage Guild"></a>';
		$main_content .= '<BR><BR>
		<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
		<TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=3 CLASS=white><B>Guild Members</B></TD></TR>
		<TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=30%><B>Rank</B></TD>
		<TD WIDTH=70%><B>Name and Title</B></TD></TR>';
		$showed_players = 1;
		foreach($rank_list as $rank)
		{
			$players_with_rank = $rank->getPlayersList();
			$players_with_rank->orderBy('name');
			$players_with_rank_number = count($players_with_rank);
			if($players_with_rank_number > 0)
			{
				if(is_int($showed_players / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $showed_players++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD valign="top">'.$rank->getName().'</TD>
				<TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%>';
				foreach($players_with_rank as $player)
				{
$main_content .= '';
					$main_content .= '<TR><TD><FORM ACTION="?subtopic=guilds&action=change_nick&name='.urlencode($player->getName()).'" METHOD=post><A HREF="?subtopic=characters&name='.urlencode($player->getName()).'">'.($player->isOnline() ? "<font color=\"green\">".$player->getName()."</font>" : "<font color=\"red\">".$player->getName()."</font>").'</A> <br><small>Level: '.$player->getLevel().' '.$vocation_name[$player->getWorld()][$player->getPromotion()][$player->getVocation()].'</small>';
					$guild_nick = $player->getGuildNick();
					if($logged)
						if(in_array($player->getId(), $players_from_account_ids))
							$main_content .= '(<input type="text" name="nick" value="'.htmlentities($player->getGuildNick()).'"><input type="submit" value="Change">)';
						else
						if(!empty($guild_nick))
							$main_content .= ' ('.htmlentities($player->getGuildNick()).')';
					else
						if(!empty($guild_nick))
							$main_content .= ' ('.htmlentities($player->getGuildNick()).')';
					if($level_in_guild > $rank->getLevel() || $guild_leader)
						if($guild_leader_char->getName() != $player->getName())
							$main_content .= '&nbsp;<font size=1>{<a href="?subtopic=guilds&action=kickplayer&guild='.$guild->getId().'&name='.urlencode($player->getName()).'">KICK</a>}</font>';
					$main_content .= '</FORM></TD></TR>';
				}
				$main_content .= '</TABLE></TD></TR>';
			}
		}
		$main_content .= '</TABLE><br><br>';
		$guild_id = (int)$_GET['guild'];$guildMembers = $SQL->query( 'SELECT COUNT(`gr`.`id`) AS `total` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` = '.$guild_id )->fetch( );$allM = $SQL->query ('SELECT COUNT(1) as `people` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') AND online = 1')->fetch(); $allM1 = $SQL->query ('SELECT SUM(`level`) as `level` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ')->fetch(); $allM2 = $SQL->query ('SELECT AVG(`level`) as `level` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ')->fetch(); $allM3 = $SQL->query ('SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ORDER BY `level` ASC LIMIT 1')->fetch(); $allM4 = $SQL->query ('SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ORDER BY `level` DESC LIMIT 1')->fetch(); $invite = $SQL->query( 'SELECT COUNT(*) FROM `guild_invites` WHERE `guild_id` = '.$guild_id.'')->fetch( );						$main_content .= '<table width="100%" cellspacing="1" cellpadding="4" border="0">		<tbody><tr bgcolor="#505050"><td class="white" colspan="3"><b>Guild Statistic</b></td></tr>		<tr bgcolor="#d4c0a1"><td width="30%"><b>Type</b></td>		<td width="50%"><b>Value</b></td></tr><tr bgcolor="#f1e0c6">				<td valign="top">Number of Members in Guild</td>		<td><table width="100%" cellspacing="0" cellpadding="0" border="0">		<tbody><tr><td>'.$guildMembers['total'].'</td></tr></tbody></table>		</td></tr>				<tr bgcolor="#d4c0a1"><td valign="top">Number of Members Online in Guild</td>				<td><table width="100%" cellspacing="0" cellpadding="0" border="0">		<tbody><tr><td>'.$allM[0].'</td></tr></tbody></table>		</td></tr>				<td valign="top">Total Level in guild</td>		<td><table width="100%" cellspacing="0" cellpadding="0" border="0">		<tbody><tr><td>'.$allM1[0].'</td></tr></tbody></table>		</td></tr>				<tr bgcolor="#d4c0a1"><td valign="top">Avg Level in guild</td>				<td><table width="100%" cellspacing="0" cellpadding="0" border="0">		<tbody><tr><td>'.round($allM2[0]).'</td></tr></tbody></table>		</td></tr>				<td valign="top">Lowest Level in guild</td>		<td><table width="100%" cellspacing="0" cellpadding="0" border="0">		<tbody><tr><td>'.$allM3[0].'</td></tr></tbody></table>		</td></tr>				<tr bgcolor="#d4c0a1"><td valign="top">Highest Level in guild</td>				<td><table width="100%" cellspacing="0" cellpadding="0" border="0">		<tbody><tr><td>'.$allM4[0].'</td></tr></tbody></table>		</td></tr>				<tr bgcolor="#f1e0c6"><td valign="top">Number of Invited Members</td>				<td><table width="100%" cellspacing="0" cellpadding="0" border="0">		<tbody><tr><td>'.$invite[0].'</td></tr></tbody></table>		</td></tr>		</table>';

4) End result

2lsyyvt.jpg


5) Credits

- Kavvson

Search for
PHP:
?>
at the bottom of guilds.php. And add above it


PHP:
$main_content .= '<div align="right"><small><b>Author of script: <a href="http://otland.net/members/kavvson/">Kavvson</a></b></small></div><br />';
 
*Kavvon have been banned for making a modification to Gesior*

Anyway, good work, even who it's for Gesior and not Modern :(
 
I guess tomorrow i create a modern aac version Stain this script is like 1 year old. Its not a fully code of my guilds.php show page.. I hope i create a fully version of my script for modern aac.

Regards
 
Back
Top