Пример #1
0
        public void Handle(NetworkManager nm, Bot core)
        {
            var tempLength = core.ClientWorld.BlockArray.Length;

            var temp = new byte[core.ClientWorld.BlockArray.Length];
            Buffer.BlockCopy(core.ClientWorld.BlockArray, 0, temp, 0, temp.Length);

            core.ClientWorld.BlockArray = new byte[tempLength + Length];
            Buffer.BlockCopy(temp, 0, core.ClientWorld.BlockArray, 0, temp.Length);
            Buffer.BlockCopy(Data, 0, core.ClientWorld.BlockArray, tempLength, Length);

            core.raiseDebugMessage("Map chunk size: " + Length + " Percent: " + Percent);
            core.RaiseLevelProgress(Percent);
        }
Пример #2
0
        public void Handle(NetworkManager nm, Bot core)
        {
            if (!core.EnableCpe)
                core.RaiseErrorMessage("Protocol error: Received Extinfo while CPE Disabled.");

            core.SupportsCpe = true;
            core.ServerAppName = AppName;
            core.Extensions = ExtensionCount;
            core.ServerExtensions = new Dictionary<string, int>();
            core.raiseDebugMessage("Connecting to " + AppName + " with " + ExtensionCount + " extensions.");
        }
Пример #3
0
        public void Handle(NetworkManager nm, Bot core)
        {
            if (!core.EnableCpe)
                core.RaiseErrorMessage("Protocol error: Received Extentry while CPE Disabled.");

            if (core.SentCpe)
                core.RaiseErrorMessage("Protocol error: Received ExtEntry after sending client extensions!");

            core.ReceivedExtensions += 1;

            if (core.ReceivedExtensions > core.Extensions)
                core.RaiseInfoMessage("Warning: Server sent more extensions than ExtInfo reported.");

            if (!core.ServerExtensions.ContainsKey(ExtName))
                core.ServerExtensions.Add(ExtName, Version);
            else
                core.RaiseErrorMessage("Protocol warning: Server sent ExtEntry of same name multiple times (" + ExtName + ")");

            core.raiseDebugMessage("Received ExtEntry: " + ExtName + " -- " + Version);

            if (core.ReceivedExtensions == core.Extensions)
                nm.SendCPE();
        }
Пример #4
0
 public void Handle(NetworkManager nm, Bot core)
 {
     if (PlayerId != -1) {
         var newEnt = new Entity(PlayerName, PlayerId, X, Y, Z, Yaw, Pitch);
         core.Entities.Add(PlayerId, newEnt);
         core.RaisePlayerJoin(newEnt);
     }
     else {
         core.Location.X = X;
         core.Location.Y = Y;
         core.Location.Z = Z;
         core.Position[0] = Yaw;
         core.Position[1] = Pitch;
         core.raiseDebugMessage("Set Location Via SpawnPlayer");
         core.RaiseYouMoved();
     }
 }
Пример #5
0
        public void Handle(NetworkManager nm, Bot core)
        {
            if (!core.Entities.ContainsKey(PlayerId) && PlayerId != -1) {
                core.RaiseErrorMessage("Protocol Warning: Teleported non-existant player");
                return;
            }

            if (PlayerId != -1) {
                core.Entities[PlayerId].UpdateLocation(X, Y, Z);
                core.Entities[PlayerId].UpdateLook(Yaw, Pitch);
                core.RaisePlayerMoved(core.Entities[PlayerId]);
                return;
            }

            core.Location.X = X;
            core.Location.Y = Y;
            core.Location.Z = Z;
            core.Position[0] = Yaw;
            core.Position[1] = Pitch;
            core.RaiseYouMoved();
            core.raiseDebugMessage("Set location via Teleport.");
        }
Пример #6
0
        public void Handle(NetworkManager nm, Bot core)
        {
            if (!core.EnableCpe)
                core.RaiseErrorMessage("Protocol error: Received CBSL while CPE Disabled.");

            if (!core.ClientSupportedExtensions.Contains(CPEExtensions.CustomBlocks))
                core.RaiseErrorMessage("Protocol error: Received CBSL, which client does not support.");

            core.ServerCbLevel = SupportLevel;

            var myCb = new CustomBlockSupportLevel {SupportLevel = Bot.CustomBlockSuportlevel};
            myCb.Write(nm);

            core.raiseDebugMessage("Received CustomBlockSupportLevel.");
        }