本文整理汇总了Python中com.l2jfree.tools.random.Rnd类的典型用法代码示例。如果您正苦于以下问题:Python Rnd类的具体用法?Python Rnd怎么用?Python Rnd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Rnd类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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.set("cond", "2")
st.playSound("ItemSound.quest_middle")
elif event == "32271-02.htm" :
if not st.getQuestItemsCount(ECHO_CRYSTAL) :
st.giveItems(ECHO_CRYSTAL, 1)
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
示例2: 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
item,chance = DROPLIST[npc.getNpcId()]
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 :
count = st.getQuestItemsCount(item)
if st.getInt("cond") == 1 and count < 100 :
numItems, chance = divmod(chance*Config.RATE_DROP_QUEST,100)
if dropchance < chance:
numItems += 1
if count + numItems >= 100 :
numItems = 100 - count
if numItems != 0 :
st.giveItems(item,int(numItems))
if st.getQuestItemsCount(LEAF_OF_FLAVA) == st.getQuestItemsCount(BUFFALO_MEAT) == st.getQuestItemsCount(ANTELOPE_HORN) == 100 :
st.set("cond","2")
st.playSound("ItemSound.quest_middle")
else :
st.playSound("ItemSound.quest_itemget")
return
示例3: 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
示例4: onAttack
def onAttack (self, npc, player, damage, isPet, skill) :
objId = npc.getObjectId()
if self.FirstAttacked :
if Rnd.get(4) : return
npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "Your rear is practically unguarded!"))
else :
self.FirstAttacked = True
if Rnd.get(4) : return
npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(),"Watch your back!"))
return
示例5: onAttack
def onAttack(self, npc, player, damage, isPet, skill):
npdId = npc.getNpcId()
if (npc.getMaxHp()/2) > npc.getStatus().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.getPosition().setXYZ(185462,20342,-3250)
return
示例6: onTalk
def onTalk(self, npc, player) :
npcId = npc.getNpcId()
castleOwner = CastleManager.getInstance().getCastleById(8).getOwnerId()
clanId = player.getClanId()
if castleOwner and clanId :
if castleOwner == clanId :
X = 12558 + (Rnd.get(200) - 100)
Y = -49279 + (Rnd.get(200) - 100)
player.teleToLocation(X, Y, -3007)
return
else :
htmltext = "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>"
else :
htmltext = "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>"
return htmltext
示例7: 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)
示例8: onTalk
def onTalk (self,npc,player) :
htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</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
示例9: onAdvEvent
def onAdvEvent(self,event,npc,player):
if event == "startBaylor":
self.baylor = self.addSpawn(BAYLOR, 154839, 142807, -12718, 32900, False, 0, False, self.instanceId)
return
htmltext = event
if event == "meet":
item1 = player.getInventory().getItemByItemId(BLUE_CRYSTAL)
item2 = player.getInventory().getItemByItemId(RED_CRYSTAL)
item3 = player.getInventory().getItemByItemId(CLEAR_CRYSTAL)
if not item1 or not item2 or not item3:
htmltext = "<html><body>Oracle Guide:<br>You do not have all the crystals, I can't let you in.<br><a action=\"bypass -h Quest Quest oracle7 exit\">Let me out!</a></body></html>"
else:
player.destroyItemByItemId("Meeting with Baylor", CRY[Rnd.get(len(CRY))], 1, player, True)
tele = PyObject()
tele.x = 153570
tele.y = 142077
tele.z = -12745
teleportplayer(player,tele)
if not self.isSpawned:
self.instanceId = player.getInstanceId()
self.startQuestTimer("startBaylor",10000,None,None)
self.isSpawned = True
return
elif event == "exit":
tele = PyObject()
tele.x = 149361
tele.y = 172327
tele.z = -945
exitInstance(player,tele)
return
return htmltext
示例10: onEvent
def onEvent (self,event,st) :
htmltext = event
if event == "30081-02.htm" :
st.set("cond","1")
condition = Rnd.get(1,2)
if condition == 1 :
st.set("cond","2")
htmltext = "30081-02a.htm"
else :
st.set("cond","5")
htmltext = "30081-02b.htm"
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
elif event == "30511-03.htm" :
st.set("cond","6")
st.playSound("ItemSound.quest_middle")
elif event == "31572-03.htm" :
st.set("cond","3")
st.playSound("ItemSound.quest_middle")
elif event == "30081-05a.htm" :
st.takeItems(FishChest,1)
st.giveItems(WondrousCubic,1)
st.playSound("ItemSound.quest_finish")
st.exitQuest(False)
elif event == "30081-05b.htm" :
st.takeItems(SeedJar,1)
st.giveItems(WondrousCubic,1)
st.playSound("ItemSound.quest_finish")
st.exitQuest(False)
return htmltext
示例11: 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"
示例12: 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(), "Destroy the enemy, my brothers!"))
else :
self.FirstAttacked = True
return
示例13: 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)
示例14: sendSlaves
def sendSlaves(self,player,world):
playerList = InstanceManager.getInstance().getInstance(player.getInstanceId()).getPlayers().toArray()
for slave in world.AmaskariSlaves.npclist:
char = playerList[Rnd.get(len(playerList))]
player = L2World.getInstance().findPlayer(char)
slave.setRunning()
slave.addDamageHate(player, 0, 999)
slave.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
示例15: 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(), "Dear ultimate power!!!"))
else :
self.FirstAttacked = True
return