本文整理汇总了Python中com.l2jserver.util.Rnd.get方法的典型用法代码示例。如果您正苦于以下问题:Python Rnd.get方法的具体用法?Python Rnd.get怎么用?Python Rnd.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.l2jserver.util.Rnd
的用法示例。
在下文中一共展示了Rnd.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onKill
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
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_QUEST_DROP,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
示例2: onKill
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def onKill(self,npc,player,isPet):
npcId = npc.getId()
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.getMembers().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
示例3: onKill
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def onKill(self, npc, player, isPet):
id = npc.getNpcId()
st = player.getQuestState("Leveling_System")
if not st:
st = self.newQuestState(player)
if npc:
if id == Keltas:
HellboundManager.getInstance().increaseTrust(100)
if HellboundManager.getInstance().getLevel() > 4: return
if HellboundManager.getInstance().getLevel() == 3: respTime = (72 + Rnd.get(144)) * 100000 #between 2 and 4 hours respawn retail-like
if HellboundManager.getInstance().getLevel() == 4: respTime = (288 + Rnd.get(576)) * 100000 #between 8 and 16 hours respawn retail-like
self.startQuestTimer("keltasRespawn", respTime, None, None)
for i in self.keltasmin:
i.deleteMe()
if id in self.hellboundMobs.keys():
if HellboundManager.getInstance().getLevel() > 1: return
HellboundManager.getInstance().increaseTrust(self.hellboundMobs[id]['points'])
if id in self.hellboundMobs1.keys():
HellboundManager.getInstance().increaseTrust(self.hellboundMobs1[id]['points'])
if id == WLGuard:
if HellboundManager.getInstance().getLevel() == 7:
worldObjects = SpawnTable.getInstance().getSpawnTable().values()
for i in worldObjects:
if i.getNpcid() == WLGuard:
i.stopRespawn()
示例4: runFloor
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
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
示例5: merge
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def merge(self, player, item1OID, item2OID):
inv = player.getInventory()
item1 = inv.getItemByObjectId(int(item1OID))
item2 = inv.getItemByObjectId(int(item2OID))
if not self.check(player, item1, item2):
return self.htm_header + "指定的道具出問題<BR>請確定道具能強化" + self.htm_footer
if not self.removeRequirement(player):
return self.htm_header + "需要金幣1個" + self.htm_footer
item1enclvl = item1.getEnchantLevel()
item2enclvl = item2.getEnchantLevel()
enchant2 = item2.getEnchantLevel()
inv.destroyItem(self.qn, item2, player, item2)
if Rnd.get(100) > self.chance:
self.updatePlayerInfo(player)
return self.htm_header + "<font color=FF0000>合拼強化機率性失敗</font><BR>" + self.htm_select_part + self.htm_footer
item1.setEnchantLevel(item1.getEnchantLevel()+Rnd.get(enchant2+1))
item1.updateDatabase()
player.sendPacket(EnchantResult(0, 0, 0))
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_SUCCESSFULY_ENCHANTED_A_S2_S3);
sm.addCharName(player)
sm.addNumber(item1.getEnchantLevel())
sm.addItemName(item1)
player.sendPacket(sm)
self.updatePlayerInfo(player)
return self.htm_header + "<font color=FFFF00>恭喜! 合拼強化成功 強化度由 +%d 變為 +%d</font><BR>" % (item1enclvl, item1.getEnchantLevel()) + self.htm_select_part + self.htm_footer
示例6: onEvent
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
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)
st.getPlayer().setInstanceId(0)
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(250677,25019)
st.playSound("ItemSound.quest_finish")
st.exitQuest(False)
return htmltext
示例7: spawnRaid
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def spawnRaid(self, world, raid) :
if raid == 1 :
spawnid = RAIDS1[Rnd.get(0, 2)]
elif raid == 2 :
spawnid = RAIDS2[Rnd.get(0, 3)]
elif raid == 3 :
spawnid = RAIDS3[Rnd.get(0, 2)]
spawnedNpc = self.addSpawn(spawnid, 12161, -49144, -3000, 0, False, 0, False, world.instanceId)
示例8: onAttack
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
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(), "幾乎無人防守的後方是你的!"))
else :
self.FirstAttacked = True
if Rnd.get(4) : return
npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(),"我一定會回來!"))
return
示例9: onAdvEvent
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def onAdvEvent (self, event, npc, player) :
if event == "CheckTrustP":
if self.trustp >= 500000:
HellboundManager.getInstance().changeLevel(11)
self.trustp = 0
self.saveGlobalQuestVar("trust10p", str(self.trustp))
self.cancelQuestTimers("CheckTrustP")
elif event == "keySpawn1" or event == "keySpawn2":
self.startQuestTimer("keySpawn2", 300000, None, None)
loc = LOCS[Rnd.get(len(LOCS))]
self.keymaster.teleToLocation(loc[0],loc[1],loc[2])
if event == "keySpawn1":
self.startQuestTimer("keySpawn2", 300000, None, None)
else:
self.startQuestTimer("keySpawn1", 300000, None, None)
elif event == "decayNpc":
npc.decayMe()
elif event == "NATIVESay":
world = self.worlds[npc.getInstanceId()]
npc.broadcastPacket(NpcSay(22450, 0, 22450, "我會...將...全部...打死...!"))
npc.broadcastPacket(NpcSay(22450, 0, 22450, "我會...將...全部...打死...!"))
npc.broadcastPacket(NpcSay(22450, 0, 22450, "我會...將...全部...打死...!"))
elif event == "freeprisoner":
world = self.worlds[npc.getInstanceId()]
sayNpc = npc.getObjectId()
npc.broadcastPacket(NpcSay(sayNpc, 0, npc.getNpcId(), "多謝幫助!看守者馬上就要來了快躲起來..."))
self.startQuestTimer("decayNpc", 15000, npc, None)
chance = Rnd.get(100)
if chance <= 30:
if not world.guardsSpawned:
callGuards(self,npc,player,world)
world.guardsSpawned = True
npc.broadcastPacket(NpcSay(22359, 0, 22359, "發.現.入.侵.者...!"))
hellboundLevel = HellboundManager.getInstance().getLevel()
if hellboundLevel == 10:
HellboundManager.getInstance().increaseTrust(50)
self.trustp += 50
self.saveGlobalQuestVar("trust10p", str(self.trustp))
elif event == "key":
world = self.worlds[npc.getInstanceId()]
if not world.instanceFinished:
key = player.getInventory().getItemByItemId(KEY);
if key != None:
world.instanceFinished = True
player.destroyItemByItemId("Moonlight Stone", KEY, 1, player, True);
instance = InstanceManager.getInstance().getInstance(npc.getInstanceId())
if instance != None:
instance.setDuration(30000)
instance.setReturnTeleport(ReturnPort[dataIndex][0],ReturnPort[dataIndex][1],ReturnPort[dataIndex][2])
else :
return "32343-2.htm"
else :
return "32343-1.htm"
return
示例10: onAttack
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def onAttack(self,npc,player,damage,isPet, skill):
npcId = npc.getNpcId()
NewMob,chance,NameNpc,NbMessage = MutationId[npcId]
if Rnd.get(100) <= chance :
if MutationId.has_key(npcId) :
Msg = NpcMessage[NameNpc]
npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),Msg[Rnd.get(NbMessage-1)]))
npc.deleteMe()
newNpc = self.addSpawn(NewMob,npc,)
newNpc.addDamageHate(player,0,99999)
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
return
示例11: onKill
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
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
示例12: onAttack
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def onAttack(self, npc, player, damage, isPet, skill):
npdId = npc.getId()
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
示例13: onAdvEvent
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def onAdvEvent (self,event,npc, player) :
htmltext = event
st = player.getQuestState(qn)
if not st : return
if event == "32017-03.htm" :
if st.getPlayer().getLevel() < 80 :
htmltext = "32017-02.htm"
st.exitQuest(1)
else :
st.set("cond","1")
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
elif event in REWARDS.keys() :
qty,item = REWARDS[event]
if st.getQuestItemsCount(CURSED_BURIAL) >= qty :
st.takeItems(CURSED_BURIAL,qty)
if len(item) > 1 :
itemId = item[Rnd.get(len(item))]
else :
itemId = item[0]
st.rewardItems(itemId,1)
htmltext = "32017-05c.htm"
else :
htmltext = "32017-07.htm"
elif event == "32017-08.htm" :
st.exitQuest(1)
return htmltext
示例14: onSpawn
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def onSpawn(self, npc):
npcId = npc.getNpcId()
objId = npc.getObjectId()
if npcId == AMASKARI:
self.Prisonslaves = []
self.Slaves[objId] = []
self.Slaves[objId].append("noSlaves")
xx, yy, zz = npc.getX(), npc.getY(), npc.getZ()
self.Slaves[objId] = []
for i in range(9):
offsetX = xx + (50 - Rnd.get(250))
offsetY = yy + (50 - Rnd.get(250))
newSlave = self.addSpawn(22450, offsetX, offsetY, zz, 0, False, 0, False, npc.getInstanceId())
newSlave.setRunning()
newSlave.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, npc)
self.Slaves[objId].append(newSlave)
示例15: generateBoard
# 需要导入模块: from com.l2jserver.util import Rnd [as 别名]
# 或者: from com.l2jserver.util.Rnd import get [as 别名]
def generateBoard(self, player, bet):
board = []
num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(9):
board.append(num.pop(Rnd.get(1, len(num)) - 1))
self.gameStatus[player.getName()] = [board, [], bet]
return