Esempio n. 1
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=L2DatabaseFactory.getInstance().getConnection()
  offline=con.prepareStatement("SELECT value FROM character_quests WHERE char_id=? 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)
Esempio n. 2
0
def suscribe_members(st):
    clan = st.getPlayer().getClan().getClanId()
    con = L2DatabaseFactory.getInstance().getConnection(None)
    offline = con.prepareStatement(
        "SELECT obj_Id FROM characters WHERE clanid=? AND online=0")
    offline.setInt(1, clan)
    rs = offline.executeQuery()
    while (rs.next()):
        char_id = rs.getInt("obj_Id")
        try:
            insertion = con.prepareStatement(
                "INSERT INTO character_quests (char_id,name,var,value) VALUES (?,?,?,?)"
            )
            insertion.setInt(1, char_id)
            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
Esempio n. 3
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 = L2DatabaseFactory.getInstance().getConnection(None)
        offline = con.prepareStatement(
            "UPDATE character_quests SET value=? WHERE char_id=? 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
Esempio n. 4
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 = L2DatabaseFactory.getInstance().getConnection(None)
    offline = con.prepareStatement(
        "SELECT value FROM character_quests WHERE char_id=? 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)
Esempio n. 5
0
def offlineMemberExit(st) :
  clan=st.getPlayer().getClan().getClanId()
  con=L2DatabaseFactory.getInstance().getConnection()
  offline=con.prepareStatement("DELETE FROM character_quests WHERE name = ? and char_id IN (SELECT obj_id 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
Esempio n. 6
0
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
Esempio n. 7
0
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
Esempio n. 8
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=L2DatabaseFactory.getInstance().getConnection()
    offline=con.prepareStatement("UPDATE character_quests SET value=? WHERE char_id=? 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
Esempio n. 9
0
def suscribe_members(st) :
  clan=st.getPlayer().getClan().getClanId()
  con=L2DatabaseFactory.getInstance().getConnection()
  offline=con.prepareStatement("SELECT obj_Id FROM characters WHERE clanid=? AND online=0")
  offline.setInt(1, clan)
  rs=offline.executeQuery()
  while (rs.next()) :
    char_id=rs.getInt("obj_Id")
    try :
      insertion = con.prepareStatement("INSERT INTO character_quests (char_id,name,var,value) VALUES (?,?,?,?)")
      insertion.setInt(1, char_id)
      insertion.setString(2, qn)
      insertion.setString(3, "<state>")
      insertion.setString(4, "Progress")
      insertion.executeUpdate()
      insertion.close();
    except :
      try : insertion.close()
      except : pass
  try :
    con.close()
  except :
    pass