def ismortallywounded(char, args = None):
	if args and args[0]:
		char.deltag('mortalstrike') # Delete the mortal strike tag
		if char.socket:
			char.socket.clilocmessage(1060208)
		return False
	
	if not char.hastag('mortalstrike'):
		return False
		
	expire = int(char.gettag('mortalstrike'))
	if expire < wolfpack.currenttime():
		char.deltag('mortalstrike')
		if char.socket:
			char.socket.clilocmessage(1060208)
		return False
		
	# Wont it expire within 20 seconds? > Server Restart occured
	if expire + 20000 < wolfpack.currenttime():
		char.deltag('mortalstrike')
		if char.socket:
			char.socket.clilocmessage(1060208)
		return False
		
	return True # Character is affected
	def hit(self, attacker, defender, damage):
		if not self.checkuse(attacker):
			return

		self.use(attacker)

		attacker.effect(0x3728, 10, 15)
		attacker.soundeffect(0x2a1)
		
		# Compile a list of targets
		targets = []
		center = attacker.pos
		chariter = wolfpack.charregion(center.x - 1, center.y - 1, center.x + 1, center.y + 1, center.map)
		char = chariter.first
		while char:
			if char != attacker and char != defender:
				targets.append(char)
			char = chariter.next
			
		# Our own party
		party = attacker.party
		guild = attacker.guild
		weapon = attacker.getweapon()
		
		for target in targets:
			if not attacker.canreach(target, 1):
				continue
		
			if not target.dead and not target.invulnerable and (not party or party != target.party) and (not guild or target.guild != guild):
				if attacker.socket:
					attacker.socket.clilocmessage(1060161) # The whirling attack strikes a target!
				if defender.socket:
					defender.socket.clilocmessage(1060162) # You are struck by the whirling attack and take damage!
				combat.aos.hit(attacker, target, weapon, wolfpack.currenttime())
	def hit(self, attacker, defender, damage):
		if not self.checkuse(attacker):
			return

		# Clear Ability, then check if it really can be used
		clearability(attacker)
		
		if not defender.socket or not defender.itemonlayer(LAYER_MOUNT):
			if attacker.socket:
				attacker.socket.clilocmessage(1060848)
			return

		self.use(attacker) # Use Mana
		
		if attacker.socket:
			attacker.socket.clilocmessage(1060082)
			
		mounted = attacker.itemonlayer(LAYER_MOUNT)
		
		if mounted:
			defender.socket.clilocmessage(1062315)
		else:
			defender.socket.clilocmessage(1060083)
		
		defender.soundeffect(0x140)
		defender.effect(0x3728, 10, 15)
		
		defender.unmount()		

		# Make it impossible to mount a horse for 10 seconds
		defender.socket.settag('block_mount', wolfpack.currenttime() + 10000)
		
		if not mounted:
			energydamage(defender, attacker, random.randint(15, 25), physical=100, damagetype=DAMAGE_PHYSICAL)
	def hit(self, attacker, defender, damage):
		if not self.checkuse(attacker):
			return
		self.use(attacker)

		if attacker.socket:
			attacker.socket.clilocmessage(1060086) # You deliver a mortal wound!
		if defender.socket:
			defender.socket.clilocmessage(1060087) # You have been mortally wounded!

		defender.soundeffect(0x1e1)
		defender.effect(0x37b9, 244, 25)
		defender.dispel(None, True, 'MORTALSTRIKE_CHECK')

		if defender.npc:
			defender.settag('mortalstrike', wolfpack.currenttime() + 12000)
			defender.addtimer(12000, 'combat.specialmoves.ismortallywounded', [True], False, False, 'MORTALSTRIKE_CHECK')
		else:
			defender.settag('mortalstrike', wolfpack.currenttime() + 6000)
			defender.addtimer(6000, 'combat.specialmoves.ismortallywounded', [True], False, False, 'MORTALSTRIKE_CHECK')
def checkUse(player):
	if player.gm:
		return True
	
	if player.socket and player.socket.hastag('greenthorn_delay'):
		delay = int(player.socket.gettag('greenthorn_delay'))
		
		if wolfpack.currenttime() < delay:
			return False

	return True
    def hit(self, attacker, defender, damage):
        if not self.checkuse(attacker):
            return
        self.use(attacker)

        if defender.dead or defender.pos.map == 0xFF:
            return  # Out of reach

        if attacker.socket:
            attacker.socket.clilocmessage(1060086)  # You deliver a mortal wound!
        if defender.socket:
            defender.socket.clilocmessage(1060087)  # You have been mortally wounded!

        defender.soundeffect(0x1E1)
        defender.effect(0x37B9, 244, 25)
        defender.dispel(None, True, "MORTALSTRIKE_CHECK")

        if defender.npc:
            defender.settag("mortalstrike", wolfpack.currenttime() + 12000)
            defender.addtimer(12000, ismortallywounded, [True], False, False, "MORTALSTRIKE_CHECK")
        else:
            defender.settag("mortalstrike", wolfpack.currenttime() + 6000)
            defender.addtimer(6000, ismortallywounded, [True], False, False, "MORTALSTRIKE_CHECK")
    def hit(self, attacker, defender, damage):
        if not self.checkuse(attacker):
            return

            # Clear Ability, then check if it really can be used
        clearability(attacker)

        if defender.dead or defender.pos.map == 0xFF:
            return  # Out of reach

        weapon = defender.getweapon()

        # Doesnt have a weapon to disarm
        if not weapon:
            if attacker.socket:
                attacker.socket.clilocmessage(1060849)  # Already unarmed ...

                # The weapon is immovable
        elif weapon.lockeddown or weapon.movable > 1:
            if attacker.socket:
                attacker.socket.clilocmessage(1004001)  # You cannot disarm ...

        else:
            self.use(attacker)
            if attacker.socket:
                attacker.socket.clilocmessage(1060092)  # You disarm their weapon!
            if defender.socket:
                defender.socket.clilocmessage(1060093)  # Your weapon has been disarmed!

            defender.soundeffect(0x3B9)
            defender.effect(0x37BE, 232, 25)

            layer = weapon.layer  # Save the weapon layer

            if not tobackpack(weapon, defender):  # Unequip the weapon
                weapon.update()

                # Players cannot equip another weapon for 5000 ms
            if defender.socket:
                defender.socket.settag("block_equip", wolfpack.currenttime() + 5000)
            elif defender.npc:
                defender.addtimer(random.randint(5000, 7500), reequip_weapon, [weapon.serial, layer], True)
	def hit(self, attacker, defender, damage):
		if not self.checkuse(attacker):
			return

		self.use(attacker)
		
		if attacker.socket:
			attacker.socket.clilocmessage(1060084) # You attack with lightning speed!
		if defender.socket:
			defender.socket.clilocmessage(1060085) # Your attacker strikes with lightning speed!

		if defender.dead or attacker.dead:
			return

		defender.soundeffect(0x3bb)
		defender.effect(0x37b9, 244, 25)
			
		# Make sure that the next swing has only 90% of the damage
		if attacker.socket:
			attacker.socket.settag('weaponability', 1000)
		attacker.callevent(EVENT_SWING, (attacker, defender, wolfpack.currenttime())) # Swing again
    def checkmana(self, player, weapon, use=False):
        mana = self.getmana(player, weapon)

        if mana == 0:
            return True  # This ability does not require mana

        if player.socket and player.socket.hastag("last_special_ability"):
            if player.socket.gettag("last_special_ability") + 3000 > wolfpack.currenttime():
                mana *= 2
            else:
                player.socket.deltag("last_special_ability")

                # Check if there is enough mana
        if player.mana < mana:
            if player.socket:
                player.socket.clilocmessage(1060181, str(mana))  # You need xxx mana.
            return False

            # Consume the mana
        if use:
            player.mana -= mana
            player.updatemana()

        return True
Esempio n. 10
0
def onWearItem(player, wearer, item, layer):
	if wearer.socket and wearer.socket.hastag('block_equip'):
		expire = int(wearer.socket.gettag('block_equip'))
		if expire < wolfpack.currenttime():
			wearer.socket.deltag('block_equip')
		else:
			if player == wearer:
				player.socket.sysmessage(tr('You cannot equip another so soon after being disarmed.'))
			else:
				player.socket.sysmessage(tr('They cannot equip another so soon after being disarmed.'))
			return True
	
	lower = properties.fromitem(item, LOWERREQS) / 100.0

	req_str = item.getintproperty( 'req_strength', 0 )
	if item.hastag( 'req_strength' ):
		req_str = int( item.gettag( 'req_strength' ) )
	if lower:
		req_str = int(ceil(req_str) * (1.0 - lower))

	req_dex = item.getintproperty( 'req_dexterity', 0 )
	if item.hastag( 'req_dexterity' ):
		req_dex = int( item.gettag( 'req_dexterity' ) )
	if lower:
		req_dex = int(ceil(req_dex) * (1.0 - lower))

	req_int = item.getintproperty( 'req_intelligence', 0 )
	if item.hastag( 'req_intelligence' ):
		req_int = int( item.gettag( 'req_intelligence' ) )
	if lower:
		req_int = int(ceil(req_int) * (1.0 - lower))

	if wearer.strength < req_str:
		if player != wearer:
			player.socket.sysmessage('This person can\'t wear that item, seems not strong enough.')
		else:
			player.socket.clilocmessage(500213)
		return True

	if wearer.dexterity < req_dex:
		if player != wearer:
			player.socket.sysmessage('This person can\'t wear that item, seems not agile enough.')
		else:
			player.socket.clilocmessage(502077)
		return True

	if wearer.intelligence < req_int:
		if player != wearer:
			player.socket.sysmessage('This person can\'t wear that item, seems not smart enough.')
		else:
			player.socket.sysmessage('You are not intelligent enough to equip this item.')
		return True

	# Reject equipping an item with durability 1 or less
	# if it's an armor, shield or weapon
	armor = properties.itemcheck(item, ITEM_ARMOR)
	weapon = properties.itemcheck(item, ITEM_WEAPON)
	shield = properties.itemcheck(item, ITEM_SHIELD)

	if (armor or weapon or shield) and item.health < 1:
		player.socket.sysmessage('You need to repair this before using it again.')
		return True

	return False
 def use(self, player):
     weapon = player.getweapon()  # Get the used weapon
     self.checkmana(player, weapon, True)  # Consume the mana
     clearability(player)  # Clear the ability
     if player.socket:
         player.socket.settag("last_special_ability", wolfpack.currenttime())
Esempio n. 12
0
def target(player, arguments, target):
	# Check the green thorn first
	item = wolfpack.finditem(arguments[0])
	
	# Check if we have the item in our backpack
	if not item or item.getoutmostitem() != player.getbackpack():
		player.socket.clilocmessage(1042038) # You must have the object in your backpack to use it.
		return
		
	# Check the green thorn delay
	if not checkUse(player):
		player.message(1061908) # * You must wait a while before planting another thorn. *
		return

	# This check should only happen for solen hives
	if player.pos.map not in [0, 1]:
		player.message(tr("No solen lairs exist on this facet.  Try again in Trammel or Felucca."), 0x2b2)
		return
		
	# Can we reach the target location?
	if not player.canreach(target.pos, 3):
		player.message(502825) # That location is too far away
		return
		
	# Get the land-tile id at the given location
	landid = wolfpack.map(target.pos.x, target.pos.y, player.pos.map)['id']
	
	callback = None # Callback for the green thorns effect
	
	# Check which effect should be used for the landtile type
	if landid in DIRT_TILES:
		callback = dirtCallback
		
	elif landid in FURROWS_TILES:
		callback = furrowsCallback
		
	elif landid in SWAMP_TILES:
		callback = swampCallback
	
	elif landid in SNOW_TILES:
		callback = snowCallback
	
	elif landid in SAND_TILES:
		callback = sandCallback

	if not callback:
		player.message(1061913)
	else:
		if item.amount <= 1:
			item.delete()
		else:
			item.amount -= 1
			item.update()
			
		# Show a message that we're planting a thorn
		player.socket.clilocmessage(1061914, "", 0x961, 3, player, "", False, True) # * You push the strange green thorn into the ground *
		listeners = wolfpack.chars(player.pos.x, player.pos.y, player.pos.map, 18)
		
		for listener in listeners:
			if listener != player and listener.socket:
				listener.socket.clilocmessage(1061915, player.name, 0x961, 3, player, "", False, True) # * ~1_PLAYER_NAME~ pushes a strange green thorn into the ground. *
		
		# Set the next use delay for this kind of item
		player.socket.settag('greenthorn_delay', wolfpack.currenttime() + GREENTHORN_DELAY)
		
		# Start the effect
		player.addtimer(2500, callback, [target.pos, 0])
Esempio n. 13
0
def serverinfo(socket, command, arguments):
    char = socket.player
    version = wolfpack.serverversion()
    uptime = wolfpack.currenttime() / 1000
    upseconds = uptime
    upminutes = uptime / 60
    upseconds -= upminutes * 60
    if upseconds <= 9:
        upseconds = "0%s" % (upseconds)
    uphours = upminutes / 60
    upminutes -= uphours * 60
    if upminutes <= 9:
        upminutes = "0%s" % (upminutes)
    if uphours <= 9:
        uphours = "0%s" % (uphours)
    timestring = "%s:%s:%s" % (uphours, upminutes, upseconds)

    onlinecount = wolfpack.sockets.count()
    accountcount = 0
    admincount = 0
    gmcount = 0
    seercount = 0
    counselorcount = 0
    playercount = 0
    acclist = wolfpack.accounts.list
    for i in acclist():
        record = wolfpack.accounts.find(i)
        accountcount += 1
        if record.acl == "admin":
            admincount += 1
        if record.acl == "gm":
            gmcount += 1
        if record.acl == "seer":
            seercount += 1
        if record.acl == "counselor":
            counselorcount += 1
        if record.acl == "player":
            playercount += 1

    gump = cGump(x=30, y=30)
    gump.addBackground(id=0x2436, width=280, height=400)
    # Basic Info
    text = '<basefont color="#FFFF00"><center><h3>%s Shard Status</h3></center><br />' % (shardname)
    text += '<basefont color="#FEFEFE">'
    text += "  Version: %s<br />" % (version)
    text += "  Uptime: %s<br />" % (timestring)
    # Account Info
    text += '<basefont color="#FFFF00"><center><h3>Account Information</h3></center><br />'
    text += '<basefont color="#FEFEFE">'
    text += (
        '  Online Accounts:  <basefont color="#00FFFF">%i <basefont color="#FEFEFE">/ <basefont color="#00FFFF">%i<br />'
        % (onlinecount, accountcount)
    )
    text += '<basefont color="#FEFEFE">'
    text += '  Total Admins:     <basefont color="#00FF00">%i<br />' % (admincount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Seers:      <basefont color="#00FF00">%i<br />' % (seercount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Counselors: <basefont color="#00FF00">%i<br />' % (counselorcount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Players:    <basefont color="#00FF00">%i<br />' % (playercount)
    text += '<basefont color="#FEFEFE">'
    text += '  Total Characters: <basefont color="#00FF00">%i<br />' % (wolfpack.charcount())
    text += '<basefont color="#FEFEFE">'
    text += '  Total Items:      <basefont color="#00FF00">%i<br />' % (wolfpack.itemcount())
    # Hardware Info
    text += '<basefont color="#FFFF00"><center><h3>Server Information</h3></center><br />'
    text += '<basefont color="#FEFEFE">'
    text += " OS: %s<br />" % (operatingsystem)
    text += " Processor: %s<br />" % (processor)
    text += " Memory: %s<br />" % (memory)

    gump.addHtmlGump(x=20, y=20, width=240, height=360, html=text)
    gump.send(char)
    return