本文整理汇总了Python中net.sf.l2j.util.Rnd类的典型用法代码示例。如果您正苦于以下问题:Python Rnd类的具体用法?Python Rnd怎么用?Python Rnd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Rnd类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: onKill
def onKill(self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == BUMPALUMP :
respawnMinDelay = 43200000 * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay)
self.saveGlobalQuestVar("625_respawn", str(System.currentTimeMillis()+respawn_delay))
self.startQuestTimer("spawn_npc", respawn_delay, None, None)
self.cancelQuestTimer("Icicle Emperor Bumbalump has despawned",npc,None)
party = player.getParty()
if party :
PartyQuestMembers = []
for player1 in party.getPartyMembers().toArray() :
st1 = player1.getQuestState(qn)
if st1 :
if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) :
PartyQuestMembers.append(st1)
if len(PartyQuestMembers) == 0 : return
st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
if st.getQuestItemsCount(FOOD) > 0 :
st.takeItems(FOOD,1)
st.giveItems(MEAT,1)
st.set("cond","3")
st.playSound("ItemSound.quest_middle")
else :
st = player.getQuestState(qn)
if not st : return
if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) :
if st.getQuestItemsCount(FOOD) > 0 :
st.takeItems(FOOD,1)
st.giveItems(MEAT,1)
st.set("cond","3")
st.playSound("ItemSound.quest_middle")
return
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:34,代码来源:__init__.py
示例2: runFloor
def runFloor(self, world, floor):
world.status = floor
world.FloorSt = {}
world.FloorSt[floor] = PyObject()
world.FloorSt[floor].npclist = {}
if floor in [0,1,2,3,5,6,7,8] :
i = MOBS[floor][0][1]
x = FLOORS[floor][0]
y = FLOORS[floor][1]
z = FLOORS[floor][4]
while i > 0 :
rx = Rnd.get(FLOORS[floor][2])
ry = Rnd.get(FLOORS[floor][3])
newNpc = self.addSpawn(MOBS[floor][0][0], x+rx, y+ry, z, 0, False, 0, False, world.instanceId)
world.FloorSt[floor].npclist[newNpc] = False
i -= 1
if floor in [2,3,6,7,8] :
i = MOBS[floor][1][1]
x = FLOORS[floor][0]
y = FLOORS[floor][1]
z = FLOORS[floor][4]
while i > 0 :
rx = Rnd.get(FLOORS[floor][2])
ry = Rnd.get(FLOORS[floor][3])
newNpc = self.addSpawn(MOBS[floor][1][0], x+rx, y+ry, z, 0, False, 0, False, world.instanceId)
world.FloorSt[floor].npclist[newNpc] = False
i -= 1
if floor in [4,9] :
newNpc = self.addSpawn(MOBS[floor][0][0],MOBS[floor][1][0],MOBS[floor][1][1],MOBS[floor][1][2], 0, False, 0, False, world.instanceId)
world.FloorSt[floor].npclist[newNpc] = False
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:30,代码来源:__init__.py
示例3: onEvent
def onEvent (self,event,st) :
htmltext = event
if event == "32264-02.htm" :
st.set("cond", "1")
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
elif event == "32264-08.htm" :
st.giveItems(ECHO_CRYSTAL, 1)
st.set("cond", "2")
st.playSound("ItemSound.quest_middle")
elif event == "32271-03.htm" :
st.set("cond", "3")
st.giveItems(PARMES_LETTER, 1)
st.playSound("ItemSound.quest_middle")
x = Rnd.get(-100, 100)
y = Rnd.get(-100, 100)
st.getPlayer().teleToLocation(143472 + x, 191040 + y, -3696)
elif event == "32264-12.htm" :
if st.getQuestItemsCount(PARMES_LETTER) :
st.takeItems(PARMES_LETTER, 1)
st.playSound("ItemSound.quest_middle")
elif event == "32264-13.htm" :
st.takeItems(ECHO_CRYSTAL, 1)
st.addExpAndSp(1304752, 0)
st.playSound("ItemSound.quest_finish")
st.exitQuest(False)
return htmltext
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:27,代码来源:__init__.py
示例4: onTalk
def onTalk (self,npc,player):
npcId = npc.getNpcId()
htmltext = ""
if npcId == 13001 : #heart of warding
htmltext = "13001-01.htm"
if self.antharasAI :
status = GrandBossManager.getInstance().getBossStatus(29019)
if status == 0 or status == 1 : #If entrance to see Antharas is unlocked (he is Dormant or Waiting)
st = player.getQuestState(qn)
if st.getQuestItemsCount(3865) > 0 :
st.takeItems(3865,1)
self.antharasAI.zone.allowPlayerEntry(player,30)
x = 179700 + Rnd.get(700)
y = 113800 + Rnd.get(2100)
player.teleToLocation(x,y,-7709)
if status == 0 :
antharas = GrandBossManager.getInstance().getBoss(29019)
self.antharasAI.startQuestTimer("waiting",1800000, antharas, None)
GrandBossManager.getInstance().setBossStatus(29019,1)
return
else :
htmltext = "13001-03.htm"
elif status == 2 :
htmltext = "13001-02.htm"
elif npcId == 31859 : #antharas teleport cube
x = 79800 + Rnd.get(600)
y = 151200 + Rnd.get(1100)
player.teleToLocation(x,y,-3534)
return
return htmltext
开发者ID:Vados420,项目名称:l2jtw_datapack,代码行数:30,代码来源:__init__.py
示例5: onAttack
def onAttack (self, npc, player, damage, isPet, skill) :
objId = npc.getObjectId()
if self.FirstAttacked :
if Rnd.get(50) : return
npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), TEXT[Rnd.get(4)]))
else :
self.FirstAttacked = True
return
开发者ID:Vados420,项目名称:l2jtw_datapack,代码行数:8,代码来源:timak_orc_troop_leader.py
示例6: onAttack
def onAttack (self, npc, player, damage, isPet, skill) :
objId = npc.getObjectId()
if npc.getNpcId() == GARGOS :
if self.FirstAttacked :
if Rnd.get(50) : return
npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "開...開...始..."))
else :
self.FirstAttacked = True
if Rnd.get(50) : return
npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "開...開...始..."))
return
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:11,代码来源:__init__.py
示例7: onKill
def onKill (self,npc,player,isPet):
chance = Rnd.get(100)
if chance <= 5:
dropItem(npc,9422,1)
elif chance >= 6 and chance <= 10:
dropItem(npc,9429,1)
elif chance >= 11 and chance <= 15:
dropItem(npc,9438,1)
elif chance >= 16 and chance <= 30:
dropItem(npc,Rnd.get(9455,9457),1)
elif chance >= 31 and chance <= 50:
dropItem(npc,Rnd.get(6577,6578),2)
return
开发者ID:Vados420,项目名称:l2jtw_datapack,代码行数:13,代码来源:baylorChest.py
示例8: checkBelethSample
def checkBelethSample(self, world, npc, player, BS) :
world.attacked = True
for mob in world.FifthRoom.npclist :
if mob[0] == npc :
if mob[2] == 0 :
world.foundBeleth = 0
npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),TEXT[Rnd.get(9,10)]))
for mob in world.FifthRoom.npclist :
if mob[0] != npc :
mob[0].deleteMe()
else :
world.foundBeleth += 1
npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),TEXT[Rnd.get(11,13)]))
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:13,代码来源:__init__.py
示例9: onAdvEvent
def onAdvEvent (self,event,npc,player):
if event == "out":
tele = PyObject()
tele.x = 149361+Rnd.get(-100,100)
tele.y = 172327+Rnd.get(-100,100)
tele.z = -945
st = player.getQuestState("oracle7")
if not st :
st = self.newQuestState(player)
st.takeItems(9694,-1)
st.takeItems(9698,-1)
st.takeItems(9699,-1)
exitInstance(player,tele)
return
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:14,代码来源:oracle7.py
示例10: onAttack
def onAttack(self, npc, player, damage, isPet):
npdId = npc.getNpcId()
if (npc.getMaxHp()/2) > npc.getCurrentHp():
if Rnd.get(100) < 4:
if self.ImpGraveKepperStat == 1:
for j in range(2):
for k in range(2):
self.addSpawn(27180,npc.getX()+70*pow(-1,j%2),npc.getY()+70*pow(-1,k%2),npc.getZ(),0,False,0)
self.ImpGraveKepperStat = 2
else:
players = npc.getKnownList().getKnownPlayers().values().toArray()
if len(players) :
playerToTP = players[Rnd.get(int(len(players)))]
playerToTP.teleToLocation(185462,20342,-3250)
return
开发者ID:Vados420,项目名称:l2jtw_datapack,代码行数:15,代码来源:__init__.py
示例11: onKill
def onKill(self, npc, player, isPet):
npcId = npc.getNpcId()
if npcId == DAIMON:
FindTemplate(ALTAR).setBusy(False)
self.cancelQuestTimer("Daimon the White-Eyed has despawned", npc, None)
party = player.getParty()
if party:
PartyQuestMembers = []
for player1 in party.getPartyMembers().toArray():
st1 = player1.getQuestState(qn)
if st1:
if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2):
PartyQuestMembers.append(st1)
if len(PartyQuestMembers) == 0:
return
st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
if st.getQuestItemsCount(S_SUMMON) > 0:
st.takeItems(S_SUMMON, 1)
st.giveItems(ESSENCE, 1)
st.set("cond", "3")
st.playSound("ItemSound.quest_middle")
else:
st = player.getQuestState(qn)
if not st:
return
if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2):
if st.getQuestItemsCount(S_SUMMON) > 0:
st.takeItems(S_SUMMON, 1)
st.giveItems(ESSENCE, 1)
st.set("cond", "3")
st.playSound("ItemSound.quest_middle")
return
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:32,代码来源:__init__.py
示例12: runSteamRoom3Oracle
def runSteamRoom3Oracle(self,world):
world.OracleTriggered = False
o1,o2,o3,o4 = ordreOracle3[Rnd.get(len(ordreOracle3))]
self.addSpawn(o1, 152461, 152505, -12169, 31613, False, 0, False, world.instanceId)
self.addSpawn(o2, 152461, 152575, -12169, 31613, False, 0, False, world.instanceId)
self.addSpawn(o3, 152461, 152645, -12169, 31613, False, 0, False, world.instanceId)
self.addSpawn(o4, 152461, 152715, -12169, 31613, False, 0, False, world.instanceId)
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:7,代码来源:EmeraldSteam.py
示例13: onTalk
def onTalk (self,npc,player) :
htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>"
st = player.getQuestState(qn)
if not st : return htmltext
clan = player.getClan()
npcId = npc.getNpcId()
if player.getClan() == None or player.isClanLeader() == 0 :
st.exitQuest(1)
htmltext = "30868-0a.htm"
elif player.getClan().getLevel() < 5 :
st.exitQuest(1)
htmltext = "30868-0b.htm"
else :
cond = st.getInt("cond")
raid = st.getInt("raid")
id = st.getState()
if id == State.CREATED and cond == 0 :
htmltext = "30868-0c.htm"
elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys() :
npc,item,min,max=REWARDS_LIST[raid]
count = st.getQuestItemsCount(item)
CLAN_POINTS_REWARD = Rnd.get(min, max)
if not count :
htmltext = "30868-"+str(raid)+"a.htm"
elif count == 1 :
htmltext = "30868-"+str(raid)+"b.htm"
st.takeItems(item,1)
clan.setReputationScore(clan.getReputationScore()+CLAN_POINTS_REWARD,True)
player.sendPacket(SystemMessage(1777).addNumber(CLAN_POINTS_REWARD))
clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
return htmltext
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:31,代码来源:__init__.py
示例14: runForthRoom
def runForthRoom(self, world) :
world.status = 7
openDoor(D5, world.instanceId)
world.ForthRoom = PyObject()
world.ForthRoom.npclist = []
world.ForthRoom.counter = 0
temp = []
templist = []
xx = 0
for i in range(0, 7) :
temp.append(Rnd.get(len(rows)))
a, b, c, d, e, f, g = temp
world.ForthRoom.colmnOrder = []
world.ForthRoom.colmnOrder.append([a, b, c, d, e, f, g])
for i in range(0, len(temp)) :
templist.append(rows[temp[i]])
for x in range(148660, 149285, 125) :
yy = 0
for y in range(179280, 178405, -125) :
newNpc = self.addSpawn(SC, x, y, -6115, 16215, False, 0, False, world.instanceId)
world.ForthRoom.npclist.append([newNpc, templist[yy][xx], yy])
yy += 1
xx += 1
for npc in world.ForthRoom.npclist :
if npc[1] == 0 :
npc[0].setIsInvul(True)
if debug : print "DarkCloudMansion: spawned forth room"
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:27,代码来源:__init__.py
示例15: onAttack
def onAttack(self, npc, player, damage, isPet, skill) :
npcId = npc.getNpcId()
if self.worlds.has_key(npc.getInstanceId()) :
world = self.worlds[player.getInstanceId()]
if world.status == 2 :
if npcId == 22264 :
closeDoor(D2, world.instanceId)
if world.status == 7 :
if npcId == SC :
closeDoor(D5, world.instanceId)
for mob in world.ForthRoom.npclist :
if mob[0] == npc :
if mob[0].isInvul() and Rnd.get(100) < 12 :
if debug : print "DarkCloudMansion: spawn room 4 guard"
newNpc = self.addSpawn(BM[Rnd.get(len(BM))], player.getX(), player.getY(), player.getZ(), 0, False, 0, False, world.instanceId)
if world.status == 9 and not world.attacked :
checkBelethSample(self, world, npc, player, BS)
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:17,代码来源:__init__.py
示例16: onAttack
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(100) : return
npc.broadcastPacket(NpcSay(objId,0,npc.getNpcId(),"清除入侵者。"))
else :
self.FirstAttacked = True
npc.broadcastPacket(NpcSay(objId,0,npc.getNpcId(),"發現非法的目標。"))
npc.broadcastPacket(NpcSay(objId,0,npc.getNpcId(),"開始入侵者清除系統。"))
return
开发者ID:Vados420,项目名称:l2jtw_datapack,代码行数:10,代码来源:core.py
示例17: runFifthRoom
def runFifthRoom(self, world, player) :
world.status = 9
world.foundBeleth = 0
world.attacked = False
openDoor(D6, world.instanceId)
world.FifthRoom = PyObject()
world.FifthRoom.npclist = []
a, b, c, d, e, f, g = beleths[Rnd.get(len(beleths))]
world.FifthRoom.belethOrder = []
world.FifthRoom.belethOrder.append([a, b, c, d, e, f, g])
temp = [a, b, c, d, e, f, g]
idx = 0
for x in range(148720, 149175, 65) :
newNpc = self.addSpawn(BS[idx], x, 182145, -6117, 48810, False, 0, False, world.instanceId)
world.FifthRoom.npclist.append([newNpc, idx, temp[idx]])
if temp[idx] == 1 and Rnd.get(100) < 50 :
newNpc.broadcastPacket(NpcSay(newNpc.getObjectId(),0,newNpc.getNpcId(),TEXT[Rnd.get(8)]))
idx += 1
if debug : print "DarkCloudMansion: spawned fifth room"
if debug : print str(world.FifthRoom.npclist)
开发者ID:svn2github,项目名称:l2jtw_datapack,代码行数:20,代码来源:__init__.py
示例18: onSkillSee
def onSkillSee (self,npc,player,skill,targets,isPet):
# this behavior is only run when the target of skill is the passed npc (chest)
# i.e. when the player is attempting to open the chest using a skill
if not npc in targets: return
npcId = npc.getNpcId()
skillId = skill.getId()
skillLevel= skill.getLevel()
# check if the npc and skills used are valid for this script. Exit if invalid.
if npcId not in self.chests : return
# if this has already been interacted, no further ai decisions are needed
# if it's the first interaction, check if this is a box or mimic
if not npc.isInteracted() :
npc.setInteracted()
if Rnd.get(100) < IS_BOX :
# if it's a box, either it will be successfully openned by a proper key, or instantly disappear
if skillId == SKILL_DELUXE_KEY :
# check the chance to open the box
keyLevelNeeded = int(npc.getLevel()/10)
levelDiff = keyLevelNeeded - skillLevel
if levelDiff < 0 :
levelDiff = levelDiff * (-1)
chance = BASE_CHANCE - levelDiff * LEVEL_DECREASE
# success, pretend-death with rewards: npc.reduceCurrentHp(99999999, player)
if Rnd.get(100) < chance :
npc.setMustRewardExpSp(False)
npc.setSpecialDrop();
npc.reduceCurrentHp(99999999, player)
return
# used a skill other than chest-key, or used a chest-key but failed to open: disappear with no rewards
npc.onDecay()
else :
attacker = player
if npc.getAttackByList().contains(player.getPet()):
attacker = player.getPet()
npc.setRunning()
npc.addDamageHate(attacker,0,999)
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker)
return
开发者ID:Vados420,项目名称:l2jtw_datapack,代码行数:41,代码来源:chests.py
示例19: onKill
def onKill(self,npc,player,isPet):
partyMember1 = self.getRandomPartyMember(player,"1")
partyMember2 = self.getRandomPartyMemberState(player, State.COMPLETED)
if not partyMember1 and not partyMember2 : return
partyMember = partyMember1
numItems,chance = divmod(100*Config.RATE_DROP_QUEST,100)
dropchance = Rnd.get(100)
if dropchance < chance:
# player who has State.COMPLETED up to 2 out of 3 item collections may consume the party drop
if partyMember2 :
if Rnd.get(100) <= 66:
return
else :
partyMember = partyMember1
st = partyMember.getQuestState(qn)
if st :
if st.getState() == State.STARTED :
npcId = npc.getNpcId()
if st.getInt("cond") == 1:
if dropchance < chance :
numItems = numItems + 1
numItems = int(numItems)
item = ITEMS[npcId]
count = st.getQuestItemsCount(item)
if count < 50 :
if count + numItems > 50 :
numItems = 50 - count
st.giveItems(item,numItems)
count_trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES)
count_foot = st.getQuestItemsCount(FOOT_OF_BANDERSNATCHLING)
count_spice = st.getQuestItemsCount(SECRET_SPICE)
if count_trunk == count_foot == count_spice == 50 :
st.set("cond","3")
st.playSound("ItemSound.quest_middle")
else:
st.playSound("ItemSound.quest_itemget")
return
开发者ID:Vados420,项目名称:l2jtw_datapack,代码行数:37,代码来源:__init__.py
示例20: onKill
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId in range(27185,27189) :
for x in xrange(20):
newNpc = self.addSpawn(27189,npc)
killer = player
if isPet :
killer = player.getPet()
newNpc.setRunning()
newNpc.addDamageHate(killer,0,999)
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, killer)
self.startQuestTimer("despawn",300000, newNpc, None)
if Rnd.get(2) :
skill = SkillTable.getInstance().getInfo(4243,1)
if skill != None :
skill.getEffects(newNpc, killer)
return
开发者ID:Vados420,项目名称:l2jtw_datapack,代码行数:17,代码来源:fairy_trees.py
注:本文中的net.sf.l2j.util.Rnd类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论