def canSpawn(self, player): if not player: return False if not self.isGM_join_event and player.isGM(): return False if player.isSilentMoving(): return False if player.getTransformationId() == 5: return False if player.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE: return False if player.getAI().getIntention() == CtrlIntention.AI_INTENTION_REST: return False if not player.isInsideZone(player.ZONE_TOWN): return False if TownManager.getTown(player.getX(), player.getY(), player.getZ()).getTownId() not in self.main_town_id: return False if Rnd.get(100) > self.npc_town_spawn_chance: return False return True
def canSpawn(self, player): if not player: return False if not self.isGM_join_event and player.isGM(): return False if player.isSilentMoving(): return False if player.getTransformationId() == 5: return False if player.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE: return False if player.getAI().getIntention() == CtrlIntention.AI_INTENTION_REST: return False if not player.isInsideZone(player.ZONE_TOWN): return False if TownManager.getTown( player.getX(), player.getY(), player.getZ()).getTownId() not in self.main_town_id: return False if Rnd.get(100) > self.npc_town_spawn_chance: return False return True
def checkCondition(self, player): if player.isGM(): return False #GM 不檢, 注意 如果GM被關需要由另一位GM釋放 if player.isInOlympiadMode(): return False #奧P 不檢 if not TownManager.getTown(player.getX(), player.getY(), player.getZ()) == None: return False #在城鎮中 不檢 if player.isInsideZone(L2Character.ZONE_PEACE): return False #安全地區 不檢 if player.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE: return False #發呆 不檢 #if player.getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW: return False #跟隨 不檢 #if player.getAI().getIntention() == CtrlIntention.AI_INTENTION_MOVE_TO: return False #跑路 不檢 #if player.getAI().getIntention() == CtrlIntention.AI_INTENTION_REST: return False #坐下休息 不檢 if player.isInJail(): return False #監禁中 不檢 st = player.getQuestState(self.qn) if not st: st = self.newQuestState(player) st.setState(State.STARTED) if self.timepass_check: last = st.get('last_time') if last and time.time() - float(last) < self.timepass: return False #免測時間內 不檢 if st.getQuestTimer("timeout_%d" % player.getObjectId()): return False #已在檢測中 不檢 return True