def getLeaderVar(st, var) : try : clan = st.getPlayer().getClan() if clan == None: return -1 leader=clan.getLeader().getPlayerInstance() if leader != None : return int(leader.getQuestState(qn).get(var)) except : pass leaderId=st.getPlayer().getClan().getLeaderId() con=L2DatabaseFactory.getInstance().getConnection() offline=con.prepareStatement("SELECT value FROM character_quests WHERE charId=? AND var=? AND name=?") offline.setInt(1, leaderId) offline.setString(2, var) offline.setString(3, qn) rs=offline.executeQuery() if rs : rs.next() try : val=rs.getInt("value") con.close() except : val=-1 try : con.close() except : pass else : val=-1 return int(val)
def suscribe_members(st): clan = st.getPlayer().getClan().getClanId() con = L2DatabaseFactory.getInstance().getConnection() offline = con.prepareStatement( "SELECT charId FROM characters WHERE clanid=? AND online=0") offline.setInt(1, clan) rs = offline.executeQuery() while (rs.next()): charId = rs.getInt("charId") try: insertion = con.prepareStatement( "INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?)" ) insertion.setInt(1, charId) insertion.setString(2, qn) insertion.setString(3, "<state>") insertion.setString(4, "Started") insertion.executeUpdate() insertion.close() except: try: insertion.close() except: pass try: con.close() except: pass
def getLeaderVar(st, var): try: clan = st.getPlayer().getClan() if clan == None: return -1 leader = clan.getLeader().getPlayerInstance() if leader != None: return int(leader.getQuestState(qn).get(var)) except: pass leaderId = st.getPlayer().getClan().getLeaderId() con = L2DatabaseFactory.getInstance().getConnection() offline = con.prepareStatement( "SELECT value FROM character_quests WHERE charId=? AND var=? AND name=?" ) offline.setInt(1, leaderId) offline.setString(2, var) offline.setString(3, qn) rs = offline.executeQuery() if rs: rs.next() try: val = rs.getInt("value") con.close() except: val = -1 try: con.close() except: pass else: val = -1 return int(val)
def setLeaderVar(st, var, value): clan = st.getPlayer().getClan() if clan == None: return leader = clan.getLeader().getPlayerInstance() if leader != None: leader.getQuestState(qn).set(var, value) else: leaderId = st.getPlayer().getClan().getLeaderId() con = L2DatabaseFactory.getInstance().getConnection() offline = con.prepareStatement( "UPDATE character_quests SET value=? WHERE charId=? AND var=? AND name=?" ) offline.setString(1, value) offline.setInt(2, leaderId) offline.setString(3, var) offline.setString(4, qn) try: offline.executeUpdate() offline.close() con.close() except: try: con.close() except: pass return
def suscribe_members(st): clan = st.getPlayer().getClanId() con = L2DatabaseFactory.getInstance().getConnection() offline = con.prepareStatement("SELECT charId FROM characters WHERE clanid=? AND online=0") offline.setInt(1, clan) rs = offline.executeQuery() while rs.next(): charId = rs.getInt("charId") try: insertion = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?)") insertion.setInt(1, charId) insertion.setString(2, qn) insertion.setString(3, "<state>") insertion.setString(4, "Started") insertion.executeUpdate() insertion.close() except: try: insertion.close() except: pass try: con.close() except: pass
def setLeaderVar(st, var, value): clan = st.getPlayer().getClan() if clan == None: return leader = clan.getLeader().getPlayerInstance() if leader != None: leader.getQuestState(qn).set(var, value) else: leaderId = st.getPlayer().getClan().getLeaderId() con = L2DatabaseFactory.getInstance().getConnection() offline = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND var=? AND name=?") offline.setString(1, value) offline.setInt(2, leaderId) offline.setString(3, var) offline.setString(4, qn) try: offline.executeUpdate() offline.close() con.close() except: try: con.close() except: pass return
def db_exec(self, sql): con, statement = None, None try: con = L2DatabaseFactory.getInstance().getConnection() statement = con.prepareStatement(sql) statement.execute() except: pass if statement: statement.close() if con: L2DatabaseFactory.close(con)
def offlineMemberExit(st) : clan=st.getPlayer().getClan().getClanId() con=L2DatabaseFactory.getInstance().getConnection() offline=con.prepareStatement("DELETE FROM character_quests WHERE name = ? and charId IN (SELECT charId FROM characters WHERE clanId =? AND online=0") offline.setString(1, qn) offline.setInt(2, clan) try : offline.executeUpdate() offline.close() con.close() except : try : con.close() except : pass
def get_GB_respawn_time(self): r = {} con, statement, rset = None, None, None try: con = L2DatabaseFactory.getInstance().getConnection() statement = con.prepareStatement("select `boss_id`, `respawn_time` from `grandboss_data`;") rset = statement.executeQuery() while rset.next(): r[rset.getInt("boss_id")] = rset.getLong("respawn_time") finally: if rset: rset.close() if statement: statement.close() if con: L2DatabaseFactory.close(con) return r
def EvolvePet(player, item, striderControlItem): con = L2DatabaseFactory.getInstance().getConnection() statement = con.prepareStatement("UPDATE items SET item_id =? WHERE object_id=? AND owner_id=?") statement.setInt(1, striderControlItem) statement.setInt(2, item.getObjectId()) statement.setInt(3, player.getObjectId()) statement.execute() statement.close() con.close() sm1 = SystemMessage.getSystemMessage(SystemMessageId.S2_S1_DISAPPEARED) sm1.addItemName(item.getItemId()) sm1.addNumber(1) sm2 = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_A_S1_S2) sm2.addNumber(item.getEnchantLevel()) sm2.addItemName(striderControlItem) player.sendPacket(sm1) player.sendPacket(sm2) player.sendPacket(ItemList(player, False)) return
def EvolvePet(player,item,striderControlItem) : con = L2DatabaseFactory.getInstance().getConnection() statement = con.prepareStatement("UPDATE items SET item_id =? WHERE object_id=? AND owner_id=?") statement.setInt(1, striderControlItem) statement.setInt(2, item.getObjectId()) statement.setInt(3, player.getObjectId()) statement.execute() statement.close() con.close() sm1 = SystemMessage.getSystemMessage(SystemMessageId.S2_S1_DISAPPEARED) sm1.addItemName(item.getItemId()) sm1.addNumber(1) sm2 = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_A_S1_S2) sm2.addNumber(item.getEnchantLevel()) sm2.addItemName(striderControlItem) player.sendPacket(sm1) player.sendPacket(sm2) player.sendPacket(ItemList(player, False)) return
def db_query(self, sql, cb): r = [] con, statement, rset = None, None, None try: con = L2DatabaseFactory.getInstance().getConnection() statement = con.prepareStatement(sql) rset = statement.executeQuery() while rset.next(): try: r += [cb(rset)] except: pass finally: if rset: rset.close() if statement: statement.close() if con: L2DatabaseFactory.close(con) return r
def __init__(self, id, name, descr): JQuest.__init__(self, id, name, descr) self.hellboundTrust = 0 self.hellboundLevel = 0 self.hellboundMobs = { 22320: { 'points': 10 }, 22321: { 'points': 10 }, 22324: { 'points': 1 }, 22325: { 'points': 1 }, 22327: { 'points': 3 }, 22328: { 'points': 3 }, 22329: { 'points': 3 }, } self.hellboundMobs1 = { 22322: { 'points': -10 }, 22323: { 'points': -10 }, 22342: { 'points': 3 }, 22343: { 'points': 3 }, 22361: { 'points': 20 }, 22449: { 'points': 50 }, 22450: { 'points': -10 }, 25536: { 'points': 200 } } self.Warpgateloc = [] self.Warpgate1loc = [] self.buronloc = [] self.kiefloc = [] self.keltasmin = [] self.keltasloc = [] self.Keltas = 0 con = L2DatabaseFactory.getInstance().getConnection() trigger = con.prepareStatement( "SELECT name FROM hellbound WHERE dummy=0") trigger1 = trigger.executeQuery() ZoneName = 100 while (trigger1.next()): ZoneName = trigger1.getInt("name") try: con.close() except: pass if ZoneName != 8000: con = L2DatabaseFactory.getInstance().getConnection() insertion = con.prepareStatement( "INSERT INTO hellbound (name,trustLevel,zonesLevel,unlocked,dummy) VALUES (?,?,?,?,?)" ) insertion.setInt(1, 8000) insertion.setInt(2, 0) insertion.setInt(3, 0) insertion.setInt(4, 0) insertion.setInt(5, 0) insertion.executeUpdate() insertion.close() try: con.close() except: pass self.hellboundLevel = HellboundManager.getInstance().getLevel() self.hellboundTrust = HellboundManager.getInstance().getTrust() if self.hellboundLevel == 0: self.Warpgateloc = [] self.Warpgate1loc = [] oldWarpgate = self.addSpawn(Warpgate, 112080, 219568, -3664, 0, False, 0) oldWarpgate1 = self.addSpawn(Warpgate, -16899, 209827, -3640, 0, False, 0) self.Warpgateloc.append(oldWarpgate) self.Warpgate1loc.append(oldWarpgate1) if self.hellboundLevel >= 1: newWarpgate6 = self.addSpawn(32319, 112080, 219568, -3664, 0, False, 0) newWarpgate6 = self.addSpawn(32319, -16899, 209827, -3640, 0, False, 0) if self.hellboundLevel >= 2: newFalk = self.addSpawn(32297, -19904, 250016, -3240, 12288, False, 0) if self.hellboundLevel >= 3 and self.hellboundLevel < 5: self.keltasloc = [] xx, yy, zz = KeltasSpawn newKeltas = self.addSpawn(Keltas, xx, yy, zz, 0, False, 0) self.keltasloc.append(newKeltas) self.keltasmin = [] for i in range(31): xx, yy, zz = KeltasMinionsSpawns[i] RndMobSpawn = KeltasMinions[Rnd.get(len(KeltasMinions))] newKeltasMinion = self.addSpawn(RndMobSpawn, xx, yy, zz, 0, False, 0) self.keltasmin.append(newKeltasMinion) if self.hellboundLevel == 4: newDerek = self.addSpawn(ghostofderek, -28058, 256885, -1934, 0, False, 0) if self.hellboundLevel < 5: self.buronloc = [] self.kiefloc = [] oldKief = self.addSpawn(Kief, -21271, 250238, -3314, 16384, False, 0) oldBuron = self.addSpawn(Buron, -11173, 236537, -3236, 41760, False, 0) self.buronloc.append(oldBuron) self.kiefloc.append(oldKief) if self.hellboundLevel >= 5: newSolomon = self.addSpawn(Solomon, -28916, 249381, -3472, 0, False, 0) newTraitor = self.addSpawn(Traitor, -27352, 252387, -3520, 5416, False, 0) newKief = self.addSpawn(Kief, -28357, 248993, -3472, 16384, False, 0) newBuron = self.addSpawn(Buron, -28567, 248994, -3472, 16384, False, 0) if self.hellboundLevel < 6: changeBoxesSpawnState(0) if self.hellboundLevel < 7: changeChimeraSpawnState(0) if self.hellboundLevel >= 7: #worldObjects = SpawnTable.getInstance().getSpawnTable().values() worldObjects = SpawnTable.getInstance().getSpawnTable() for i in worldObjects: npcId = i.getNpcid() if npcId == WLGuard: xx, yy, zz = i.getLocx(), i.getLocy(), i.getLocz() i.stopRespawn() curNpc = i.getLastSpawn() curNpc.onDecay() self.startQuestTimer("LevelCheck", 60000, None, None, True)
def __init__(self, id, name, descr): JQuest.__init__(self, id, name, descr) self.hellboundTrust = 0 self.hellboundLevel = 0 self.hellboundMobs = { 22320: {'points':10}, 22321: {'points':10}, 22324: {'points':1}, 22325: {'points':1}, 22327: {'points':3}, 22328: {'points':3}, 22329: {'points':3}, } self.hellboundMobs1 = { 22322: {'points':-10}, 22323: {'points':-10}, 22342: {'points':3}, 22343: {'points':3}, 22361: {'points':20}, 22449: {'points':50}, 22450: {'points':-10}, 25536: {'points':200} } self.Warpgateloc = [] self.Warpgate1loc = [] self.buronloc = [] self.kiefloc = [] self.keltasmin = [] self.keltasloc = [] self.Keltas = 0 con = L2DatabaseFactory.getInstance().getConnection() trigger = con.prepareStatement("SELECT name FROM hellbound WHERE dummy=0") trigger1 = trigger.executeQuery() ZoneName = 100 while (trigger1.next()): ZoneName = trigger1.getInt("name") try: con.close() except: pass if ZoneName != 8000: con = L2DatabaseFactory.getInstance().getConnection() insertion = con.prepareStatement("INSERT INTO hellbound (name,trustLevel,zonesLevel,unlocked,dummy) VALUES (?,?,?,?,?)") insertion.setInt(1, 8000) insertion.setInt(2, 0) insertion.setInt(3, 0) insertion.setInt(4, 0) insertion.setInt(5, 0) insertion.executeUpdate() insertion.close(); try: con.close() except: pass self.hellboundLevel = HellboundManager.getInstance().getLevel() self.hellboundTrust = HellboundManager.getInstance().getTrust() if self.hellboundLevel == 0: self.Warpgateloc = [] self.Warpgate1loc = [] oldWarpgate = self.addSpawn(Warpgate, 112080, 219568, -3664, 0, False, 0) oldWarpgate1 = self.addSpawn(Warpgate, -16899, 209827, -3640, 0, False, 0) self.Warpgateloc.append(oldWarpgate) self.Warpgate1loc.append(oldWarpgate1) if self.hellboundLevel >= 1: newWarpgate6 = self.addSpawn(32319, 112080, 219568, -3664, 0, False, 0) newWarpgate6 = self.addSpawn(32319, -16899, 209827, -3640, 0, False, 0) if self.hellboundLevel >= 2: newFalk = self.addSpawn(32297, -19904, 250016, -3240, 12288, False, 0) if self.hellboundLevel >= 3 and self.hellboundLevel < 5: self.keltasloc = [] xx, yy, zz = KeltasSpawn newKeltas = self.addSpawn(Keltas, xx, yy, zz, 0, False, 0) self.keltasloc.append(newKeltas) self.keltasmin = [] for i in range(31): xx, yy, zz = KeltasMinionsSpawns[i] RndMobSpawn = KeltasMinions[Rnd.get(len(KeltasMinions))] newKeltasMinion = self.addSpawn(RndMobSpawn, xx, yy, zz, 0, False, 0) self.keltasmin.append(newKeltasMinion) if self.hellboundLevel == 4: newDerek = self.addSpawn(ghostofderek, -28058, 256885, -1934, 0, False, 0) if self.hellboundLevel < 5: self.buronloc = [] self.kiefloc = [] oldKief = self.addSpawn(Kief, -21271, 250238, -3314, 16384, False, 0) oldBuron = self.addSpawn(Buron, -11173, 236537, -3236, 41760, False, 0) self.buronloc.append(oldBuron) self.kiefloc.append(oldKief) if self.hellboundLevel >= 5: newSolomon = self.addSpawn(Solomon, -28916, 249381, -3472, 0, False, 0) newTraitor = self.addSpawn(Traitor, -27352, 252387, -3520, 5416, False, 0) newKief = self.addSpawn(Kief, -28357, 248993, -3472, 16384, False, 0) newBuron = self.addSpawn(Buron, -28567, 248994, -3472, 16384, False, 0) if self.hellboundLevel < 6: changeBoxesSpawnState(0) if self.hellboundLevel < 7: changeChimeraSpawnState(0) if self.hellboundLevel >= 7: worldObjects = SpawnTable.getInstance().getSpawnTable().values() for i in worldObjects: npcId = i.getNpcid() if npcId == WLGuard: xx, yy, zz = i.getLocx(), i.getLocy(), i.getLocz() i.stopRespawn() curNpc = i.getLastSpawn() curNpc.onDecay() self.startQuestTimer("LevelCheck", 60000, None, None, True)