def transfer_unreal_soul(self): if self.current_unreal_soul_id_ != 0: facade_request.remove_npc(self.current_unreal_soul_id_) self.current_unreal_soul_id_ = facade_request.summon_npc( self.scene_, self.unreal_monster_order_[self.current_unreal_wave_] * 10 + 1, Config.UNREAL_SOUL_X_, Config.UNREAL_SOUL_Y_)
def erase_by_id(self, id): if id <= 0: return False for x in range(Chessboard.WIDTH): for y in range(Chessboard.HEIGHT): if self.board_[x][y].get_id() == id: facade_request.remove_npc(id, 0) self.board_[x][y].set_template(0); self.board_[x][y].set_id(0);
def erase_by_pos(self, x, y): if x < 0 or x >= Chessboard.WIDTH: return False if y < 0 or y >= Chessboard.HEIGHT: return False id = self.board_[x][y].get_id() facade_request.remove_npc(id, 0) self.board_[x][y].set_template(0); self.board_[x][y].set_id(0);
def erase_associated_by_pos(self, npc_template, x, y): if x < 0 or x >= Chessboard.WIDTH: proxy.Logging.error("[slime] erase_associated_by_pos(%d,%d,%d)"\ % (npc_template, x, y)) return 0 if y < 0 or y >= Chessboard.HEIGHT: proxy.Logging.error("[slime] erase_associated_by_pos(%d,%d,%d)"\ % (npc_template, x, y)) return 0 score = 0 for x1 in range(x-1, -1, -1): proxy.Logging.debug("[slime] x1(%d) in range(x, -1, -1)" % x1) if self.board_[x1][y].get_template() == npc_template: facade_request.remove_npc(self.board_[x1][y].get_id(), 0) score = score + 1 self.board_[x1][y].set_template(0) self.board_[x1][y].set_id(0) self.refresh_by_pos(x1, y) else: proxy.Logging.debug("[slime] associated1: %d %d" % (self.board_[x1][y].get_template(), npc_template)) break for x1 in range(x+1, Chessboard.WIDTH, 1): proxy.Logging.debug("[slime] x1(%d) in range(x, 1, Chessboard.WIDTH)" % x1) if self.board_[x1][y].get_template() == npc_template: facade_request.remove_npc(self.board_[x1][y].get_id(), 0) score = score + 1 self.board_[x1][y].set_template(0) self.board_[x1][y].set_id(0) self.refresh_by_pos(x1, y) proxy.Logging.debug("[slime] associated2: %d %d" % (self.board_[x1][y].get_template(), npc_template)) else: break for y1 in range(y-1, -1, -1): proxy.Logging.debug("[slime] y1(%d) in range(y, -1, -1)" % y1) if self.board_[x][y1].get_template() == npc_template: facade_request.remove_npc(self.board_[x][y1].get_id(), 0) score = score + 1 self.board_[x][y1].set_template(0) self.board_[x][y1].set_id(0) self.refresh_by_pos(x, y1) proxy.Logging.debug("[slime] associated3: %d %d" % (self.board_[x][y1].get_template(), npc_template)) else: break for y1 in range(y+1, Chessboard.HEIGHT, 1): proxy.Logging.debug("[slime] y1(%d) in range(y, 1, Chessboard.WIDTH)" % y1) if self.board_[x][y1].get_template() == npc_template: facade_request.remove_npc(self.board_[x][y1].get_id(), 0) score = score + 1 self.board_[x][y1].set_template(0) self.board_[x][y1].set_id(0) self.refresh_by_pos(x, y1) proxy.Logging.debug("[slime] associated4: %d %d" % (self.board_[x][y1].get_template(), npc_template)) else: break return score
def transfer_unreal_soul(self): if self.current_unreal_soul_id_ != 0: facade_request.remove_npc(self.current_unreal_soul_id_) self.current_unreal_soul_id_ = facade_request.summon_npc(self.scene_, self.unreal_monster_order_[self.current_unreal_wave_] * 10 + 1, Config.UNREAL_SOUL_X_, Config.UNREAL_SOUL_Y_)
def remove_rune(self): now = time.time() for k, v in self.runes_.items(): if now >= v: facade_request.remove_npc(k) del self.runes_[k]
def erase_all(self): for x in range(Chessboard.WIDTH): for y in range(Chessboard.HEIGHT): facade_request.remove_npc(self.board_[x][y].get_id(), 0) self.board_[x][y].set_template(0); self.board_[x][y].set_id(0);