williamleonard / obblm

Automatically exported from code.google.com/p/obblm
1 stars 0 forks source link

Player Leaderboard Stats modification #481

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure how to submit this as anything other than a defect when it isn't one 
in the base code.

I'm running SVN 756.

On the main page I have the player leader boxes.  Since we run a perpetual 
league it is setup to pull the overall highest leaders from the league, not 
just a tournament.   I removed the Value field and replaced it with a player 
Status field.  It displays whether players are ready, injured, dead, retired 
ect.  Checking the player's date_sold works for a retirement, the status number 
checks for injury and Death.

One thing I have been trying to do but I can't seem to figure out how to link 
the player's team and team's status to the player.  What I have been trying to 
do is pull the player's owned_by_team_id to use that to look up the team_id on 
the teams table and see if the teams retired = 1 so the player will also 
therefore show up as being retired.

I've gotten it to run a few times and pull up numbers that I have not been able 
to figure out where they are.  My php is limited to the Qbasic, Vbasic, limited 
C++ and google.  Is it possible to make a relation like that in php and a dbase?

This is my sections.php lines 409-427.
                        <?php
                        foreach ($players as $p) {
                            echo "<tr>\n";
                            echo "<td>".(($settings['fp_links']) ? "<a href='".urlcompile(T_URL_PROFILE,T_OBJ_PLAYER,$p['player_id'],false,false)."'>$p[name]</a>" : $p['name'])."</td>\n";
                                                        if ($box['show_team']) {
                                echo "<td>".(($settings['fp_links']) ? "<a href='".urlcompile(T_URL_PROFILE,T_OBJ_TEAM,$p['owned_by_team_id'],false,false)."'>$p[f_tname]</a>" : $p['f_tname'])."</td>\n";
                            }
                            echo "<td>".$p[$f]."</td>\n";
                            if ($p['date_sold'] > 0)
                                echo "<td><i><b><font color='blue'>".'Retired'."</font></b></i></td>\n";
                            elseif ($p['status'] == 1)
                                echo "<td><i><b><font color='green'>".'Ready'."</font></b></i></td>\n";
                            elseif ($p['status'] > 1 && $p['status'] < 8 )
                                echo "<td><i><b><font color='purple'>".'Injured'."</font></b></i></td>\n";
                            elseif ($p['status'] == 8)
                                echo "<td><i><b><font color='red'>".'Dead'."</font></b></i></td>\n";
                            echo "</tr>";
                        }
                        ?>

The site is http://bb.obtenebration.org if you want to see what it looks like 
as is.

Original issue reported on code.google.com by meini...@gmail.com on 16 Jan 2011 at 8:26

GoogleCodeExporter commented 9 years ago
These properties would help you:
Boolean:
$is_dead
$is_sold
$is_mng - This will handle all your injured statuses.

I don't think you need these, but here are the specific injuries as an integer:
$inj_ma,$inj_st,$inj_ag,$inj_av,$inj_ni

$owned_by_team_id will get you the team id and then you can create the team 
object to get the name of the team.

Original comment by funnyfin...@hotmail.com on 19 Jan 2011 at 10:14

GoogleCodeExporter commented 9 years ago
$team = new Team($player->owned_by_team_id);
echo $team->name

...will give you the team's name.

Original comment by Nimda...@gmail.com on 20 Jan 2011 at 10:58

GoogleCodeExporter commented 9 years ago
Splitting hairs, but just want to say $p as opposed to $player in this case, 
right?

Original comment by funnyfin...@hotmail.com on 20 Jan 2011 at 6:00

GoogleCodeExporter commented 9 years ago
The above does not look like player objects.

Instead use $p['owned_by_team_id'] for team ID.

Original comment by Nimda...@gmail.com on 6 Feb 2011 at 11:51

GoogleCodeExporter commented 9 years ago
Yeah I've had it working to pull up any data on the players table.

The problem I am still having is I can not figure out how to pull up data from 
the teams table that goes with the player being analyzed.

Mainly if teams->retired = 1 then it assumes player is also retired.

No amount of using the above logic and my own crazy combinations have I managed 
to get that section to pull up the team's retired status.

Original comment by meini...@gmail.com on 8 Feb 2011 at 3:22

GoogleCodeExporter commented 9 years ago
Try

$team = new Team($p['owned_by_team_id']);
echo $team->is_retired ? 'retired' : 'NOT retired';

...?

Original comment by Nimda...@gmail.com on 8 Feb 2011 at 12:55

GoogleCodeExporter commented 9 years ago

Original comment by Nimda...@gmail.com on 9 Mar 2011 at 10:50

GoogleCodeExporter commented 9 years ago

Original comment by Nimda...@gmail.com on 23 Mar 2011 at 4:07