def trap_disable(self): self._checkloc("trap") t = trap.get(self.user["trap"]) if t.need_item == None: self._error("Cannot disable trap %s" % t.id) if self.user['inventory'].remove(t.need_item): self.user["trap_result"] = "disabled" else: self._error("Don't have item %s" % t.need_item) self.user.go("trap2")
def trap_escape(self): self._checkloc("trap") t = trap.get(self.user["trap"]) if rnd() < t.escape_chance: self.user["trap_result"] = "escaped" else: self.user["trap_result"] = "triggered" if t.trigger(self.user): self.user.update() return self.user.go("trap2")
def trap2(user): res = _zone(user) t = trap.get(user["trap"]) res.update({"trap": t.js(), "trap_result_text": t.get_text(user["trap_result"])}) return res
def trap(user): res = _zone(user) res.update({"trap": trap.get(user["trap"]).js()}) return res