Пример #1
0
 public function setSkills($makeString = false)
 {
     $query = "SELECT skills FROM game_data_stars WHERE star_id = {$this->star_id}";
     $result = mysql_query($query);
     list($skillsstr) = mysql_fetch_row($result);
     $this->skills = $makeString ? skillsTrans($skillsstr) : (empty($skillsstr) ? array() : explode(',', $skillsstr));
 }
Пример #2
0
 public function profile($sid)
 {
     global $lng;
     $s = new self($sid);
     title($s->name);
     echo '<center><a href="' . urlcompile(T_URL_STANDINGS, T_OBJ_STAR, false, false, false) . '">' . $lng->getTrn('common/back') . '</a></center><br><br>';
     echo "<b>" . $lng->getTrn('common/skills') . ":</b> " . skillsTrans($s->skills) . "<br><br>";
     echo "<b>" . $lng->getTrn('common/races') . ":</b> " . racesTrans($s->races) . "<br><br>";
     self::starHireHistory(false, false, false, false, $s->star_id, array('url' => urlcompile(T_URL_PROFILE, T_OBJ_STAR, $s->star_id, false, false)));
 }
Пример #3
0
    public static function profile($rid)
    {
        global $lng, $DEA;
        $race = new Race($rid);
        $roster = $DEA[$race->name];
        title($lng->getTrn('race/' . strtolower(str_replace(' ', '', $race->name))));
        ?>
    <center><img src="<?php 
        echo RACE_ICONS . '/' . $roster['other']['icon'];
        ?>
" alt="Race icon"></center>
    <ul>
        <li><?php 
        echo $lng->getTrn('common/reroll');
        ?>
: <?php 
        echo $roster['other']['rr_cost'] / 1000;
        ?>
k</li>
    </ul><br>
    <?php 
        $players = array();
        foreach ($roster['players'] as $player => $d) {
            $p = (object) array_merge(array('position' => $player), $d);
            $p->skills = implode(', ', skillsTrans($p->def));
            $p->N = implode('', $p->norm);
            $p->D = implode('', $p->doub);
            $p->position = $lng->getTrn("position/" . strtolower(str_replace(' ', '', $p->position)));
            $players[] = $p;
        }
        $fields = array('position' => array('desc' => $lng->getTrn('common/pos')), 'pos_id' => array('desc' => 'ID'), 'ma' => array('desc' => 'Ma'), 'st' => array('desc' => 'St'), 'ag' => array('desc' => 'Ag'), 'av' => array('desc' => 'Av'), 'skills' => array('desc' => $lng->getTrn('common/skills'), 'nosort' => true), 'N' => array('desc' => 'Normal', 'nosort' => true), 'D' => array('desc' => 'Double', 'nosort' => true), 'cost' => array('desc' => $lng->getTrn('common/price'), 'kilo' => true, 'suffix' => 'k'), 'qty' => array('desc' => 'Max. qty'));
        HTMLOUT::sort_table('Roster', urlcompile(T_URL_PROFILE, T_OBJ_RACE, $race->race_id, false, false), $players, $fields, sort_rule('race_page'), isset($_GET['sortpl']) ? array(($_GET['dirpl'] == 'a' ? '+' : '-') . $_GET['sortpl']) : array(), array('GETsuffix' => 'pl', 'noHelp' => true, 'doNr' => false));
        // Teams of the chosen race.
        $url = urlcompile(T_URL_PROFILE, T_OBJ_RACE, $race->race_id, false, false);
        HTMLOUT::standings(STATS_TEAM, false, false, array('url' => $url, 'teams_from' => STATS_RACE, 'teams_from_id' => $race->race_id));
        echo '<br>';
        HTMLOUT::recentGames(STATS_RACE, $race->race_id, false, false, false, false, array('url' => $url, 'n' => MAX_RECENT_GAMES, 'GET_SS' => 'gp'));
    }
Пример #4
0
 function createRoster()
 {
     $this->roster .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     $this->roster .= "<?xml-stylesheet type=\"text/xsl\" href=\"/modules/leegmgr/team.xsl\"?>\n";
     $this->roster .= "<team>\n";
     $this->roster .= "    <name>" . htmlspecialchars($this->name, ENT_NOQUOTES, 'UTF-8') . "</name>\n";
     $this->roster .= "    <race>" . htmlspecialchars($this->race, ENT_NOQUOTES, 'UTF-8') . "</race>\n";
     $this->roster .= "    <coach>" . htmlspecialchars($this->coach_name, ENT_NOQUOTES, 'UTF-8') . "</coach>\n";
     $this->roster .= "    <rerolls>" . $this->rerolls . "</rerolls>\n";
     $this->roster .= "    <fanfactor>" . $this->fan_factor . "</fanfactor>\n";
     $this->roster .= "    <assistants>" . $this->ass_coaches . "</assistants>\n";
     $this->roster .= "    <cheerleaders>" . $this->cheerleaders . "</cheerleaders>\n";
     $this->roster .= "    <apothecary>" . $this->apothecary . "</apothecary>\n";
     $this->roster .= "    <treasury>" . $this->treasury . "</treasury>\n";
     $this->roster .= "    <players>\n";
     foreach ($this->players as $p) {
         if (!$p->is_dead && !$p->is_sold) {
             $skills = $p->getSkillsStr();
             $a_skills = explode(', ', $skills);
             $this->roster .= "        <player number=\"" . $p->nr . "\">\n";
             $this->roster .= "            <name>" . htmlspecialchars($p->name, ENT_NOQUOTES, 'UTF-8') . "</name>\n";
             $this->roster .= "            <position>" . htmlspecialchars($p->pos, ENT_NOQUOTES, 'UTF-8') . "</position>\n";
             $this->roster .= "            <ma>" . $p->ma . "</ma>\n";
             $this->roster .= "            <st>" . $p->st . "</st>\n";
             $this->roster .= "            <ag>" . $p->ag . "</ag>\n";
             $this->roster .= "            <av>" . $p->av . "</av>\n";
             $this->roster .= "            <skills>\n";
             //For Cyanide Roster BEGIN
             $this->obblm_team['players'][$p->nr]['id'] = $p->nr;
             $this->obblm_team['players'][$p->nr]['name'] = $p->name;
             $this->obblm_team['players'][$p->nr]['type'] = $p->pos;
             $this->obblm_team['players'][$p->nr]['skin'] = 0;
             //@FIXME need to map race skin number options
             $this->obblm_team['players'][$p->nr]['age'] = '100.';
             $this->obblm_team['players'][$p->nr]['Number'] = $p->nr;
             //int 1-32 only
             $this->obblm_team['players'][$p->nr]['MA'] = $p->ma;
             $this->obblm_team['players'][$p->nr]['ST'] = $p->st;
             $this->obblm_team['players'][$p->nr]['AG'] = $p->ag;
             $this->obblm_team['players'][$p->nr]['AV'] = $p->av;
             $this->obblm_team['players'][$p->nr]['Level'] = FALSE;
             $this->obblm_team['players'][$p->nr]['SPP'] = $p->mv_spp;
             $this->obblm_team['players'][$p->nr]['COST'] = 0;
             $this->obblm_team['players'][$p->nr]['VALUE'] = $p->value / 1000;
             $chrs = array();
             $extras = empty($p->extra_skills) ? array() : skillsTrans($p->extra_skills);
             if ($p->ach_ma > 0) {
                 array_push($chrs, "+1 Ma");
             }
             if ($p->ach_ma > 1) {
                 array_push($chrs, "+1 Ma");
             }
             if ($p->ach_st > 0) {
                 array_push($chrs, "+1 St");
             }
             if ($p->ach_st > 1) {
                 array_push($chrs, "+1 St");
             }
             if ($p->ach_ag > 0) {
                 array_push($chrs, "+1 Ag");
             }
             if ($p->ach_ag > 1) {
                 array_push($chrs, "+1 Ag");
             }
             if ($p->ach_av > 0) {
                 array_push($chrs, "+1 Av");
             }
             if ($p->ach_av > 1) {
                 array_push($chrs, "+1 Av");
             }
             $skillstr = skillsTrans(array_merge($p->ach_nor_skills, $p->ach_dob_skills));
             if ($p->f_pos_id == 201) {
                 array_push($extras, 'Sprint');
             }
             if ($p->is_journeyman) {
                 array_push($extras, 'Loner');
             }
             $cy_skills = array_merge(empty($skillstr) ? array() : $skillstr, $extras, $chrs);
             $i = 0;
             $this->obblm_team['players'][$p->nr]['Skills'][0] = false;
             while ($i < count($cy_skills) && strlen($cy_skills[0]) > 0) {
                 $this->obblm_team['players'][$p->nr]['Skills'][$i] = $cy_skills[$i];
                 $i++;
             }
             $this->obblm_team['players'][$p->nr]['Casualty'][0] = $p->is_mng ? "Pinched Nerve" : false;
             $i = $this->obblm_team['players'][$p->nr]['Casualty'][0] ? 1 : 0;
             while ($i < $p->inj_ni) {
                 $this->obblm_team['players'][$p->nr]['Casualty'][$i] = "Damaged Back";
                 $i++;
             }
             if ($p->is_mng) {
                 unset($this->obblm_team['players'][$p->nr]);
             }
             //For Cyanide Roster END
             $i = 0;
             while ($i < count($a_skills) && strlen($a_skills[0]) > 0) {
                 if (strpos($a_skills[$i], "Ball & Chain") !== FALSE) {
                     $a_skills[$i] = "Ball and Chain";
                 }
                 if (strpos($a_skills[$i], "Nurgle's Rot") !== FALSE) {
                     $a_skills[$i] = "Nurgles Rot";
                 }
                 if (strpos($a_skills[$i], "Claw/Claws") !== FALSE) {
                     $a_skills[$i] = "Claws";
                 }
                 if (strpos($a_skills[$i], "*")) {
                     $a_skills[$i] = str_replace("*", "", $a_skills[$i]);
                 }
                 $this->roster .= "                <skill>" . htmlspecialchars($a_skills[$i], ENT_NOQUOTES, 'UTF-8') . "</skill>\n";
                 $i++;
             }
             $injured = $p->is_mng ? "true" : "false";
             $this->roster .= "            </skills>\n";
             $this->roster .= "            <spp>" . $p->mv_spp . "</spp>\n";
             $this->roster .= "            <nigglings>" . $p->inj_ni . "</nigglings>\n";
             $this->roster .= "            <injured>" . $injured . "</injured>\n";
             $this->roster .= "            <value>" . $p->value . "</value>\n";
             $this->roster .= "        </player>\n";
         }
     }
     $this->roster .= "    </players>\n";
     $this->roster .= "</team>";
 }
Пример #5
0
 public static function main($argv)
 {
     global $pdf;
     global $DEA;
     global $skillarray;
     global $rules;
     global $inducements;
     define("MARGINX", 20);
     define("MARGINY", 20);
     define("DEFLINECOLOR", '#000000');
     define("HEADLINEBGCOLOR", '#c3c3c3');
     // Custom settings for inducements.
     define('MAX_STARS', 2);
     define('MERC_EXTRA_COST', 30000);
     define('MERC_EXTRA_SKILL_COST', 50000);
     // Color codes.
     define('COLOR_ROSTER_NORMAL', COLOR_HTML_NORMAL);
     define('COLOR_ROSTER_READY', COLOR_HTML_READY);
     define('COLOR_ROSTER_MNG', COLOR_HTML_MNG);
     define('COLOR_ROSTER_DEAD', COLOR_HTML_DEAD);
     define('COLOR_ROSTER_SOLD', COLOR_HTML_SOLD);
     define('COLOR_ROSTER_STARMERC', COLOR_HTML_STARMERC);
     define('COLOR_ROSTER_JOURNEY', COLOR_HTML_JOURNEY);
     define('COLOR_ROSTER_JOURNEY_USED', COLOR_HTML_JOURNEY_USED);
     define('COLOR_ROSTER_NEWSKILL', COLOR_HTML_NEWSKILL);
     //-----
     define('COLOR_ROSTER_CHR_EQP1', COLOR_HTML_CHR_EQP1);
     // Characteristic equal plus one.
     define('COLOR_ROSTER_CHR_GTP1', COLOR_HTML_CHR_GTP1);
     // Characteristic greater than plus one.
     define('COLOR_ROSTER_CHR_EQM1', COLOR_HTML_CHR_EQM1);
     // Characteristic equal minus one.
     define('COLOR_ROSTER_CHR_LTM1', COLOR_HTML_CHR_LTM1);
     // Characteristic less than minus one.
     define('T_PDF_ROSTER_SET_EMPTY_ON_ZERO', true);
     # Prints cp, td etc. as '' (empty string) when field = 0.
     $ind_cost = 0;
     //
     // Most of team and player data is copy/pasted from teams.php
     //
     $team_id = $_GET['team_id'];
     // Is team id valid?
     if (!get_alt_col('teams', 'team_id', $team_id, 'team_id')) {
         fatal("Invalid team ID.");
     }
     $team = new Team($team_id);
     $coach = isset($_SESSION['logged_in']) ? new Coach($_SESSION['coach_id']) : null;
     setupGlobalVars(T_SETUP_GLOBAL_VARS__LOAD_LEAGUE_SETTINGS, array('lid' => $team->f_lid));
     // Load correct $rules for league.
     $players = $team->getPlayers();
     $tmp_players = array();
     foreach ($players as $p) {
         if ($p->is_dead || $p->is_sold) {
             continue;
         }
         array_push($tmp_players, $p);
     }
     $players = $tmp_players;
     // Team specific data
     $rerollcost = $DEA[$team->f_rname]['other']['rr_cost'];
     $pdf = new BB_PDF('L', 'pt', 'A4');
     // Creating a new PDF doc. Landscape, scale=pixels, size A4
     $pdf->SetAutoPageBreak(false, 20);
     // No auto page break to mess up layout
     $pdf->SetAuthor('Daniel Straalman');
     $pdf->SetCreator('OBBLM');
     $pdf->SetTitle('PDF Roster for ' . utf8_decode($team->name));
     $pdf->SetSubject('PDF Roster for ' . utf8_decode($team->name));
     $pdf->AddFont('Tahoma', '', 'tahoma.php');
     // Adding regular font Tahoma which is in font dir
     $pdf->AddFont('Tahoma', 'B', 'tahomabd.php');
     // Adding Tahoma Bold
     // Initial settings
     $pdf->SetFont('Tahoma', 'B', 14);
     $pdf->AddPage();
     $pdf->SetLineWidth(1.5);
     $currentx = MARGINX;
     $currenty = MARGINY;
     $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR));
     $pdf->RoundedRect($currentx, $currenty, 802, 20, 6, 'DF');
     // Filled rectangle around Team headline
     $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR));
     // Text in headline
     $pdf->SetXY($currentx + 30, $currenty);
     $pdf->Cell(310, 20, utf8_decode($team->name), 0, 0, 'L', false, '');
     $pdf->SetFont('Tahoma', '', 12);
     $pdf->Cell(60, 20, "Race:", 0, 0, 'R', false, '');
     $pdf->Cell(70, 20, $team->f_rname, 0, 0, 'L', false, '');
     $pdf->Cell(300, 20, "Head Coach: " . utf8_decode($team->f_cname), 0, 0, 'R', false, '');
     $currenty += 25;
     $currentx += 6;
     $pdf->SetXY($currentx, $currenty);
     $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR));
     $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR));
     $pdf->SetFont('Tahoma', 'B', 8);
     $pdf->SetLineWidth(1.5);
     $h = 14;
     // Printing headline for player table
     $pdf->Cell(23, $h, 'Nr', 1, 0, 'C', true, '');
     $pdf->Cell(97, $h, 'Name', 1, 0, 'L', true, '');
     $pdf->Cell(75, $h, 'Position', 1, 0, 'L', true, '');
     $pdf->Cell(18, $h, 'MA', 1, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'ST', 1, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'AG', 1, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'AV', 1, 0, 'C', true, '');
     $pdf->Cell(329, $h, 'Skills and Injuries', 1, 0, 'L', true, '');
     $pdf->Cell(23, $h, 'MNG', 1, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'CP', 1, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'TD', 1, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'Int', 1, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'Cas', 1, 0, 'C', true, '');
     $pdf->Cell(23, $h, 'MVP', 1, 0, 'C', true, '');
     $pdf->Cell(25, $h, 'SPP', 1, 0, 'C', true, '');
     $pdf->Cell(41, $h, 'Value', 1, 0, 'C', true, '');
     $currenty += 17;
     $pdf->SetXY($currentx, $currenty);
     $pdf->SetFont('Tahoma', '', 8);
     $h = 15;
     // Row/cell height for player table
     //
     // Printing player rows
     //
     $sum_spp = 0;
     $sum_pvalue = 0;
     $sum_p_missing_value = 0;
     $sum_avail_players = 0;
     $sum_players = 0;
     $sum_cp = 0;
     $sum_td = 0;
     $sum_int = 0;
     $sum_cas = 0;
     $sum_mvp = 0;
     $i = 0;
     // Looping through the players and printing the rows
     foreach ($players as $p) {
         $i++;
         $mng = '';
         // Journeymen
         if ($p->is_journeyman) {
             $p->position = 'Journeyman';
             $bgc = COLOR_ROSTER_JOURNEY;
             if ($p->is_journeyman_used) {
                 $bgc = COLOR_ROSTER_JOURNEY_USED;
             }
         } else {
             $bgc = COLOR_ROSTER_NORMAL;
         }
         // Concatenate skills, upgrades and injuries
         $skillstr = $p->getSkillsStr(false);
         $injstr = $p->getInjsStr(false);
         if ($skillstr == '') {
             // No skills
             if ($injstr != '') {
                 $skills_injuries = $injstr;
             } else {
                 $skills_injuries = '';
             }
             // No skills nor injuries
         } else {
             if ($injstr != '') {
                 $skills_injuries = $skillstr . ', ' . $injstr;
             } else {
                 $skills_injuries = $skillstr;
             }
             // Only skills, no injuries
         }
         // Colorcoding new skills available
         if ($p->mayHaveNewSkill()) {
             $bgc = COLOR_ROSTER_NEWSKILL;
         }
         if (!$p->is_mng) {
             $sum_avail_players++;
             $inj = "";
         } else {
             $bgc = COLOR_ROSTER_MNG;
             $sum_p_missing_value += $p->value;
             $inj = "MNG";
             // For MNG column
             // Removing MNG from skills and injuries
             $skills_injuries = str_replace(', MNG', '', $skills_injuries);
             $skills_injuries = str_replace('MNG', '', $skills_injuries);
             $skills_injuries = str_replace('  ', ' ', $skills_injuries);
             // Maybe not needed after changes to rest of code?
         }
         // Characteristic's colors, copied and modified from teams.php
         foreach (array('ma', 'ag', 'av', 'st') as $chr) {
             $sub = $p->{$chr} - $p->{"def_{$chr}"};
             if ($sub == 0) {
                 $p->{"{$chr}_color"} = $bgc;
             } elseif ($sub >= 1) {
                 $p->{"{$chr}_color"} = COLOR_ROSTER_CHR_GTP1;
             } elseif ($sub <= -1) {
                 $p->{"{$chr}_color"} = COLOR_ROSTER_CHR_LTM1;
             }
         }
         $pp = array('nr' => $p->nr, 'name' => utf8_decode($p->name), 'pos' => $p->position, 'ma' => $p->ma, 'st' => $p->st, 'ag' => $p->ag, 'av' => $p->av, 'skills' => $skills_injuries, 'inj' => $inj, 'cp' => $p->mv_cp, 'td' => $p->mv_td, 'int' => $p->mv_intcpt, 'cas' => $p->mv_cas, 'mvp' => $p->mv_mvp, 'spp' => $p->mv_spp, 'value' => $pdf->Mf($p->value));
         $sum_spp += $p->mv_spp;
         $sum_pvalue += $p->value;
         $sum_players++;
         $sum_cp += $p->mv_cp;
         $sum_td += $p->mv_td;
         $sum_int += $p->mv_intcpt;
         $sum_cas += $p->mv_cas;
         $sum_mvp += $p->mv_mvp;
         if (T_PDF_ROSTER_SET_EMPTY_ON_ZERO) {
             foreach (array('cp', 'td', 'int', 'cas', 'mvp', 'spp') as $f) {
                 if ($pp[$f] == 0) {
                     $pp[$f] = '';
                 }
             }
         }
         // Printing player row
         $currenty += $pdf->print_prow($pp, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8, $p->ma_color, $p->st_color, $p->ag_color, $p->av_color);
     }
     // Filling up with empty rows to max number of players
     $pp = array('nr' => '', 'name' => '', 'pos' => '', 'ma' => '', 'st' => '', 'ag' => '', 'av' => '', 'skills' => '', 'inj' => '', 'cp' => '', 'td' => '', 'int' => '', 'cas' => '', 'mvp' => '', 'spp' => '', 'value' => '');
     $bgc = COLOR_ROSTER_NORMAL;
     while ($i < $rules['max_team_players']) {
         $i++;
         $currenty += $pdf->print_prow($pp, $currentx, $currenty, $h, '#FFFFFF', '#000000', 0.5, 8, $bgc, $bgc, $bgc, $bgc);
     }
     // Sums
     $sum_pvalue -= $sum_p_missing_value;
     $pdf->SetXY($currentx = MARGINX + 6 + 23, $currenty += 4);
     $pdf->print_box($currentx, $currenty, 172, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Total number of players next game:');
     $pdf->print_box($currentx += 172, $currenty, 30, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $sum_avail_players . '/' . $sum_players);
     $pdf->SetX($currentx = MARGINX + 6 + 559);
     $pdf->print_box($currentx, $currenty, 60, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Totals (excl TV for MNG players):');
     $pdf->print_box($currentx += 60, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_cp);
     $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_td);
     $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_int);
     $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_cas);
     $pdf->print_box($currentx += 21, $currenty, 23, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_mvp);
     $pdf->print_box($currentx += 23, $currenty, 25, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_spp);
     $pdf->print_box($currentx += 25, $currenty, 41, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $pdf->Mf($sum_pvalue));
     // Stars and Mercs part of roster
     $currentx = MARGINX + 6 + 23;
     $currenty += $h + 2;
     // Draw rounded rectangle around stars and mercs
     // This rectangle has flexible height depending on how high player table is
     $pdf->SetLineWidth(0.6);
     $pdf->RoundedRect(MARGINX + 6, $currenty, 792, 560 - $currenty - 130, 5, 'D');
     $pdf->SetXY($currentx, $currenty += 2);
     $h = 14;
     $pdf->SetFont('Tahoma', 'B', 8);
     $pdf->Cell(97 + 75, $h, 'Induced Stars and Mercenaries', 0, 0, 'L', true, '');
     $pdf->Cell(18, $h, 'MA', 0, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'ST', 0, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'AG', 0, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'AV', 0, 0, 'C', true, '');
     $pdf->Cell(329, $h, 'Skills', 0, 0, 'L', true, '');
     //$pdf->Cell(23, $h, 'MNG', 1, 0, 'C', true, ''); // No MNG stars/mercs. They heal. ;-)
     $pdf->Cell(21, $h, 'CP', 0, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'TD', 0, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'Int', 0, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'Cas', 0, 0, 'C', true, '');
     $pdf->Cell(23, $h, 'MVP', 0, 0, 'C', true, '');
     $pdf->Cell(25, $h, 'SPP', 0, 0, 'C', true, '');
     $pdf->Cell(41, $h, 'Value', 0, 0, 'R', true, '');
     $currenty += 14;
     $pdf->SetXY($currentx, $currenty);
     $h = 13;
     // Printing chosen stars and mercs
     $pdf->SetFont('Tahoma', '', 8);
     $merc = array(0 => 'No Merc');
     $i = 0;
     if ($_POST) {
         foreach ($DEA[$team->f_rname]["players"] as $p => $m) {
             $i++;
             array_push($merc, $m);
             $pos[$i] = $p;
         }
         $postvars = array();
         # initialize.
         foreach ($_POST as $postkey => $postvalue) {
             if ($postkey == "Submit") {
                 continue;
             }
             if ($postvalue == "0") {
                 continue;
             }
             if ($postvalue == "0k") {
                 continue;
             }
             if ($postvalue == "-No Extra Skill-") {
                 continue;
             }
             $postvars[str_replace('_', ' ', $postkey)] = $postvalue;
         }
         $star_array_tmp[0] = 0;
         $merc_array_tmp[0] = 0;
         while (list($key, $val) = each($postvars)) {
             if (strpos($key, 'Star') !== false) {
                 // if POST key is StarX
                 array_push($star_array_tmp, $val);
                 continue;
             } elseif (strpos($key, 'Merc') !== false) {
                 $merc_nr = preg_replace("/[^0-9]/", "", $key);
                 $merc_array_tmp[$merc_nr] = $pos[$val];
                 if (isset($postvars["Extra{$merc_nr}"])) {
                     $extra_array_tmp[$merc_nr] = $postvars["Extra{$merc_nr}"];
                 } else {
                     $extra_array_tmp[$merc_nr] = '';
                 }
                 continue;
             } elseif ($key == 'Bloodweiser Babes') {
                 $ind_babes = (int) $val;
                 continue;
             } elseif ($key == 'Bribes') {
                 $ind_bribes = (int) $val;
                 continue;
             } elseif ($key == 'Card') {
                 $ind_card = (int) str_replace('k', '000', $val);
                 continue;
             } elseif ($key == 'Extra Training') {
                 $ind_rr = (int) $val;
                 continue;
             } elseif ($key == 'Halfling Master Chef') {
                 $ind_chef = (int) $val;
                 continue;
             } elseif ($key == 'Igor') {
                 $ind_igor = (int) $val;
                 continue;
             } elseif ($key == 'Wandering Apothecaries') {
                 $ind_apo = (int) $val;
                 continue;
             } elseif ($key == 'Wizard') {
                 $ind_wiz = (int) $val;
                 continue;
             }
         }
         // Printing stars first
         if (isset($star_array_tmp[1])) {
             unset($star_array_tmp[0]);
             foreach ($star_array_tmp as $sid) {
                 $s = new Star($sid);
                 $s->setSkills(true);
                 $ss = array('name' => utf8_decode($s->name), 'ma' => $s->ma, 'st' => $s->st, 'ag' => $s->ag, 'av' => $s->av, 'skills' => $s->skills, 'cp' => $s->mv_cp, 'td' => $s->mv_td, 'int' => $s->mv_intcpt, 'cas' => $s->mv_cas, 'mvp' => $s->mv_mvp, 'spp' => $s->mv_spp, 'value' => $pdf->Mf($s->cost));
                 $currenty += $pdf->print_srow($ss, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8);
                 $ind_cost += $s->cost;
             }
         }
         // Then Mercs
         if (is_array($merc_array_tmp)) {
             unset($merc[0]);
             $r = $team->f_rname;
             $i = 0;
             unset($merc_array_tmp[0]);
             foreach ($merc_array_tmp as $mpos) {
                 $i++;
                 $m['name'] = 'Mercenary ' . $mpos;
                 $m['ma'] = $DEA[$r]['players'][$mpos]['ma'];
                 $m['st'] = $DEA[$r]['players'][$mpos]['st'];
                 $m['ag'] = $DEA[$r]['players'][$mpos]['ag'];
                 $m['av'] = $DEA[$r]['players'][$mpos]['av'];
                 $m['skillarr'] = $DEA[$r]['players']["{$mpos}"]['def'];
                 if (!in_array(99, $m['skillarr'])) {
                     array_unshift($m['skillarr'], 99);
                 }
                 // Adding Loner unless already in array
                 $m['skills'] = implode(', ', skillsTrans($m['skillarr']));
                 $m['cost'] = $DEA[$r]['players'][$mpos]['cost'] + MERC_EXTRA_COST;
                 if (isset($postvars["Extra{$i}"])) {
                     $m['cost'] += MERC_EXTRA_SKILL_COST;
                     $m['extra'] = $postvars["Extra{$i}"];
                     if ($m['skills'] == '') {
                         $m['skills'] = $m['extra'];
                     } else {
                         $m['skills'] = $m['skills'] . ', ' . $m['extra'];
                     }
                 }
                 $ss = array('name' => utf8_decode($m['name']), 'ma' => $m['ma'], 'st' => $m['st'], 'ag' => $m['ag'], 'av' => $m['av'], 'skills' => $m['skills'], 'cp' => ' ', 'td' => ' ', 'int' => ' ', 'cas' => ' ', 'mvp' => ' ', 'spp' => ' ', 'value' => $pdf->Mf($m['cost']));
                 $currenty += $pdf->print_srow($ss, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8);
                 $ind_cost += $m['cost'];
             }
         }
     }
     $h = 13;
     // Printing lower part of roster
     $currentx = MARGINX;
     $currenty = 435;
     //print_box($x, $y, $w, $h, $bgcolor='#FFFFFF', $bordercolor='#000000', $linewidth=1, $borderstyle, $fontsize, $font, $bold=false, $align, $text)
     $h = 13;
     // Height of cells
     $pdf->print_box($currentx, $currenty, 170, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Inducements ');
     $pdf->print_box($currentx += 170, $currenty, 120, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'L', '(for next match)');
     $pdf->print_box($currentx = 630, $currenty, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Team Goods');
     // 156 to margin
     // Checking if Wandering Apothecary should be replaced with Igor
     $r = $team->f_rname;
     if ($r == 'Nurgle' || $r == 'Khemri' || $r == 'Necromantic' || $r == 'Undead') {
         $apo_igor = 'Igor (0-1):';
         unset($inducements['Wandering Apothecaries']);
         if (isset($ind_igor)) {
             $ind_apo_igor_cost = $ind_igor * $inducements['Igor']['cost'];
             $ind_cost += $ind_igor * $ind_apo_igor_cost;
             $ind_apo_igor = $ind_igor;
         } else {
             $ind_apo_igor = '__';
             $ind_apo_igor_cost = $inducements['Igor']['cost'];
         }
     } else {
         $apo_igor = 'Wandering Apothecaries (0-2):';
         unset($inducements['Igor']);
         if (isset($ind_apo)) {
             $ind_apo_igor_cost = $inducements['Wandering Apothecaries']['cost'];
             $ind_cost += $ind_apo * $ind_apo_igor_cost;
             $ind_apo_igor = $ind_apo;
         } else {
             $ind_apo_igor = '__';
             $ind_apo_igor_cost = $inducements['Wandering Apothecaries']['cost'];
         }
     }
     // Checking LRB6 cheaper Chef for Halfling
     $chef_cost = $inducements['Halfling Master Chef'][$r == 'Halfling' ? 'reduced_cost' : 'cost'];
     // Checking LRB6 cheaper bribes for Goblin
     $bribe_cost = $inducements['Bribes'][$r == 'Goblin' ? 'reduced_cost' : 'cost'];
     if (isset($ind_babes)) {
         $ind_cost += $ind_babes * $inducements['Bloodweiser Babes']['cost'];
     } else {
         $ind_babes = '__';
     }
     if (isset($ind_bribes)) {
         $ind_cost += $ind_bribes * $inducements['Bribes']['cost'];
     } else {
         $ind_bribes = '__';
     }
     if (isset($ind_card)) {
         $ind_cost += $ind_card;
     } else {
         $ind_card = '__';
     }
     if (isset($ind_rr)) {
         $ind_cost += $ind_rr * $inducements['Extra Training']['cost'];
     } else {
         $ind_rr = '__';
     }
     if (isset($ind_chef)) {
         $ind_cost += $ind_chef * $chef_cost;
     } else {
         $ind_chef = '__';
     }
     if (isset($ind_wiz)) {
         $ind_cost += $ind_wiz * $inducements['Wizard']['cost'];
     } else {
         $ind_wiz = '__';
     }
     // print_inducements($x, $y, $h, $bgcol, $linecol, $fontsize, $ind_name, $ind_amount, $ind_value)
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Bloodweiser Babes (0-2):', $ind_babes, $pdf->Mf($inducements['Bloodweiser Babes']['cost']));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Bribes (0-3):', $ind_bribes, $pdf->Mf($bribe_cost));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Extra Training (0-4):', $ind_rr, $pdf->Mf($inducements['Extra Training']['cost']));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Halfling Master Chef (0-1):', $ind_chef, $pdf->Mf($chef_cost));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, $apo_igor, $ind_apo_igor, $pdf->Mf($ind_apo_igor_cost));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Wizard (0-1):', $ind_wiz, $pdf->Mf($inducements['Wizard']['cost']));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Card budget:', ' ', $pdf->Mf($ind_card));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Gate:', null, '');
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'FAME:', null, '');
     $currenty = 435;
     $currentx = 630;
     // print_team_goods($x, $y, $h, $bgcol, $linecol, $perm_name, $perm_nr, $perm_value, $perm_total_value, $bold=false)
     $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Rerolls:', $team->rerolls, $pdf->Mf($rerollcost), $pdf->Mf($team->rerolls * $rerollcost), false);
     $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Fan Factor:', $team->rg_ff, $pdf->Mf($rules['cost_fan_factor']), $pdf->Mf($team->rg_ff * $rules['cost_fan_factor']), false);
     $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Assistant Coaches:', $team->ass_coaches, $pdf->Mf($rules['cost_ass_coaches']), $pdf->Mf($team->ass_coaches * $rules['cost_ass_coaches']), false);
     $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Cheerleaders:', $team->cheerleaders, $pdf->Mf($rules['cost_cheerleaders']), $pdf->Mf($team->cheerleaders * $rules['cost_cheerleaders']), false);
     if ($r == 'Undead' || $r == 'Necromantic') {
         // Swap Apothecary for Necromancer
         $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Necromancer:', 1, 0, 0, false);
     } elseif ($r == 'Nurgle' || $r == 'Khemri') {
         // Remove Apothecary
         $currenty += $h;
     } else {
         // Normal case
         $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Apothecary:', $team->apothecary, $pdf->Mf($rules['cost_apothecary']), $pdf->Mf($team->apothecary * $rules['cost_apothecary']), false);
     }
     $pdf->print_box($currentx += 70, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Treasury:');
     $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $pdf->Mf($team->treasury));
     // Team Value, Inducements Value, Match Value
     $h = 13;
     $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Team Value (incl MNGs value):');
     $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($team->value + $sum_p_missing_value));
     $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Induced Value:');
     $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($ind_cost));
     $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Match Value (TV for match):');
     $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($team->value + $ind_cost));
     // Drawing a rectangle around inducements
     $pdf->SetLineWidth(0.6);
     $pdf->RoundedRect(MARGINX + 6, 435, 792, 130, 5, 'D');
     global $settings;
     if ($settings['enable_pdf_logos']) {
         // Team logo
         // Comment out if you dont have GD 2.x installed, or if you dont want the logo in roster.
         // Not tested with anything except PNG images that comes with OBBLM.
         $img = new ImageSubSys(IMGTYPE_TEAMLOGO, $team->team_id);
         $pdf->Image($img->getPath(), 346, 436, 128, 128, '', '', false, 0);
         // OBBLM text lower left corner as a pic
         $pdf->Image('modules/pdf/OBBLM_pdf_logo.png', MARGINX + 12, 534, 60, 28, '', '', false, 0);
     }
     // Color legends
     $pdf->SetFont('Tahoma', '', 8);
     $currentx = MARGINX + 16;
     $currenty = 572;
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_MNG));
     $pdf->SetXY($currentx, $currenty);
     $pdf->Rect($currentx, $currenty, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(20, 8, 'MNG', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY));
     $pdf->Rect($currentx += 22 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(45, 8, 'Journeyman', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY_USED));
     $pdf->Rect($currentx += 47 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(45, 8, 'Used journeyman', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_NEWSKILL));
     $pdf->Rect($currentx += 67 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(70, 8, 'New skill available', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_CHR_GTP1));
     $pdf->Rect($currentx += 70 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(50, 8, 'Stat upgrade', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_CHR_LTM1));
     $pdf->Rect($currentx += 50 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(50, 8, 'Stat downgrade', 0, 0, 'L', false);
     $pdf->SetFont('Tahoma', '', 7);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_NORMAL));
     $pdf->SetXY($currentx + 160, $currenty + 1);
     $donate = "Please consider donating to the OBBLM project if you enjoy this software and wish to support\n further development and maintenance. For more information visit nicholasmr.dk";
     $pdf->Multicell(300, 8, $donate, 0, 0, 'L', false);
     // Output the PDF document
     $pdf->Output(utf8_decode($team->name) . date(' Y-m-d') . '.pdf', 'I');
 }
Пример #6
0
 private static function addPlayer($pos, $d, $isStarPlayer)
 {
     global $lng;
     $p = array();
     $positionName = strtolower(str_replace(array('-', '\'', ' ', '(', ')', '+', '.'), '', $pos));
     if (!$isStarPlayer) {
         $p['position'] = $lng->getTrn('position/' . $positionName);
     } else {
         $p['position'] = $lng->getTrn('starplayer/' . $positionName);
     }
     $p['ma'] = $d['ma'];
     $p['st'] = $d['st'];
     $p['ag'] = $d['ag'];
     $p['av'] = $d['av'];
     $p['skills'] = implode(', ', skillsTrans($d['def']));
     $p['N'] = isset($d['norm']) ? implode('', $d['norm']) : "";
     $p['D'] = isset($d['doub']) ? implode('', $d['doub']) : "";
     $p['cost'] = $d['cost'] / 1000;
     $p['id'] = isset($d['pos_id']) ? $d['pos_id'] : $d['id'];
     $p['ind'] = isset($d['pos_id']) ? 0 : 1;
     $p['max'] = isset($d['qty']) ? $d['qty'] : 1;
     return $p;
 }
Пример #7
0
    public static function main($argv)
    {
        // Check if teamid is provided, else show error mess
        $team_id = $_GET['team_id'];
        if (!get_alt_col('teams', 'team_id', $team_id, 'team_id')) {
            fatal("Invalid team ID.");
        }
        global $stars, $DEA, $rules, $skillarray, $inducements, $racesNoApothecary;
        // Move these constants to header.php?
        define('MAX_STARS', 2);
        define('MERC_EXTRA_COST', 30000);
        define('MERC_EXTRA_SKILL_COST', 50000);
        $ind_cost = 0;
        $redirectlink = 'handler.php?type=roster&detailed=0&team_id=' . $team_id;
        $t = new Team($team_id);
        $star_list[0] = '      <option value="0">-No Induced Stars-</option>' . "\n";
        foreach ($stars as $s => $d) {
            $star_list[0] .= "      <option " . (in_array($t->f_race_id, $d['races']) ? 'style="background-color: ' . COLOR_HTML_READY . ';" ' : '') . "value=\"{$d['id']}\">{$s}</option>\n";
        }
        ?>
<!--
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link type="text/css" href="css/stylesheet1.css" rel="stylesheet">
-->
<style type="text/css">
td { background-color: #EEEEEE; color: #000000; font: 13px Tahoma; }
td.indtitle { background-color: #EEEEEE; color: #000000; font: bold 12px Tahoma; }
td.boxie { background-color: #EEEEEE; color: #000000; }
td.cent { text-align: center; }
td.cent2 { text-align: center; background-color: #EEEEEE; color: #000000; }
td.right { text-align: right; background-color: #EEEEEE; color: #000000; }
</style>
<script language="javascript">
<!--
function SendToPDF()
{
    document.InduceForm.action = "<?php 
        print $redirectlink;
        ?>
"    // Redirect to pdf_roster
    document.InduceForm.submit();        // Submit the page
    return true;
}
-->
</script>
<!--
</head>
<body>
<div class="everything">
<div class="section">
-->
<?php 
        title('Inducements try-out');
        ?>
<form action="" method="post" name="InduceForm">

<table>
    <tr>
        <td class="indtitle">Star Name</td>
        <td class="indtitle">Cost</td>
        <td class="indtitle">MA</td>
        <td class="indtitle">ST</td>
        <td class="indtitle">AG</td>
        <td class="indtitle">AV</td>
        <td class="indtitle">Skills</td> <!-- <td>Cp</td><td>Td</td><td>Int</td><td>Cas</td><td>BH</td><td>Si</td><td>Ki</td><td>MVP</td><td>SPP</td> -->
    </tr>
<?php 
        $brick_n_grotty = false;
        $i = 1;
        while ($i <= MAX_STARS) {
            print "  <tr>\n";
            if (array_key_exists("Star{$i}", $_POST)) {
                $sid = $_POST["Star{$i}"];
                if ($sid != 0) {
                    $s = new Star($sid);
                    #      $s->setStats(false, false, false, false);
                    $star_list[$i] = $star_list[0];
                    if ($sid == "-6" || $sid == "-7") {
                        // Select Brick as selected and add row for Grotty later
                        $brick_n_grotty = true;
                        $star_list[$i] = str_replace('option value="-6"', 'option selected value="-6"', $star_list[$i]);
                        // Hardcoded Brick
                        $star_list[$i] = str_replace('option style="background-color: ' . COLOR_HTML_READY . ';" value="-6"', 'option selected style="background-color: ' . COLOR_HTML_READY . ';" value="-6"', $star_list[$i]);
                        $sid = -6;
                        $s = new Star($sid);
                        // Making sure to switch from Grotty to Brick
                        #        $s->setStats(false, false, false, false);
                        $star_list[0] = str_replace('      <option value="-6">Brick Far\'th (+ Grotty)</option>' . "\n", '', $star_list[0]);
                        // Removing Brick from second row
                        $star_list[0] = str_replace('      <option style="background-color: ' . COLOR_HTML_READY . ';" value="-6">Brick Far\'th (+ Grotty)</option>' . "\n", '', $star_list[0]);
                        $star_list[0] = str_replace('      <option value="-7">Grotty (included in Brick Far\'th)</option>' . "\n", '', $star_list[0]);
                        // Removing Grotty from second row
                        $star_list[0] = str_replace('      <option style="background-color: ' . COLOR_HTML_READY . ';" value="-7">Grotty (included in Brick Far\'th)</option>' . "\n", '', $star_list[0]);
                    } else {
                        $star_list[$i] = str_replace('option value="' . $sid . '"', 'option selected value="' . $sid . '"', $star_list[$i]);
                        $star_list[$i] = str_replace('option style="background-color: ' . COLOR_HTML_READY . ';" value="' . $sid . '"', 'option selected style="background-color: ' . COLOR_HTML_READY . ';" value="' . $sid . '"', $star_list[$i]);
                        $star_list[0] = str_replace('<option value="' . $sid . '">' . $s->name . "</option>\n", '', $star_list[0]);
                        $star_list[0] = str_replace('option style="background-color: ' . COLOR_HTML_READY . ';" value="' . $sid . '">' . $s->name . "</option>\n", '', $star_list[0]);
                    }
                    print '    <td class="boxie"><SELECT name="Star' . $i . '" onChange="this.form.submit()">' . "\n";
                    print $star_list[$i];
                    print '    </SELECT></td>' . "\n";
                    print '<td class="cent">' . str_replace('000', '', $s->cost) . "k</td>\n<td class=\"cent\">" . $s->ma . "</td>\n<td class=\"cent\">" . $s->st . "</td>\n<td class=\"cent\">" . $s->ag . "</td>\n<td class=\"cent\">" . $s->av . "</td>\n<td>\n<small>" . skillsTrans($s->skills) . "</small></td>\n";
                    //      print "<td>".$s->cp."</td>\n<td>".$s->td."</td>\n<td>".$s->intcpt."</td>\n<td>".$s->cas."</td>\n<td>".$s->bh."</td>\n<td>".$s->si."</td>\n<td>".$s->ki."</td>\n<td>".$s->mvp."</td>\n<td>".$s->spp."</td>\n<td>";
                    print "</tr>\n";
                    $ind_cost += $s->cost;
                    $i++;
                    continue;
                }
            }
            print '    <td class="boxie"><SELECT name="Star' . $i . '" onChange="this.form.submit()">' . "\n";
            print $star_list[0];
            print '    </SELECT>' . "\n";
            print '</tr>' . "\n";
            $i++;
            break;
        }
        if ($brick_n_grotty) {
            // Print Grotty and add hidden input field
            $sid = -7;
            // ID for Grotty hardcoded :-P
            $s = new Star($sid);
            #  $s->setStats(false, false, false, false);
            echo '<tr>';
            $grotty_nr = MAX_STARS + 1;
            echo '<td>' . $s->name . '<input type="hidden" name="Star' . $grotty_nr . '" value="-7"></td>';
            print "<td class=\"cent\">" . str_replace('000', '', $s->cost) . "k</td>\n<td class=\"cent\">" . $s->ma . "</td>\n<td class=\"cent\">" . $s->st . "</td>\n<td class=\"cent\">" . $s->ag . "</td>\n<td class=\"cent\">" . $s->av . "</td>\n<td>\n<small>" . implode(', ', skillsTrans($s->skills)) . "</small></td>\n";
            //  print "<td>".$s->cp."</td>\n<td>".$s->td."</td>\n<td>".$s->intcpt."</td>\n<td>".$s->cas."</td>\n<td>".$s->bh."</td>\n<td>".$s->si."</td>\n<td>".$s->ki."</td>\n<td>".$s->mvp."</td>\n<td>".$s->spp."</td>\n<td>";
            print "</tr>\n";
        }
        ?>
</table>
<table>
    <tr>
        <td class="indtitle">Mercenaries</td>
        <td class="indtitle">Position</td>
        <td class="indtitle">Cost</td>
        <td class="indtitle">MA</td>
        <td class="indtitle">ST</td>
        <td class="indtitle">AG</td>
        <td class="indtitle">AV</td>
        <td class="indtitle">Skills</td>
        <td class="indtitle">Extra Skill</td>
    </tr>
<?php 
        // Validate to not exceed maximum number of positionals? Leaving it open for now.
        $merc_list[0] = '            <option value="0">-No Induced Mercs-</option>' . "\n";
        $merc = array(0 => 'No Merc');
        $i = 0;
        foreach ($DEA[$t->f_rname]["players"] as $p => $m) {
            $i++;
            $merc_list[0] .= '            <option value="' . "{$i}" . '">' . "Merc {$p}" . '</option>' . "\n";
            array_push($merc, $m);
            $pos[$i] = $p;
        }
        $i = 1;
        while (isset($_POST["Merc{$i}"])) {
            print "    <tr>\n";
            if ($_POST["Merc{$i}"] != '0') {
                $mid = $_POST["Merc{$i}"];
                if (isset($_POST["Extra{$i}"])) {
                    $extra_skill_cost = $_POST["Extra{$i}"] == '-No Extra Skill-' ? 0 : MERC_EXTRA_SKILL_COST;
                    $extra[$i] = $_POST["Extra{$i}"];
                } else {
                    $extra_skill_cost = 0;
                    $extra[$i] = false;
                }
                // Fill skill list from what normal skills positional has to chose from
                $n_skills = $DEA[$t->f_rname]['players'][str_replace('Merc ', '', $pos[$mid])]['norm'];
                $extra_list[$i] = "            <option>-No Extra Skill-</option>\n";
                foreach ($n_skills as $category) {
                    foreach ($skillarray[$category] as $id => $skill) {
                        if (!in_array($id, $merc[$mid]["def"])) {
                            $extra_list[$i] .= '<option>' . skillsTrans($id) . '</option>' . "\n";
                        }
                    }
                }
                $merc_list[$i] = str_replace('<option value="' . $mid . '"', '<option selected value="' . $mid . '"', $merc_list[0]);
                print '        <td><SELECT name="Merc' . $i . '" onChange="this.form.submit()">' . "\n";
                print $merc_list[$i];
                $cost[$i] = (int) $merc[$mid]["cost"] + MERC_EXTRA_COST + $extra_skill_cost;
                echo "        </SELECT></td>\n";
                if (!in_array(99, $merc[$mid]["def"])) {
                    array_unshift($merc[$mid]["def"], 99);
                }
                // Adding Loner to default skills if Merc does not have Loner already
                $def_skills = skillsTrans($merc[$mid]["def"]);
                if (empty($def_skills)) {
                    $def_skills[] = '&nbsp;';
                }
                print "        <td>{$pos[$mid]}</td><td>" . str_replace('000', '', $cost[$i]) . "k</td><td class=\"cent\">" . $merc[$mid]["ma"] . "</td><td class=\"cent\">" . $merc[$mid]["st"] . "</td>";
                print "<td class=\"cent\">" . $merc[$mid]["ag"] . "</td><td class=\"cent\">" . $merc[$mid]["av"] . "</td><td><small>" . implode(', ', $def_skills) . "</small></td>\n";
                if ($extra[$i] != false) {
                    $extra_list[$i] = str_replace('<option>' . $extra[$i] . '</option>', '<option selected>' . $extra[$i] . '</option>', $extra_list[$i]);
                }
                echo '        <td><SELECT name="Extra' . $i . '" onChange="this.form.submit()">' . "\n";
                print $extra_list[$i];
                echo "        </SELECT></td>\n";
                echo "    </tr>\n";
                $ind_cost += $cost[$i];
                $i++;
                continue;
            } else {
                $merc_list[$i] = $merc_list[0];
                break;
            }
        }
        echo "    <tr>\n";
        echo '      <td><SELECT name="Merc' . $i . '" onChange="this.form.submit()">' . "\n";
        print $merc_list[0];
        echo "      </SELECT></td>\n";
        echo "    </tr>\n";
        ?>

</table>
<table>
<tr><td>
<table>
    <tr>
        <td class="indtitle">Inducement</td>
        <td class="indtitle">#</td>
        <td class="indtitle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <td class="indtitle">Cost</td>
        <td class="indtitle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <td class="indtitle">Total Cost</td>
    </tr>
<?php 
        // Regular inducements
        $r = $t->f_rname;
        $rid = $t->f_race_id;
        // Checking if team can hire Igor or Wandering Apo
        unset($inducements[in_array($rid, $racesNoApothecary) ? 'Wandering Apothecaries' : 'Igor']);
        foreach ($inducements as $ind_name => $ind) {
            $this_cost = $ind[in_array($rid, $ind['reduced_cost_races']) ? 'reduced_cost' : 'cost'];
            # Reduced cost?
            echo '<tr>';
            print '<td>' . $ind_name . ' (0-' . $ind['max'] . ')</td>';
            echo '<td><SELECT name="' . str_replace(' ', '_', $ind_name) . '" onChange="this.form.submit()">';
            // Changing spaces to underscores for (ugly?) POST workaround
            $ind_list = "<option>0</option>\n";
            for ($i = 1; $i <= $ind['max']; $i++) {
                $ind_list .= '<option>' . $i . "</option>\n";
            }
            $pi = 0;
            if (isset($_POST[str_replace(' ', '_', $ind_name)])) {
                $pi = $_POST[str_replace(' ', '_', $ind_name)];
                if ($pi != 0) {
                    $ind_list = str_replace('<option>' . $pi . '</option>', '<option selected>' . $pi . '</option>', $ind_list);
                }
            }
            print $ind_list;
            echo '</SELECT></td>';
            echo '<td class="cent2">x</td><td class="cent">' . $this_cost / 1000 . 'k</td>';
            echo '<td class="cent2">=</td>';
            $ind_cost += $pi * $this_cost;
            echo '<td class="cent">' . $pi * $this_cost / 1000 . 'k</td>';
            echo '</tr>';
        }
        // Cards
        $card_list = '';
        # Declare.
        echo '<tr>';
        echo '<td>Card budget</td><td class="cent2">&nbsp;</td><td class="cent2">&nbsp;</td>';
        echo '<td><SELECT name="Card" onChange="this.form.submit()">';
        for ($i = 0; $i <= 1000; $i += 50) {
            $card_list .= '<option>' . $i . "k</option>\n";
        }
        $cardb = '';
        if (isset($_POST["Card"])) {
            $cardb = $_POST["Card"];
            if ($cardb != 0) {
                $card_list = str_replace('<option>' . $cardb . '</option>', '<option selected>' . $cardb . '</option>', $card_list);
            }
        }
        $card_cost = str_replace('k', '', $cardb);
        $ind_cost += $card_cost * 1000;
        print $card_list;
        echo '</SELECT></td>';
        echo '<td class="cent2">=</td><td class="cent">' . $cardb . '</td>';
        echo '</tr>';
        ?>
<tr>
<td class="right" colspan="6"><br><input type="submit" name="Submit" value="Create PDF roster" onclick="return SendToPDF();"></td></tr>
<tr><td><a href="<?php 
        echo urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team_id, false, false);
        ?>
"> <- Back to team page</a></td></tr>
</table>
</td><td class="cent2">
<table>
<?php 
        function kilo($str)
        {
            if (strpos($str, '000000')) {
                return str_replace('000', '', $str) . '000';
            } else {
                return str_replace('000', '', $str);
            }
        }
        echo '<tr><td class="indtitle">Team Value:</td><td class="indtitle">' . kilo($t->value) . 'k</td></tr>';
        echo '<tr><td class="indtitle">Inducements Value:</td><td class="indtitle">' . kilo($ind_cost) . 'k</td></tr>';
        echo '<tr><td class="indtitle">Match Value:</td><td class="indtitle">' . kilo($ind_cost + $t->value) . 'k</td></tr>';
        ?>

</table>
</td>
</tr>

</table>
</form>
<!--
</div>
</div>
</body>
</html>
-->

<?php 
    }
Пример #8
0
 public function getSkillsStr($HTML = false)
 {
     /**
      * Compiles skills string.
      **/
     $this->setSkills();
     $chrs = array();
     $extras = empty($this->extra_skills) ? array() : array_strpack($HTML ? '<u>%s</u>' : '%s*', skillsTrans($this->extra_skills));
     if ($this->ach_ma > 0) {
         array_push($chrs, "+{$this->ach_ma} Ma");
     }
     if ($this->ach_st > 0) {
         array_push($chrs, "+{$this->ach_st} St");
     }
     if ($this->ach_ag > 0) {
         array_push($chrs, "+{$this->ach_ag} Ag");
     }
     if ($this->ach_av > 0) {
         array_push($chrs, "+{$this->ach_av} Av");
     }
     $defs = skillsTrans($this->def_skills);
     if ($HTML) {
         $defs = array_strpack('<i>%s</i>', $defs);
     }
     $skillstr = array_merge($defs, skillsTrans(array_merge($this->ach_nor_skills, $this->ach_dob_skills)));
     return implode(', ', array_merge($skillstr, $extras, $chrs));
 }