Ir para conteúdo

[Gesior Aac]Guild Statiscts.


tyuahoi

Posts Recomendados

Olá

 

Decidi POstar Aqui Um Script Para Quem Quer Que Tenha Mais Estatisticas Nas Guild De Seu OTserver.

 

 

Vamos Ao Que Interessa.

 

 

1) Abra o: Guilds.php

Procure Por: (aprox. na linha 100-120)

 

//-----------------------------------------------------------------------------
//show guild page 

 

2) Selecione todo o texto (acima da linha) - Mas sem ele!

 

include('pot/InvitesDriver.php');

 

 

3) Substitua por:

 

//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 .= '   <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 .= ' <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) Resultado.

 

2lsyyvt.jpg

 

 

 

 

 

CRÉDITOS

 

- Kavvson 

Editado por 1tyi
Link para o comentário
Compartilhar em outros sites

Cara o tutorial está ótimo, com certeza irá ajudar muita gente...

Agora está melhor...

 

Tutorial aprovado e movido para a área correta!

Obrigado por trazer conteúdo ao XTibia.com!

Editado por Doidin
Link para o comentário
Compartilhar em outros sites

  • 1 month later...
  • 4 months later...

Voçê acabou renascendo o Topico que estava com mais de 1 mes sem resposta que é contra as regras do Xtibia ;D

 

Topico reportado ;'

 

 

 

@topic o texto q esta acima do include('pot/InvitesDriver.php'); vc apaga entendeu?

Editado por 1tyi
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...