def est_effect_02(command): if len(command) == 19: #est_Effect_02 <player Filter> <delay> <model> <start ent> <start position "X Y Z"> <end ent> <end position "X Y Z"> <framerate> <life> <start width> <end width> <fade distance> <amplitude> <R> <G> <B> <A> <speed> str_vec = command[5] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) str_vec = command[7] str_vec = str_vec.split(",") vec2 = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('BeamEntPoint', start_entity_index=int(command[4]), start_point=Vector(float(command[5])), end_entity_index=int(command[6]), end_point=vec2, model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, frame_rate=int(command[8]), life_time=float(command[9]), start_width=int(command[10]), end_width=int(command[11]), fade_length=int(command[12]), amplitude=int(command[13]), red=int(command[14]), green=int(command[15]), blue=int(command[16]), alpha=int(command[17]), speed=int(command[18])) te.create(delay=float(command[2]))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._model = Model("sprites/lgtning.vmt", True) self._model._precache() if not stun_sound.is_precached: stun_sound.precache()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.cooldowns = CooldownDict() self._model = Model("sprites/lgtning.vmt", True) self._model._precache() if not heal_sound.is_precached: heal_sound.precache()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.cooldowns = CooldownDict() self._godmode = False self._model = Model("sprites/halo.vmt", True) self._model._precache() if not godmode_sound.is_precached: godmode_sound.precache()
class EarthgrabTotem(Skill): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.model = Model('sprites/blueflare1.vmt', True) self.model._precache() self.effect = TempEntity('BeamRingPoint', start_radius=120, end_radius=0, model_index=self.model.index, halo_index=self.model.index, life_time=1.5, amplitude=10, red=10, green=255, blue=10, alpha=245, flags=0, start_width=6, end_width=6) if not root_sound.is_precached: root_sound.precache() @classproperty def description(cls): return 'Root your enemies to the ground, 16-24% chance.' @classproperty def max_level(cls): return 8 _msg_a = '{{GREEN}}Rooted {{RED}}{name} {{PALE_GREEN}}to the ground.' _msg_b = '{{PALE_GREEN}}You have been {{GREEN}}rooted {{PALE_GREEN}}to the ground by {{RED}}{name}.' @events('player_pre_attack') def _on_player_pre_attack(self, attacker, victim, **kwargs): if self.level == 0: return if randint(1, 100) <= 16 + self.level and not victim.stuck: victim.stuck = True victim.delay(1.5, victim.__setattr__, args=('stuck', False)) send_wcs_saytext_by_index(self._msg_a.format(name=victim.name), attacker.index) send_wcs_saytext_by_index(self._msg_b.format(name=attacker.name), victim.index) root_sound.index = victim.index root_sound.origin = victim.origin root_sound.play() self.effect.create(center=victim.origin) self.effect.create(center=victim.origin, start_radius=80)
def est_effect_15(command): if len(command) == 9: #est_Effect_15 - Bubble Trail Effect est_Effect_15 <player Filter> <delay> <model> <Min "X Y Z"> <Max "X Y Z"> <heigth> <count> <speed> te = TempEntity('Bubble Trail', model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, mins=vec, maxs=vec2, height=int(command[6]), count=int(command[7]), speed=int(command[8])) te.create(delay=float(command[2]))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.cooldowns = CooldownDict() self.beam = TempEntity('BeamPoints', alpha=255, red=255, green=200, blue=200, life_time=1.0, start_width=15, end_width=15, frame_rate=255) self.laser = Model('sprites/lgtning.vmt') self.laser._precache()
def est_effect_04(command): #est_Effect_04 <player Filter> <delay> <model> <Follow ent> <life> <start width> <end width> <fade distance> <R> <G> <B> <A> te = TempEntity('BeamFollow') te.alpha = int(command[12]) te.blue = int(command[11]) te.green = int(command[10]) te.end_width = int(command[7]) te.life_time = float(command[5]) te.start_width = int(command[6]) te.entity_index = Player.from_userid(int(command[4])).index te.fade_length = int(command[8]) te.halo_index = Model(str(command[3])).index te.model_index = Model(str(command[3])).index te.red = int(command[9]) te.create(delay=float(command[2]))
class HammerOfJustice(Skill): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._model = Model("sprites/lgtning.vmt", True) self._model._precache() if not stun_sound.is_precached: stun_sound.precache() @classproperty def description(cls): return 'Slam your hammer into the ground, to knock up and enemy and stun them.' @classproperty def max_level(cls): return 6 @events('player_pre_attack') def _on_player_pre_attack(self, attacker, victim, **kwargs): if randint( 1, 100) < 10 + self.level and not victim.stuck and self.level > 0: victim.base_velocity = Vector(0, 0, 400) victim.delay(0.8, victim.__setattr__, args=('stuck', True)) victim.delay(1.8, victim.__setattr__, args=('stuck', False)) bottom_vector = victim.origin top_vector = victim.origin top_vector.z += 100 _effect = TempEntity('BeamPoints', alpha=255, red=100, blue=255, green=100, amplitude=10, end_width=20, start_width=20, life_time=2, fade_length=2, halo_index=self._model.index, model_index=self._model.index, start_point=top_vector, end_point=bottom_vector) _effect.create() stun_sound.index = victim.index stun_sound.origin = victim.origin stun_sound.play()
class Ammo(Item): name = 'Ammo (10 Primary Bullets)' model = Model( 'models/props/coop_cementplant/coop_ammo_stash/coop_ammo_stash_empty.mdl' ) weight = 0.5 @classmethod def create(cls, location): entity = Entity.create('prop_physics_override') entity.model = cls.model entity.origin = location entity.spawn_flags = 256 entity.solid_flags = 152 entity.collision_group = 11 entity.spawn() return cls(entity) def on_use(self, player): if not player.primary: return player.primary.ammo += 10 player.inventory.discard(self) def on_remove(self): self.entity.remove() def on_pickup(self, player): player.inventory.add(self) self.on_remove()
def effect10(model, x, y, z, start_radius, end_radius, life_time, width, fade_length, amplitude, red, green, blue, alpha, speed): """ est_effect 10 <player filter> <delay> <model> <x> <y> <z> <start radius> <end radius> <life> <width> <spread> <amplitude> <red> <green> <blue> <alpha> <speed> """ if not isinstance(model, Model): model = Model(model) te = TempEntity('BeamRingPoint') te.model = model te.halo = model te.center = Vector(x, y, z) te.start_radius = start_radius te.end_radius = end_radius te.life_time = life_time te.start_width = width te.end_width = width te.fade_length = fade_length te.amplitude = amplitude te.red = red te.green = green te.blue = blue te.alpha = alpha te.speed = speed return te
def effect105(model, start_entity_index, end_entity_index, frame_rate, life_time, start_width, end_width, fade_length, amplitude, red, green, blue, alpha, speed): """ est_effect_05 <player filter> <delay> <model> <start entity> <end entity> <framerate> <life> <start width> <end width> <fade distance> <amplitude> <red> <green> <blue> <alpha> <speed> """ if not isinstance(model, Model): model = Model(model) te = TempEntity('BeamLaser') te.model = model te.halo = model te.start_entity_index = start_entity_index te.end_entity_index = end_entity_index te.frame_rate = frame_rate te.life_time = life_time te.start_width = start_width te.end_width = end_width te.fade_length = fade_length te.amplitude = amplitude te.red = red te.green = green te.blue = blue te.alpha = alpha te.speed = speed return te
def set_model(command): userid = int(command[1]) model = str(command[2]) if model == '0': inthandle = _remove_model(userid) if inthandle is not None: Player.from_userid(userid).color = Color(255, 255, 255, 255) return _remove_model(userid) if 'models/' not in model: model = 'models/' + model player = Player.from_userid(userid) player.color = Color(255, 255, 255, 0) model = Model(model) entity = Entity.create('prop_dynamic_override') entity.origin = player.origin entity.parent = player entity.set_model(model) entity.spawn() _game_models[entity.inthandle] = player.userid entity.add_output('OnUser1 !self,Kill,,0,1')
def effect108(model, center, start_radius, end_radius, frame_rate, life_time, width, fade_length, amplitude, red, green, blue, alpha, speed, flags): """ est_effect_08 <player filter> <delay> <model> <middle x y z> <start radius> <end radius> <framerate> <life> <width> <spread> <amplitude> <red> <green> <blue> <alpha> <speed> <flags> """ if not isinstance(model, Model): model = Model(model) if not isinstance(center, Vector): center = Vector(*center) te = TempEntity('BeamRingPoint') te.model = model te.halo = model te.center = center te.start_radius = start_radius te.end_radius = end_radius te.frame_rate = frame_rate te.life_time = life_time te.start_width = width te.end_width = width te.fade_length = fade_length te.amplitude = amplitude te.red = red te.green = green te.blue = blue te.alpha = alpha te.speed = speed te.flags = flags return te
def effect112(model, origin, angle, size, velocity, randomization, count, time, flags): """ est_effect_12 <player filter> <delay> <model> <origin x y z> <angle p y r> <Size x y z> <velocity x y z> <randomization> <count> <time> <flags> """ if not isinstance(model, Model): model = Model(model) if not isinstance(origin, Vector): origin = Vector(*origin) if not isinstance(angle, QAngle): angle = QAngle(*angle) if not isinstance(size, Vector): size = Vector(*size) if not isinstance(velocity, Vector): velocity = Vector(*velocity) te = TempEntity('Break Model') te.model = model te.origin = origin te.rotation = angle te.size = size te.velocity = velocity te.randomization = randomization te.count = count te.life_time = time te.flags = flags return te
def get_effect_entry(self, entry): config = self.config['effects'][entry] effect = effects_manager[config['type']] for key, value in config['args'].items(): if value is None: continue if isinstance(value, str): if value.startswith('$'): current = None for next_key in value[1:].split('.'): if current is None: current = self.config[next_key] else: if next_key == 'GAME_NAME': if GAME_NAME in current: next_key = GAME_NAME else: next_key = 'default' current = current[next_key] value = current # It's probably a model if '/' in value or '\\' in value: _models[self][key] = Model(value) continue setattr(effect, key, value) return effect
def effect110(model, origin, direction, red, green, blue, alpha, size): """ est_effect_10 <player filter> <delay> <model> <origin x y z> <direction x y z> <red> <green> <blue> <alpha> <size> """ if not isinstance(model, Model): model = Model(model) if not isinstance(origin, Vector): origin = Vector(*origin) if not isinstance(direction, Vector): direction = Vector(*direction) te = TempEntity('Blood Sprite') te.drop_model = model te.spray_model = model te.origin = origin te.direction = direction te.red = red te.green = green te.blue = blue te.alpha = alpha te.size = size return te
def effect127(model, skin, position, angle, velocity, flags, effects): """ est_effect_27 <player filter> <delay> <model> <subtype/skin> <position x y z> <angle p y r> <velocity x y z> <flags> <effects> """ if not isinstance(model, Model): model = Model(model) if not isinstance(position, Vector): position = Vector(*position) if not isinstance(angle, QAngle): angle = QAngle(*angle) if not isinstance(velocity, Vector): velocity = Vector(*velocity) te = TempEntity('physicsprop') te.model = model te.skin = skin te.origin = position te.angles = angle te.velocity = velocity te.flags = flags te.effects = effects return te
def get_model_instance(name): model = _models.get(name) if model is None: model = _models[name] = Model(name, True) return model
def effect107(model, start_point, end_point, frame_rate, life_time, width, fade_length, amplitude, red, green, blue, alpha, speed): """ est_effect_07 <player filter> <delay> <model> <start entity> <end entity> <framerate> <life> <width> <spread> <amplitude> <red> <green> <blue> <alpha> <speed> """ if not isinstance(model, Model): model = Model(model) if not isinstance(start_point, Vector): start_point = Vector(*start_point) if not isinstance(end_point, Vector): end_point = Vector(*end_point) te = TempEntity('BeamPoints') te.model = model te.halo = model te.start_point = start_point te.end_point = end_point te.frame_rate = frame_rate te.life_time = life_time te.start_width = width te.end_width = width te.fade_length = fade_length te.amplitude = amplitude te.red = red te.green = green te.blue = blue te.alpha = alpha te.speed = speed return te
def effect5(model, start_userid, end_entity_index, life_time, width, fade_length, amplitude, red, green, blue, alpha, speed): """ est_effect 5 <player filter> <delay> <model> <userid> <end index> <life> <width> <spread> <amplitude> <red> <green> <blue> <alpha> <speed> """ if not isinstance(model, Model): model = Model(model) te = TempEntity('BeamRing') te.model = model te.halo = model te.start_entity_index = index_from_userid(start_userid) te.end_entity_index = end_entity_index te.life_time = life_time te.start_width = width te.end_width = width te.fade_length = fade_length te.amplitude = amplitude te.red = red te.green = green te.blue = blue te.alpha = alpha te.speed = speed return te
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.ultimate_index = -1 self.ultimates = [ self.teleport, self.roots, self.chain_lightning, self.health_boost ] self.cooldowns = CooldownDict() ## Chain Lightning self.beam = TempEntity('BeamPoints', alpha=255, red=255, green=200, blue=200, life_time=1.0, start_width=15, end_width=15, frame_rate=255) self.laser = Model('sprites/lgtning.vmt') self.laser._precache() ## Entangling Roots self.beam2 = TempEntity('BeamPoints', alpha=255, red=0, green=200, blue=0, life_time=1.0, start_width=15, end_width=15, frame_rate=255) self.laser._precache() self.effect = TempEntity('BeamRingPoint', start_radius=120, end_radius=0, model_index=self.laser.index, halo_index=self.laser.index, life_time=1.5, amplitude=10, red=10, green=255, blue=10, alpha=245, flags=0, start_width=6, end_width=6)
def est_effect_14(command): #est_Effect_14 - Bubbles Effectest_Effect_14 <player Filter> <delay> <model> <Min "X Y Z"> <Max "X Y Z"> <heigth> <count> <speed> if len(command) == 9: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) str_vec = command[5] str_vec = str_vec.split(",") vec2 = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('Bubbles', model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, mins=vec, maxs=vec2, height=int(command[6]), count=int(command[7]), speed=int(command[8])) te.create(delay=float(command[2]))
class LifestealSkill(Skill): _msg_a = '{{PALE_GREEN}}Healed {{GREEN}}{heal} {{PALE_GREEN}}HP by {{DULL_RED}}stealing {{PALE_GREEN}}life from {{RED}}{name}.' laser = Model("sprites/lgtning.vmt", True) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.max_health = self.parent.parent.health + 100 self.beam = TempEntity('BeamPoints', alpha=255, red=255, green=0, blue=0, life_time=1.0, model_index=self.laser.index, start_width=7, end_width=7, frame_rate=255, halo_index=self.laser.index) @property def chance(self): return self.level * 8 @property def leech_multiplier(self): return 0.6 @events('player_spawn') def _on_player_spawn(self, player, **kwargs): self.max_health = player.health + 100 @events('player_pre_attack') def _on_player_pre_attack(self, attacker, victim, info, **kwargs): if self.level == 0: return heal = int(info.damage * self.leech_multiplier) can_heal = self.max_health > attacker.health + heal if self.chance > randint(0, 100) or not can_heal: return attacker.health += heal send_wcs_saytext_by_index( self._msg_a.format(heal=heal, name=victim.name), attacker.index) weapon = attacker.active_weapon if weapon and weapon.weapon_name.split( "_")[-1] not in weapon_manager.projectiles: start_location = weapon.origin.copy() start_location.z += 40 end_location = attacker.get_view_coordinates() self.beam.create(start_point=start_location, end_point=end_location)
def est_effect_07(command): #est_Effect_07 <player Filter> <delay> <model> <start ent> <end ent> <framerate> <life> <width> <spread> <amplitude> <R> <G> <B> <A> <speed> if len(command) == 16: te = TempEntity('BeamRing', model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, start_entity_index=int(command[4]), end_entity_index=int(command[5]), frame_rate=int(command[6]), life_time=float(command[7]), start_width=int(command[8]), end_width=int(command[8]), amplitude=int(command[10]), red=int(command[11]), green=int(command[12]), blue=int(command[13]), alpha=int(command[14]), speed=int(command[15])) te.create(delay=float(command[2]))
def est_effect_03(command): #est_Effect_03 <player Filter> <delay> <model> <start ent> <end ent> <framerate><life> <start width> <end width> <fade distance> <amplitude> <R> <G> <B> <A> <speed> if len(command) == 16: te = TempEntity('BeamEnts', model_index=Model(str(command[3])), halo_index=Model(str(command[3])), start_entity_index=int(command[4]), end_entity_index=int(command[5]), frame_rate=int(command[6]), start_width=int(command[7]), end_with=int(command[8]), fade_length=int(command[9]), amplitude=int(command[10]), red=int(command[11]), green=int(command[12]), blue=int(command[13]), alpha=int(command[14]), speed=int(command[15])) te.create(delay=float(command[2]))
def est_effect_24(command): if len(command) == 6: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) #est_Effect_24 - Large Funnel Effect est_Effect_24 <player Filter> <delay> <model> <Position "X Y Z"> <reversed> te = TempEntity('Large Funnel', model_index=Model(str(command[3])).index, origin=vec, reversed=int(command[5])) te.create(delay=float(command[2]))
def set_model(command): userid = int(command[1]) model_str = str(command[2]) if exists(userid): if ".mdl" not in model_str: model_str = model_str + ".mdl" if "models/" not in model_str: model_str = "models/" + model_str model = Model(model_str) player = Player.from_userid(userid) player.model = model
def get_model(self): """Return the entity's model. :return: ``None`` if the entity has no model. :rtype: Model """ if not self.model_name: return None return Model(self.model_name)
def est_effect_10(command): #est_Effect_10 <player Filter> <delay> <model> <origin "X Y Z"> <direction "X Y Z"> <R> <G> <B> <A> <Size> if len(command) == 11: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) str_vec = command[5] str_vec = str_vec.split(",") vec2 = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('Blood Sprite', drop_model_index=Model(str(command[3])).index, spray_model_index=Model(str(command[3])).index, origin=vec, direction=vec2, red=int(command[6]), green=int(command[7]), blue=int(command[8]), alpha=int(command[9]), size=float(command[10])) te.create(delay=float(command[2]))