Esempio n. 1
0
 def run_checks(self):
     """ Всяческие проверки при создании объекта.
     """
     global running_checks
     if self.id in running_checks:
         return
     running_checks.append(self.id)
     try:
         _now = now()
         if self["duel_invite"]:
             self["duel_invite"] = [x for x in self["duel_invite"] if _now < x[1]]
         self["effects"] = [(eff, limit) for eff, limit in (self["effects"] or []) if limit > _now]
         if self["encounter_limit"] and _now >= self["encounter_limit"]:
             self.encounter_start()
             return
         if self["explore_limit"] and _now >= self["explore_limit"]:
             del self["explore_limit"]
             self.update_hp()
             zone.get(self["zone"]).explore(self)
             return
         if self["loc"] == "encounter_help":
             try:
                 other = User.get(self["help_for"])
                 if self["loc"] == "encounter_help" and (not other.online or other["loc"] != "encounter"):
                     self.go("default")
             except:
                 log_exception()
                 self.go("default")
     finally:
         running_checks.remove(self.id)
Esempio n. 2
0
 def zone_explore(self):
     self._checkloc("default")
     z = zone.get(self.user["zone"])
     if not z.can_explore(self.user):
         self._error("Cannot explore zone " + z.id)
     self.user.explore()
Esempio n. 3
0
 def zone_go(self):
     self._checkloc("default")
     zone.get(self.user["zone"]).go(self.user, self.q["where"])
Esempio n. 4
0
 def zone_action(self):
     self._checkloc("default")
     if self.q["which"].startswith('!'):
         zone.get(self.user["zone"]).action(self.user, self.q["which"], self.q["sent"])
     else:
         zone.get(self.user["zone"]).action(self.user, self.q["which"])
Esempio n. 5
0
def _zone(user):
    return {"zone": zone.get(user["zone"]).js(user)}