瀏覽代碼

BustsViewer, added no busts handling

  Oops, what if we don't have any busts... say we are playing good,
    might need to double check that.
david 5 年之前
父節點
當前提交
e43de960c8
共有 1 個文件被更改,包括 32 次插入23 次删除
  1. 32 23
      flexible.py

+ 32 - 23
flexible.py

@@ -4432,35 +4432,44 @@ class bustViewer(object):
             c1 = merge(Style.BRIGHT + Fore.WHITE + Back.BLUE)
             c2 = merge(Style.BRIGHT + Fore.CYAN + Back.BLUE)
 
-            box = Boxes(42, color=tc)
-            self.queue_game.put(box.top())
-            self.queue_game.put(
-                box.row(
-                    tc
-                    + " {0:10} {1:<20} {2:8} ".format(
-                        "Sector", "Date Busted On", "Days old"
+            if self.busted:
+                box = Boxes(42, color=tc)
+                self.queue_game.put(box.top())
+                self.queue_game.put(
+                    box.row(
+                        tc
+                        + " {0:10} {1:<20} {2:8} ".format(
+                            "Sector", "Date Busted On", "Days old"
+                        )
                     )
                 )
-            )
-            self.queue_game.put(box.middle())
-            for s in self.busted:
-                if self.age[s]:
-                    self.queue_game.put(
-                        box.row(
-                            c1
-                            + " {0:<10} {1:<20} {2:8} ".format(
-                                s, self.busted[s], self.age[s]
+                self.queue_game.put(box.middle())
+                for s in self.busted:
+                    if self.age[s]:
+                        self.queue_game.put(
+                            box.row(
+                                c1
+                                + " {0:<10} {1:<20} {2:8} ".format(
+                                    s, self.busted[s], self.age[s]
+                                )
                             )
                         )
-                    )
-                else:
-                    self.queue_game.put(
-                        box.row(
-                            c1 + " {0:<10} {1:<20}          ".format(s, self.busted[s])
+                    else:
+                        self.queue_game.put(
+                            box.row(
+                                c1
+                                + " {0:<10} {1:<20}          ".format(s, self.busted[s])
+                            )
                         )
-                    )
 
-            self.queue_game.put(box.bottom())
+                self.queue_game.put(box.bottom())
+            else:
+                self.send2player(
+                    self.nl
+                    + Boxes.alert(
+                        "You have no busts to view, perhaps you just aren't into trouble."
+                    )
+                )
             self.deactivate(True)
 
     def game_line(self, line: str):