ReadNetWorldOrder() static private method

static private ReadNetWorldOrder ( BinaryReader r ) : void
r System.IO.BinaryReader
return void
Beispiel #1
0
        private static void ReadNetIDs(BinaryReader reader)
        {
            var mods = ModLoader.Mods;
            var list = new List <Mod>();
            var n    = reader.ReadInt32();

            for (short i = 0; i < n; i++)
            {
                var name = reader.ReadString();
                var mod  = mods.SingleOrDefault(m => m.Name == name);
                list.Add(mod);
                if (mod != null)                 //nosync mod that doesn't exist on the client
                {
                    mod.netID = i;
                }
            }
            netMods = list.ToArray();
            SetupDiagnostics();

            ItemLoader.ReadNetGlobalOrder(reader);
            WorldHooks.ReadNetWorldOrder(reader);
            int serverMaxBuffs = reader.ReadInt32();

            if (serverMaxBuffs != Player.MaxBuffs)
            {
                Netplay.disconnect = true;
                Main.statusText    = $"The server expects Player.MaxBuffs of {serverMaxBuffs}\nbut this client reports {Player.MaxBuffs}.\nSome mod is behaving poorly.";
            }
        }
Beispiel #2
0
        private static void ReadNetIDs(BinaryReader reader)
        {
            var mods = ModLoader.Mods;
            var list = new List <Mod>();
            var n    = reader.ReadInt32();

            for (short i = 0; i < n; i++)
            {
                var name = reader.ReadString();
                var mod  = mods.SingleOrDefault(m => m.Name == name);
                list.Add(mod);
                if (mod != null)                 //nosync mod that doesn't exist on the client
                {
                    mod.netID = i;
                }
            }
            netMods = list.ToArray();

            ItemLoader.ReadNetGlobalOrder(reader);
            WorldHooks.ReadNetWorldOrder(reader);
        }