def teleport(self, to_x, to_y, to_z): packet = EntityUpdate() self.entity_data.pos.x = to_x self.entity_data.pos.y = to_y self.entity_data.pos.z = to_z self.chunk = get_chunk(self.entity_data.pos) self.old_pos = self.entity_data.pos packet.set_entity(self.entity_data, 0) self.send_packet(packet) packet.set_entity(self.entity_data, self.entity_id) self.relay_packet(packet)
def heal(self, amount=None): if amount is not None and amount <= 0: return False packet = EntityUpdate() if amount is None or amount + self.entity_data.hp > 1000: self.entity_data.hp = 1000 else: self.entity_data.hp += amount packet.set_entity(self.entity_data, self.entity_id) self.relay_packet(packet) packet.set_entity(self.entity_data, 0) self.send_packet(packet)
""" King of the hill script by Sarcen """ from cuwo.script import ServerScript, ConnectionScript, command, admin from cuwo.entity import ItemData, ItemUpgrade, NAME_BIT, AppearanceData from cuwo.packet import (KillAction, MissionData, EntityUpdate) from cuwo.vector import Vector3 from cuwo import constants from cuwo.common import set_bit entity_packet = EntityUpdate() import time import math import random KOTH_DATA = 'kingofthehill_settings' REWARD_WEAPONS = dict({ # Weapons (3, 0): (1, ), # 1h swords only iron (3, 1): (1, ), # axes only iron (3, 2): (1, ), # maces only iron (3, 3): (1, ), # daggers only iron (3, 4): (1, ), # fists only iron (3, 5): (1, ), # longswords only iron (3, 6): (2, ), # bows, only wood (3, 7): (2, ), # crossbows, only wood (3, 8): (2, ), # boomerangs, only wood (3, 10): (2, ), # wands, only wood (3, 11): (2, ), # staffs, only wood (3, 12): (11, 12), # bracelets, silver, gold