|
@@ -1,722 +1,719 @@
|
|
|
<?php
|
|
<?php
|
|
|
- /**
|
|
|
|
|
- * HTML helper file.
|
|
|
|
|
- *
|
|
|
|
|
- * Provides a helper to perform HTML operations.
|
|
|
|
|
- *
|
|
|
|
|
- * @category Helper.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * HTML helper file.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Provides a helper to perform HTML operations.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author Iñigo Valentin <i@inigovalentin.com>
|
|
|
|
|
+ * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
|
|
|
|
|
+ * @package SWDB
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Require dependent files if not present.
|
|
|
|
|
- */
|
|
|
|
|
- require_once(PATH::HELPER . "Helper.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Unit.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Monster.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Building.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Buildable.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Decoration.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Decorative.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Rune.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Artifact.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Enchantment.php");
|
|
|
|
|
- require_once(PATH::ENTITY . "Item.php");
|
|
|
|
|
|
|
+require_once(PATH::HELPER . "Helper.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Unit.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Monster.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Building.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Buildable.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Decoration.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Decorative.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Rune.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Artifact.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Enchantment.php");
|
|
|
|
|
+require_once(PATH::ENTITY . "Item.php");
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * HTML helper.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Contains utilities to parse and format HTML and to build elements.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @category Helper.
|
|
|
|
|
+ */
|
|
|
|
|
+final class HTML extends Helper{
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * HTML helper.
|
|
|
|
|
- *
|
|
|
|
|
- * Contains utilities to parse and format HTML and to build elements.
|
|
|
|
|
|
|
+ * Escapes HTML characters
|
|
|
|
|
+ *
|
|
|
|
|
+ * Alias for htmlspecialchars([input], ENT_QUOTES)
|
|
|
*
|
|
*
|
|
|
- * @category Helper.
|
|
|
|
|
|
|
+ * @param string $input Text to escape.
|
|
|
|
|
+ * @return string Escaped text.
|
|
|
*/
|
|
*/
|
|
|
- final class HTML extends Helper{
|
|
|
|
|
|
|
+ public static function e($input){
|
|
|
|
|
+ return htmlspecialchars($input, ENT_QUOTES);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Escapes HTML characters
|
|
|
|
|
- *
|
|
|
|
|
- * Alias for htmlspecialchars([input], ENT_QUOTES)
|
|
|
|
|
- *
|
|
|
|
|
- * @param string $input Text to escape.
|
|
|
|
|
- * @return string Escaped text.
|
|
|
|
|
- */
|
|
|
|
|
- public static function e($input){
|
|
|
|
|
- return htmlspecialchars($input, ENT_QUOTES);
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Generates a unit panel.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param Unit|Monster Entity to get the info from.
|
|
|
|
|
+ * @return string HTML content for a monster panel. Empty on error.
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function unit_panel($unit) {
|
|
|
|
|
+ if ($unit instanceof Unit){
|
|
|
|
|
+ $k = $unit->get_monster();
|
|
|
|
|
+ $stars = $unit->get_stars();
|
|
|
|
|
+ $level = true;
|
|
|
|
|
+ $teams = (sizeof($unit->get_teams()) > 0);
|
|
|
|
|
+ $lock = $unit->is_locked();
|
|
|
|
|
+ $storage = $unit->is_in_storage();
|
|
|
|
|
+ $maxed = ($unit->get_level() == 40 && $unit->is_fully_skilled());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Generates a unit panel.
|
|
|
|
|
- *
|
|
|
|
|
- * @param Unit|Monster Entity to get the info from.
|
|
|
|
|
- * @return string HTML content for a monster panel. Empty on error.
|
|
|
|
|
- */
|
|
|
|
|
- public static function unit_panel($unit) {
|
|
|
|
|
- if ($unit instanceof Unit){
|
|
|
|
|
- $k = $unit->get_monster();
|
|
|
|
|
- $stars = $unit->get_stars();
|
|
|
|
|
- $level = true;
|
|
|
|
|
- $teams = (sizeof($unit->get_teams()) > 0);
|
|
|
|
|
- $lock = $unit->is_locked();
|
|
|
|
|
- $storage = $unit->is_in_storage();
|
|
|
|
|
- $maxed = ($unit->get_level() == 40 && $unit->is_fully_skilled());
|
|
|
|
|
- }
|
|
|
|
|
- elseif ($unit instanceof Monster){
|
|
|
|
|
- $k = $unit;
|
|
|
|
|
- $stars = $unit->get_base_stars();
|
|
|
|
|
- $level = false;
|
|
|
|
|
- $teams = 0;
|
|
|
|
|
- $lock = false;
|
|
|
|
|
- $storage = false;
|
|
|
|
|
- $maxed = false;
|
|
|
|
|
|
|
+ elseif ($unit instanceof Monster){
|
|
|
|
|
+ $k = $unit;
|
|
|
|
|
+ $stars = $unit->get_base_stars();
|
|
|
|
|
+ $level = false;
|
|
|
|
|
+ $teams = 0;
|
|
|
|
|
+ $lock = false;
|
|
|
|
|
+ $storage = false;
|
|
|
|
|
+ $maxed = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html = "";
|
|
|
|
|
+ if ($k->get_awakens_from() == null && $k->get_awakens_to() == null){
|
|
|
|
|
+ // No to, no from
|
|
|
|
|
+ if ($k->get_base_stars() >= 4){
|
|
|
|
|
+ // SFV Collab event units, always awakened.
|
|
|
|
|
+ $star_class = "star_purple";
|
|
|
}
|
|
}
|
|
|
- else{
|
|
|
|
|
- return "";
|
|
|
|
|
|
|
+ elseif($k->get_archetype() == ARCHETYPE_ID::MATERIAL && $k->get_element() == ELEMENT_ID::LIGHT){
|
|
|
|
|
+ // Rainbowmon, always awakened
|
|
|
|
|
+ $star_class = "star_purple";
|
|
|
}
|
|
}
|
|
|
- $html = "";
|
|
|
|
|
- if ($k->get_awakens_from() == null && $k->get_awakens_to() == null){
|
|
|
|
|
- // No to, no from
|
|
|
|
|
- if ($k->get_base_stars() >= 4){
|
|
|
|
|
- // SFV Collab event units, always awakened.
|
|
|
|
|
- $star_class = "star_purple";
|
|
|
|
|
- }
|
|
|
|
|
- elseif($k->get_archetype() == ARCHETYPE_ID::MATERIAL && $k->get_element() == ELEMENT_ID::LIGHT){
|
|
|
|
|
- // Rainbowmon, always awakened
|
|
|
|
|
- $star_class = "star_purple";
|
|
|
|
|
- }
|
|
|
|
|
- elseif($k->get_archetype() == ARCHETYPE_ID::MATERIAL && $k->get_element() == ELEMENT_ID::DARK){
|
|
|
|
|
- // Devilmon, always unawakened
|
|
|
|
|
- $star_class = "star_silver";
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- // Unawakeable monster
|
|
|
|
|
- $star_class = "star_silver";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ elseif($k->get_archetype() == ARCHETYPE_ID::MATERIAL && $k->get_element() == ELEMENT_ID::DARK){
|
|
|
|
|
+ // Devilmon, always unawakened
|
|
|
|
|
+ $star_class = "star_silver";
|
|
|
}
|
|
}
|
|
|
- elseif ($k->get_awakens_from() != ""){
|
|
|
|
|
- // Already awakened
|
|
|
|
|
- if ($k->get_base_stars() - $k->get_natural_stars() == 1){
|
|
|
|
|
- // Normal awaken.
|
|
|
|
|
- $star_class ="star_purple";
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- // Second awaken.
|
|
|
|
|
- $star_class ="star_red";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ else{
|
|
|
|
|
+ // Unawakeable monster
|
|
|
|
|
+ $star_class = "star_silver";
|
|
|
}
|
|
}
|
|
|
- elseif ($k->get_awakens_to() != ""){
|
|
|
|
|
- // Awakeable.
|
|
|
|
|
- $star_class ="star_gold";
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ elseif ($k->get_awakens_from() != ""){
|
|
|
|
|
+ // Already awakened
|
|
|
|
|
+ if ($k->get_base_stars() - $k->get_natural_stars() == 1){
|
|
|
|
|
+ // Normal awaken.
|
|
|
|
|
+ $star_class ="star_purple";
|
|
|
}
|
|
}
|
|
|
- $html .= "<span class='stars'>\n";
|
|
|
|
|
- for ($i = 0; $i < $stars; $i ++){
|
|
|
|
|
- $html .= "<img class='star $star_class' src='" . URL::IMG["ICON"] . "star.png'/>\n";
|
|
|
|
|
|
|
+ else{
|
|
|
|
|
+ // Second awaken.
|
|
|
|
|
+ $star_class ="star_red";
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+ elseif ($k->get_awakens_to() != ""){
|
|
|
|
|
+ // Awakeable.
|
|
|
|
|
+ $star_class ="star_gold";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= "<span class='stars'>\n";
|
|
|
|
|
+ for ($i = 0; $i < $stars; $i ++){
|
|
|
|
|
+ $html .= "<img class='star $star_class' src='" . URL::IMG["ICON"] . "star.png'/>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ $html .= "<img title='" . $k->get_title() . "' class='monster border_" . $k->get_element_name() . "' src='" . $k->get_image() . "'/>\n";
|
|
|
|
|
+ if ($level){
|
|
|
|
|
+ $html .= "<span class='level'>\n";
|
|
|
|
|
+ $html .= $unit->get_level() . "\n";
|
|
|
$html .= "</span>\n";
|
|
$html .= "</span>\n";
|
|
|
- $html .= "<img title='" . $k->get_title() . "' class='monster border_" . $k->get_element_name() . "' src='" . $k->get_image() . "'/>\n";
|
|
|
|
|
- if ($level){
|
|
|
|
|
- $html .= "<span class='level'>\n";
|
|
|
|
|
- $html .= $unit->get_level() . "\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "<span class='badges'>\n";
|
|
|
|
|
- if ($maxed){
|
|
|
|
|
- $html .= "<img title='Maxed unit' src='" . URL::IMG["ICON"] . "maxed.png'>";
|
|
|
|
|
- }
|
|
|
|
|
- if ($teams > 0){
|
|
|
|
|
- $title = $teams . " teams";
|
|
|
|
|
- if ($teams == 1){
|
|
|
|
|
- $title = "1 team: " . $unit->get_teams()[0]->get_name();
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "<img title='$title' src='" . URL::IMG["ICON"] . "team.png'>";
|
|
|
|
|
- }
|
|
|
|
|
- if ($lock == 1){
|
|
|
|
|
- $html .= "<img title='Locked' src='" . URL::IMG["ICON"] . "lock.png'>";
|
|
|
|
|
- }
|
|
|
|
|
- if ($storage){
|
|
|
|
|
- $html .= "<img title='In storage' src='" . URL::IMG["ICON"] . "storage.png'>";
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= "<span class='badges'>\n";
|
|
|
|
|
+ if ($maxed){
|
|
|
|
|
+ $html .= "<img title='Maxed unit' src='" . URL::IMG["ICON"] . "maxed.png'>";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($teams > 0){
|
|
|
|
|
+ $title = $teams . " teams";
|
|
|
|
|
+ if ($teams == 1){
|
|
|
|
|
+ $title = "1 team: " . $unit->get_teams()[0]->get_name();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
- return $html;
|
|
|
|
|
|
|
+ $html .= "<img title='$title' src='" . URL::IMG["ICON"] . "team.png'>";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($lock == 1){
|
|
|
|
|
+ $html .= "<img title='Locked' src='" . URL::IMG["ICON"] . "lock.png'>";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($storage){
|
|
|
|
|
+ $html .= "<img title='In storage' src='" . URL::IMG["ICON"] . "storage.png'>";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Generates a transformed monster panel.
|
|
|
|
|
- *
|
|
|
|
|
- * @param Unit|Monster 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->get_unit();
|
|
|
|
|
- }
|
|
|
|
|
- elseif ($unit instanceof Monster){
|
|
|
|
|
- $k = $unit;
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- return "";
|
|
|
|
|
- }
|
|
|
|
|
- if ($k->get_transformation() == null){
|
|
|
|
|
- return "";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "<div class='monster_transformation_panel'>\n";
|
|
|
|
|
- $html .= "<img title='" . $unit->get_title() . " (transformed)' class='monster_transformation border_" . $k->get_element_name() . "' src='" . $k->get_transformation()->get_image() . "'/>\n";
|
|
|
|
|
- $html .= "</div>\n";
|
|
|
|
|
- return $html;
|
|
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ return $html;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Generates a transformed monster panel.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param Unit|Monster 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->get_unit();
|
|
|
|
|
+ }
|
|
|
|
|
+ elseif ($unit instanceof Monster){
|
|
|
|
|
+ $k = $unit;
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($k->get_transformation() == null){
|
|
|
|
|
+ return "";
|
|
|
}
|
|
}
|
|
|
|
|
+ $html .= "<div class='monster_transformation_panel'>\n";
|
|
|
|
|
+ $html .= "<img title='" . $unit->get_title() . " (transformed)' class='monster_transformation border_" . $k->get_element_name() . "' src='" . $k->get_transformation()->get_image() . "'/>\n";
|
|
|
|
|
+ $html .= "</div>\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 .= "<div class='rune_panel rune_slot_" . $rune->get_slot() . " rune_level_" . $rune->get_level() . " rune_quality_" . strtolower($rune->get_quality_name()) . " rune_original_quality_" . strtolower($rune->get_original_quality_name()) . " rune_ancient_" . (int) $rune->is_ancient() . "'>\n";
|
|
|
|
|
- $html .= "<img class='rune_base' src='" . URL::IMG["RUNE"] . "base.png'/>\n";
|
|
|
|
|
- $html .= "<img class='rune_icon' src='" . $rune->get_set()->get_image() . "'/>\n";
|
|
|
|
|
- $html .= "<span class='rune_stars'>\n";
|
|
|
|
|
- $star_color = "gold";
|
|
|
|
|
- if ($rune->geT_level() == 15){
|
|
|
|
|
- $star_color = "purple";
|
|
|
|
|
- }
|
|
|
|
|
- for ($i = 0; $i < $rune->get_stars(); $i ++){
|
|
|
|
|
- $html .= "<img class='star star_$star_color' src='" . URL::IMG["ICON"] . "star.png'/>\n";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
- $html .= "<span class='rune_level'>\n";
|
|
|
|
|
- $html .= $rune->get_level() . "\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 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 .= "<div class='rune_panel rune_slot_" . $rune->get_slot() . " rune_level_" . $rune->get_level() . " rune_quality_" . strtolower($rune->get_quality_name()) . " rune_original_quality_" . strtolower($rune->get_original_quality_name()) . " rune_ancient_" . (int) $rune->is_ancient() . "'>\n";
|
|
|
|
|
+ $html .= "<img class='rune_base' src='" . URL::IMG["RUNE"] . "base.png'/>\n";
|
|
|
|
|
+ $html .= "<img class='rune_icon' src='" . $rune->get_set()->get_image() . "'/>\n";
|
|
|
|
|
+ $html .= "<span class='rune_stars'>\n";
|
|
|
|
|
+ $star_color = "gold";
|
|
|
|
|
+ if ($rune->geT_level() == 15){
|
|
|
|
|
+ $star_color = "purple";
|
|
|
|
|
+ }
|
|
|
|
|
+ for ($i = 0; $i < $rune->get_stars(); $i ++){
|
|
|
|
|
+ $html .= "<img class='star star_$star_color' src='" . URL::IMG["ICON"] . "star.png'/>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ $html .= "<span class='rune_level'>\n";
|
|
|
|
|
+ $html .= $rune->get_level() . "\n";
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ $html .= "</div>\n";
|
|
|
|
|
+ if ($unit instanceof Unit){
|
|
|
|
|
+ $html .= "<div class='assigned'>\n";
|
|
|
|
|
+ $html .= "<a target='blank' href='/monsters/" . $unit->get_id() . "'>\n";
|
|
|
|
|
+ $html .= "<img title='" . $unit->get_title() . "' class='monster_image border_" . $unit->get_monster()->get_element_name() . "' src='" . $unit->get_monster()->get_image() . "'/>\n";
|
|
|
|
|
+ $html .= "</a>\n";
|
|
|
$html .= "</div>\n";
|
|
$html .= "</div>\n";
|
|
|
- if ($unit instanceof Unit){
|
|
|
|
|
- $html .= "<div class='assigned'>\n";
|
|
|
|
|
- $html .= "<a target='blank' href='/monsters/" . $unit->get_id() . "'>\n";
|
|
|
|
|
- $html .= "<img title='" . $unit->get_title() . "' class='monster_image border_" . $unit->get_monster()->get_element_name() . "' src='" . $unit->get_monster()->get_image() . "'/>\n";
|
|
|
|
|
- $html .= "</a>\n";
|
|
|
|
|
- $html .= "</div>\n";
|
|
|
|
|
- }
|
|
|
|
|
- return $html;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ 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 .= "<table class='rune' id='rune-" . $rune->get_id() . "'>\n";
|
|
|
|
|
- $html .= "<tr>\n";
|
|
|
|
|
- $html .= "<td class='icon'>\n";
|
|
|
|
|
- $html .= HTML::rune_panel($rune, $unit) . "\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='stats'>\n";
|
|
|
|
|
- $html .= "<table>\n";
|
|
|
|
|
- // Main stat
|
|
|
|
|
- $html .= "<tr class='main_stat'>\n";
|
|
|
|
|
- $html .= "<td class='stat'>\n";
|
|
|
|
|
- if (in_array($rune->get_main_stat()->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
- $stat_name = str_replace("%", "", $rune->get_main_stat()->get_stat_name());
|
|
|
|
|
- $stat_value = "+" . $rune->get_main_stat()->get_value() . "%";
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- $stat_name = $rune->get_main_stat()->get_stat_name();
|
|
|
|
|
- $stat_value = "+" . $rune->get_main_stat()->get_value(). " ";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= $stat_name . "\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='value'>\n";
|
|
|
|
|
- $html .= $stat_value . "\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='grind'>\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='enchant'>\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
- // Innate stat
|
|
|
|
|
- $html .= "<tr class='innate_stat'>\n";
|
|
|
|
|
- $html .= "<td class='stat'>\n";
|
|
|
|
|
- if ($rune->get_innate_stat() == null){
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 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 .= "<table class='rune' id='rune-" . $rune->get_id() . "'>\n";
|
|
|
|
|
+ $html .= "<tr>\n";
|
|
|
|
|
+ $html .= "<td class='icon'>\n";
|
|
|
|
|
+ $html .= HTML::rune_panel($rune, $unit) . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='stats'>\n";
|
|
|
|
|
+ $html .= "<table>\n";
|
|
|
|
|
+ // Main stat
|
|
|
|
|
+ $html .= "<tr class='main_stat'>\n";
|
|
|
|
|
+ $html .= "<td class='stat'>\n";
|
|
|
|
|
+ if (in_array($rune->get_main_stat()->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
+ $stat_name = str_replace("%", "", $rune->get_main_stat()->get_stat_name());
|
|
|
|
|
+ $stat_value = "+" . $rune->get_main_stat()->get_value() . "%";
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ $stat_name = $rune->get_main_stat()->get_stat_name();
|
|
|
|
|
+ $stat_value = "+" . $rune->get_main_stat()->get_value(). " ";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= $stat_name . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='value'>\n";
|
|
|
|
|
+ $html .= $stat_value . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='grind'>\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='enchant'>\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ // Innate stat
|
|
|
|
|
+ $html .= "<tr class='innate_stat'>\n";
|
|
|
|
|
+ $html .= "<td class='stat'>\n";
|
|
|
|
|
+ if ($rune->get_innate_stat() == null){
|
|
|
|
|
+ $stat_name = " ";
|
|
|
|
|
+ $stat_value = "";
|
|
|
|
|
+ }
|
|
|
|
|
+ elseif (in_array($rune->get_innate_stat()->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
+ $stat_name = str_replace("%", "", $rune->get_innate_stat()->get_stat_name());
|
|
|
|
|
+ $stat_value = "+" . $rune->get_innate_stat()->get_value() . "%";
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ $stat_name = $rune->get_innate_stat()->get_stat_name();
|
|
|
|
|
+ $stat_value = "+" . $rune->get_innate_stat()->get_value(). " ";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= $stat_name . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='value'>\n";
|
|
|
|
|
+ $html .= $stat_value . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='grind'>\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ for ($i = 0; $i < 4; $i ++){
|
|
|
|
|
+ if ($rune->get_substats()[$i] == null){
|
|
|
$stat_name = " ";
|
|
$stat_name = " ";
|
|
|
$stat_value = "";
|
|
$stat_value = "";
|
|
|
}
|
|
}
|
|
|
- elseif (in_array($rune->get_innate_stat()->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
- $stat_name = str_replace("%", "", $rune->get_innate_stat()->get_stat_name());
|
|
|
|
|
- $stat_value = "+" . $rune->get_innate_stat()->get_value() . "%";
|
|
|
|
|
|
|
+ elseif (in_array($rune->get_substats()[$i]->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
+ $stat_name = str_replace("%", "", $rune->get_substats()[$i]->get_stat_name());
|
|
|
|
|
+ $stat_value = "+" . $rune->get_substats()[$i]->get_value() . "%";
|
|
|
}
|
|
}
|
|
|
else{
|
|
else{
|
|
|
- $stat_name = $rune->get_innate_stat()->get_stat_name();
|
|
|
|
|
- $stat_value = "+" . $rune->get_innate_stat()->get_value(). " ";
|
|
|
|
|
|
|
+ $stat_name = $rune->get_substats()[$i]->get_stat_name();
|
|
|
|
|
+ $stat_value = "+" . $rune->get_substats()[$i]->get_value(). " ";
|
|
|
|
|
+ }
|
|
|
|
|
+ $grind = "";
|
|
|
|
|
+ if ($rune->get_substats()[$i] != null && $rune->get_substats()[$i]->get_grind() > 0){
|
|
|
|
|
+ $grind = "+" . $rune->get_substats()[$i]->get_grind();
|
|
|
|
|
+ if (in_array($rune->get_substats()[$i]->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
+ $grind = $grind . "%";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ $html .= "<tr class=substat>\n";
|
|
|
|
|
+ $html .= "<td class='stat'>\n";
|
|
|
$html .= $stat_name . "\n";
|
|
$html .= $stat_name . "\n";
|
|
|
$html .= "</td>\n";
|
|
$html .= "</td>\n";
|
|
|
$html .= "<td class='value'>\n";
|
|
$html .= "<td class='value'>\n";
|
|
|
$html .= $stat_value . "\n";
|
|
$html .= $stat_value . "\n";
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='grind'>\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
- for ($i = 0; $i < 4; $i ++){
|
|
|
|
|
- if ($rune->get_substats()[$i] == null){
|
|
|
|
|
- $stat_name = " ";
|
|
|
|
|
- $stat_value = "";
|
|
|
|
|
- }
|
|
|
|
|
- elseif (in_array($rune->get_substats()[$i]->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
- $stat_name = str_replace("%", "", $rune->get_substats()[$i]->get_stat_name());
|
|
|
|
|
- $stat_value = "+" . $rune->get_substats()[$i]->get_value() . "%";
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- $stat_name = $rune->get_substats()[$i]->get_stat_name();
|
|
|
|
|
- $stat_value = "+" . $rune->get_substats()[$i]->get_value(). " ";
|
|
|
|
|
- }
|
|
|
|
|
- $grind = "";
|
|
|
|
|
- if ($rune->get_substats()[$i] != null && $rune->get_substats()[$i]->get_grind() > 0){
|
|
|
|
|
- $grind = "+" . $rune->get_substats()[$i]->get_grind();
|
|
|
|
|
- if (in_array($rune->get_substats()[$i]->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
- $grind = $grind . "%";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "<tr class=substat>\n";
|
|
|
|
|
- $html .= "<td class='stat'>\n";
|
|
|
|
|
- $html .= $stat_name . "\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='value'>\n";
|
|
|
|
|
- $html .= $stat_value . "\n";
|
|
|
|
|
- $html .= "<td class='grind grind_$grind'>\n";
|
|
|
|
|
- $html .= $grind . "\n";
|
|
|
|
|
- if ($rune->get_substats()[$i] != null && $rune->get_substats()[$i]->is_enchanted()){
|
|
|
|
|
- $html .= "<img title='Enchanted' src='" . URL::IMG["RUNE"] . "enchanted.png'/>\n";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
|
|
+ $html .= "<td class='grind grind_$grind'>\n";
|
|
|
|
|
+ $html .= $grind . "\n";
|
|
|
|
|
+ if ($rune->get_substats()[$i] != null && $rune->get_substats()[$i]->is_enchanted()){
|
|
|
|
|
+ $html .= "<img title='Enchanted' src='" . URL::IMG["RUNE"] . "enchanted.png'/>\n";
|
|
|
}
|
|
}
|
|
|
- $html .= "</table>\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- // Details
|
|
|
|
|
- $html .= "<td class='details'>\n";
|
|
|
|
|
- $html .= "<table class='table_details'>\n";
|
|
|
|
|
- $html .= "<tr>\n";
|
|
|
|
|
- $html .= "<td class='title'>\n";
|
|
|
|
|
- $html .= "QY.:\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='value'>\n";
|
|
|
|
|
- $html .= "<span class='quality quality_" . strtolower($rune->get_quality_name()) . "'>\n";
|
|
|
|
|
- $html .= $rune->get_quality_name() . "\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
$html .= "</td>\n";
|
|
$html .= "</td>\n";
|
|
|
$html .= "</tr>\n";
|
|
$html .= "</tr>\n";
|
|
|
- $html .= "<tr>\n";
|
|
|
|
|
- $html .= "<td class='title'>\n";
|
|
|
|
|
- $html .= "O.QY.:\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='value'>\n";
|
|
|
|
|
- $html .= "<span class='quality quality_" . strtolower($rune->geT_original_quality_name()) . "'>\n";
|
|
|
|
|
- $html .= $rune->get_original_quality_name() . "\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
- $html .= "<tr>\n";
|
|
|
|
|
- $html .= "<td class='title'>\n";
|
|
|
|
|
- $html .= "Value:\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='value'>\n";
|
|
|
|
|
- $html .= number_format($rune->get_value(), 0, ".", ",") . "\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
- $html .= "<tr>\n";
|
|
|
|
|
- $html .= "<td class='title'>\n";
|
|
|
|
|
- $html .= "EFF.:\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='value'>\n";
|
|
|
|
|
- $html .= number_format($rune->get_efficiency(), 2, ".", ",") . "%\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
- $html .= "<tr>\n";
|
|
|
|
|
- $html .= "<td class='title'>\n";
|
|
|
|
|
- $html .= "MX.E.:\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='value'>\n";
|
|
|
|
|
- $html .= number_format($rune->get_max_efficiency(), 2, ".", ",") . "%\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
- $html .= "</table>\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
- $html .= "</table>\n";
|
|
|
|
|
- return $html;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $html .= "</table>\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ // Details
|
|
|
|
|
+ $html .= "<td class='details'>\n";
|
|
|
|
|
+ $html .= "<table class='table_details'>\n";
|
|
|
|
|
+ $html .= "<tr>\n";
|
|
|
|
|
+ $html .= "<td class='title'>\n";
|
|
|
|
|
+ $html .= "QY.:\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='value'>\n";
|
|
|
|
|
+ $html .= "<span class='quality quality_" . strtolower($rune->get_quality_name()) . "'>\n";
|
|
|
|
|
+ $html .= $rune->get_quality_name() . "\n";
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ $html .= "<tr>\n";
|
|
|
|
|
+ $html .= "<td class='title'>\n";
|
|
|
|
|
+ $html .= "O.QY.:\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='value'>\n";
|
|
|
|
|
+ $html .= "<span class='quality quality_" . strtolower($rune->geT_original_quality_name()) . "'>\n";
|
|
|
|
|
+ $html .= $rune->get_original_quality_name() . "\n";
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ $html .= "<tr>\n";
|
|
|
|
|
+ $html .= "<td class='title'>\n";
|
|
|
|
|
+ $html .= "Value:\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='value'>\n";
|
|
|
|
|
+ $html .= number_format($rune->get_value(), 0, ".", ",") . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ $html .= "<tr>\n";
|
|
|
|
|
+ $html .= "<td class='title'>\n";
|
|
|
|
|
+ $html .= "EFF.:\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='value'>\n";
|
|
|
|
|
+ $html .= number_format($rune->get_efficiency(), 2, ".", ",") . "%\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ $html .= "<tr>\n";
|
|
|
|
|
+ $html .= "<td class='title'>\n";
|
|
|
|
|
+ $html .= "MX.E.:\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='value'>\n";
|
|
|
|
|
+ $html .= number_format($rune->get_max_efficiency(), 2, ".", ",") . "%\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ $html .= "</table>\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ $html .= "</table>\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 .= "<div class='artifact_panel artifact_level_" . $artifact->get_level() . " artifact_quality_" . strtolower($artifact->get_quality_name()) . " artifact_original_quality_" . strtolower($artifact->get_original_quality_name()) . " '>\n";
|
|
|
|
|
- $background = "";
|
|
|
|
|
- $icon = "";
|
|
|
|
|
- if ($artifact->is_archetypal()){
|
|
|
|
|
- $background = URL::IMG["ARTIFACT"] . "type_" . strtolower($artifact->get_quality_name()) . ".png";
|
|
|
|
|
- $icon = URL::IMG["ARTIFACT"] . "type_";
|
|
|
|
|
- switch ($artifact->get_archetype()){
|
|
|
|
|
- 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";
|
|
|
|
|
|
|
+ // 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 .= "<div class='artifact_panel artifact_level_" . $artifact->get_level() . " artifact_quality_" . strtolower($artifact->get_quality_name()) . " artifact_original_quality_" . strtolower($artifact->get_original_quality_name()) . " '>\n";
|
|
|
|
|
+ $background = "";
|
|
|
|
|
+ $icon = "";
|
|
|
|
|
+ if ($artifact->is_archetypal()){
|
|
|
|
|
+ $background = URL::IMG["ARTIFACT"] . "type_" . strtolower($artifact->get_quality_name()) . ".png";
|
|
|
|
|
+ $icon = URL::IMG["ARTIFACT"] . "type_";
|
|
|
|
|
+ switch ($artifact->get_archetype()){
|
|
|
|
|
+ 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;
|
|
|
}
|
|
}
|
|
|
- else{
|
|
|
|
|
- $background = URL::IMG["ARTIFACT"] . "element_" . strtolower($artifact->get_quality_name()) . ".png";
|
|
|
|
|
- $icon = URL::IMG["ARTIFACT"] . "element_";
|
|
|
|
|
- switch ($artifact->get_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";
|
|
|
|
|
|
|
+ $icon .= ".png";
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ $background = URL::IMG["ARTIFACT"] . "element_" . strtolower($artifact->get_quality_name()) . ".png";
|
|
|
|
|
+ $icon = URL::IMG["ARTIFACT"] . "element_";
|
|
|
|
|
+ switch ($artifact->get_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;
|
|
|
}
|
|
}
|
|
|
- $html .= "<img class='artifact_base' src='" . $background . "'/>\n";
|
|
|
|
|
- $html .= "<img class='artifact_icon' src='" . $icon . "'/>\n";
|
|
|
|
|
- $html .= "<span class='artifact_stars'>\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
- $html .= "<span class='artifact_level'>\n";
|
|
|
|
|
- $html .= $artifact->get_level() . "\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
|
|
+ $icon .= ".png";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= "<img class='artifact_base' src='" . $background . "'/>\n";
|
|
|
|
|
+ $html .= "<img class='artifact_icon' src='" . $icon . "'/>\n";
|
|
|
|
|
+ $html .= "<span class='artifact_stars'>\n";
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ $html .= "<span class='artifact_level'>\n";
|
|
|
|
|
+ $html .= $artifact->get_level() . "\n";
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ $html .= "</div>\n";
|
|
|
|
|
+ if ($unit instanceof Unit){
|
|
|
|
|
+ $html .= "<div class='assigned'>\n";
|
|
|
|
|
+ $html .= "<a target='blank' href='/monsters/" . $unit->get_id() . "'>\n";
|
|
|
|
|
+ $html .= "<img title='" . $unit->get_title() . "' class='monster_image border_" . $unit->get_monster()->get_element_name() . "' src='" . $unit->get_monster()->get_image() . "'/>\n";
|
|
|
|
|
+ $html .= "</a>\n";
|
|
|
$html .= "</div>\n";
|
|
$html .= "</div>\n";
|
|
|
- if ($unit instanceof Unit){
|
|
|
|
|
- $html .= "<div class='assigned'>\n";
|
|
|
|
|
- $html .= "<a target='blank' href='/monsters/" . $unit->get_id() . "'>\n";
|
|
|
|
|
- $html .= "<img title='" . $unit->get_title() . "' class='monster_image border_" . $unit->get_monster()->get_element_name() . "' src='" . $unit->get_monster()->get_image() . "'/>\n";
|
|
|
|
|
- $html .= "</a>\n";
|
|
|
|
|
- $html .= "</div>\n";
|
|
|
|
|
- }
|
|
|
|
|
- return $html;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ 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 .= "<table class='artifact' id='artifact-" . $artifact->get_id() . "'>\n";
|
|
|
|
|
- $html .= "<tr>\n";
|
|
|
|
|
- $html .= "<td class='icon'>\n";
|
|
|
|
|
- $html .= HTML::artifact_panel($artifact, $unit) . "\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "<td class='effects'>\n";
|
|
|
|
|
- $html .= "<table>\n";
|
|
|
|
|
- // Main stat
|
|
|
|
|
- $html .= "<tr class='effect main_stat'>\n";
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 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 .= "<table class='artifact' id='artifact-" . $artifact->get_id() . "'>\n";
|
|
|
|
|
+ $html .= "<tr>\n";
|
|
|
|
|
+ $html .= "<td class='icon'>\n";
|
|
|
|
|
+ $html .= HTML::artifact_panel($artifact, $unit) . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "<td class='effects'>\n";
|
|
|
|
|
+ $html .= "<table>\n";
|
|
|
|
|
+ // Main stat
|
|
|
|
|
+ $html .= "<tr class='effect main_stat'>\n";
|
|
|
|
|
+ $html .= "<td class='effect'>\n";
|
|
|
|
|
+ $stat_name = $artifact->get_stat()->get_name();
|
|
|
|
|
+ $stat_value = "+" . $artifact->get_stat()->get_value();
|
|
|
|
|
+ $html .= $stat_name . "\n";
|
|
|
|
|
+ $html .= $stat_value . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\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 .= "<tr class='effect'>\n";
|
|
|
$html .= "<td class='effect'>\n";
|
|
$html .= "<td class='effect'>\n";
|
|
|
- $stat_name = $artifact->get_stat()->get_name();
|
|
|
|
|
- $stat_value = "+" . $artifact->get_stat()->get_value();
|
|
|
|
|
- $html .= $stat_name . "\n";
|
|
|
|
|
- $html .= $stat_value . "\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\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 .= "<tr class='effect'>\n";
|
|
|
|
|
- $html .= "<td class='effect'>\n";
|
|
|
|
|
- if (count($artifact->get_effects()) <= $i){
|
|
|
|
|
- $name = " ";
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- $name = $artifact->get_effects()[$i]->get_name();
|
|
|
|
|
- $name = str_replace("Increasing", "Inc.", $name);
|
|
|
|
|
- $name = str_replace("Decrease", "Dec.", $name);
|
|
|
|
|
- $name = str_replace("Critical", "Crit.", $name);
|
|
|
|
|
- $name = str_replace("Received ", "", $name);
|
|
|
|
|
- $name = str_replace("Damage", "Dmg.", $name);
|
|
|
|
|
- $name = str_replace("Additional", "Addl.", $name);
|
|
|
|
|
- $name = str_replace("Proportional", "Rel.", $name);
|
|
|
|
|
- $name = str_replace("Counterattack", "Counter", $name);
|
|
|
|
|
- $name = str_replace("Dealt by Attacking Together", "Attacking Together", $name);
|
|
|
|
|
- $name = str_replace("HP condition is bad", "bad HP", $name);
|
|
|
|
|
- $name = str_replace("HP condition is good", "good HP", $name);
|
|
|
|
|
- }
|
|
|
|
|
- $html .= $name;
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
|
|
+ if (count($artifact->get_effects()) <= $i){
|
|
|
|
|
+ $name = " ";
|
|
|
}
|
|
}
|
|
|
- $html .= "</table>\n";
|
|
|
|
|
- $html .= "</td>\n";
|
|
|
|
|
- $html .= "</tr>\n";
|
|
|
|
|
- $html .= "<tr>\n";
|
|
|
|
|
- $html .= "<td class='details' colspan='2'>\n";
|
|
|
|
|
- $html .= "EFF.: " . number_format($artifact->get_efficiency(), 2, ".", ",") . "% \n";
|
|
|
|
|
- $html .= "MX.E.: " . number_format($artifact->get_max_efficiency(), 2, ".", ",") . "% \n";
|
|
|
|
|
- $html .= "Value.: " . number_format($artifact->get_value(), 0, ".", ",") . "\n";
|
|
|
|
|
|
|
+ else{
|
|
|
|
|
+ $name = $artifact->get_effects()[$i]->get_name();
|
|
|
|
|
+ $name = str_replace("Increasing", "Inc.", $name);
|
|
|
|
|
+ $name = str_replace("Decrease", "Dec.", $name);
|
|
|
|
|
+ $name = str_replace("Critical", "Crit.", $name);
|
|
|
|
|
+ $name = str_replace("Received ", "", $name);
|
|
|
|
|
+ $name = str_replace("Damage", "Dmg.", $name);
|
|
|
|
|
+ $name = str_replace("Additional", "Addl.", $name);
|
|
|
|
|
+ $name = str_replace("Proportional", "Rel.", $name);
|
|
|
|
|
+ $name = str_replace("Counterattack", "Counter", $name);
|
|
|
|
|
+ $name = str_replace("Dealt by Attacking Together", "Attacking Together", $name);
|
|
|
|
|
+ $name = str_replace("HP condition is bad", "bad HP", $name);
|
|
|
|
|
+ $name = str_replace("HP condition is good", "good HP", $name);
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= $name;
|
|
|
$html .= "</td>\n";
|
|
$html .= "</td>\n";
|
|
|
$html .= "</tr>\n";
|
|
$html .= "</tr>\n";
|
|
|
- $html .= "</table>\n";
|
|
|
|
|
- return $html;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $html .= "</table>\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ $html .= "<tr>\n";
|
|
|
|
|
+ $html .= "<td class='details' colspan='2'>\n";
|
|
|
|
|
+ $html .= "EFF.: " . number_format($artifact->get_efficiency(), 2, ".", ",") . "% \n";
|
|
|
|
|
+ $html .= "MX.E.: " . number_format($artifact->get_max_efficiency(), 2, ".", ",") . "% \n";
|
|
|
|
|
+ $html .= "Value.: " . number_format($artifact->get_value(), 0, ".", ",") . "\n";
|
|
|
|
|
+ $html .= "</td>\n";
|
|
|
|
|
+ $html .= "</tr>\n";
|
|
|
|
|
+ $html .= "</table>\n";
|
|
|
|
|
+ return $html;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Generates a grindstone or gem panel.
|
|
|
|
|
- *
|
|
|
|
|
- * @param Enchantment Entity to get the info from.
|
|
|
|
|
- * @return string HTML content for a rune panel. Empty on error.
|
|
|
|
|
- */
|
|
|
|
|
- public static function enchantment_panel($enchantment) {
|
|
|
|
|
- if (!($enchantment instanceof Enchantment)){
|
|
|
|
|
- return "";
|
|
|
|
|
- }
|
|
|
|
|
- $html = "";
|
|
|
|
|
- if ($enchantment->is_gem()){
|
|
|
|
|
- if ($enchantment->is_inmemorial()){
|
|
|
|
|
- $base = URL::IMG["GRIND"] . "gem_inmemorial.png";
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- $base = URL::IMG["GRIND"] . "gem.png";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- if ($enchantment->is_inmemorial()){
|
|
|
|
|
- $base = URL::IMG["GRIND"] . "grind_inmemorial.png";
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- $base = URL::IMG["GRIND"] . "grind.png";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (! $enchantment->is_inmemorial() && $enchantment->get_rune_set() != null){
|
|
|
|
|
- $icon = "<img class='enchantment_icon' src='" . $enchantment->get_rune_set()->get_image() . "'/>\n";
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Generates a grindstone or gem panel.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param Enchantment Entity to get the info from.
|
|
|
|
|
+ * @return string HTML content for a rune panel. Empty on error.
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function enchantment_panel($enchantment) {
|
|
|
|
|
+ if (!($enchantment instanceof Enchantment)){
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html = "";
|
|
|
|
|
+ if ($enchantment->is_gem()){
|
|
|
|
|
+ if ($enchantment->is_inmemorial()){
|
|
|
|
|
+ $base = URL::IMG["GRIND"] . "gem_inmemorial.png";
|
|
|
}
|
|
}
|
|
|
else{
|
|
else{
|
|
|
- $icon = "";
|
|
|
|
|
|
|
+ $base = URL::IMG["GRIND"] . "gem.png";
|
|
|
}
|
|
}
|
|
|
- if (in_array($enchantment->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
- $stat_name = str_replace("%", "", $enchantment->get_stat_name());
|
|
|
|
|
- $stat_value = "+" . $enchantment->get_min() . "~" . $enchantment->get_max() . "%";
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ if ($enchantment->is_inmemorial()){
|
|
|
|
|
+ $base = URL::IMG["GRIND"] . "grind_inmemorial.png";
|
|
|
}
|
|
}
|
|
|
else{
|
|
else{
|
|
|
- $stat_name = $enchantment->get_stat_name();
|
|
|
|
|
- $stat_value = "+" . $enchantment->get_min() . "~" . $enchantment->get_max();
|
|
|
|
|
|
|
+ $base = URL::IMG["GRIND"] . "grind.png";
|
|
|
}
|
|
}
|
|
|
- $html .= "<div class='enchantment_panel enchantment_quality_" . strtolower($enchantment->get_quality_name()) . " enchantment_ancient_" . $enchantment->is_ancient() . "'>\n";
|
|
|
|
|
- $html .= "<img class='enchantment_base' src='" . $base . "'/>\n";
|
|
|
|
|
- $html .= $icon;
|
|
|
|
|
- $html .= "<span class='enchantment_stat'>\n";
|
|
|
|
|
- $html .= "<span class='enchantment_stat->stat_name'>" . $stat_name . "</span>\n";
|
|
|
|
|
- $html .= "<span class='enchantment_stat->value'>" . $stat_value . "</span>\n";
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (! $enchantment->is_inmemorial() && $enchantment->get_rune_set() != null){
|
|
|
|
|
+ $icon = "<img class='enchantment_icon' src='" . $enchantment->get_rune_set()->get_image() . "'/>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ $icon = "";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (in_array($enchantment->get_stat_name(), array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
|
|
|
|
|
+ $stat_name = str_replace("%", "", $enchantment->get_stat_name());
|
|
|
|
|
+ $stat_value = "+" . $enchantment->get_min() . "~" . $enchantment->get_max() . "%";
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ $stat_name = $enchantment->get_stat_name();
|
|
|
|
|
+ $stat_value = "+" . $enchantment->get_min() . "~" . $enchantment->get_max();
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= "<div class='enchantment_panel enchantment_quality_" . strtolower($enchantment->get_quality_name()) . " enchantment_ancient_" . $enchantment->is_ancient() . "'>\n";
|
|
|
|
|
+ $html .= "<img class='enchantment_base' src='" . $base . "'/>\n";
|
|
|
|
|
+ $html .= $icon;
|
|
|
|
|
+ $html .= "<span class='enchantment_stat'>\n";
|
|
|
|
|
+ $html .= "<span class='enchantment_stat->stat_name'>" . $stat_name . "</span>\n";
|
|
|
|
|
+ $html .= "<span class='enchantment_stat->value'>" . $stat_value . "</span>\n";
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ if ($enchantment->get_amount() > 1){
|
|
|
|
|
+ $html .= "<span class='enchantment_amount'>\n";
|
|
|
|
|
+ $html .= "x" . $enchantment->get_amount() . "\n";
|
|
|
$html .= "</span>\n";
|
|
$html .= "</span>\n";
|
|
|
- if ($enchantment->get_amount() > 1){
|
|
|
|
|
- $html .= "<span class='enchantment_amount'>\n";
|
|
|
|
|
- $html .= "x" . $enchantment->get_amount() . "\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "</div>\n";
|
|
|
|
|
- return $html;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $html .= "</div>\n";
|
|
|
|
|
+ return $html;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Generates a building panel.
|
|
|
|
|
- *
|
|
|
|
|
- * @param Building|Decoration|Buildable|Decorative $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->get_buildable()->get_name();
|
|
|
|
|
- $description = $building->get_buildable()->get_description();
|
|
|
|
|
- $img = $building->get_buildable()->get_image();
|
|
|
|
|
- }
|
|
|
|
|
- elseif ($building instanceof Buildable){
|
|
|
|
|
- $level = false;
|
|
|
|
|
- $title = $building->get_name();
|
|
|
|
|
- $description = $building->get_description();
|
|
|
|
|
- $img = $building->get_image();
|
|
|
|
|
- }
|
|
|
|
|
- elseif ($building instanceof Decoration){
|
|
|
|
|
- $level = $building->get_level();
|
|
|
|
|
- $title = $building->get_decorative()->get_name();
|
|
|
|
|
- $description = $building->get_decorative()->get_description();
|
|
|
|
|
- $img = $building->get_decorative()->get_image();
|
|
|
|
|
- }
|
|
|
|
|
- elseif ($building instanceof Decorative){
|
|
|
|
|
- $level = false;
|
|
|
|
|
- $title = $building->get_name();
|
|
|
|
|
- $description = $building->get_description();
|
|
|
|
|
- $img = $building->get_image();
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- return "";
|
|
|
|
|
- }
|
|
|
|
|
- if (strlen($description) > 0){
|
|
|
|
|
- $title .= ": " . $description;
|
|
|
|
|
- }
|
|
|
|
|
- $html = "<div class='building_panel'>\n";
|
|
|
|
|
- $html .= "<img title='" . $title . "' class='building' src='" . $img . "'/>\n";
|
|
|
|
|
- if ($level){
|
|
|
|
|
- $html .= "<span class='level'>\n";
|
|
|
|
|
- $html .= $level . "\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
- }
|
|
|
|
|
- $html .= "</div>\n";
|
|
|
|
|
- return $html;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Generates a building panel.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param Building|Decoration|Buildable|Decorative $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->get_buildable()->get_name();
|
|
|
|
|
+ $description = $building->get_buildable()->get_description();
|
|
|
|
|
+ $img = $building->get_buildable()->get_image();
|
|
|
}
|
|
}
|
|
|
|
|
+ elseif ($building instanceof Buildable){
|
|
|
|
|
+ $level = false;
|
|
|
|
|
+ $title = $building->get_name();
|
|
|
|
|
+ $description = $building->get_description();
|
|
|
|
|
+ $img = $building->get_image();
|
|
|
|
|
+ }
|
|
|
|
|
+ elseif ($building instanceof Decoration){
|
|
|
|
|
+ $level = $building->get_level();
|
|
|
|
|
+ $title = $building->get_decorative()->get_name();
|
|
|
|
|
+ $description = $building->get_decorative()->get_description();
|
|
|
|
|
+ $img = $building->get_decorative()->get_image();
|
|
|
|
|
+ }
|
|
|
|
|
+ elseif ($building instanceof Decorative){
|
|
|
|
|
+ $level = false;
|
|
|
|
|
+ $title = $building->get_name();
|
|
|
|
|
+ $description = $building->get_description();
|
|
|
|
|
+ $img = $building->get_image();
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (strlen($description) > 0){
|
|
|
|
|
+ $title .= ": " . $description;
|
|
|
|
|
+ }
|
|
|
|
|
+ $html = "<div class='building_panel'>\n";
|
|
|
|
|
+ $html .= "<img title='" . $title . "' class='building' src='" . $img . "'/>\n";
|
|
|
|
|
+ if ($level){
|
|
|
|
|
+ $html .= "<span class='level'>\n";
|
|
|
|
|
+ $html .= $level . "\n";
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html .= "</div>\n";
|
|
|
|
|
+ return $html;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Generates a item panel.
|
|
|
|
|
- *
|
|
|
|
|
- * @param Inventory $item Entity to get the info from.
|
|
|
|
|
- * @return string HTML content for an item panel. Empty on error.
|
|
|
|
|
- */
|
|
|
|
|
- public static function item_panel($item) {
|
|
|
|
|
- if (!($item instanceof Inventory) && !($item instanceof Item)){
|
|
|
|
|
- return "";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if ($item instanceof Item){
|
|
|
|
|
- $html = "<div class='item_panel'>\n";
|
|
|
|
|
- $html .= "<img title='" . $item->get_name() . "' class='item' src='" . $item->get_image() . "'/>\n";
|
|
|
|
|
- $html .= "<span class='amount'>\n";
|
|
|
|
|
- $html .= $item->get_amount() . "\n";
|
|
|
|
|
- $html .= "</span>\n";
|
|
|
|
|
- $html .= "</div>\n";
|
|
|
|
|
- }
|
|
|
|
|
- elseif ($item instanceof Inventory){
|
|
|
|
|
- $html = "<div class='item_panel'>\n";
|
|
|
|
|
- $html .= "<img title='" . $item->get_name() . "' class='item' src='" . $item->get_image() . "'/>\n";
|
|
|
|
|
- $html .= "</div>\n";
|
|
|
|
|
- }
|
|
|
|
|
- return $html;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Generates a item panel.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param Inventory $item Entity to get the info from.
|
|
|
|
|
+ * @return string HTML content for an item panel. Empty on error.
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function item_panel($item) {
|
|
|
|
|
+ if (!($item instanceof Inventory) && !($item instanceof Item)){
|
|
|
|
|
+ return "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Generates a source panel.
|
|
|
|
|
- *
|
|
|
|
|
- * @param Inventory $source Entity to get the info from.
|
|
|
|
|
- * @return string HTML content for a source panel. Empty on error.
|
|
|
|
|
- */
|
|
|
|
|
- public static function source_panel($source) {
|
|
|
|
|
- //if (!($item instanceof Source)){
|
|
|
|
|
- // return "";
|
|
|
|
|
- //}
|
|
|
|
|
- $html = "<div class='source_panel'>\n";
|
|
|
|
|
- $html .= "<img title='" . $source->get_name() . "' class='item' src='" . $source->get_image() . "'/>\n";
|
|
|
|
|
|
|
+ if ($item instanceof Item){
|
|
|
|
|
+ $html = "<div class='item_panel'>\n";
|
|
|
|
|
+ $html .= "<img title='" . $item->get_name() . "' class='item' src='" . $item->get_image() . "'/>\n";
|
|
|
|
|
+ $html .= "<span class='amount'>\n";
|
|
|
|
|
+ $html .= $item->get_amount() . "\n";
|
|
|
|
|
+ $html .= "</span>\n";
|
|
|
$html .= "</div>\n";
|
|
$html .= "</div>\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"] . "0901.png";
|
|
|
|
|
- $tit = "Beginer";
|
|
|
|
|
- }
|
|
|
|
|
- $html = "<img alt='$tit' title='$tit' src='$src'/>";
|
|
|
|
|
- return $html;
|
|
|
|
|
|
|
+ elseif ($item instanceof Inventory){
|
|
|
|
|
+ $html = "<div class='item_panel'>\n";
|
|
|
|
|
+ $html .= "<img title='" . $item->get_name() . "' class='item' src='" . $item->get_image() . "'/>\n";
|
|
|
|
|
+ $html .= "</div>\n";
|
|
|
}
|
|
}
|
|
|
|
|
+ return $html;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Generates a source panel.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param Inventory $source Entity to get the info from.
|
|
|
|
|
+ * @return string HTML content for a source panel. Empty on error.
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function source_panel($source) {
|
|
|
|
|
+ //if (!($item instanceof Source)){
|
|
|
|
|
+ // return "";
|
|
|
|
|
+ //}
|
|
|
|
|
+ $html = "<div class='source_panel'>\n";
|
|
|
|
|
+ $html .= "<img title='" . $source->get_name() . "' class='item' src='" . $source->get_image() . "'/>\n";
|
|
|
|
|
+ $html .= "</div>\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"] . "0901.png";
|
|
|
|
|
+ $tit = "Beginer";
|
|
|
|
|
+ }
|
|
|
|
|
+ $html = "<img alt='$tit' title='$tit' src='$src'/>";
|
|
|
|
|
+ return $html;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-?>
|
|
|
|
|
|
|
+}
|