def _load_gameobjects():
        gobject_spawns, session = WorldDatabaseManager.gameobject_get_all_spawns(
        )

        for gobject in gobject_spawns:
            if gobject.gameobject:
                gobject_mgr = GameObjectManager(
                    gobject_template=gobject.gameobject,
                    gobject_instance=gobject)
                gobject_mgr.load()

        session.close()
        return len(gobject_spawns)
Exemple #2
0
    def handle(world_session, socket, reader):
        if len(reader.data) >= 12:  # Avoid handling empty gameobject query packet.
            entry, guid = unpack('<IQ', reader.data[:12])
            if guid > 0:
                gobject_mgr = MapManager.get_surrounding_gameobject_by_guid(world_session.player_mgr, guid)
                if not gobject_mgr:
                    gobject_spawn, session = WorldDatabaseManager.gameobject_spawn_get_by_guid(guid)
                    if gobject_spawn and gobject_spawn.gameobject.entry == entry:
                        gobject_mgr = GameObjectManager(
                            gobject_template=gobject_spawn.gameobject
                        )
                    session.close()
                if gobject_mgr:
                    world_session.enqueue_packet(gobject_mgr.query_details())

        return 0
Exemple #3
0
    def load_gameobjects():
        gobject_spawns, session = WorldDatabaseManager.gameobject_get_all_spawns(
        )
        length = len(gobject_spawns)
        count = 0

        for gobject in gobject_spawns:
            if gobject.gameobject:
                gobject_mgr = GameObjectManager(
                    gobject_template=gobject.gameobject,
                    gobject_instance=gobject)
                gobject_mgr.load()
            count += 1
            Logger.progress('Spawning gameobjects...', count, length)

        session.close()
        return length
Exemple #4
0
    def create_arbiter(requester, target, arbiter_entry):
        go_template, session = WorldDatabaseManager.gameobject_template_get_by_entry(
            arbiter_entry)
        session.close()

        if not go_template:
            return None

        in_between_pos = requester.location.get_point_in_middle(
            target.location)

        # TODO: Need a factory for GO's that also handles guids.
        instance = SpawnsGameobjects()
        instance.spawn_id = DuelManager.ARBITERS_GUID
        instance.spawn_entry = arbiter_entry
        instance.spawn_map = requester.map_
        instance.spawn_rotation0 = 0
        instance.spawn_orientation = 0
        instance.spawn_rotation2 = 0
        instance.spawn_rotation1 = 0
        instance.spawn_rotation3 = 0
        instance.spawn_positionX = in_between_pos.x
        instance.spawn_positionY = in_between_pos.y
        instance.spawn_positionZ = in_between_pos.z
        instance.spawn_state = True
        DuelManager.ARBITERS_GUID += 1

        go_arbiter = GameObjectManager(gobject_template=go_template,
                                       gobject_instance=instance)
        go_arbiter.faction = requester.faction

        go_arbiter.load()
        go_arbiter.send_update_surrounding()  # spawn arbiter

        return go_arbiter