public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);
            theGameStream = new GameStream(theGameState);

            theGameState.Set(ComponentKeys.Roundtime, "0");

            theLog = new InMemoryScriptLog();

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IScriptLog>(theLog);

            theScriptContext = new ScriptContext("1", "waitfor", CancellationToken.None, theServices, null);
            theScriptContext.DebugLevel = 5;

            theHandler = new WaitForReTokenHandler(theGameState, theGameStream);
        }
Exemple #2
0
        //private ContentView _selectedContentView;

        public ManifestView(AssetViewContext context)
        {
            _gameStream = new GameStream(context.Entry, context.Game);
        }
 public void WriteTo(GameStream writer, Player player, byte deltaFlags = 0)
 {
     writer.Write(InternalMapId);
     writer.Write(UserId);
 }
 public override IByteReadable ReadFrom(GameStream stream)
 {
     this.Token = stream.ReadString();
     return(this);
 }
Exemple #5
0
 internal Player(TcpClient client)
 {
     Client = client;
     Stream = new GameStream(client.GetStream());
 }
Exemple #6
0
        public void Send(ref MinecraftClient client, GameStream stream)
        {
            string message = Chat.Format(_reason, client.Player);

            Protocol.Send(ref client, stream, Packet, message);
        }
Exemple #7
0
 public static void Disconnect(Player client, GameStream stream, string reason)
 {
     Protocol.Send(client, stream, Packet.LoginDisconnect, reason);
 }
 public abstract IByteReadable ReadFrom(GameStream stream);
Exemple #9
0
 public void Receive(ref MinecraftClient client, GameStream stream)
 {
     new Response().Send(ref client, stream);
 }
Exemple #10
0
 public void Send(ref MinecraftClient client, GameStream stream)
 {
     Protocol.Send(ref client, stream, Packet,
                   client.Player.PlayerEntity.Id, _pos, _stage);
 }
Exemple #11
0
 public void Send(ref MinecraftClient client, GameStream stream)
 {
     // Sends the ping back to the client as pong.
     // :) ping pong
     Protocol.Send(ref client, stream, Packet, _ping);
 }
Exemple #12
0
 public void Send(ref MinecraftClient client, GameStream stream)
 {
 }
Exemple #13
0
 public static void SendPong(Player player, GameStream stream)
 {
     Protocol.Send(player, stream, Packet.Pong, stream.Payload);
 }
Exemple #14
0
 public static void DeclareRecipes(Player player, GameStream stream,
                                   VarInt numberOf, RecipeArray recipes)
 {
     Protocol.Send(player, stream, Packet.DeclareRecipes,
                   recipes);
 }
        public void SetUp()
        {
            theScript = new StubScript();
            theLoader = new StubScriptLoader();
            theLogger = new InMemoryScriptLog();

            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);

            theReplacer = new VariableReplacer();

            theServices = new InMemoryServiceLocator();

            theGameStream = new GameStream(theGameState);

            var waitForTokenHandler = new WaitForTokenHandler(theGameState, theGameStream);
            var waitForReTokenHandler = new WaitForReTokenHandler(theGameState, theGameStream);
            var matchWaitTokenHandler = new MatchWaitTokenHandler(theGameState, theGameStream);

            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IGameState>(theGameState);
            theServices.Add<IScriptLog>(theLogger);
            theServices.Add<ICommandProcessor>(new CommandProcessor(theServices, theReplacer, theLogger));
            theServices.Add<IVariableReplacer>(theReplacer);
            theServices.Add<IIfBlocksParser>(new IfBlocksParser());
            theServices.Add<WaitForTokenHandler>(waitForTokenHandler);
            theServices.Add<WaitForReTokenHandler>(waitForReTokenHandler);
            theServices.Add<MatchWaitTokenHandler>(matchWaitTokenHandler);
            theServices.Add<IIfBlockExecuter>(new IfBlockExecuter(waitForTokenHandler, waitForReTokenHandler, matchWaitTokenHandler));

            theRunner = new ScriptRunner(theServices, theLoader, theLogger);

            theRunner.Create = () => theScript;
        }
Exemple #16
0
 public static void SendAllPlayerAbilities(Player player, GameStream stream,
                                           float flyingSpeed, float fieldOfViewModifier)
 {
     SendPlayerAbilities(player, stream,
                         new[] { Ability.All }, flyingSpeed, fieldOfViewModifier);
 }
 public void Send(ref MinecraftClient client, GameStream stream)
 {
     Protocol.Send(ref client, stream, Packet,
                   _pos, _block.Hardness,
                   (VarInt)(int)_status, _success);
 }
Exemple #18
0
        public void Load(Subsystem subsystem)
        {
            foreach (var entry in GetFilesForSubsystem(subsystem))
            {
                _contentManager.LoadIniFile(entry);
            }

            // Load hardcoded files
            switch (subsystem)
            {
            case Subsystem.Core:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFile(@"Data\INI\Mouse.ini");
                    _contentManager.LoadIniFile(@"Data\INI\Water.ini");
                    _contentManager.LoadIniFile(@"Data\INI\WaterTextures.ini");
                    _contentManager.LoadIniFile(@"Maps\MapCache.ini");
                    break;

                case SageGame.Cnc3:
                    // TODO: Use .version file.
                    var manifestFileEntry  = _fileSystem.GetFile(@"Data\global_common.manifest");
                    var gameStream         = new GameStream(manifestFileEntry, _game);
                    var manifestFileEntry2 = _fileSystem.GetFile(@"Data\static_common.manifest");
                    var gameStream2        = new GameStream(manifestFileEntry2, _game);
                    break;
                }
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                    _contentManager.LoadIniFile($@"Lang\{_contentManager.Language}\HeaderTemplate.ini");
                    break;

                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFile($@"HeaderTemplate.ini");
                    break;
                }
                break;

            case Subsystem.Players:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFile(@"Data\INI\ControlBarScheme.ini");
                    _contentManager.LoadIniFile(@"Data\INI\CommandSet.ini");
                    _contentManager.LoadIniFile(@"Data\INI\CommandButton.ini");
                    break;
                }
                break;

            case Subsystem.Audio:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFile(@"Data\INI\AudioSettings.ini");
                    _contentManager.LoadIniFile(@"Data\INI\SoundEffects.ini");
                    _contentManager.LoadIniFile(@"Data\INI\MiscAudio.ini");
                    _contentManager.LoadIniFile(@"Data\INI\Voice.ini");
                    break;
                }
                break;

            case Subsystem.Wnd:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFiles(@"Data\INI\MappedImages\HandCreated\");
                    _contentManager.LoadIniFiles(@"Data\INI\MappedImages\TextureSize_512\");
                    _contentManager.LoadIniFiles(@"Data\INI\MappedImages\AptImages\");
                    break;
                }
                break;
            }
        }
Exemple #19
0
 public void Send(ref MinecraftClient client, GameStream stream)
 {
     Protocol.Send(ref client, stream, Packet,
                   _id, (byte)_anime);
 }