コード例 #1
0
ファイル: tears.py プロジェクト: Qvinticom/l2emu
 def onSkillSee(self, npc, caster, skill, targets, isPet):
     npcId = npc.getNpcId()
     skillId = skill.getId()
     if npcId == TEARS:
         if not npc in targets:
             return
         nowHp = self.tears.getCurrentHp()
         percentage = nowHp / self.maxHp
         if percentage <= 0.1:
             if skillId == SCALESKILL:
                 if not self.getQuestTimer("ResetCasterList", npc, None):
                     self.startQuestTimer("ResetCasterList", 3200, npc,
                                          None)
                 currentTime = System.currentTimeMillis()
                 for player in self.activatedScaleList:
                     if player[0] == caster:
                         return
                 thisCasterInfo = [caster, currentTime]
                 self.activatedScaleList.append(thisCasterInfo)
                 activatedScalesCount = len(self.activatedScaleList)
                 playerList = InstanceManager.getInstance().getInstance(
                     self.instanceId).getPlayers().toArray()
                 playerCount = len(playerList)
                 if activatedScalesCount == playerCount:
                     for info in self.activatedScaleList:
                         if currentTime > info[1] + 3000:
                             self.activatedScaleList = []
                             return
                     self.tears.getEffects().stopEffects(5225)
                     self.activatedScaleList = []
コード例 #2
0
ファイル: tears.py プロジェクト: impos89/l2emu
	def onSkillSee(self,npc,caster,skill,targets,isPet):
		npcId = npc.getNpcId()
		skillId = skill.getId()
		if npcId == TEARS:
			if not npc in targets:
				return
			nowHp = self.tears.getCurrentHp()
			percentage = nowHp / self.maxHp
			if percentage <= 0.1:
				if skillId == SCALESKILL:
					if not self.getQuestTimer("ResetCasterList",npc,None):
						self.startQuestTimer("ResetCasterList",3200,npc,None)
					currentTime = System.currentTimeMillis()
					for player in self.activatedScaleList:
						if player[0] == caster:
							return
					thisCasterInfo = [caster,currentTime]
					self.activatedScaleList.append(thisCasterInfo)
					activatedScalesCount = len(self.activatedScaleList)
					playerList = InstanceManager.getInstance().getInstance(self.instanceId).getPlayers().toArray()
					playerCount = len(playerList)
					if activatedScalesCount == playerCount:
						for info in self.activatedScaleList:
							if currentTime > info[1] + 3000:
								self.activatedScaleList = []
								return
						self.tears.getEffects().stopEffects(5225)
						self.activatedScaleList = []
コード例 #3
0
ファイル: crystaline.py プロジェクト: impos89/l2emu
	def onAdvEvent (self,event,npc,player):
		if event == "timer" or event =="timer2":
			if self.npcobject[npc.getObjectId()].correct == False:
				dx = npc.getX() - 142999
				dy = npc.getY() - 151671
				d = dx * dx + dy * dy
				if d < 10000:
					npc.broadcastPacket(MagicSkillUse(npc, npc, 5441, 1, 1, 0))
					self.npcobject[npc.getObjectId()].correct = True
					self.worlds[npc.getInstanceId()].correct = self.worlds[npc.getInstanceId()].correct +1

			if self.npcobject[npc.getObjectId()].correct == False:
				dx = npc.getX() - 139494
				dy = npc.getY() - 151668
				d = dx * dx + dy * dy
				if d < 10000:
					npc.broadcastPacket(MagicSkillUse(npc, npc, 5441, 1, 1, 0))
					self.npcobject[npc.getObjectId()].correct = True
					self.worlds[npc.getInstanceId()].correct = self.worlds[npc.getInstanceId()].correct +1

			if self.worlds[npc.getInstanceId()].correct>=2:
				for door in InstanceManager.getInstance().getInstance(npc.getInstanceId()).getDoors():
					if door.getDoorId() == 24220026:
						door.openMe()
				return

			if self.npcobject[npc.getObjectId()].lastitem:
				L2World.getInstance().removeVisibleObject(self.npcobject[npc.getObjectId()].lastitem, self.npcobject[npc.getObjectId()].lastitem.getWorldRegion())
				L2World.getInstance().removeObject(self.npcobject[npc.getObjectId()].lastitem)
				if len(self.npcobject[npc.getObjectId()].walklist_order)==0:
					return

			for item in self.npcobject[npc.getObjectId()].walklist_order:
				crystal = self.npcobject[npc.getObjectId()].walklist[item]
				newpos = L2CharPosition(crystal.getX(), crystal.getY(), crystal.getZ(), 0)
				npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, newpos)
				self.npcobject[npc.getObjectId()].lastitem = crystal
				self.npcobject[npc.getObjectId()].walklist_order.remove(item)
				break;

			if(len(self.npcobject[npc.getObjectId()].walklist_order))>0:
				if event == "timer":
					self.startQuestTimer("timer2",2000,npc,None)
				else:
					self.startQuestTimer("timer",2000,npc,None)
			else:
				if self.npcobject[npc.getObjectId()].last == False:
					self.npcobject[npc.getObjectId()].last = True
					if event == "timer":
						self.startQuestTimer("timer2",2000,npc,None)
					else:
						self.startQuestTimer("timer",2000,npc,None)
			return
コード例 #4
0
ファイル: crystaline.py プロジェクト: Qvinticom/l2emu
    def onAdvEvent(self, event, npc, player):
        if event == "timer" or event == "timer2":
            if self.npcobject[npc.getObjectId()].correct == False:
                dx = npc.getX() - 142999
                dy = npc.getY() - 151671
                d = dx * dx + dy * dy
                if d < 10000:
                    npc.broadcastPacket(MagicSkillUse(npc, npc, 5441, 1, 1, 0))
                    self.npcobject[npc.getObjectId()].correct = True
                    self.worlds[npc.getInstanceId(
                    )].correct = self.worlds[npc.getInstanceId()].correct + 1

            if self.npcobject[npc.getObjectId()].correct == False:
                dx = npc.getX() - 139494
                dy = npc.getY() - 151668
                d = dx * dx + dy * dy
                if d < 10000:
                    npc.broadcastPacket(MagicSkillUse(npc, npc, 5441, 1, 1, 0))
                    self.npcobject[npc.getObjectId()].correct = True
                    self.worlds[npc.getInstanceId(
                    )].correct = self.worlds[npc.getInstanceId()].correct + 1

            if self.worlds[npc.getInstanceId()].correct >= 2:
                for door in InstanceManager.getInstance().getInstance(
                        npc.getInstanceId()).getDoors():
                    if door.getDoorId() == 24220026:
                        door.openMe()
                return

            if self.npcobject[npc.getObjectId()].lastitem:
                L2World.getInstance().removeVisibleObject(
                    self.npcobject[npc.getObjectId()].lastitem, self.npcobject[
                        npc.getObjectId()].lastitem.getWorldRegion())
                L2World.getInstance().removeObject(
                    self.npcobject[npc.getObjectId()].lastitem)
                if len(self.npcobject[npc.getObjectId()].walklist_order) == 0:
                    return

            for item in self.npcobject[npc.getObjectId()].walklist_order:
                crystal = self.npcobject[npc.getObjectId()].walklist[item]
                newpos = L2CharPosition(crystal.getX(), crystal.getY(),
                                        crystal.getZ(), 0)
                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                         newpos)
                self.npcobject[npc.getObjectId()].lastitem = crystal
                self.npcobject[npc.getObjectId()].walklist_order.remove(item)
                break

            if (len(self.npcobject[npc.getObjectId()].walklist_order)) > 0:
                if event == "timer":
                    self.startQuestTimer("timer2", 2000, npc, None)
                else:
                    self.startQuestTimer("timer", 2000, npc, None)
            else:
                if self.npcobject[npc.getObjectId()].last == False:
                    self.npcobject[npc.getObjectId()].last = True
                    if event == "timer":
                        self.startQuestTimer("timer2", 2000, npc, None)
                    else:
                        self.startQuestTimer("timer", 2000, npc, None)
            return