當前位置: 首頁>>代碼示例>>Python>>正文


Python random.Rnd類代碼示例

本文整理匯總了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
開發者ID:brisioksss,項目名稱:scoria-interlude,代碼行數:34,代碼來源:__init__.py

示例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 
開發者ID:andyperm,項目名稱:scoria-interlude,代碼行數:10,代碼來源:karul_bugbear.py

示例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
開發者ID:andyperm,項目名稱:scoria-interlude,代碼行數:15,代碼來源:benom.py

示例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
開發者ID:andyperm,項目名稱:scoria-interlude,代碼行數:15,代碼來源:__init__.py

示例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 
開發者ID:brisioksss,項目名稱:scoria-interlude,代碼行數:48,代碼來源:__init__.py

示例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
開發者ID:brisioksss,項目名稱:scoria-interlude,代碼行數:31,代碼來源:__init__.py

示例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 
開發者ID:brisioksss,項目名稱:scoria-interlude,代碼行數:8,代碼來源:timak_orc_overlord.py

示例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
開發者ID:Kingzor,項目名稱:scoria4,代碼行數:17,代碼來源:squash.py

示例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
開發者ID:andyperm,項目名稱:scoria-interlude,代碼行數:8,代碼來源:cats_eye_bandit.py

示例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
開發者ID:Kingzor,項目名稱:scoria4,代碼行數:9,代碼來源:evabox.py

示例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 
開發者ID:andyperm,項目名稱:scoria-interlude,代碼行數:9,代碼來源:delu_lizardman_special_agent.py

示例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
開發者ID:Kingzor,項目名稱:scoria4,代碼行數:9,代碼來源:__init__.py

示例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 
開發者ID:andyperm,項目名稱:scoria-interlude,代碼行數:9,代碼來源:orfen.py

示例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 
開發者ID:andyperm,項目名稱:scoria-interlude,代碼行數:9,代碼來源:ol_mahum_general.py

示例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
開發者ID:andyperm,項目名稱:scoria-interlude,代碼行數:10,代碼來源:cats_eye_bandit.py


注:本文中的com.l2scoria.util.random.Rnd類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。