예제 #1
0
def checkCondition(player):
    party = player.getParty()
    if not party:
        player.sendPacket(
            SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER))
        return False
    else:
        st = player.getQuestState(qn)
        partyLeader = st.getPlayer().getParty().getLeader()
        if player != partyLeader:
            player.sendPacket(
                SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER))
            return
        for partyMember in party.getPartyMembers().toArray():
            if not partyMember.isInsideRadius(player, 500, True, True):
                sm = SystemMessage(
                    SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED)
                sm.addPcName(partyMember)
                player.sendPacket(sm)
                return False
            if not partyMember.getLevel() >= 78:
                sm = SystemMessage(
                    SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT)
                sm.addPcName(partyMember)
                player.sendPacket(sm)
                partyMember.sendPacket(sm)
                return False
    return True
예제 #2
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     if not st:
         st = self.newQuestState(player)
     level = int(event[3:])
     KamaInfo = KAMALOKA[level]
     if not KamaInfo[9]:
         player.sendPacket(
             SystemMessage.sendString(
                 "This Kamaloka has been disabled by an Admin"))
         return
     party = player.getParty()
     if party:
         partyLeader = st.getPlayer().getParty().getLeader()
         if player != partyLeader:
             player.sendPacket(
                 SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER))
             return
     if player.getInstanceId() != 0:
         player.sendPacket(
             SystemMessage(SystemMessageId.
                           ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER))
         return
     instanceId = enterInstance(self, player, KamaInfo, level)
     if not instanceId:
         return
     if instanceId == 0:
         return
     return
예제 #3
0
def enterInstance(self,player,template,teleto):
    instanceId = 0
    if not checkCondition(player):
        return 0
    party = player.getParty()
    # Check for existing instances of party members
    for partyMember in party.getPartyMembers().toArray():
        if partyMember.getInstanceId()!=0:
            sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED)
            sm.addPcName(partyMember)
            player.sendPacket(sm)
            return 0
    instanceId = InstanceManager.getInstance().createDynamicInstance(template)
    world = PyObject()
    world.instanceId = instanceId
    world.instanceFinished = False
    world.guardsSpawned = False
    world.status = 0
    self.worlds[instanceId] = world
    self.world_ids.append(instanceId)
    spawnKeyMaster(self,world)
    # Teleports player
    teleto.instanceId = instanceId
    for partyMember in party.getPartyMembers().toArray():
        st = partyMember.getQuestState(qn)
        if not st:
            self.newQuestState(partyMember)
        teleportplayer(self,partyMember,teleto)
    return instanceId
예제 #4
0
def checkCondition(player, KamaInfo):
    currentTime = System.currentTimeMillis() / 1000
    party = player.getParty()
    if not party:
        player.sendPacket(
            SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER))
        return False
    # Check size of the party, max 6 for entering Kamaloka Hall of Abyss, 9 for Labyrinth
    if party and party.getMemberCount() > KamaInfo[5]:
        player.sendPacket(
            SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER))
        return False
    for partyMember in party.getPartyMembers().toArray():
        if partyMember.getLevel() < KamaInfo[3] or partyMember.getLevel(
        ) > KamaInfo[4]:
            sm = SystemMessage(
                SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT)
            sm.addPcName(partyMember)
            player.sendPacket(sm)
            partyMember.sendPacket(sm)
            return False
        st = partyMember.getQuestState(qn)
        if st:
            LastEntry = st.getInt("LastEntry")
            if currentTime < LastEntry + KamaInfo[1]:
                sm = SystemMessage(SystemMessageId.NO_RE_ENTER_TIME_FOR_C1)
                sm.addPcName(partyMember)
                player.sendPacket(sm)
                partyMember.sendPacket(sm)
                return False
    return True
예제 #5
0
 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
     npcId = npc.getNpcId()
     if npcId == YOGI:
         account = player.getAccountName()
         if account in FORBIDDEN_ACCOUNTS:
             player.sendPacket(
                 SystemMessage.sendString(
                     "Your account is not allowed to participate in the event. Contact a GameMaster if you need explanations."
                 ))
             return ""
         if ALLOWEDLEVELS > 0 and player.getLevel() < ALLOWEDLEVELS:
             player.sendPacket(
                 SystemMessage.sendString(
                     "Sorry, you may only take part of this event once you reached level "
                     + str(ALLOWEDLEVELS)))
             return ""
         htmltext = st.showHtmlFile("32599.htm").replace(
             "Adena1", str(1000 * RATE))
         htmltext = htmltext.replace("Adena2", str(6000 * RATE))
         htmltext = htmltext.replace("Adena3", str(77777 * RATE))
         htmltext = htmltext.replace("Adena4", str(777770 * RATE))
     return htmltext
예제 #6
0
def enterInstance(self,player,KamaInfo,level):
	instanceId = 0
	template = KamaInfo[0]
	reuse = KamaInfo[1]
	if checkDistance(player):
		return 0
	if not checkCondition(player,KamaInfo):
		return 0
	party = player.getParty()
	# Check for existing instances of party members
	for partyMember in party.getPartyMembers().toArray():
		if partyMember.getInstanceId() != 0:
			sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED)
			sm.addPcName(partyMember)
			player.sendPacket(sm)
			return 0
	# New instance
	instanceId = InstanceManager.getInstance().createDynamicInstance(template)
	world = PyObject()
	world.instanceId = instanceId
	self.worlds[instanceId]=world
	self.world_ids.append(instanceId)
	if level in [29,39,49,59,69,78,81]:
		world.level = level
		startFirstRoom(self,world)
	if debug:
		print "Kamaloka: started " + template + " Instance: " +str(instanceId) + " created by player: " + str(player.getName())
	# Teleport players
	for partyMember in party.getPartyMembers().toArray():
		partyMember.stopAllEffectsExceptThoseThatLastThroughDeath()
		partyMember.clearSouls()
		partyMember.clearCharges()
		teleportplayer(self,partyMember,KamaInfo,instanceId)
	return instanceId
예제 #7
0
def enterInstance(self, player, template, teleto):
    instanceId = 0
    if not checkCondition(player):
        return 0
    party = player.getParty()
    # Check for existing instances of party members
    for partyMember in party.getPartyMembers().toArray():
        if partyMember.getInstanceId() != 0:
            sm = SystemMessage(
                SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED)
            sm.addPcName(partyMember)
            player.sendPacket(sm)
            return 0
    instanceId = InstanceManager.getInstance().createDynamicInstance(template)
    world = PyObject()
    world.instanceId = instanceId
    world.instanceFinished = False
    world.guardsSpawned = False
    world.status = 0
    self.worlds[instanceId] = world
    self.world_ids.append(instanceId)
    spawnKeyMaster(self, world)
    # Teleports player
    teleto.instanceId = instanceId
    for partyMember in party.getPartyMembers().toArray():
        st = partyMember.getQuestState(qn)
        if not st:
            self.newQuestState(partyMember)
        teleportplayer(self, partyMember, teleto)
    return instanceId
예제 #8
0
 def giveItem(self,player,itemId,count):
     item = player.getInventory().addItem("Quest", itemId, count, player, None)
     iu = InventoryUpdate()
     iu.addItem(item)
     player.sendPacket(iu)
     sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2)
     sm.addItemName(item)
     sm.addNumber(1)
     player.sendPacket(sm)
     return item
예제 #9
0
def checkDistance(player) :
	isTooFar = False
	party = player.getParty()
	if party:
		for partyMember in party.getPartyMembers().toArray():
			if not partyMember.isInsideRadius(player, MAX_DISTANCE, True, True):
				isTooFar = True
				break;
	if isTooFar:
		sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED)
		sm.addPcName(partyMember)
		player.sendPacket(sm)
	return isTooFar
예제 #10
0
def checkDistance(player):
    isTooFar = False
    party = player.getParty()
    if party:
        for partyMember in party.getPartyMembers().toArray():
            if not partyMember.isInsideRadius(player, MAX_DISTANCE, True,
                                              True):
                isTooFar = True
                break
    if isTooFar:
        sm = SystemMessage(
            SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED)
        sm.addPcName(partyMember)
        player.sendPacket(sm)
    return isTooFar
예제 #11
0
 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-0.htm"
  elif player.getClan().getLevel() < 5 :
     st.exitQuest(1)
     htmltext =  "31331-0.htm"
  else :
     cond = st.getInt("cond")
     id = st.getState()
     if id == State.CREATED and cond == 0 :
        htmltext =  "31331-1.htm"
     elif id == State.STARTED and cond == 1 :
        count = st.getQuestItemsCount(Claw)
        if not count :
           htmltext = "31331-4.htm"
        elif count >= 1 :
           htmltext = "31331-7.htm" # custom html
           st.takeItems(Claw,-1)
           reward = int(CLAN_POINTS_REWARD * count)
           clan.setReputationScore(clan.getReputationScore()+reward,True)
           player.sendPacket(SystemMessage(1777).addNumber(reward))
           clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
  return htmltext
예제 #12
0
 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
예제 #13
0
def checkCondition(player):
    party = player.getParty()
    if party:
        player.sendPacket(
            SystemMessage.sendString("Pailaka only for one person."))
        return False
    return True
예제 #14
0
 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
     npcId = npc.getNpcId()
     if npcId == YOGI :
         account = player.getAccountName()
         if account in FORBIDDEN_ACCOUNTS:
             player.sendPacket(SystemMessage.sendString("Your account is not allowed to participate in the event. Contact a GameMaster if you need explanations."))
             return ""
         if ALLOWEDLEVELS > 0 and player.getLevel() < ALLOWEDLEVELS:
             player.sendPacket(SystemMessage.sendString("Sorry, you may only take part of this event once you reached level "+str(ALLOWEDLEVELS)))
             return ""
         htmltext = st.showHtmlFile("32599.htm").replace("Adena1", str(1000 * RATE))
         htmltext = htmltext.replace("Adena2", str(6000 * RATE))
         htmltext = htmltext.replace("Adena3", str(77777 * RATE))
         htmltext = htmltext.replace("Adena4", str(777770 * RATE))
     return htmltext
예제 #15
0
def checkCondition(player,KamaInfo):
	currentTime = System.currentTimeMillis()/1000
	party = player.getParty()
	if not party:
		player.sendPacket(SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER))
		return False
	# Check size of the party, max 6 for entering Kamaloka Hall of Abyss, 9 for Labyrinth
	if party and party.getMemberCount() > KamaInfo[5]:
		player.sendPacket(SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER))
		return False
	for partyMember in party.getPartyMembers().toArray():
		if partyMember.getLevel() < KamaInfo[3] or partyMember.getLevel() > KamaInfo[4]:
			sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT)
			sm.addPcName(partyMember)
			player.sendPacket(sm)
			partyMember.sendPacket(sm)
			return False
		st = partyMember.getQuestState(qn)
		if st:
			LastEntry = st.getInt("LastEntry")
			if currentTime < LastEntry + KamaInfo[1]:
				sm = SystemMessage(SystemMessageId.NO_RE_ENTER_TIME_FOR_C1)
				sm.addPcName(partyMember)
				player.sendPacket(sm)
				partyMember.sendPacket(sm)
				return False
	return True
예제 #16
0
def enterInstance(self, player, KamaInfo, level):
    instanceId = 0
    template = KamaInfo[0]
    reuse = KamaInfo[1]
    if checkDistance(player):
        return 0
    if not checkCondition(player, KamaInfo):
        return 0
    party = player.getParty()
    # Check for existing instances of party members
    for partyMember in party.getPartyMembers().toArray():
        if partyMember.getInstanceId() != 0:
            sm = SystemMessage(
                SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED)
            sm.addPcName(partyMember)
            player.sendPacket(sm)
            return 0
    # New instance
    instanceId = InstanceManager.getInstance().createDynamicInstance(template)
    world = PyObject()
    world.instanceId = instanceId
    self.worlds[instanceId] = world
    self.world_ids.append(instanceId)
    if level in [29, 39, 49, 59, 69, 78, 81]:
        world.level = level
        startFirstRoom(self, world)
    if debug:
        print "Kamaloka: started " + template + " Instance: " + str(
            instanceId) + " created by player: " + str(player.getName())
    # Teleport players
    for partyMember in party.getPartyMembers().toArray():
        partyMember.stopAllEffectsExceptThoseThatLastThroughDeath()
        partyMember.clearSouls()
        partyMember.clearCharges()
        teleportplayer(self, partyMember, KamaInfo, instanceId)
    return instanceId
예제 #17
0
 def onSkillSee(self, npc, caster, skill, targets, isPet):
     if HellboundManager.getInstance().getHellboundLevel() >= 7:
         skillId = skill.getId()
         if skillId != 2359:
             return
         if not npc in targets:
             return
         percent = npc.getStatus().getCurrentHp() / npc.getMaxHp() * 100
         if percent <= 10:
             npc.setMagicBottled(True, percent)
         else:
             npc.setQuestDropable(False)
             caster.sendPacket(
                 SystemMessage(SystemMessageId.NOTHING_HAPPENED))
             return
     return
예제 #18
0
 def giveItem(self, player, itemId, count):
     item = player.getInventory().addItem("Quest", itemId, count, player,
                                          None)
     iu = InventoryUpdate()
     iu.addItem(item)
     player.sendPacket(iu)
     sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2)
     sm.addItemName(item)
     sm.addNumber(1)
     player.sendPacket(sm)
     return item
예제 #19
0
def checkCondition(player):
    if not player.getLevel() >= 78:
        sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT)
        sm.addPcName(player)
        player.sendPacket(sm)
        return False
    party = player.getParty()
    if not party:
        player.sendPacket(SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER))
        return False
    if party and party.getMemberCount() > 2:
        player.sendPacket(SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER))
        return False
    st = player.getQuestState(qn)
    partyLeader = st.getPlayer().getParty().getLeader()
    if player != partyLeader:
        player.sendPacket(SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER))
        return False
    return True
예제 #20
0
	def onAdvEvent (self,event,npc,player):
		st = player.getQuestState(qn)
		if not st:
			st = self.newQuestState(player)
		level = int(event[3:])
		KamaInfo = KAMALOKA[level]
		if not KamaInfo[9]:
			player.sendPacket(SystemMessage.sendString("This Kamaloka has been disabled by an Admin"))
			return
		party = player.getParty()
		if party:
			partyLeader = st.getPlayer().getParty().getLeader()
			if player != partyLeader:
				player.sendPacket(SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER))
				return	
		if player.getInstanceId() != 0:
			player.sendPacket(SystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER))
			return
		instanceId = enterInstance(self,player,KamaInfo,level)
		if not instanceId:
			return
		if instanceId == 0:
			return
		return
예제 #21
0
    def onTalk (self,npc,player):
        npcId = npc.getNpcId()
        if npcId == YIYEN :
            tele = PyObject()
            tele.x = 146534
            tele.y = 180464
            tele.z = -6117
            instanceId = enterInstance(self, player, "DarkCloudMansion.xml", tele)
            if not instanceId:
                return
            if instanceId == 0:
                return
        elif npcId == SOTruth :
            if npc.getInstanceId() == 0:
                return
            world = self.worlds[npc.getInstanceId()]
            item = player.getInventory().addItem("Quest", CC, 1, player, None)
            iu = InventoryUpdate()
            iu.addItem(item)
            player.sendPacket(iu)
            sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2)
            sm.addItemName(item)
            sm.addNumber(1)
            player.sendPacket(sm)

            tele = PyObject()
            tele.x = 139968
            tele.y = 150367
            tele.z = -3111
            exitInstance(player,tele)
            if debug: print "DarkCloudMansion - id"+str(player.getObjectId())+" rewarded and gone out of instance"

            # Check if the instance is empty, as it should be destroyed directly if yes according to retail info.
            playerList = InstanceManager.getInstance().getInstance(world.instanceId).getPlayers().toArray()
            playerCount = len(playerList)
            if playerCount == 0:
                del self.worlds[npc.getInstanceId()]
                self.world_ids.remove(npc.getInstanceId())
                InstanceManager.getInstance().destroyInstance(npc.getInstanceId())
        return
예제 #22
0
def checkCondition(player):
    party = player.getParty()
    if not party:
        player.sendPacket(SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER))    
        return False
    else:
        st = player.getQuestState(qn)
        partyLeader = st.getPlayer().getParty().getLeader()
        if player != partyLeader:
            player.sendPacket(SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER))
            return
        for partyMember in party.getPartyMembers().toArray():
            if not partyMember.isInsideRadius(player, 500, True, True):
                sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED)
                sm.addPcName(partyMember)
                player.sendPacket(sm)
                return False
            if not partyMember.getLevel() >= 78:
                sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT)
                sm.addPcName(partyMember)
                player.sendPacket(sm)
                partyMember.sendPacket(sm)
                return False
    return True
예제 #23
0
 def sendString(self,player,string):
     player.sendPacket(SystemMessage.sendString(string))
예제 #24
0
def checkCondition(player):
    party = player.getParty()
    if party:
        player.sendPacket(SystemMessage.sendString("Pailaka only for one person."))    
        return False
    return True
예제 #25
0
 def onAdvEvent (self,event,npc,player):
     if event == "Autochat":
         text = TEXTS[Rnd.get(len(TEXTS))]
         npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),str(text)))
         return
     elif event == "SpawnYogi":
         self.yogiSpawnList = []
         yogi = self.addSpawn(YOGI, 82941, 149318, -3473, 39138, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 148022, -55481, -2738, 34214, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 15776, 142872, -2710, 17423, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, -14067, 123290, -3121, 18774, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 87015, -143229, -1296, 4092, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 117104, 77017, -2699, 32767, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 146772, 25906, -2017, 57344, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 43984, -47713, -801, 47497, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 82882, 53098, -1500, 17351, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, -83127, 150941, -3133, 0, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 111333, 219424, -3550, 48247, False, 0, False, 0)
         self.yogiSpawnList.append(yogi)
         if AUTODESPAWN:
             self.startQuestTimer("DespawnYogi", 1800000, None, None)
         return
     elif event == "DespawnYogi":
         DATE = getDate(self)
         if int(DATE) <= int(EVENTENDDATE):
             self.startQuestTimer("DespawnYogi", 1800000, None, None)
         else:
             for yogi in self.yogiSpawnList:
                 yogi.decayMe()
             print "Master of Enchanting event is finished"  
         return
     st = player.getQuestState(qn)
     if not st: st = self.newQuestState(player)
     htmltext = event
     npcId = npc.getNpcId()
     if npcId == YOGI:
         if event == "32599.htm":
             htmltext = st.showHtmlFile("32599.htm").replace("Adena1", str(1000 * RATE))
             htmltext = htmltext.replace("Adena2", str(6000 * RATE))
             htmltext = htmltext.replace("Adena3", str(77777 * RATE))
             htmltext = htmltext.replace("Adena4", str(777770 * RATE))
         elif event == "32599-01.htm":
             if st.getQuestItemsCount(STAFF) >= 1 or st.getQuestItemsCount(ADENA) < 1000 * RATE:
                 htmltext = "32599-02.htm"
             else:
                 st.takeItems(ADENA, 1000 * RATE)
                 st.giveItems(STAFF, 1)
         elif event == "32599-03.htm":
             if st.getQuestItemsCount(ADENA) < 6000 * RATE:
                 htmltext = "32599-02.htm"
             else:
                 lastUsed = check(self,player)
                 if lastUsed == 0:
                     st.takeItems(ADENA, 6000 * RATE)
                     st.giveItems(SCROLL, 24)
                 else:
                     remainingTime = (lastUsed + 21600) - (System.currentTimeMillis() / 1000)
                     player.sendPacket(SystemMessage.sendString("Remaining time: "+str(remainingTime)+" seconds"))
         elif event == "32599-05.htm":
             if st.getQuestItemsCount(ADENA) < 77777 * RATE:
                 htmltext = "32599-02.htm"
             else:
                 st.takeItems(ADENA, 77777 * RATE)
                 st.giveItems(SCROLL, 1)
         elif event == "32599-06.htm":
             if st.getQuestItemsCount(ADENA) < 777770 * RATE:
                 htmltext = "32599-02.htm"
             else:
                 st.takeItems(ADENA, 777770 * RATE)
                 st.giveItems(SCROLL, 10)
         elif event == "Rewards":
             account = player.getAccountName()
             if account in FORBIDDEN_ACCOUNTS:
                 player.sendPacket(SystemMessage.sendString("Your account is not allowed to participate in the event. Contact a GameMaster if you need explanations."))
                 return ""
             weapon = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
             if weapon:
                 weaponId = weapon.getItemId()
                 if weaponId == STAFF and weapon.getEnchantLevel() > 3:
                     enchant = weapon.getEnchantLevel()
                     if LOGVALUE > 0 and enchant >= LOGVALUE:
                         print "Master of Enchanting event: Player "+str(player.getName())+" brought a +"+str(enchant)+" weapon"
                     rewardPlayer(self,st,enchant)
                     htmltext = "32599-08.htm"
                 else:
                     htmltext = "32599-07.htm"
             else:
                 htmltext = "32599-07.htm"
     return htmltext
예제 #26
0
 def onAdvEvent(self, event, npc, player):
     if event == "Autochat":
         text = TEXTS[Rnd.get(len(TEXTS))]
         npc.broadcastPacket(
             NpcSay(npc.getObjectId(), 0, npc.getNpcId(), str(text)))
         return
     elif event == "SpawnYogi":
         self.yogiSpawnList = []
         yogi = self.addSpawn(YOGI, 82941, 149318, -3473, 39138, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 148022, -55481, -2738, 34214, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 15776, 142872, -2710, 17423, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, -14067, 123290, -3121, 18774, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 87015, -143229, -1296, 4092, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 117104, 77017, -2699, 32767, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 146772, 25906, -2017, 57344, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 43984, -47713, -801, 47497, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 82882, 53098, -1500, 17351, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, -83127, 150941, -3133, 0, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         yogi = self.addSpawn(YOGI, 111333, 219424, -3550, 48247, False, 0,
                              False, 0)
         self.yogiSpawnList.append(yogi)
         if AUTODESPAWN:
             self.startQuestTimer("DespawnYogi", 1800000, None, None)
         return
     elif event == "DespawnYogi":
         DATE = getDate(self)
         if int(DATE) <= int(EVENTENDDATE):
             self.startQuestTimer("DespawnYogi", 1800000, None, None)
         else:
             for yogi in self.yogiSpawnList:
                 yogi.decayMe()
             print "Master of Enchanting event is finished"
         return
     st = player.getQuestState(qn)
     if not st: st = self.newQuestState(player)
     htmltext = event
     npcId = npc.getNpcId()
     if npcId == YOGI:
         if event == "32599.htm":
             htmltext = st.showHtmlFile("32599.htm").replace(
                 "Adena1", str(1000 * RATE))
             htmltext = htmltext.replace("Adena2", str(6000 * RATE))
             htmltext = htmltext.replace("Adena3", str(77777 * RATE))
             htmltext = htmltext.replace("Adena4", str(777770 * RATE))
         elif event == "32599-01.htm":
             if st.getQuestItemsCount(STAFF) >= 1 or st.getQuestItemsCount(
                     ADENA) < 1000 * RATE:
                 htmltext = "32599-02.htm"
             else:
                 st.takeItems(ADENA, 1000 * RATE)
                 st.giveItems(STAFF, 1)
         elif event == "32599-03.htm":
             if st.getQuestItemsCount(ADENA) < 6000 * RATE:
                 htmltext = "32599-02.htm"
             else:
                 lastUsed = check(self, player)
                 if lastUsed == 0:
                     st.takeItems(ADENA, 6000 * RATE)
                     st.giveItems(SCROLL, 24)
                 else:
                     remainingTime = (lastUsed + 21600) - (
                         System.currentTimeMillis() / 1000)
                     player.sendPacket(
                         SystemMessage.sendString("Remaining time: " +
                                                  str(remainingTime) +
                                                  " seconds"))
         elif event == "32599-05.htm":
             if st.getQuestItemsCount(ADENA) < 77777 * RATE:
                 htmltext = "32599-02.htm"
             else:
                 st.takeItems(ADENA, 77777 * RATE)
                 st.giveItems(SCROLL, 1)
         elif event == "32599-06.htm":
             if st.getQuestItemsCount(ADENA) < 777770 * RATE:
                 htmltext = "32599-02.htm"
             else:
                 st.takeItems(ADENA, 777770 * RATE)
                 st.giveItems(SCROLL, 10)
         elif event == "Rewards":
             account = player.getAccountName()
             if account in FORBIDDEN_ACCOUNTS:
                 player.sendPacket(
                     SystemMessage.sendString(
                         "Your account is not allowed to participate in the event. Contact a GameMaster if you need explanations."
                     ))
                 return ""
             weapon = player.getInventory().getPaperdollItem(
                 Inventory.PAPERDOLL_LRHAND)
             if weapon:
                 weaponId = weapon.getItemId()
                 if weaponId == STAFF and weapon.getEnchantLevel() > 3:
                     enchant = weapon.getEnchantLevel()
                     if LOGVALUE > 0 and enchant >= LOGVALUE:
                         print "Master of Enchanting event: Player " + str(
                             player.getName()) + " brought a +" + str(
                                 enchant) + " weapon"
                     rewardPlayer(self, st, enchant)
                     htmltext = "32599-08.htm"
                 else:
                     htmltext = "32599-07.htm"
             else:
                 htmltext = "32599-07.htm"
     return htmltext
예제 #27
0
def EvolvePet(player,item,striderControlItem) :
   con = L2DatabaseFactory.getInstance().getConnection()
   statement = con.prepareStatement("UPDATE items SET item_id =? WHERE object_id=? AND owner_id=?")
   statement.setInt(1, striderControlItem)
   statement.setInt(2, item.getObjectId())
   statement.setInt(3, player.getObjectId())
   statement.execute()
   statement.close()
   con.close()
   sm1 = SystemMessage(SystemMessageId.S2_S1_DISAPPEARED)
   sm1.addItemName(item.getItemId())
   sm1.addNumber(1)
   sm2 = SystemMessage(SystemMessageId.YOU_PICKED_UP_A_S1_S2)
   sm2.addNumber(item.getEnchantLevel())
   sm2.addItemName(striderControlItem)
   player.sendPacket(sm1)
   player.sendPacket(sm2)
   player.sendPacket(ItemList(player, False))
   return
예제 #28
0
 def sendString(self, player, string):
     player.sendPacket(SystemMessage.sendString(string))