private function getModeSkillSection($stat_id, $fractal, $results) { if (array_key_exists(FateGameGlobals::STAT_MODE, $fractal->stats)) { $modeskill_data = array('fields' => array('label' => '', 'value' => array('label' => 'Ranking', 'type' => 'rankselect')), 'modeskill' => 1, 'unique' => 0); $ladder = FateGameGlobals::getLadder(); $levels = array_reverse(FateGameGlobals::getModeLevels(), true); $form .= "<table>"; foreach ($fractal->stats[FateGameGlobals::STAT_MODE] as $mode) { $has_discipline = 0; $parent_skill = ''; foreach ($fractal->fate_game->modes_by_id[$mode->{'parent_id'}]['skill_list'] as $sk) { if ($fractal->fate_game->skills_by_id[$sk]['has_disciplines']) { $has_discipline = 1; $parent_skill = $fractal->fate_game->skills_by_id[$sk]; break; } } $modeskill_data['mode_value'] = $mode->{stat_value}; $modeskill_data['mode_id'] = $mode->{fractal_stat_id}; $form .= "<thead><tr><td colspan=4><h4>Mode: " . $ladder[$mode->{stat_value}] . " (+" . $mode->{stat_value} . ") " . $mode->{stat_field} . "</h4></td></tr></thead><tbody id='stat_" . $stat_id . "'>"; $disciplines = array(); $modeskill_data['fields']['label'] = array('label' => '', 'type' => 'display'); for ($i = 2; $i >= 0; $i--) { foreach ($fractal->skills_by_mode[$mode->{fractal_stat_id}]['skills_by_level'][$i] as $skill) { if ($skill->{is_discipline}) { $disciplines[] = $skill; continue; } $form .= $this->getEditStatRow($stat_id, $modeskill_data, $skill, $fractal->fate_game, $results); } } if ($has_discipline) { $modeskill_data['fields']['label'] = array('size' => 35); if (count($disciplines) > 0) { $modeskill_data['fields']['label']['label'] = $parent_skill['label'] . " Discipline"; foreach ($disciplines as $discipline) { $form .= $this->getEditStatRow($stat_id, $modeskill_data, $discipline, $fractal->fate_game, $results); } } // For now, assume these aren't unique. Add handling later if necessary $modeskill_data['fields']['label']['label'] = "New " . $parent_skill['label'] . " Discipline"; $form .= "</tbody><tbody id='newstat_" . $stat_id . "'>"; $count = count($results) > 0 ? $results['new'][$stat_id]['max'] : 1; for ($i = 1; $i <= $count; $i++) { $form .= $this->getEditStatRow($stat_id, $modeskill_data, array(), $fractal->fate_game, $results, $i); } } $form .= "</tbody>"; } $form .= "</table>"; } else { $form .= "<h4>Please define Modes for this fractal first, before stats can be edited.</h4>"; } return $form; }
public function getFractalSheet() { $sheet = <<<EOT <style type='text/css'> #charsheet h2 { margin: 0; font-weight: normal; position: relative; font-size: 18px; line-height: 20px; background: #295079; padding: 5px 15px; color: white; border-radius: 0 10px 0 0; font-family: Tahoma, Geneva, sans-serif; } #charsheet .modes h3 { color: #295079; font-family: Tahoma, Geneva, sans-serif; text-align: right; vertical-align: middle; padding: 0px; margin: 0px; } #charsheet .modes h4 { color: #295079; font-family: Tahoma, Geneva, sans-serif; white-space: nowrap; padding: 0px; } #charsheet .modes { width: 100%; border-spacing: 0px; margin-bottom: 0.5em; } #charsheet .modes td { padding: 3px; } #charsheet .modes span { font-weight: bold; } #charsheet .modes tr:nth-child(even) { background-color: #BDD1EC; } #charsheet .block { border: 2px solid #295079; width: auto; margin: 0 0 0.5em 0;padding: 5px 15px; position: relative; } #charsheet .block.consequence { margin-left: 1em; } #charsheet .block.stress { margin-left: 1em; float: left; margin-right: .5em; font-family: monospace; font-size: 22px; font-weight: bold; } #charsheet .block.consequence .value, #charsheet .block.stress .value { position: absolute; font-family: Tahoma, Geneva, sans-serif; font-size: 28px; font-weight: bold; left: -13px; top: -4px; color: #295079} #charsheet .block .block_label { position: absolute; font-family: Tahoma, Geneva, sans-serif; margin: 0px; padding: 0px; font-weight: bold; font-size: 10px; line-height: 10px; top: 0px; left: 2px; color: #999999;} .skill_label { vertical-align: middle; text-align: right; font-size: 18px; font-family: Tahoma, Geneva, sans-serif; } .fate { font-family: monospace; font-size: 22px; font-weight: bold; text-align: center; } .name { font-size: 20px; font-family: Tahoma, Geneva, sans-serif; } #charsheet .approaches .block { padding: 5px 8px; margin: 0 10px 0 5px;} </style> <div id='charsheet'> <div class='name'>{$this->name}</div> EOT; if (array_key_exists(FateGameGlobals::STAT_ASPECT, $this->stats)) { $sheet .= "<H2>ASPECTS</h2>\n"; foreach ($this->stats[FateGameGlobals::STAT_ASPECT] as $aspect) { $sheet .= "<div class='block'>"; if ($aspect->{stat_label}) { $sheet .= "<div class='block_label'>" . $aspect->{stat_label} . "</div>"; } $sheet .= $aspect->{stat_field} . "</div>\n"; } } if (array_key_exists(FateGameGlobals::STAT_SKILL, $this->stats)) { $sheet .= "<H2>" . strtoupper($this->fate_game->skill_alternative ? $this->fate_game->skill_alternative : 'SKILLS') . "</H2>"; if ($this->fate_game->skill_distribution == FateGameGlobals::SKILL_DISTRIBUTION_APPROACHES) { $sheet .= "<table class='approaches'>"; $rows = array(); $count = 0; foreach ($this->stats[FateGameGlobals::STAT_SKILL] as $skill) { $rows[$count] .= "<td class='skill_label'><p>" . $skill->{stat_label} . "</p></td>" . "<td><div class='block'>+" . $skill->{stat_value} . "</div></td>"; $count++; $count %= 2; } $sheet .= "<tr>" . $rows[0] . "</tr><tr>" . $rows[1] . "</tr></table>"; } elseif ($this->fate_game->skill_distribution == FateGameGlobals::SKILL_DISTRIBUTION_MODES) { $ladder = FateGameGlobals::getLadder(); $levels = array_reverse(FateGameGlobals::getModeLevels(), true); $sheet .= "<table class='modes'><tr><td> </td>"; foreach ($this->stats[FateGameGlobals::STAT_MODE] as $mode) { $mode_label = strtoupper($ladder[$mode->{stat_value}] . " (+" . $mode->{stat_value} . ") " . $mode->{stat_field}); $sheet .= "<td><h4>{$mode_label}</h4></td>"; } $sheet .= "</tr>"; foreach ($levels as $level => $label) { $sheet .= "<tr><td><h3>" . strtoupper($label) . "</h3></td>"; foreach ($this->stats[FateGameGlobals::STAT_MODE] as $mode) { $this_mode = $this->skills_by_mode[$mode->{fractal_stat_id}]; if (count($this_mode['skills_by_level'][$level]) > 0) { $level_label = $ladder[$this_mode['mode_value'] + $level] . " (+" . ($this_mode['mode_value'] + $level) . "):"; $label_list = array(); foreach ($this_mode['skills_by_level'][$level] as $skill) { $label_list[] = $skill->{stat_label}; } $sheet .= "<td><span>{$level_label}</span> " . implode(", ", $label_list) . "</td>"; } else { $sheet .= "<td> </td>"; } } $sheet .= "</tr>"; } $sheet .= "</table>"; } /* Other Skill Distributions eventually go here */ } if (array_key_exists(FateGameGlobals::STAT_MOOK, $this->stats)) { $sheet .= "<h2>MOOK SKILLS</h2>\n"; $levels = FateGameGlobals::getMookLevels(); $last_label = ''; $first = 1; foreach ($this->stats[FateGameGlobals::STAT_MOOK] as $mook) { $this_label = $levels[$mook->{stat_value}]; if ($this_label != $last_label) { if (!$first) { $sheet .= "</div>"; } else { $first = 0; } $sheet .= "<div class='block'><div class='block_label'>" . $this_label . ' (' . ($mook->{stat_value} > 0 ? '+' : '') . $mook->{stat_value} . ') at</div>'; $last_label = $this_label; } else { $sheet .= ", "; } $sheet .= $mook->{stat_field}; } if ($last_label) { $sheet .= "</div>"; } } if (array_key_exists(FateGameGlobals::STAT_STUNT, $this->stats)) { $sheet .= "<H2>STUNTS</H2>\n<div class='block'><dl>"; foreach ($this->stats[FateGameGlobals::STAT_STUNT] as $stunt) { $sheet .= "<dt>" . $stunt->{stat_field} . "</dt>" . "<dd>" . $stunt->{stat_description} . "</dd>"; } $sheet .= "</dl></div>\n"; } if (array_key_exists(FateGameGlobals::STAT_CONSEQUENCE, $this->stats)) { $sheet .= "<H2>CONSEQUENCES</H2>\n"; foreach ($this->stats[FateGameGlobals::STAT_CONSEQUENCE] as $consequence) { $sheet .= "<div class='block consequence'><div class='value'>" . $consequence->{stat_display_value} . "</div><div class='block_label'>" . $consequence->{stat_label} . "</div>" . ($consequence->{stat_field} ? $consequence->{stat_field} : ' ') . "</div>\n"; } } $stress_table = ''; $fate_table = ''; if (array_key_exists(FateGameGlobals::STAT_STRESS, $this->stats)) { $stress_table .= '<table>'; foreach ($this->stats[FateGameGlobals::STAT_STRESS] as $stress) { $stress_table .= "<tr><td><h2>" . strtoupper($stress->{stat_label}) . " STRESS</h2></td></tr><tr><td>"; for ($label = 1; $label <= $stress->{stat_max_value}; $label++) { $stress_table .= "<div class='block stress'><div class='value'>{$label}</div>" . ($stress->{stat_value} >= $label ? 'X' : ' ') . "</div>\n"; } $stress_table .= "</td></tr>"; } $stress_table .= "</table>"; } if (array_key_exists(FateGameGlobals::STAT_FATE, $this->stats) || array_key_exists(FateGameGlobals::STAT_REFRESH, $this->stats)) { $fate_table .= "<table><tr><td><h2>FATE POINTS</h2></td></tr><tr><td>"; if (array_key_exists(FateGameGlobals::STAT_REFRESH, $this->stats)) { $refresh = $this->stats[FateGameGlobals::STAT_REFRESH][0]; $fate_table .= "<div class='block fate'><div class='block_label'>Refresh</div>" . $refresh->{stat_value} . "</div>\n"; } if (array_key_exists(FateGameGlobals::STAT_FATE, $this->stats)) { $fate = $this->stats[FateGameGlobals::STAT_FATE][0]; $fate_table .= "<div class='block fate'><div class='block_label'>Current</div>" . $fate->{stat_value} . "</div>\n"; } $fate_table .= "</td></tr></table>"; } if ($stress_table || $fate_table) { $sheet .= "<table><tr>"; if ($stress_table) { $sheet .= "<td valign='top'>" . $stress_table . "</td>"; } if ($fate_table) { $sheet .= "<td valign='top'>" . $fate_table . "</td>"; } $sheet .= "</tr></table>"; } $sheet .= "</div>"; return $sheet; }