Beispiel #1
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
Beispiel #2
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
Beispiel #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
Beispiel #4
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
Beispiel #5
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
Beispiel #6
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
Beispiel #7
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
Beispiel #8
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
Beispiel #9
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
Beispiel #10
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
Beispiel #11
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