本文整理汇总了Python中com.l2scoria.util.random.Rnd类的典型用法代码示例。如果您正苦于以下问题:Python Rnd类的具体用法?Python Rnd怎么用?Python Rnd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Rnd类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onKill
def onKill(self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == DAIMON :
respawnMinDelay = 43200000 * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay)
self.saveGlobalQuestVar("604_respawn", str(System.currentTimeMillis()+respawn_delay))
self.startQuestTimer("spawn_npc", respawn_delay, None, None)
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 and Util.checkIfInRange(Config.ALT_PARTY_RANGE, player, player1, True) :
if st1.getState() == 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() == 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
示例2: onAttack
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(4) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Your rear is practically unguarded!"))
else :
self.FirstAttacked = True
if Rnd.get(4) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Watch your back!"))
return
示例3: 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
示例4: 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.setXYZ(185462,20342,-3250)
return
示例5: onAttack
def onAttack (self,npc,player,damage,isPet):
npcId = npc.getNpcId()
if npcId in HSMOBS:
if (Rnd.get(2) == 1):
if player.getFirstEffect(int(4554)):
malaria = player.getFirstEffect(int(4554)).getLevel()
if (Rnd.get(100) < 15):
if malaria < 10:
newmalaria = int(malaria + 1)
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4554,newmalaria))
else:
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4554,1))
elif npcId == 21317 or npcId == 21322 :
if player.getFirstEffect(int(4553)):
flu = player.getFirstEffect(int(4553)).getLevel()
if (Rnd.get(100) < 15):
if flu < 10:
newflu = int(flu + 1)
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4553,newflu))
else:
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4553,1))
elif npcId == 21319 or npcId == 21316 :
if player.getFirstEffect(int(4552)):
holera = player.getFirstEffect(int(4552)).getLevel()
if (Rnd.get(100) < 30):
if holera < 10:
newholera = int(holera + 1)
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4552,newholera))
else:
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4552,1))
else:
if player.getFirstEffect(int(4551)):
rheumatism = player.getFirstEffect(int(4551)).getLevel()
if (Rnd.get(100) < 30):
if rheumatism < 10:
newrheumatism = int(rheumatism + 1)
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4551,newrheumatism))
else:
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4551,1))
return
示例6: 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 = "31331-0a.htm"
elif player.getClan().getLevel() < 6 :
st.exitQuest(1)
htmltext = "31331-0b.htm"
else :
cond = st.getInt("cond")
raid = st.getInt("raid")
id = st.getState()
if id == CREATED and cond == 0 :
htmltext = "31331-0c.htm"
elif id == 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 = "31331-"+str(raid)+"a.htm"
elif count == 1 :
htmltext = "31331-"+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
示例7: onAttack
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(50) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Dear ultimate power!!!"))
else :
self.FirstAttacked = True
return
示例8: onAttack
def onAttack(self,npc,player,damage,isPet) :
npcId = npc.getNpcId()
objId = npc.getObjectId()
if npcId not in WATERED_SQUASH : return
if npcId in self.adultLargeSquash :
if Rnd.get(30) < 2 :
mytext = ["Укусы плетут кружево крысой ..., чтобы заменить ... тело ...!",
"Ха ха, росла! Полностью на всех!",
"Не можете чтоли все прицелиться? Смотрите все, чтобы не сбежала ...",
"Я считаю ваши удары! О, напоминает удар снова!",
"Не тратьте впустую ваше время!",
"Ха, этот звук действительно приятно слышать?",
"Я потребляю ваши атаки, чтобы расти!",
"Время, чтобы ударить снова! Ударь еще разок!",
"Tолько полезная музыка может открыть большую тыкву... Меня нельзя открыть с оружием!"]
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
return
示例9: onAttack
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(40) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"You childish fool, do you think you can catch me?"))
else :
self.FirstAttacked = True
return
示例10: onKill
def onKill (self,npc,player,isPet):
found = False
for effect in player.getAllEffects():
if effect.getSkill().getId() in KISS_OF_EVA:
found = True
if found:
dropid = Rnd.get(len(REWARDS))
dropItem(npc,REWARDS[dropid],1,player)
return
示例11: onAttack
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(40) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Hey! Were having a duel here!"))
else :
self.FirstAttacked = True
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"How dare you interrupt our fight! Hey guys, help!"))
return
示例12: onKill
def onKill(self,npc,player,isPet) :
st = player.getQuestState(qn)
if not st : return
npcId = npc.getNpcId()
if npcId in Droplist.keys() :
if Rnd.get(100) < Droplist[npcId] :
st.giveItems(Medal,1)
st.playSound("ItemSound.quest_itemget")
return
示例13: onKill
def onKill(self,npc,player,isPet):
self.FirstAttacked = False
respawnTime = long((19 + Rnd.get(8)) * 3600000)
GrandBossManager.getInstance().setBossStatus(ORFEN,DEAD)
self.startQuestTimer("orfen_spawn", respawnTime, None, None)
info = GrandBossManager.getInstance().getStatsSet(ORFEN)
info.set("respawn_time",(long(System.currentTimeMillis()) + respawnTime))
GrandBossManager.getInstance().setStatsSet(ORFEN,info)
return
示例14: onAttack
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(100) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
else :
self.FirstAttacked = True
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I will definitely repay this humiliation!"))
return
示例15: onKill
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.cats_eye_bandit:
objId=npc.getObjectId()
if Rnd.get(80) : npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I must do something about this shameful incident..."))
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ())
return