소스 검색

Maxed unit badge

Iñigo Valentin 6 년 전
부모
커밋
b209297568
3개의 변경된 파일21개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      application/entity/Unit.php
  2. 5 0
      application/helper/html.php
  3. BIN
      public/img/icon/maxed.png

+ 16 - 0
application/entity/Unit.php

@@ -454,5 +454,21 @@
                     break;
             }
         }
+
+        /**
+         *
+         */
+        public function are_skills_maxed(){
+            error_log('MAXED??');
+            $maxed = true;
+            for ($i = 0; $i < sizeof($this->unit->skill); $i ++){
+                error_log("    " . $this->skill_levels[$i] . "/" . $this->unit->skill[$i]->max_level);
+                if ($this->unit->skill[$i]->max_level > $this->skill_levels[$i]){
+                    $maxed = false;
+                    break;
+                }
+            }
+            return $maxed;
+        }
     }
 ?>

+ 5 - 0
application/helper/html.php

@@ -15,6 +15,7 @@
             $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;
@@ -23,6 +24,7 @@
             $teams = 0;
             $lock = false;
             $storage = false;
+            $maxed = false;
         }
         else{
             return "";
@@ -59,6 +61,9 @@
             $html .= "</span>\n";
         }
         $html .= "<span class='badges'>\n";
+        if ($maxed){
+            $html .= "<img title='Maxed unit' src='" . $path["img"]["icon"] . "maxed.png'>";
+        }
         if ($teams > 0){
             $title = $teams . " teams";
             if ($teams == 1){

BIN
public/img/icon/maxed.png