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(None) 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(None) 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(None) 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 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(None) 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 updateState(state) : con = L2DatabaseFactory.getInstance().getConnection(None) offline = con.prepareStatement("UPDATE grandboss_intervallist SET state = ? WHERE bossId = 29054") offline.setInt(1, state) try : offline.executeUpdate() offline.close() con.close() except : try : con.close() except : pass
def offlineMemberExit(st) : clan=st.getPlayer().getClan().getClanId() con=L2DatabaseFactory.getInstance().getConnection(None) 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 updateState(state): con = L2DatabaseFactory.getInstance().getConnection(None) offline = con.prepareStatement( "UPDATE grandboss_intervallist SET state = ? WHERE bossId = 29054") offline.setInt(1, state) try: offline.executeUpdate() offline.close() con.close() except: try: con.close() except: pass
def offlineMemberExit(st): clan = st.getPlayer().getClan().getClanId() con = L2DatabaseFactory.getInstance().getConnection(None) 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 checkState() : checkState = False con = L2DatabaseFactory.getInstance().getConnection(None) offline = con.prepareStatement("SELECT state FROM grandboss_intervallist WHERE bossId = 29054") rs = offline.executeQuery() if rs : rs.next() try : checkState = rs.getInt("state") con.close() except : checkState = 1 try : con.close() except : pass else : checkState = 1 return int(checkState)
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(SystemMessageId.S2_S1_DISAPPEARED) sm1.addItemName(item.getItemId()) sm1.addNumber(1) sm2 = SystemMessage(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 checkState(): checkState = False con = L2DatabaseFactory.getInstance().getConnection(None) offline = con.prepareStatement( "SELECT state FROM grandboss_intervallist WHERE bossId = 29054") rs = offline.executeQuery() if rs: rs.next() try: checkState = rs.getInt("state") con.close() except: checkState = 1 try: con.close() except: pass else: checkState = 1 return int(checkState)
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(None) 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().getClan().getClanId() con=L2DatabaseFactory.getInstance().getConnection(None) 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