def healingwarden(): userid = str(es.ServerVar('wcs_userid')) count = int(wcsgroup.getUser(userid, 'ability_count')) if count: param = str(wcsgroup.getUser(userid, 'ability_parameter')) if param: param = param.split('_') team = int(es.getplayerteam(userid)) if team == 2: teamtarget = '2' teamtargetn = '#t' color = '255 0 10 150' elif team == 3: teamtarget = '3' teamtargetn = '#ct' color = '10 0 255 150' x, y, z = es.getplayerlocation(userid) es.server.queuecmd('wcs_healingwarden ' + userid + ' ' + param[0] + ' ' + param[1] + ' ' + param[2] + ' ' + teamtarget + ' ' + teamtargetn + ' ' + str(x) + ' ' + str(y) + ' ' + str(z) + ' ' + str(es.ServerVar('wcs_roundcounter'))) tell(userid, 'a_wardencreated') if count and not count == -1: wcsgroup.setUser(userid, 'ability_count', count - 1) else: tell(userid, 'a_failed')
def player_death(ev): atk_play = Player.from_userid(ev['attacker']) vic_play = Player.from_userid(ev['userid']) if vic_play.userid == atk_play.userid or not atk_play.userid or not teambounty and vic_play.team == atk_play.team: return kills = int(wcsgroup.getUser(atk_play.userid, "wcs_bounty_kills")) + 1 wcsgroup.setUser(atk_play.userid, "wcs_bounty_kills", kills) bounty = int(wcsgroup.getUser(atk_play.userid, "wcs_bounty_bounty")) if kills == int(streak): wcsgroup.setUser(atk_play.userid, "wcs_bounty_bounty", int(xpstart)) if int(telltype): wcs.wcs.tell( atk_play.userid, "\x04[WCS]\x05 You started a bounty of \x04%s\x05." % xpstart) else: for player in PlayerIter(): wcs.wcs.tell( player.userid, "\x04[WCS]\x05 Player \x04%s \x05has started a bounty of \x04%s\x05." % (atk_play.name, xpstart)) elif kills > int(streak): bounty += int(xpincrease) wcsgroup.setUser(atk_play.userid, "wcs_bounty_bounty", bounty) if int(telltype): wcs.wcs.tell( atk_play.userid, "\x04[WCS]\x05 Your bounty increased to \x04%s\x05." % bounty) else: for player in PlayerIter(): wcs.wcs.tell( player.userid, "\x04[WCS]\x05Player \x04%s \x05bounty has increased to \x04%s\x05." % (atk_play.name, bounty)) bounty = int(wcsgroup.getUser(ev["userid"], "wcs_bounty_bounty")) kills = int(wcsgroup.getUser(ev["userid"], "wcs_bounty_kills")) if bounty and kills: wcs.wcs.getPlayer(atk_play.userid).giveXp(bounty, "bounty experience") if int(telltype): wcs.wcs.tell( atk_play.userid, "\x04[WCS]\x05 You stole \x05%s bounty of \x04%s\x05." % (vic_play.name, bounty)) wcs.wcs.tell( vic_play.userid, "\x04[WCS]\x05 \x04%s \x05stole your bounty of \x04%s\x05." % (atk_play.name, bounty)) else: for player in PlayerIter(): wcs.wcs.tell( player.userid, "\x04[WCS]\x05 Player \x04%s\x05 has stolen \x04%s\x05 bounty of \x04%s\x05." % (atk_play.name, vic_play.name, bounty)) wcsgroup.setUser(vic_play.userid, "wcs_bounty_kills", 0) wcsgroup.setUser(vic_play.userid, "wcs_bounty_bounty", 0)
def pre_hurt(ev): victim = Player.from_userid(int(ev['userid'])) if ev['attacker'] != 0: attacker = Player.from_userid(int(ev['attacker'])) weapon = ev['weapon'] damage = int(ev['dmg_health']) absorb = wcsgroup.getUser(victim.userid, 'absorb') if absorb != None: absorb = float(absorb) if absorb > 0: absorb_dmg = damage * absorb if int(absorb_dmg) > 0: victim.health += int(absorb_dmg) wcs.wcs.tell( victim.userid, '\x04[WCS] \x05You absorbed %s damage!' % int(absorb_dmg)) return resist = wcsgroup.getUser(victim.userid, 'resist_' + weapon) if resist != None: resist = float(resist) if resist > 0: resist_dmg = damage * resist if int(resist_dmg) > 0: victim.health += int(resist_dmg) wcs.wcs.tell( victim.userid, '\x04[WCS] \x05You resisted %s damage!' % int(absorb_dmg)) evasion = wcsgroup.getUser(victim.userid, 'evasion') evasion_chance = wcsgroup.getUser(victim.userid, 'evasion_chance') if evasion != None: evasion = int(evasion) if evasion > 0: if randint(0, 100) <= int(evasion_chance): victim.health += damage wcs.wcs.tell( victim.userid, '\x04[WCS] \x05You evaded %s damage!' % damage) else: falldamage = wcsgroup.getUser(victim.userid, 'falldamage') if falldamage != None: falldamage = float(falldamage) if falldamage != 1.0: damage = int(ev['dmg_health']) falldamage_dmg = damage - (damage * falldamage) if falldamage_dmg > 0: victim.health += int(falldamage_dmg) wcs.wcs.tell( victim.userid, '\x04[WCS] \x05You blocked %s falldamage!' % int(falldamage_dmg))
def _regeneration_repeat(player, amount, maxhp, maxheal, radius): if exists(player.userid): if wcsgroup.getUser(player.userid, 'regeneration_active') == 1: if repeat_dict[player.userid] < maxheal: if player.health + amount <= maxhp: player.health += amount wcs.wcs.tell(player.userid, '\x04[WCS] \x05You got healed by a spell') repeat_dict[player.userid] += amount else: player.health = maxhp for play in PlayerIter('all'): if play != player: if play.origin.get_distance(player.origin) <= radius: if play.team == player.team: if (play.health + amount <= maxhp): wcs.wcs.tell( play.userid, '\x04[WCS] \x05You got healed by a spell' ) play.health += amount else: play.health = maxhp else: if valid_repeat(repeat_dict[player.userid]) == 1: if repeat_dict[player.userid].status == RepeatStatus.RUNNING: repeat_dict[player.userid].stop
def wcs_ulti_roots(): userid = int(es.ServerVar('wcs_userid')) player = Player.from_userid(userid) if player.team >= 2: count = 0 wcs_commands.fade(userid, 10, 55, 5, 200, 1) radius = float(es.ServerVar('wcs_radius')) time = float(es.ServerVar('wcs_duration')) atk_origin = player.origin for play in PlayerIter('alive'): if play.team != player.team: vic_origin = play.origin if vic_origin.get_distance(atk_origin) <= radius: if not wcsgroup.getUser(play.userid, 'ulti_immunity'): play.move_type = MoveType.NONE count += 1 Delay(time, remove_freeze, (play, )) es.emitsound('player', play.userid, 'wcs/root.wav', 1.0, 0.6) queue_command_string( 'es est_effect_06 #a 0 sprites/laser.vmt "%s,%s,%s" "%s,%s,%s" 10 1 5 5 10 4 0 160 0 155 2' % (atk_origin[0], atk_origin[1], atk_origin[2] + 35, vic_origin[0], vic_origin[1], vic_origin[2] + 35)) queue_command_string( 'es est_effect_06 #a 0 sprites/laser.vmt "%s,%s,%s" "%s,%s,%s" 10 1 4 4 10 2 0 108 0 180 2' % (atk_origin[0], atk_origin[1], atk_origin[2] + 35, vic_origin[0], vic_origin[1], vic_origin[2] + 35)) queue_command_string( 'es est_effect_06 #a 0 sprites/laser.vmt "%s,%s,%s" "%s,%s,%s" 10 1 5 5 10 4 0 80 0 190 2' % (atk_origin[0], atk_origin[1], atk_origin[2] + 35, vic_origin[0], vic_origin[1], vic_origin[2] + 35)) queue_command_string( 'es est_effect 10 #a 0 sprites/laser.vmt %s %s %s 60 20 1 3 3 5 0 80 0 155 0 255 2' % (vic_origin[0], vic_origin[1], vic_origin[2] + 10)) queue_command_string( 'es est_effect 10 #a 0 sprites/laser.vmt %s %s %s 75 35 1 3 3 6 0 108 0 190 0 255 2' % (vic_origin[0], vic_origin[1], vic_origin[2] + 25)) else: es.tell( player.userid, '#multi', '#lightgreenYour ultimate was blocked, the enemy is #greenimmune.' ) es.tell( play.userid, '#multi', '#lightgreenYou #greenblocked #lightgreenan ultimate skill.' ) if count > 0: es.centertell(userid, 'Entangling Roots: %s' % (count)) else: es.tell( userid, '#multi', '#lightgreenEntangling Roots #greenfailed#lightgreen, because no enemy is close enough.' ) cancel(userid, 'player_ultimate')
def player_jump(ev): userid = ev['userid'] player = Player(index_from_userid(userid)) value = wcsgroup.getUser(userid, 'longjump') if value is not None: value = float(value) if value > 1.0: vec = player.get_property_vector("m_vecVelocity") vec_new = Vector(vec[0] * value, vec[1] * value, vec[2]) player.set_property_vector("m_vecBaseVelocity", vec_new)
def get_cooldown(command): userid = int(command[1]) var = str(command[2]) if exists(userid): cooldown = wcs.wcs.get_cooldown(userid) timed = int(float(time.time())) cooldown = wcsgroup.getUser(userid, 'player_ultimate_cooldown') downtime = wcs.wcs.get_cooldown(userid) if cooldown == None: ConVar(var).set_int(downtime) return ConVar(var).set_int(downtime - (timed - cooldown))
def pre_hurt(ev): victim = Player.from_userid(int(ev['userid'])) if ev['attacker'] > 1: damage = int(ev['dmg_health']) headshot_immunity = wcsgroup.getUser(victim.userid, 'headshot_immunity') if headshot_immunity != None: if victim.hitgroup == HitGroup.HEAD: headshot_immunity = float(headshot_immunity) if headshot_immunity > 0: headshot_immunity_dmg = damage * headshot_immunity if int(headshot_immunity_dmg) > 0: victim.health += int(headshot_immunity_dmg)
def wcs_ulti_chain(): userid = int(es.ServerVar('wcs_userid')) player = Player.from_userid(userid) if player.team >= 2: count = 0 wcs_commands.fade(userid, 10, 55, 5, 200, 1) radius = float(es.ServerVar('wcs_radius')) atk_origin = player.origin for play in PlayerIter('alive'): if play.team != player.team: vic_origin = play.origin if vic_origin.get_distance(atk_origin) <= radius: if not wcsgroup.getUser(play.userid, 'ulti_immunity'): wcs_commands.damage(play.userid, 32, userid, solo=1) count += 1 es.emitsound('player', play.userid, 'wcs/lightning.wav', 1.0, 0.6) queue_command_string( 'es est_effect_06 #a 0 sprites/lgtning.vmt "%s,%s,%s" "%s,%s,%s" 10 .2 10 1 1 13 160 160 230 255 11' % (atk_origin[0], atk_origin[1], atk_origin[2] + 35, vic_origin[0], vic_origin[1], vic_origin[2] + 35)) queue_command_string( 'es est_effect_06 #a 0 sprites/lgtning.vmt "%s,%s,%s" "%s,%s,%s" 10 .2 10 2 2 12 150 150 255 220 8' % (atk_origin[0], atk_origin[1], atk_origin[2] + 35, vic_origin[0], vic_origin[1], vic_origin[2] + 35)) queue_command_string( 'es est_effect_06 #a 0 sprites/lgtning.vmt "%s,%s,%s" "%s,%s,%s" 10 .2 10 1 1 14 200 200 255 235 10' % (atk_origin[0], atk_origin[1], atk_origin[2] + 35, vic_origin[0], vic_origin[1], vic_origin[2] + 35)) else: es.tell( userid, '#multi', '#lightgreenYour ultimate was blocked, the enemy is #greenimmune.' ) es.tell( play.userid, '#multi', '#lightgreenYou #greenblocked #lightgreenan ultimate skill.' ) if count > 0: es.centertell(userid, 'Chain Lightning: %s players damaged' % (count)) else: es.tell( userid, '#multi', '#lightgreenChain Lightning #greenfailed#lightgreen, because no enemy is close enough to be damaged.' ) cancel(userid, 'player_ultimate')
def tick_listener(): for player in PlayerIter('all'): newval = player.move_type if player.userid in ladder: oldval = ladder[player.userid] else: ladder[player.userid] = {} oldval = 2 if oldval != newval: if newval == 2: if oldval == 9: if wcsgroup.getUser(player.userid, 'gravity') != None: gravity = wcsgroup.getUser(player.userid, 'gravity') else: gravity = 1.0 player.gravity = float(gravity) if wcsgroup.getUser(player.userid, 'jetpack') != None: jetpack = int( wcsgroup.getUser(player.userid, 'jetpack')) else: jetpack = 0 if jetpack == 1: player.set_jetpack(1) ladder[player.userid] = newval
def player_hurt(ev): userid = int(ev['userid']) if wcsgroup.getUser(userid, 'noflash') == 1: remove_overlay(index_from_userid(userid))
def player_blind(ev): noflash = wcsgroup.getUser(int(ev['userid']), 'noflash') if noflash == 1: player = Player.from_userid(int(ev['userid'])) player.set_property_float('m_flFlashDuration', 0.0) player.set_property_float('m_flFlashMaxAlpha', 0.0)
def _setfx_command(command): todo = str(command[1]) userid = int(command[2]) operator = str(command[3]) amount = command[4] if len(command) > 5: time = float(command[5]) else: time = 0 player = Player(index_from_userid(userid)) if todo == "blind": if operator == "=": if time == 0.0: time == 10000.0 color = Color(255, 255, 255, int(amount)) Fade(int(time), int(time), color, FadeFlags.PURGE).send(player.index) if todo == "flicker": if time == 0.0: time == 10000.0 if int(amount) == 1: player.set_key_value_int("renderfx", 13) if int(amount) == 0: player.set_key_value_int("renderfx", 0) if time: Delay(time, removefx, ("flicker", player, int(amount))) if todo == "1stclip": clip = player.get_weapon(is_filters="primary").clip if operator == "=": player.get_weapon(is_filters="primary").clip = int(amount) if time: Delay(time, player.get_weapon(is_filters="primary").set_clip, (clip, )) if operator == "+": player.get_weapon(is_filters="primary").clip += int(amount) if time: Delay(time, player.get_weapon(is_filters="primary").set_clip, (player.get_weapon(is_filters="primary").clip - int(amount), )) if operator == "-": player.get_weapon(is_filters="primary").clip -= int(amount) if time: Delay(time, player.get_weapon(is_filters="primary").set_clip, (player.get_weapon(is_filters="primary").clip + int(amount), )) if todo == "2ndclip": clip = player.get_weapon(is_filters="secondary").clip if operator == "=": player.get_weapon(is_filters="secondary").clip = int(amount) if time: Delay(time, player.get_weapon(is_filters="secondary").set_clip, (clip, )) if operator == "+": player.get_weapon(is_filters="secondary").clip += int(amount) if time: Delay(time, player.get_weapon(is_filters="primary").set_clip, (player.get_weapon(is_filters="secondary").clip - int(amount), )) if operator == "-": player.get_weapon(is_filters="secondary").clip -= int(amount) if time: Delay(time, player.get_weapon(is_filters="primary").set_clip, (player.get_weapon(is_filters="secondary").clip + int(amount), )) if todo == "1stammo": ammo = player.get_weapon(is_filters="primary").ammo if operator == "=": player.get_weapon(is_filters="primary").ammo = int(amount) if time: Delay(time, player.get_weapon(is_filters="primary").set_ammo, (ammo, )) if operator == "+": player.get_weapon(is_filters="primary").ammo += int(amount) if time: Delay(time, player.get_weapon(is_filters="primary").set_clip, (player.get_weapon(is_filters="primary").ammo - int(amount), )) if operator == "-": player.get_weapon(is_filters="primary").ammo -= int(amount) if time: Delay(time, player.get_weapon(is_filters="primary").set_clip, (player.get_weapon(is_filters="primary").ammo + int(amount), )) if todo == "2ndammo": ammo = player.get_weapon(is_filters="secondary").ammo if operator == "=": player.get_weapon(is_filters="secondary").ammo = int(amount) if time: Delay(time, player.get_weapon(is_filters="secondary").set_ammo, (ammo, )) if operator == "+": player.get_weapon(is_filters="secondary").ammo += int(amount) if time: Delay(time, player.get_weapon(is_filters="secondary").set_ammo, (player.get_weapon(is_filters="primary").ammo - int(amount), )) if operator == "-": player.get_weapon(is_filters="secondary").ammo -= int(amount) if time: Delay(time, player.get_weapon(is_filters="secondary").set_ammo, (player.get_weapon(is_filters="primary").ammo + int(amount), )) if todo == "invisp": old_color = player.color if operator == "=": old_invisp = float(player.color.a) / 2.55 amount = float(amount) * 2.55 amount = 255 - amount player.color = Color(old_color[0], old_color[1], old_color[2], int(amount)) if time: old_invisp = float(old_invisp) * 2.55 - float(amount) Delay(time, removefx, ('invisp', player, old_invisp)) if operator == "-": old_invisp = float(player.color.a) / 2.55 amount = float(amount) * 2.55 if (player.color.a - int(amount)) <= 0: player.color = Color(old_color[0], old_color[1], old_color[2], 0) else: player.color = Color(old_color[0], old_color[1], old_color[2], old_color[3] - int(amount)) if time: Delay(time, removefx, ('invisp', player, old_invisp)) if operator == "+": old_invisp = float(player.color.a) / 2.55 amount = float(amount) * 2.55 if (player.color.a + int(amount)) >= 255: player.color = Color(old_color[0], old_color[1], old_color[2], 255) else: player.color = Color(old_color[0], old_color[1], old_color[2], old_color[3] + int(amount)) if time: Delay(time, removefx, ('invisp', player, -old_invisp)) if todo == "invis": old_color = player.color amount = int(amount) if operator == "=": old_invisp = player.color.a player.color = Color(old_color[0], old_color[1], old_color[2], int(amount)) if time: old_invisp = old_invisp - amount Delay(time, removefx, ('invis', player, old_invisp)) if operator == "-": old_invisp = player.color.a if (player.color.a - amount) <= 0: player.color = Color(old_color[0], old_color[1], old_color[2], 0) else: player.color = Color(old_color[0], old_color[1], old_color[2], old_color[3] - int(amount)) if time: Delay(time, removefx, ('invis', player, old_invisp)) if operator == "+": old_invisp = player.color.a amount = amount if (player.color.a + amount) >= 255: player.color = Color(old_color[0], old_color[1], old_color[2], 255) else: player.color = Color(old_color[0], old_color[1], old_color[2], old_color[3] + int(amount)) if time: Delay(time, removefx, ('invis', player, -amount)) if todo == "longjump": longjump = wcsgroup.getUser(userid, 'longjump') if longjump != None: longjump = float(longjump) else: longjump = 1.0 if operator == "=": wcsgroup.setUser(userid, 'longjump', amount) if time > 0: Delay(time, wcsgroup.setUser, (userid, 'longjump', 0)) if operator == "+": wcsgroup.setUser(userid, 'longjump', longjump + float(amount)) if time > 0: Delay(time, wcsgroup.setUser, (userid, 'longjump', float(wcsgroup.getUser(userid, 'longjump')) - float(amount))) if operator == "-": wcsgroup.setUser(userid, 'longjump', longjump - float(amount)) if time > 0: Delay(time, wcsgroup.setUser, (userid, 'longjump', float(wcsgroup.getUser(userid, 'longjump')) + float(amount))) if todo == "speed": current_speed = player.speed if time: time = float(time) if operator == "=": oldspeed = player.speed player.speed = float(amount) dif = oldspeed - player.speed if time: Delay(time, removefx, ('speed', player, float(dif))) if operator == "+": player.speed += float(amount) if time: Delay(time, removefx, ('speed', player, -float(amount))) if operator == "-": player.speed -= float(amount) if time: Delay(time, removefx, ('speed', player, float(amount))) if todo == 'jetpack': if operator == "=": player.set_jetpack(int(amount)) if time: Delay(time, removefx, ('jetpack', player, amount)) wcsgroup.setUser(player.userid, 'jetpack', int(player.jetpack)) if todo == 'gravity': old_grav = player.gravity if operator == "=": player.gravity = float(amount) if time: return_value = float(amount) - old_grav Delay(time, removefx, ('gravity', player, return_value)) if operator == "-": player.gravity -= float(amount) if time: Delay(time, removefx, ('gravity', player, -amount)) if operator == "+": player.gravity += float(amount) if time: Delay(time, removefx, ('gravity', player, amount)) wcsgroup.setUser(player.userid, 'gravity', player.gravity) if todo == 'health': old_health = player.health if operator == "=": player.health = int(round(float(amount))) if time: Delay(time, removefx, ('health', player, old_health)) if operator == "-": player.health -= int(round(float(amount))) if time: Delay(time, removefx, ('health', player, -amount)) if operator == "+": player.health += int(round(float(amount))) if time: Delay(time, removefx, ('health', player, amount)) if todo == 'freeze': if operator == "=": if amount == "0": player.move_type = MoveType.WALK if amount == "1": player.move_type = MoveType.NONE if time: Delay(time, removefx, ('freeze', player, amount)) if todo in "cash;money": if operator == "=": old_amount = player.cash old_amount = old_amount - int(amount) player.cash = int(amount) if time: Delay(time, removefx, ('cash', player, old_amount)) if operator == "-": old_amount = player.cash player.cash -= int(amount) if time: Delay(time, removefx, ('cash', player, -amount)) if operator == "+": old_amount = player.cash player.cash += int(amount) if time: Delay(time, removefx, ('cash', player, amount)) if todo == "burn": if operator == "=": if int(amount) == 1: if time: if time == 0: time = 999 else: time = 999 player.ignite_lifetime(float(time)) else: player.ignite_lifetime(0) if todo == "god": if operator == "=": player.godmode = int(amount) if time: Delay(time, removefx, ('god', player, int(amount))) if todo == "disguise": if operator == "=": if int(amount) == 2: player.model = Model( "models/player/custom_player/legacy/tm_leet_variantB.mdl") if int(amount) == 3: player.model = Model( "models/player/custom_player/legacy/ctm_idf_variantC.mdl") if time: Delay(time, removefx, ('disguise', player, amount))
def cancel(userid, what): wcsgroup.setUser(userid, what + '_cooldown', wcsgroup.getUser(userid, what + '_pre_cooldown'))