当前位置: 首页>>代码示例>>Python>>正文


Python L2DatabaseFactory.getInstance方法代码示例

本文整理汇总了Python中com.l2jserver.L2DatabaseFactory.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Python L2DatabaseFactory.getInstance方法的具体用法?Python L2DatabaseFactory.getInstance怎么用?Python L2DatabaseFactory.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.l2jserver.L2DatabaseFactory的用法示例。


在下文中一共展示了L2DatabaseFactory.getInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: suscribe_members

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
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
开发者ID:soultobe,项目名称:ZersiaHi5_FinalEdition,代码行数:27,代码来源:__init__.py

示例2: getLeaderVar

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
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)
开发者ID:4everlucky,项目名称:Data,代码行数:31,代码来源:__init__.py

示例3: setLeaderVar

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
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
开发者ID:soultobe,项目名称:ZersiaHi5_FinalEdition,代码行数:27,代码来源:__init__.py

示例4: db_exec

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
	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)
开发者ID:6009821,项目名称:s4L2J,代码行数:14,代码来源:AdminRandomSpawn.py

示例5: offlineMemberExit

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
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
开发者ID:4everlucky,项目名称:Data,代码行数:15,代码来源:__init__.py

示例6: get_GB_respawn_time

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
	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
开发者ID:andy7435,项目名称:s4L2J,代码行数:19,代码来源:GBreset.py

示例7: EvolvePet

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
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
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:21,代码来源:__init__.py

示例8: db_query

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
	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
开发者ID:6009821,项目名称:s4L2J,代码行数:22,代码来源:Rank.py

示例9: __init__

# 需要导入模块: from com.l2jserver import L2DatabaseFactory [as 别名]
# 或者: from com.l2jserver.L2DatabaseFactory import getInstance [as 别名]
	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:
#.........这里部分代码省略.........
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:103,代码来源:Leveling_System.py


注:本文中的com.l2jserver.L2DatabaseFactory.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。