public ValkyrieGameServer(GameServerSettings settings) : this() { var assemblies = settings[ServerSettingName.EventAssemblies].Split (';') .Where ( s => !string.IsNullOrEmpty(s)) .Select ( s => Assembly.LoadFile(Path.Combine(Environment.CurrentDirectory, s))); this.worlds = new ServerWorldManager(assemblies, settings[ServerSettingName.MapDirectory] ); this.collision = new ServerCollisionProvider(this.worlds); this.movement = new ServerNewMovementProvider(this.collision); this.movement.PlayerMoved += this.MovementProvider_PlayerMoved; this.movement.FailedMovementVerification += this.MovementProvider_FailedVerify; this.players = new NetworkPlayerCache(); this.server = new NetworkServerConnectionProvider(); this.server.Port = 6116; this.settings = settings; Dictionary<ushort, Func<MessageBase>> types = new Dictionary<ushort,Func<MessageBase>> (); types.Add ((ushort) ClientMessageType.ClientEventMessage, () => new ClientEventRequestMessage ()); types.Add ((ushort) ServerMessageType.ServerEventMessage, () => new ServerEventMessage ()); MessageBase.AddMessageTypes (types); }
public void LoadEngineContext(IEngineContext context) { if(context != null) this.worldmanager = context.WorldManager; this.isloaded = true; }
public StructBlock(int worldX, int worldY, int worldZ, byte type, byte metaData, IWorldManager world) { _type = type; _coords = UniversalCoords.FromWorld(worldX, worldY, worldZ); _metaData = metaData; _world = world as WorldManager; _worldInterface = world; }
public StructBlock(UniversalCoords coords, byte type, byte metaData, IWorldManager world) { _type = type; _coords = coords; _metaData = metaData; _world = world as WorldManager; _worldInterface = world; }
/// <summary> /// Initializes a new instance of the <see cref="ScreenControlHost"/> class. /// </summary> /// <param name="worldManager"> /// The world Manager. /// </param> /// <param name="contentProvider"> /// The content provider. /// </param> /// <param name="worldBoundary"> /// The world Boundary. /// </param> public ScreenControlHost(IWorldManager worldManager, ContentProvider contentProvider, Rectangle worldBoundary) { this.worldManager = worldManager; // TODO state machine flips between screens // TODO subscribe to engine change events this.screens = new List<IScreen>(); this.screens.Add(new OverworldScreen(worldManager, contentProvider, worldBoundary)); // this.screens.Add(new UndergroundScreen(contentProvider)); this.currentEngine = 0; }
public void HandleMovementStatus(ref IPacketReader packet, ref IWorldManager manager) { if (manager.Account.ActiveCharacter.IsTeleporting) { return; } uint opcode = packet.Opcode; long pos = packet.Position; var character = manager.Account.ActiveCharacter; ulong Flags = packet.ReadUInt64(); character.Location.Update(packet, true); //packet.Position = pos; //PacketWriter writer = new PacketWriter(opcode, Sandbox.Instance.Opcodes[opcode].ToString()); //writer.Write(packet.ReadToEnd()); //manager.Send(writer); }
public void HandleAreaTrigger(ref IPacketReader packet, ref IWorldManager manager) { uint id = packet.ReadUInt32(); if (AreaTriggers.Triggers.ContainsKey(id)) { // HACK - Scarlet Monastery Location loc = AreaTriggers.Triggers[id]; if (id == 45) { loc = new Location(77f, -1f, 20f, 0, 44); } manager.Account.ActiveCharacter.Teleport(loc, ref manager); } else { Log.Message(LogType.ERROR, "AreaTrigger for {0} missing.", id); } }
public void HandleAuthSession(ref IPacketReader packet, ref IWorldManager manager) { ClientAuth.Encode = true; packet.ReadUInt64(); string name = packet.ReadString().ToUpper(); Account account = new Account(name); account.Load <Character>(); manager.Account = account; PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_AUTH_RESPONSE], "SMSG_AUTH_RESPONSE"); writer.WriteUInt8(0x0C); //AUTH_OK writer.WriteUInt32(0); writer.WriteUInt8(0); writer.WriteUInt32(0); manager.Send(writer); }
public void HandleNameCache(ref IPacketReader packet, ref IWorldManager manager) { ulong guid = packet.ReadUInt64(); var character = manager.Account.GetCharacter(guid, Sandbox.Instance.Build); if (character == null) { return; } PacketWriter nameCache = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_NAME_QUERY_RESPONSE], "SMSG_NAME_QUERY_RESPONSE"); nameCache.WriteUInt64(guid); nameCache.WriteString(character.Name); nameCache.WriteUInt8(0); nameCache.WriteUInt32(character.Race); nameCache.WriteUInt32(character.Gender); nameCache.WriteUInt32(character.Class); manager.Send(nameCache); }
public override void Teleport(float x, float y, float z, float o, uint map, ref IWorldManager manager) { IsTeleporting = true; if (Location.Map == map) { PacketWriter movementStatus = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.MSG_MOVE_TELEPORT_ACK], "MSG_MOVE_TELEPORT_ACK"); movementStatus.WritePackedGUID(Guid); movementStatus.WriteUInt64(0); movementStatus.WriteUInt32(0); movementStatus.WriteFloat(x); movementStatus.WriteFloat(y); movementStatus.WriteFloat(z); movementStatus.WriteFloat(o); movementStatus.WriteFloat(0); manager.Send(movementStatus); } else { // Loading screen PacketWriter transferPending = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TRANSFER_PENDING], "SMSG_TRANSFER_PENDING"); transferPending.WriteUInt32(map); manager.Send(transferPending); // New world transfer PacketWriter newWorld = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_NEW_WORLD], "SMSG_NEW_WORLD"); newWorld.WriteUInt32(map); newWorld.WriteFloat(x); newWorld.WriteFloat(y); newWorld.WriteFloat(z); newWorld.WriteFloat(o); manager.Send(newWorld); } System.Threading.Thread.Sleep(150); // Pause to factor unsent packets Location = new Location(x, y, z, o, map); manager.Send(BuildUpdate()); IsTeleporting = false; }
public static bool InvokeHandler(string message, IWorldManager manager) { if (string.IsNullOrEmpty(message) || message[0] != '.') { return(false); } string[] parts = message.Split(' '); string command = parts[0].TrimStart('.').Trim(); // remove command "." prefix and format string[] args = parts.Skip(1).Select(x => x.Trim().ToLower()).ToArray(); if (CommandHandlers.TryGetValue(command, out var handle)) { handle.Invoke(manager, args); return(true); } return(false); }
public void HandleMessageChat(ref IPacketReader packet, ref IWorldManager manager) { var character = manager.Account.ActiveCharacter; PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_MESSAGECHAT], "SMSG_MESSAGECHAT"); writer.WriteUInt8((byte)packet.ReadInt32()); //System Message packet.ReadUInt32(); writer.WriteUInt32(0); //Language: General writer.WriteUInt64(character.Guid); string message = packet.ReadString(); writer.WriteString(message); writer.WriteUInt8(0); if (!CommandManager.InvokeHandler(message, manager)) { manager.Send(writer); } }
public static void Fly(IWorldManager manager, string[] args) { // check client build if (Authenticator.ClientBuild < 5965) { return; } // validate args if (args.Length < 1) { return; } var character = manager.Account.ActiveCharacter; bool enabled = false; IPacketWriter packet = null; switch (args[0]) { case "on": packet = character.BuildFly(true); enabled = true; break; case "off": packet = character.BuildFly(false); break; default: return; } if (packet != null) { manager.Send(packet); manager.Send(character.BuildMessage($"Flight {(enabled ? "enabled" : "disabled")}")); } }
/// <summary> /// Create a new Mob object based on MobType and provided data /// </summary> /// <param name="world"></param> /// <param name="entityId"></param> /// <param name="type"></param> /// <param name="data"></param> /// <returns></returns> public IMob CreateMob(IWorldManager world, IServer iServer, MobType type, IMetaData data = null) { Type mobType = GetMobClass(world, type); Server server = iServer as Server; if (mobType != null) { ConstructorInfo ci = mobType.GetConstructor(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(WorldManager), typeof(int), typeof(MetaData) }, null); if (ci != null) { return((Mob)ci.Invoke(new object[] { world, server.AllocateEntity(), data })); } } return(null); }
public void HandleCharCreate(ref IPacketReader packet, ref IWorldManager manager) { string name = packet.ReadString(); Character cha = new Character() { Name = name.ToUpperFirst(), Race = packet.ReadByte(), Class = packet.ReadByte(), Gender = packet.ReadByte(), Skin = packet.ReadByte(), Face = packet.ReadByte(), HairStyle = packet.ReadByte(), HairColor = packet.ReadByte(), FacialHair = packet.ReadByte() }; var result = manager.Account.Characters.Where(x => x.Build == Sandbox.Instance.Build); PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_CHAR_CREATE], "SMSG_CHAR_CREATE"); if (result.Any(x => x.Name.Equals(cha.Name, StringComparison.CurrentCultureIgnoreCase))) { writer.WriteUInt8(0x2B); //Duplicate name manager.Send(writer); return; } cha.Guid = (ulong)(manager.Account.Characters.Count + 1); cha.Location = new Location(-8949.95f, -132.493f, 83.5312f, 0, 0); cha.RestedState = (byte)new Random().Next(1, 5); cha.SetDefaultValues(true); manager.Account.Characters.Add(cha); manager.Account.Save(); //Success writer.WriteUInt8(0x28); manager.Send(writer); }
public void HandlePlayerLogin(ref IPacketReader packet, ref IWorldManager manager) { ulong guid = packet.ReadUInt64(); Character character = (Character)manager.Account.SetActiveChar(guid, Sandbox.Instance.Build); character.DisplayId = character.GetDisplayId(); // Verify World : REQUIRED PacketWriter verify = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_LOGIN_VERIFY_WORLD], "SMSG_LOGIN_VERIFY_WORLD"); verify.WriteUInt32(character.Location.Map); verify.WriteFloat(character.Location.X); verify.WriteFloat(character.Location.Y); verify.WriteFloat(character.Location.Z); verify.WriteFloat(character.Location.O); manager.Send(verify); // Account Data Hash : REQUIRED PacketWriter accountdata = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_ACCOUNT_DATA_MD5], "SMSG_ACCOUNT_DATA_MD5"); for (int i = 0; i < 31; i++) { accountdata.WriteInt32(0); } manager.Send(accountdata); // Tutorial Flags : REQUIRED PacketWriter tutorial = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TUTORIAL_FLAGS], "SMSG_TUTORIAL_FLAGS"); for (int i = 0; i < 8; i++) { tutorial.WriteInt32(-1); } manager.Send(tutorial); HandleQueryTime(ref packet, ref manager); manager.Send(character.BuildUpdate()); }
public void HandleAreaTrigger(ref IPacketReader packet, ref IWorldManager manager) { uint id = packet.ReadUInt32(); if (AreaTriggers.Triggers.ContainsKey(id)) { var loc = AreaTriggers.Triggers[id]; // Hacky override switch (id) { case 45: // Scarlet Monestary loc = new Common.Structs.Location(77f, -1f, 20f, 0, 44); break; } manager.Account.ActiveCharacter.Teleport(loc, ref manager); } else { Log.Message(LogType.ERROR, "AreaTrigger for {0} missing.", id); } }
public EntityNode(ISceneGraph graph, Session session, Entity entity) : base(graph) { m_Session = session; m_WorldManager = m_Session.GetManager <IWorldManager>(); m_EntityManager = m_WorldManager.EntityManager; m_ComponentCache = m_Session.GetManager <UnityComponentCacheManager>(); Entity = entity; Guid = m_WorldManager.GetEntityGuid(entity); if (m_EntityManager.HasComponent <SiblingIndex>(Entity)) { Index = m_EntityManager.GetComponentData <SiblingIndex>(Entity); } else { Index = new SiblingIndex { Index = int.MaxValue }; m_EntityManager.AddComponentData(Entity, Index); } }
public void HandleMessageChat(ref IPacketReader packet, ref IWorldManager manager) { var character = manager.Account.ActiveCharacter; var bitunpack = new BitUnpacker(packet); var language = packet.ReadUInt32(); var message = packet.ReadString(bitunpack.GetBits <int>(9)); PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_MESSAGECHAT], "SMSG_MESSAGECHAT"); writer.WriteUInt8(1); // System Message writer.WriteUInt32(0); // Language: General writer.WriteUInt64(character.Guid); writer.WriteUInt32(0); writer.WriteUInt64(0); writer.WriteInt32(message.Length + 1); writer.WriteString(message); writer.WriteUInt8(0); if (!CommandManager.InvokeHandler(message, manager)) { manager.Send(writer); } }
public void HandleAuthSession(ref IPacketReader packet, ref IWorldManager manager) { Authenticator.PacketCrypt.Initialised = true; packet.Position += 8; // client version, session id string name = packet.ReadString().ToUpper(); packet.Position += 4 + 4 + 20 + 4 + 4; // realm type, salt, encrypted password if (Authenticator.ClientBuild > 12213) { packet.Position += 12; } int addonsize = packet.ReadInt32(); Account account = new Account(name); account.Load <Character>(); manager.Account = account; // enable addons var addonPacketInfo = new PacketReader(this.GetAddonInfo(packet), false); var addonPacketResponse = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_ADDON_INFO], "SMSG_ADDON_INFO"); this.WriteAddonInfo(addonPacketInfo, addonPacketResponse, addonsize); manager.Send(addonPacketResponse); PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_AUTH_RESPONSE], "SMSG_AUTH_RESPONSE"); writer.WriteUInt8(0x0C); // AUTH_OK writer.WriteUInt32(0); writer.WriteUInt8(0); writer.WriteUInt32(0); writer.WriteUInt8(Authenticator.ExpansionLevel.Clamp(1, 2)); // Expansion level manager.Send(writer); }
private static void GoLocation(IWorldManager manager, string[] args) { if (args.Length < 3 || args.Length > 4) { return; } var character = manager.Account.ActiveCharacter; uint map = character.Location.Map; bool teleport = Read(args, 0, out float x); teleport &= Read(args, 1, out float y); teleport &= Read(args, 2, out float z); if (args.Length > 3) { teleport &= Read(args, 3, out map); } if (teleport) { character.Teleport(x, y, z, character.Location.O, map, ref manager); } }
public void HandleWorldTeleport(ref IPacketReader packet, ref IWorldManager manager) { packet.ReadUInt32(); byte zone = packet.ReadUInt8(); float x = packet.ReadFloat(); float y = packet.ReadFloat(); float z = packet.ReadFloat(); float o = packet.ReadFloat(); PacketWriter movementStatus = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_MOVE_WORLDPORT_ACK], "SMSG_MOVE_WORLDPORT_ACK"); movementStatus.WriteUInt64(0); movementStatus.WriteFloat(0); movementStatus.WriteFloat(0); movementStatus.WriteFloat(0); movementStatus.WriteFloat(0); movementStatus.WriteFloat(x); movementStatus.WriteFloat(y); movementStatus.WriteFloat(z); movementStatus.WriteFloat(o); movementStatus.WriteFloat(0); movementStatus.WriteUInt32(0); manager.Send(movementStatus); }
public ChunkPartManager(IWorldManager worldManager, IChunkManager chunkManager, IBlocksProvider blocksProvider) { _blocksProvider = blocksProvider; _chunkManager = chunkManager; _worldManager = worldManager; }
/// <summary> /// Drops an item at the given location. /// </summary> /// <param name="world">The world in which the coordinates reside.</param> /// <param name="coords">The target coordinate</param> /// <param name="stack">The stack to be dropped</param> /// <param name="velocity">An optional velocity (the velocity will be clamped to -0.4 and 0.4 on each axis)</param> /// <returns>The entity ID of the item drop.</returns> public int DropItem(IWorldManager world, UniversalCoords coords, IItemInventory stack, Vector3 velocity = new Vector3()) { if (ItemHelper.IsVoid(stack)) return -1; int entityId = AllocateEntity(); bool sendVelocity = false; if (velocity != Vector3.Origin) { velocity = new Vector3(velocity.X.Clamp(-0.4, 0.4), velocity.Y.Clamp(-0.4, 0.4), velocity.Z.Clamp(-0.4, 0.4)); sendVelocity = true; } AddEntity(new ItemEntity(this, entityId) { World = world as WorldManager, Position = new AbsWorldCoords(new Vector3(coords.WorldX + 0.5, coords.WorldY, coords.WorldZ + 0.5)), // Put in the middle of the block (ignoring Y) ItemId = stack.Type, Count = stack.Count, Velocity = velocity, Durability = stack.Durability }); if (sendVelocity) SendPacketToNearbyPlayers(world as WorldManager, coords, new EntityVelocityPacket { EntityId = entityId, VelocityX = (short)(velocity.X * 8000), VelocityY = (short)(velocity.Y * 8000), VelocityZ = (short)(velocity.Z * 8000) }); return entityId; }
/// <summary> /// Yields an enumerable of nearby entities, including players. Thread-safe. /// </summary> /// <param name="world">The world containing the coordinates.</param> /// <param name="x">The center X coordinate.</param> /// <param name="y">The center Y coordinate.</param> /// <param name="z">The center Z coordinate.</param> /// <returns>A lazy enumerable of nearby entities.</returns> public Dictionary<int, IEntityBase> GetNearbyEntitiesDict(IWorldManager world, UniversalCoords coords) { int radius = ChraftConfig.MaxSightRadius; Dictionary<int, IEntityBase> dict = new Dictionary<int, IEntityBase>(); foreach (EntityBase e in GetEntities()) { int entityChunkX = (int)Math.Floor(e.Position.X) >> 4; int entityChunkZ = (int)Math.Floor(e.Position.Z) >> 4; if (e.World == world && Math.Abs(coords.ChunkX - entityChunkX) <= radius && Math.Abs(coords.ChunkZ - entityChunkZ) <= radius) { dict.Add(e.EntityId, e); } } return dict; }
// TODO: This should be removed in favor of the one below /// <summary> /// Yields an enumerable of nearby players, thread-safe. /// </summary> /// <param name="world">The world containing the coordinates.</param> /// <param name="absCoords">The center coordinates.</param> /// <returns>A lazy enumerable of nearby players.</returns> /*public IEnumerable<Client> GetNearbyPlayers(WorldManager world, AbsWorldCoords absCoords) { int radius = ChraftConfig.SightRadius << 4; foreach (Client c in GetAuthenticatedClients()) { if (c.Owner.World == world && Math.Abs(absCoords.X - c.Owner.Position.X) <= radius && Math.Abs(absCoords.Z - c.Owner.Position.Z) <= radius) yield return c; } }*/ public IEnumerable<IClient> GetNearbyPlayers(IWorldManager world, UniversalCoords coords) { return GetNearbyPlayersInternal(world as WorldManager, coords); }
public void SendEntityToNearbyPlayers(IWorldManager world, IEntityBase iEntity) { Packet packet; EntityBase entity = iEntity as EntityBase; if ((packet = (GetSpawnPacket(entity) as Packet)) != null) { if (packet is NamedEntitySpawnPacket) { List<Packet> packets = new List<Packet> { packet }; for (short i = 0; i < 5; i++) { packets.Add(new EntityEquipmentPacket { EntityId = entity.EntityId, Slot = i, Item = ItemHelper.Void, }); } SendPacketsToNearbyPlayers(world as WorldManager, UniversalCoords.FromAbsWorld(entity.Position), packets, entity is Player ? ((Player)entity).Client : null); } else SendPacketToNearbyPlayers(world as WorldManager, UniversalCoords.FromAbsWorld(entity.Position), packet, entity is Player ? ((Player)entity).Client : null); } else if (entity is TileEntity) { } else { List<Packet> packets = new List<Packet> { new CreateEntityPacket { EntityId = entity.EntityId }, new EntityTeleportPacket { EntityId = entity.EntityId, Pitch = entity.PackedPitch, Yaw = entity.PackedYaw, X = entity.Position.X, Y = entity.Position.Y, Z = entity.Position.Z } }; SendPacketsToNearbyPlayers(world as WorldManager, UniversalCoords.FromAbsWorld(entity.Position), packets); } }
public void Init(IWorldManager world, long seed) { _Seed = seed; _World = world; _blockHelper = _World.GetServer().GetBlockHelper(); }
public void HandleStandState(ref IPacketReader packet, ref IWorldManager manager) { manager.Account.ActiveCharacter.StandState = (StandState)packet.ReadUInt32(); manager.Send(manager.Account.ActiveCharacter.BuildUpdate()); }
public WorldCreatedEventArgs(IWorldManager World) : base(World) { }
/// <summary> /// Initializes a new instance of the <see cref="OverworldScreen"/> class. /// </summary> /// <param name="worldManager"> /// The world Manager. /// </param> /// <param name="contentProvider"> /// The content Provider. /// </param> /// <param name="worldBoundary"> /// The world Boundary. /// </param> public OverworldScreen(IWorldManager worldManager, ContentProvider contentProvider, Rectangle worldBoundary) : base(worldManager, contentProvider, worldBoundary) { }
public Type GetMobClass(IWorldManager world, MobType type) { // TODO: extension point to allow plugin to override class for MobType for world Type mobType = null; // If a custom Mob has not been created, return a built-in Mob if (mobType == null) { switch (type) { case MobType.Cow: mobType = typeof(Cow); break; case MobType.Creeper: mobType = typeof(Creeper); break; case MobType.Ghast: mobType = typeof(Ghast); break; case MobType.Giant: mobType = typeof(GiantZombie); break; case MobType.Hen: mobType = typeof(Hen); break; case MobType.Pig: mobType = typeof(Pig); break; case MobType.PigZombie: mobType = typeof(ZombiePigman); break; case MobType.Sheep: mobType = typeof(Sheep); break; case MobType.Skeleton: mobType = typeof(Skeleton); break; case MobType.Slime: mobType = typeof(Slime); break; case MobType.Spider: mobType = typeof(Spider); break; case MobType.Squid: mobType = typeof(Squid); break; case MobType.Wolf: mobType = typeof(Wolf); break; case MobType.Zombie: mobType = typeof(Zombie); break; default: mobType = null; break; } } if (mobType != null && typeof(Mob).IsAssignableFrom(mobType) && mobType.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(WorldManager), typeof(int), typeof(MetaData) }, null) != null) { return mobType; } return null; }
/// <summary> /// Create a new Mob object based on MobType and provided data /// </summary> /// <param name="world"></param> /// <param name="entityId"></param> /// <param name="type"></param> /// <param name="data"></param> /// <returns></returns> public IMob CreateMob(IWorldManager world, IServer iServer, MobType type, IMetaData data = null) { Type mobType = GetMobClass(world, type); Server server = iServer as Server; if (mobType != null) { ConstructorInfo ci = mobType.GetConstructor(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof (WorldManager), typeof (int), typeof (MetaData) }, null); if (ci != null) return (Mob)ci.Invoke(new object[] {world, server.AllocateEntity(), data}); } return null; }
public WorldDeletedEventArgs(IWorldManager World) : base(World) { }
public void Load(ISceneProvider draw, IEventProvider events, INetworkProvider network, ISoundProvider sound, IModuleProvider modules, IMovementProvider movement, ICollisionProvider collision, IVoiceChatProvider voicechat, IWorldManager world, ITextureManager texture, ISoundManager soundmanager) { this.drawprovider = draw; this.eventprovider = events; this.networkprovider = network; this.soundprovider = sound; this.moduleprovider = modules; this.movementprovider = movement; this.collisionprovider = collision; this.voicechatprovider = voicechat; this.texturemanager = texture; this.worldmanager = world; this.soundmanager = soundmanager; this.LoadContexts (drawprovider, eventprovider, networkprovider, soundprovider, moduleprovider, movementprovider, collisionprovider, voicechatprovider, texturemanager, worldmanager, soundmanager); }
public void HandleWorldTeleportAck(ref IPacketReader packet, ref IWorldManager manager) { }
public WorldUnloadEventArgs(IWorldManager World) : base(World) { }
public void SendRemoveEntityToNearbyPlayers(IWorldManager world, IEntityBase entity) { SendPacketToNearbyPlayers(world as WorldManager, UniversalCoords.FromAbsWorld(entity.Position), new DestroyEntityPacket { EntitiesCount = 1, EntitiesId = new []{ entity.EntityId} }, entity is Player ? ((Player)entity).Client : null); }
public PlayerWorldEventArgs(IClient Client, IWorldManager World) : base(World) { this.Client = Client; }
public IEnumerable<IEntityBase> GetNearbyEntities(IWorldManager world, UniversalCoords coords) { return GetNearbyEntitiesInternal(world as WorldManager, coords); }
public CommandResolver(IWorldManager spawner) { parserLibrary = new ParserLibrary(); this.worldManager = spawner; }
public IEnumerable<ILivingEntity> GetNearbyLivings(IWorldManager world, UniversalCoords coords) { return GetNearbyLivingsInternal(world as WorldManager, coords); }
public WorldEventArgs(IWorldManager World) { this.World = World; this.EventCanceled = false; }
public void BroadcastTimeUpdate(IWorldManager world) { Client[] authClients = GetAuthenticatedClients() as Client[]; if (authClients.Length == 0) return; TimeUpdatePacket packet = new TimeUpdatePacket {AgeOfWorld = 0, Time = world.Time}; packet.SetShared(Logger, authClients.Length); Parallel.ForEach(authClients, (client) => client.SendPacket(packet)); }
public WorldLeftEventArgs(IClient Clent, IWorldManager World) : base(Clent, World) { }
/// <summary> /// Initializes a new instance of the <see cref="AttackManager"/> class. /// </summary> /// <param name="world">World.</param> public AttackManager(IWorldManager world) { this.world = world; random = new Random(); }
public static void Teleport(this ICharacter character, Location loc, ref IWorldManager manager) { character.Teleport(loc.X, loc.Y, loc.Z, loc.O, loc.Map, ref manager); }
protected bool RequiredChunksExist(IWorldManager world, UniversalCoords startingPoint, int xSize, int ySize, int zSize) { if (startingPoint.WorldY + ySize > 127) return false; UniversalCoords endPoint = UniversalCoords.FromWorld(startingPoint.WorldX + xSize, startingPoint.WorldY, startingPoint.WorldZ + zSize); if (startingPoint.ChunkX == endPoint.ChunkX && startingPoint.ChunkZ == endPoint.ChunkZ) return true; for (int x = startingPoint.ChunkX; x <= endPoint.ChunkX; x++) for (int z = startingPoint.ChunkZ; z <= endPoint.ChunkZ; z++) if (world.GetChunkFromChunkSync(x, z) == null) return false; return true; }
public WorldJoinedEventArgs(IClient Client, IWorldManager World) : base(Client, World) { }
public RequireLoginFilter(IWorldManager worldManager) { this.worldManager = worldManager; }
public ServerCollisionProvider(IWorldManager worldmanager) { this.worldmanager = worldmanager; }
public void HandlePlayerLogin(ref IPacketReader packet, ref IWorldManager manager) { ulong guid = packet.ReadUInt64(); Character character = (Character)manager.Account.SetActiveChar(guid, Sandbox.Instance.Build); character.DisplayId = character.GetDisplayId(); // Verify World : REQUIRED PacketWriter verify = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_LOGIN_VERIFY_WORLD], "SMSG_LOGIN_VERIFY_WORLD"); verify.WriteUInt32(character.Location.Map); verify.WriteFloat(character.Location.X); verify.WriteFloat(character.Location.Y); verify.WriteFloat(character.Location.Z); verify.WriteFloat(character.Location.O); manager.Send(verify); // Account Data Hash : REQUIRED PacketWriter accountdata = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_ACCOUNT_DATA_MD5], "SMSG_ACCOUNT_DATA_MD5"); accountdata.WriteInt32((int)DateTimeOffset.UtcNow.ToUnixTimeSeconds()); accountdata.WriteUInt8(1); accountdata.WriteUInt32((uint)AccountDataMask.ALL); for (int i = 0; i < 8; i++) { accountdata.WriteUInt32(0); } manager.Send(accountdata); // Tutorial Flags : REQUIRED PacketWriter tutorial = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TUTORIAL_FLAGS], "SMSG_TUTORIAL_FLAGS"); for (int i = 0; i < 8; i++) { tutorial.WriteInt32(-1); } manager.Send(tutorial); // send language spells so we can type commands PacketWriter spells = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_INITIAL_SPELLS], "SMSG_INITIAL_SPELLS"); spells.WriteUInt8(0); spells.WriteUInt16(2); // spell count spells.WriteUInt32(CharacterData.COMMON_SPELL_ID); spells.WriteUInt16(0); spells.WriteUInt32(CharacterData.ORCISH_SPELL_ID); spells.WriteUInt16(0); spells.WriteUInt16(0); // cooldown count manager.Send(spells); HandleQueryTime(ref packet, ref manager); manager.Send(character.BuildUpdate()); // handle flying manager.Send(character.BuildFly(character.IsFlying)); // Force timesync : REQUIRED PacketWriter timesyncreq = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TIME_SYNC_REQ], "SMSG_TIME_SYNC_REQ"); timesyncreq.Write(0); manager.Send(timesyncreq); }
public override void Unload() { m_ChangeManager.UnregisterChangeCallback(HandleChanges); Flush(); m_WorldManager = null; }
public void HandleWorldTeleport(ref IPacketReader packet, ref IWorldManager manager) { throw new NotImplementedException(); }
public static void Gps(IWorldManager manager, string[] args) { var character = manager.Account.ActiveCharacter; manager.Send(character.BuildMessage(character.Location.ToString())); }
public void HandleZoneUpdate(ref IPacketReader packet, ref IWorldManager manager) { manager.Account.ActiveCharacter.Zone = packet.ReadUInt32(); }
/// <summary> /// Initializes a new instance of the <see cref="ScreenBase"/> class. /// </summary> /// <param name="worldManager"> /// The world Manager. /// </param> protected ScreenBase(IWorldManager worldManager) { // TODO register world manager switchout this.WorldManager = worldManager; }