unit; $stars = $unit->stars; $level = true; $teams = (sizeof($unit->teams) > 0); $lock = $unit->lock; $storage = $unit->in_storage; $maxed = ($unit->level == 40 && $unit->are_skills_maxed()); } elseif ($unit instanceof K_Unit){ $k = $unit; $stars = $unit->base_stars; $level = false; $teams = 0; $lock = false; $storage = false; $maxed = false; } else{ return ""; } $html = ""; if ($k->awakens_from == "" && $k->awakens_to == ""){ // No to, no from if ($k->base_stars >= 4){ // SFV Collab event units, always awakened. $star_class = "star_purple"; } elseif($k->archetype == ARCHETYPE_ID::MATERIAL && $k->element == ELEMENT_ID::LIGHT){ // Rainbowmon, always awakened $star_class = "star_purple"; } elseif($k->archetype == ARCHETYPE_ID::MATERIAL && $k->element == ELEMENT_ID::DARK){ // Devilmon, always unawakened $star_class = "star_silver"; } else{ // Unawakeable monster $star_class = "star_silver"; } } elseif ($k->awakens_from != ""){ // Already awakened if ($k->base_stars - $k->natural_stars == 1){ // Normal awaken. $star_class ="star_purple"; } else{ // Second awaken. $star_class ="star_red"; } } elseif ($k->awakens_to != ""){ // Awakeable. $star_class ="star_gold"; } $html .= "\n"; for ($i = 0; $i < $stars; $i ++){ $html .= "\n"; } $html .= "\n"; $html .= "\n"; if ($level){ $html .= "\n"; $html .= $unit->level . "\n"; $html .= "\n"; } $html .= "\n"; if ($maxed){ $html .= ""; } if ($teams > 0){ $title = $teams . " teams"; if ($teams == 1){ $title = "1 team: " . $unit->teams[0]->name; } $html .= ""; } if ($lock == 1){ $html .= ""; } if ($storage){ $html .= ""; } $html .= "\n"; return $html; } /** * Generates a transformed monster panel. * * @param Unit|K_Unit Entity to get the info from. * @return string HTML content for a monster panel. Empty on error. */ public static function unit_transformation_panel($unit) { $html = ""; if ($unit instanceof Unit){ $k = $unit->unit; } elseif ($unit instanceof K_Unit){ $k = $unit; } else{ return ""; } if ($k->transformation == null){ return ""; } $html .= "
\n"; $html .= "\n"; $html .= "
\n"; return $html; } /** * Generates a rune panel. * * @param Rune rune Entity to get the info from. * @param Unit unit Optional. The unit the rune is assigned to. * @return string HTML content for a rune panel. Empty on error. */ public static function rune_panel($rune, $unit = null) { if (!($rune instanceof Rune)){ return ""; } $html = ""; $html .= "
\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; for ($i = 0; $i < $rune->stars; $i ++){ $html .= "\n"; } $html .= "\n"; $html .= "\n"; $html .= $rune->level . "\n"; $html .= "\n"; $html .= "
\n"; if ($unit instanceof Unit){ $html .= "
\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
\n"; } return $html; } /** * Generates a rune table. * * @param Rune rune Entity to get the info from. * @param Unit unit Optional. The unit the rune is assigned to. * @return string HTML content for a rune table. Empty on error. */ public static function rune_table($rune, $unit = null) { if (!($rune instanceof Rune)){ return ""; } $html = ""; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; // Details $html .= "\n"; $html .= "\n"; $html .= "
\n"; $html .= HTML::rune_panel($rune, $unit) . "\n"; $html .= "\n"; $html .= "\n"; // Main stat $html .= "\n"; $html .= "\n"; $html .= "\n"; // Innate stat $html .= "\n"; $html .= "\n"; $html .= "\n"; $substats = array($rune->substat_1, $rune->substat_2, $rune->substat_3, $rune->substat_4); $substats_name = array($rune->substat_1_name, $rune->substat_2_name, $rune->substat_3_name, $rune->substat_4_name); $substats_value = array($rune->substat_1_value, $rune->substat_2_value, $rune->substat_3_value, $rune->substat_4_value); $substats_grind = array($rune->substat_1_grind, $rune->substat_2_grind, $rune->substat_3_grind, $rune->substat_4_grind); $substats_enchant = array($rune->substat_1_enchant, $rune->substat_2_enchant, $rune->substat_3_enchant, $rune->substat_4_enchant); for ($i = 0; $i < 4; $i ++){ if (strlen($substats_name[$i]) == 0){ $stat_name = " "; $stat_value = ""; } elseif (in_array($substats_name[$i], array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){ $stat_name = str_replace("%", "", $substats_name[$i]); $stat_value = "+ " . $substats_value[$i] . "%"; } else{ $stat_name = $substats_name[$i]; $stat_value = "+ " . $substats_value[$i]; } $grind = ""; if ($substats_grind[$i] > 0){ $grind = "+" . $substats_grind[$i]; if (in_array($substats_name[$i], array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){ $grind = $grind . "%"; } } $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; } $html .= "
\n"; if (in_array($rune->main_stat_name, array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){ $stat_name = str_replace("%", "", $rune->main_stat_name); $stat_value = "+ " . $rune->main_stat_value . "%"; } else{ $stat_name = $rune->main_stat_name; $stat_value = "+ " . $rune->main_stat_value; } $html .= $stat_name . "\n"; $html .= "\n"; $html .= $stat_value . "\n"; $html .= "\n"; $html .= "
\n"; if (strlen($rune->innate_stat) == 0){ $stat_name = " "; $stat_value = ""; } elseif (in_array($rune->innate_stat_name, array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){ $stat_name = str_replace("%", "", $rune->innate_stat_name); $stat_value = "+ " . $rune->innate_stat_value . "%"; } else{ $stat_name = $rune->innate_stat_name; $stat_value = "+ " . $rune->innate_stat_value; } $html .= $stat_name . "\n"; $html .= "\n"; $html .= $stat_value . "\n"; $html .= "\n"; $html .= "
\n"; $html .= $stat_name . "\n"; $html .= "\n"; $html .= $stat_value . "\n"; $html .= "\n"; $html .= $grind . "\n"; $html .= "\n"; if ($substats_enchant[$i] == 1){ $html .= "\n"; } $html .= "
\n"; $html .= "
\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
\n"; $html .= "Quality:\n"; $html .= "\n"; $html .= "\n"; $html .= $rune->quality_name . "\n"; $html .= "\n"; $html .= "
\n"; $html .= "Original q.:\n"; $html .= "\n"; $html .= "\n"; $html .= $rune->original_quality_name . "\n"; $html .= "\n"; $html .= "
\n"; $html .= "Value:\n"; $html .= "\n"; $html .= number_format($rune->value, 0, ".", ",") . "\n"; $html .= "
\n"; $html .= "Efficiency:\n"; $html .= "\n"; $html .= number_format($rune->efficiency, 2, ".", ",") . "%\n"; $html .= "
\n"; $html .= "Max. eff.:\n"; $html .= "\n"; $html .= number_format($rune->max_efficiency, 2, ".", ",") . "%\n"; $html .= "
\n"; $html .= "Reached. eff.:\n"; $html .= "\n"; $html .= number_format($rune->efficiency * 100 / $rune->max_efficiency, 2, ".", ",") . "%\n"; $html .= "
\n"; $html .= "
\n"; return $html; } // TODO: Icon and background selection must go in the entity code. /** * Generates an artifact panel. * * @param Artifact artifact Entity to get the info from. * @param Unit unit Optional. The unit the artifact is assigned to. * @return string HTML content for an artifact panel. Empty on error. */ public static function artifact_panel($artifact, $unit = null) { if (!($artifact instanceof Artifact)){ return ""; } $html = ""; $html .= "
\n"; $background = ""; $icon = ""; if ($artifact->type == ARTIFACT_TYPE::ARCHETYPE){ $background = URL::IMG["ARTIFACT"] . "type_" . strtolower($artifact->quality_name) . ".png"; $icon = URL::IMG["ARTIFACT"] . "type_"; switch ($artifact->type){ case ARCHETYPE_ID::ATTACK: $icon .= "attack"; break; case ARCHETYPE_ID::DEFENSE: $icon .= "defense"; break; case ARCHETYPE_ID::HP: $icon .= "hp"; break; case ARCHETYPE_ID::SUPPORT: $icon .= "support"; break; } $icon .= ".png"; } else{ $background = URL::IMG["ARTIFACT"] . "element_" . strtolower($artifact->quality_name) . ".png"; $icon = URL::IMG["ARTIFACT"] . "element_"; switch ($artifact->element){ case ELEMENT_ID::WATER: $icon .= "water"; break; case ELEMENT_ID::WIND: $icon .= "wind"; break; case ELEMENT_ID::FIRE: $icon .= "fire"; break; case ELEMENT_ID::LIGHT: $icon .= "light"; break; case ELEMENT_ID::DARK: $icon .= "dark"; break; } $icon .= ".png"; } $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= $artifact->level . "\n"; $html .= "\n"; $html .= "
\n"; if ($unit instanceof Unit){ $html .= "
\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
\n"; } return $html; } /** * Generates a artifact table. * * @param Artifact artifact Entity to get the info from. * @param Unit unit Optional. The unit the artifact is assigned to. * @return string HTML content for a artifact table. Empty on error. */ public static function artifact_table($artifact, $unit = null) { if (!($artifact instanceof Artifact)){ return ""; } $html = ""; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; // Details /* TODO: Only quaity data, and for that the icon is enough $html .= "\n"; $html .= "\n"; $html .= "
\n"; $html .= HTML::artifact_panel($artifact, $unit) . "\n"; $html .= "\n"; $html .= "\n"; // Main stat $html .= "\n"; $html .= "\n"; $html .= "\n"; $effects = array($artifact->effect_1_description, $artifact->effect_2_description, $artifact->effect_3_description, $artifact->effect_4_description); for ($i = 0; $i < 4; $i ++){ $html .= "\n"; $html .= "\n"; $html .= "\n"; } $html .= "
\n"; $stat_name = $artifact->main_stat_name; $stat_value = "+ " . $artifact->main_stat_value; $html .= $stat_name . "\n"; $html .= $stat_value . "\n"; $html .= "
\n"; $html .= $effects[$i]; $html .= "
\n"; $html .= "
\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "
\n"; $html .= "Quality:\n"; $html .= "\n"; $html .= "\n"; $html .= $artifact->quality_name . "\n"; $html .= "\n"; $html .= "
\n"; $html .= "Original q.:\n"; $html .= "\n"; $html .= "\n"; $html .= $artifact->original_quality_name . "\n"; $html .= "\n"; $html .= "
\n"; // TODO: No data on value yet $html .= ""; //"Value:\n"; $html .= "\n"; // TODO: No data on value yet $html .= ""; //number_format($artifact->value, 0, ".", ",") . "\n"; $html .= "
\n"; // TODO: No data on efficiencies yet $html .= ""; //"Efficiency:\n"; $html .= "\n"; // TODO: No data on efficiencies yet $html .= ""; //number_format($artifact->efficiency, 2, ".", ",") . "%\n"; $html .= "
\n"; // TODO: No data on efficiencies yet $html .= ""; //"Max. eff.:\n"; $html .= "\n"; // TODO: No data on efficiencies yet $html .= ""; //number_format($artifact->max_efficiency, 2, ".", ",") . "%\n"; $html .= "
\n"; // TODO: No data on efficiencies yet $html .= ""; //"Reached. eff.:\n"; $html .= "\n"; // TODO: No data on efficiencies yet $html .= ""; //number_format($artifact->efficiency * 100 / $artifact->max_efficiency, 2, ".", ",") . "%\n"; $html .= "
\n"; */ $html .= "
\n"; return $html; } /** * Generates a grindstone or gem panel. * * @param Rune_Craft craft Entity to get the info from. * @return string HTML content for a rune panel. Empty on error. */ public static function craft_panel($craft) { if (!($craft instanceof Rune_Craft)){ return ""; } $html = ""; if ($craft->gem == 1){ if ($craft->inmemorial == 1){ $base = URL::IMG["GRIND"] . "gem_inmemorial.png"; } else{ $base = URL::IMG["GRIND"] . "gem.png"; } } else{ if ($craft->inmemorial == 1){ $base = URL::IMG["GRIND"] . "grind_inmemorial.png"; } else{ $base = URL::IMG["GRIND"] . "grind.png"; } } if ($craft->inmemorial == 0 && isset($craft->rune)){ $icon = "\n"; } else{ $icon = ""; } if (in_array($craft->stat_name, array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){ $stat_name = str_replace("%", "", $craft->stat_name); $stat_value = "+ " . $craft->min . "~" . $craft->max . "%"; } else{ $stat_name = $craft->stat_name; $stat_value = "+ " . $craft->min . "~" . $craft->max; } $html .= "
\n"; $html .= "\n"; $html .= $icon; $html .= "\n"; $html .= "" . $stat_name . "\n"; $html .= "" . $stat_value . "\n"; $html .= "\n"; $html .= "\n"; $html .= "x" . $craft->amount . "\n"; $html .= "\n"; $html .= "
\n"; return $html; } /** * Generates a building panel. * * @param Building|Decoration|K_Building|K_Decoration $building Entity to get the info from. * @return string HTML content for a building panel. Empty on error. */ public static function building_panel($building) { if ($building instanceof Building){ $level = false; $title = $building->building->name; $description = $building->building->description; $img = $building->building->get_image(); } elseif ($building instanceof K_Building){ $level = false; $title = $building->name; $description = $building->building->description; $img = $building->get_image(); } elseif ($building instanceof Decoration){ $level = $building->level; $title = $building->decoration->name; $description = $building->decoration->description; $img = $building->decoration->get_image(); } elseif ($building instanceof K_Decoration){ $level = false; $title = $building->name; $description = $building->building->description; $img = $building->get_image(); } else{ return ""; } if (strlen($description) > 0){ $title .= ": " . $description; } $html = ""; $html = "
\n"; $html .= "\n"; if ($level){ $html .= "\n"; $html .= $level . "\n"; $html .= "\n"; } $html .= "
\n"; return $html; } /** * Generates a item panel. * * @param Inventory $item Entity to get the info from. * @return string HTML content for a building panel. Empty on error. */ public static function item_panel($item) { if (!($item instanceof Inventory)){ return ""; } $html = ""; $html = "
\n"; $html .= "\n"; $html .= "\n"; $html .= $item->amount . "\n"; $html .= "\n"; $html .= "
\n"; return $html; } /** * Generates an arena rank icon image. * * @param int $d Arena rank id. * @return string HTML content for the image. */ public static function arena_rank_icon($id) { switch ($id){ case ARENA_RANK_ID::BEGINER: $src = URL::IMG["RANK"] . "0901.png"; $tit = "Beginer"; break; case ARENA_RANK_ID::CHALLENGER_1: $src = URL::IMG["RANK"] . "1001.png"; $tit = "Challenger 1"; break; case ARENA_RANK_ID::CHALLENGER_2: $src = URL::IMG["RANK"] . "1002.png"; $tit = "Challenger 2"; break; case ARENA_RANK_ID::CHALLENGER_3: $src = URL::IMG["RANK"] . "1003.png"; $tit = "Challenger 3"; break; case ARENA_RANK_ID::FIGHTER_1: $src = URL::IMG["RANK"] . "2001.png"; $tit = "Fighter 1"; break; case ARENA_RANK_ID::FIGHTER_2: $src = URL::IMG["RANK"] . "2002.png"; $tit = "Fighter 2"; break; case ARENA_RANK_ID::FIGHTER_3: $src = URL::IMG["RANK"] . "2003.png"; $tit = "Fighter 3"; break; case ARENA_RANK_ID::CONQUEROR_1: $src = URL::IMG["RANK"] . "3001.png"; $tit = "Conqueror 1"; break; case ARENA_RANK_ID::CONQUEROR_2: $src = URL::IMG["RANK"] . "3002.png"; $tit = "Conqueror 2"; break; case ARENA_RANK_ID::CONQUEROR_3: $src = URL::IMG["RANK"] . "3003.png"; $tit = "Conqueror 3"; break; case ARENA_RANK_ID::GUARDIAN_1: $src = URL::IMG["RANK"] . "4001.png"; $tit = "Guardian 1"; break; case ARENA_RANK_ID::GUARDIAN_2: $src = URL::IMG["RANK"] . "4002.png"; $tit = "Guardian 2"; break; case ARENA_RANK_ID::GUARDIAN_3: $src = URL::IMG["RANK"] . "4003.png"; $tit = "Guardian 3"; break; case ARENA_RANK_ID::LEGEND: $src = URL::IMG["RANK"] . "5001.png"; $tit = "Legend"; default: $src = URL::IMG["RANK"] . $id . ".png"; } $html = "$tit"; return $html; } } ?>