Beispiel #1
0
def damage_player(script, player, damage=0, stun_duration=0):
    packet = HitPacket()
    packet.entity_id = player.entity_id
    packet.target_id = player.entity_id
    packet.hit_type = HIT_NORMAL
    packet.damage = damage
    packet.critical = 1
    packet.stun_duration = stun_duration
    packet.something8 = 0
    packet.pos = player.position
    packet.hit_dir = Vector3()
    packet.skill_hit = 0
    packet.show_light = 0
    script.server.update_packet.player_hits.append(packet)
Beispiel #2
0
def damage_player(script, player, damage=0, stun_duration=0):
    packet = HitPacket()
    packet.entity_id = player.entity_id
    packet.target_id = player.entity_id
    packet.hit_type = HIT_NORMAL
    packet.damage = damage
    packet.critical = 1
    packet.stun_duration = stun_duration
    packet.something8 = 0
    packet.pos = player.position
    packet.hit_dir = Vector3()
    packet.skill_hit = 0
    packet.show_light = 0
    script.server.update_packet.player_hits.append(packet)
Beispiel #3
0
 def silent_damage(self, damage):
     packet = HitPacket()
     packet.critical = 0
     packet.damage = damage
     packet.entity_id = self.connection.entity_id
     packet.target_id = self.connection.entity_id
     packet.hit_dir = Vector3()
     packet.pos = self.connection.entity.pos
     packet.hit_type = 2
     packet.show_light = 0
     packet.something8 = 0
     packet.stun_duration = 0
     packet.skill_hit = 0
     self.server.update_packet.player_hits.append(packet)
Beispiel #4
0
 def silent_damage(self, damage):
     packet = HitPacket()
     packet.critical = 0
     packet.damage = damage
     packet.entity_id = self.connection.entity_id
     packet.target_id = self.connection.entity_id
     packet.hit_dir = Vector3()
     packet.pos = self.connection.entity.pos
     packet.hit_type = 2
     packet.show_light = 0
     packet.something8 = 0
     packet.stun_duration = 0
     packet.skill_hit = 0
     self.server.update_packet.player_hits.append(packet)
Beispiel #5
0
 def damage(self, damage=0, critical=0, stun_duration=0, reason=None):
     if self.scripts.call('on_damage', damage, critical, stun_duration, reason).result is False:
         return False
     packet = HitPacket()
     packet.entity_id = self.entity_id
     packet.target_id = self.entity_id
     packet.hit_type = HIT_NORMAL
     packet.damage = damage
     packet.critical = critical
     packet.stun_duration = stun_duration
     packet.something8 = 0
     packet.pos = self.position
     packet.hit_dir = Vector3()
     packet.skill_hit = 0
     packet.show_light = 0
     # Processed by the server and clients in next update task run
     self.server.update_packet.player_hits.append(packet)
     self.entity_data.changed = True
     if reason:
         self.send_chat(reason)
     return True
Beispiel #6
0
def kill(script, name):
    player = get_player(script.server, name)
    packet = HitPacket()
    packet.entity_id = player.entity_id
    packet.target_id = player.entity_id
    packet.hit_type = HIT_NORMAL
    packet.damage = player.entity_data.hp + 1000.0
    packet.critical = 1
    packet.stun_duration = 0
    packet.something8 = 0
    packet.pos = player.position
    packet.hit_dir = Vector3()
    packet.skill_hit = 0
    packet.show_light = 0
    script.server.update_packet.player_hits.append(packet)
    message = '%s was killed' % player.name
    print message
    script.server.send_chat(message)
Beispiel #7
0
 def damage(self, damage, stun_duration=0):
     """Damages this entity.
     
     Keyword arguments:
     damage -- Amount of damage to deal
     stun_duration -- Duration of the stun in ms
     
     """
     packet = HitPacket()
     packet.entity_id = self.id
     packet.target_id = self.id
     packet.hit_type = HIT_NORMAL
     packet.damage = damage
     packet.critical = 1
     packet.stun_duration = stun_duration
     packet.something8 = 0
     packet.pos = self.data.pos
     packet.hit_dir = Vector3()
     packet.skill_hit = 0
     packet.show_light = 0
     self.__manager.server.update_packet.player_hits.append(packet)