예제 #1
0
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 = ConnectionFactory.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
예제 #2
0
def suscribe_members(st):
    clan = st.getPlayer().getClanId()
    con = ConnectionFactory.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
예제 #3
0
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 = ConnectionFactory.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)
예제 #4
0
파일: __init__.py 프로젝트: ailian8415/l2mx
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=ConnectionFactory.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)
예제 #5
0
def suscribe_members(st):
    clan = st.getPlayer().getClanId()
    con = ConnectionFactory.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
예제 #6
0
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 = ConnectionFactory.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
예제 #7
0
파일: __init__.py 프로젝트: ailian8415/l2mx
def offlineMemberExit(st) :
  clan=st.getPlayer().getClanId()
  con=ConnectionFactory.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
예제 #8
0
def offlineMemberExit(st):
    clan = st.getPlayer().getClanId()
    con = ConnectionFactory.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