本文整理汇总了Python中net.sf.l2j.util.Rnd类的典型用法代码示例。如果您正苦于以下问题:Python Rnd类的具体用法?Python Rnd怎么用?Python Rnd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Rnd类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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
示例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
示例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
示例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
示例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
示例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
示例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)]))
示例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
示例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
示例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
示例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)
示例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
示例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"
示例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)