Esempio n. 1
0
 // Token: 0x06002FAF RID: 12207 RVA: 0x0013B9AC File Offset: 0x00139DAC
 public static void load()
 {
     SteamBlacklist._list = new List <SteamBlacklistID>();
     if (ServerSavedata.fileExists("/Server/Blacklist.dat"))
     {
         River river = ServerSavedata.openRiver("/Server/Blacklist.dat", true);
         byte  b     = river.readByte();
         if (b > 1)
         {
             ushort num = river.readUInt16();
             for (ushort num2 = 0; num2 < num; num2 += 1)
             {
                 CSteamID newPlayerID = river.readSteamID();
                 uint     newIP;
                 if (b > 2)
                 {
                     newIP = river.readUInt32();
                 }
                 else
                 {
                     newIP = 0u;
                 }
                 CSteamID         newJudgeID       = river.readSteamID();
                 string           newReason        = river.readString();
                 uint             newDuration      = river.readUInt32();
                 uint             newBanned        = river.readUInt32();
                 SteamBlacklistID steamBlacklistID = new SteamBlacklistID(newPlayerID, newIP, newJudgeID, newReason, newDuration, newBanned);
                 if (!steamBlacklistID.isExpired)
                 {
                     SteamBlacklist.list.Add(steamBlacklistID);
                 }
             }
         }
     }
 }
Esempio n. 2
0
 // Token: 0x06002824 RID: 10276 RVA: 0x000F3350 File Offset: 0x000F1750
 public static void load()
 {
     if (LevelSavedata.fileExists("/Groups.dat"))
     {
         River river = LevelSavedata.openRiver("/Groups.dat", true);
         byte  b     = river.readByte();
         if (b > 0)
         {
             GroupManager.availableGroupID = river.readSteamID();
             if (b > 1)
             {
                 int num = river.readInt32();
                 for (int i = 0; i < num; i++)
                 {
                     CSteamID csteamID = river.readSteamID();
                     string   text     = river.readString();
                     uint     num2     = river.readUInt32();
                     if (num2 >= 1u && !string.IsNullOrEmpty(text))
                     {
                         if (!GroupManager.knownGroups.ContainsKey(csteamID))
                         {
                             GroupManager.knownGroups.Add(csteamID, new GroupInfo(csteamID, text, num2));
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 3
0
 public static void load()
 {
     if (LevelSavedata.fileExists("/Groups.dat"))
     {
         River river = LevelSavedata.openRiver("/Groups.dat", true);
         byte  b     = river.readByte();
         if (b > 0)
         {
             GroupManager.availableGroupID = river.readSteamID();
             if (b > 1)
             {
                 int num = river.readInt32();
                 for (int i = 0; i < num; i++)
                 {
                     CSteamID csteamID = river.readSteamID();
                     string   newName  = river.readString();
                     uint     num2     = river.readUInt32();
                     if (num2 > 0u)
                     {
                         GroupManager.knownGroups.Add(csteamID, new GroupInfo(csteamID, newName, num2));
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
 // Token: 0x06002893 RID: 10387 RVA: 0x000F6EC8 File Offset: 0x000F52C8
 public static void load()
 {
     if (LevelSavedata.fileExists("/Events.dat"))
     {
         River river = LevelSavedata.openRiver("/Events.dat", true);
         byte  b     = river.readByte();
         if (b > 0)
         {
             LevelManager.airdropFrequency = river.readUInt32();
             LevelManager._hasAirdrop      = river.readBoolean();
             return;
         }
     }
     LevelManager._hasAirdrop = false;
 }
 // Token: 0x060028C0 RID: 10432 RVA: 0x000F7B04 File Offset: 0x000F5F04
 public static void load()
 {
     if (LevelSavedata.fileExists("/Lighting.dat"))
     {
         River river = LevelSavedata.openRiver("/Lighting.dat", true);
         byte  b     = river.readByte();
         if (b > 0)
         {
             LightingManager._cycle = river.readUInt32();
             LightingManager._time  = river.readUInt32();
             if (b > 1)
             {
                 LightingManager.rainFrequency = river.readUInt32();
                 LightingManager.rainDuration  = river.readUInt32();
                 LightingManager._hasRain      = river.readBoolean();
                 LevelLighting.rainyness       = (ELightingRain)river.readByte();
             }
             else
             {
                 LightingManager._hasRain = false;
                 LevelLighting.rainyness  = ELightingRain.NONE;
             }
             if (b > 2)
             {
                 LightingManager.snowFrequency = river.readUInt32();
                 LightingManager.snowDuration  = river.readUInt32();
                 LightingManager._hasSnow      = river.readBoolean();
                 LevelLighting.snowyness       = (ELightingSnow)river.readByte();
             }
             else
             {
                 LightingManager._hasSnow = false;
                 LevelLighting.snowyness  = ELightingSnow.NONE;
             }
             LightingManager._offset = Provider.time - LightingManager.time;
             return;
         }
     }
     LightingManager._time    = (uint)(LightingManager.cycle * LevelLighting.transition);
     LightingManager._offset  = Provider.time - LightingManager.time;
     LightingManager._hasRain = false;
     LevelLighting.rainyness  = ELightingRain.NONE;
     LightingManager._hasSnow = false;
     LevelLighting.snowyness  = ELightingSnow.NONE;
 }
Esempio n. 6
0
 // Token: 0x06002560 RID: 9568 RVA: 0x000D90CC File Offset: 0x000D74CC
 public static void load()
 {
     LevelNodes._models                 = new GameObject().transform;
     LevelNodes.models.name             = "Nodes";
     LevelNodes.models.parent           = Level.level;
     LevelNodes.models.tag              = "Logic";
     LevelNodes.models.gameObject.layer = LayerMasks.LOGIC;
     LevelNodes._nodes = new List <Node>();
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Nodes.dat", false, false))
     {
         River river = new River(Level.info.path + "/Environment/Nodes.dat", false);
         byte  b     = river.readByte();
         if (b > 0)
         {
             ushort num = (ushort)river.readByte();
             for (ushort num2 = 0; num2 < num; num2 += 1)
             {
                 Vector3   vector    = river.readSingleVector3();
                 ENodeType enodeType = (ENodeType)river.readByte();
                 if (enodeType == ENodeType.LOCATION)
                 {
                     string newName = river.readString();
                     LevelNodes.nodes.Add(new LocationNode(vector, newName));
                 }
                 else if (enodeType == ENodeType.SAFEZONE)
                 {
                     float newRadius = river.readSingle();
                     bool  newHeight = false;
                     if (b > 1)
                     {
                         newHeight = river.readBoolean();
                     }
                     bool newNoWeapons = true;
                     if (b > 4)
                     {
                         newNoWeapons = river.readBoolean();
                     }
                     bool newNoBuildables = true;
                     if (b > 4)
                     {
                         newNoBuildables = river.readBoolean();
                     }
                     LevelNodes.nodes.Add(new SafezoneNode(vector, newRadius, newHeight, newNoWeapons, newNoBuildables));
                 }
                 else if (enodeType == ENodeType.PURCHASE)
                 {
                     float  newRadius2 = river.readSingle();
                     ushort newID      = river.readUInt16();
                     uint   newCost    = river.readUInt32();
                     LevelNodes.nodes.Add(new PurchaseNode(vector, newRadius2, newID, newCost));
                 }
                 else if (enodeType == ENodeType.ARENA)
                 {
                     float newRadius3 = river.readSingle();
                     LevelNodes.nodes.Add(new ArenaNode(vector, newRadius3));
                 }
                 else if (enodeType == ENodeType.DEADZONE)
                 {
                     float newRadius4 = river.readSingle();
                     LevelNodes.nodes.Add(new DeadzoneNode(vector, newRadius4));
                 }
                 else if (enodeType == ENodeType.AIRDROP)
                 {
                     ushort num3 = river.readUInt16();
                     byte   b2;
                     byte   b3;
                     if (SpawnTableTool.resolve(num3) == 0 && Regions.tryGetCoordinate(vector, out b2, out b3))
                     {
                         Assets.errors.Add(string.Concat(new object[]
                         {
                             Level.info.name,
                             " airdrop references invalid spawn table ",
                             num3,
                             " at (",
                             b2,
                             ", ",
                             b3,
                             ")!"
                         }));
                     }
                     LevelNodes.nodes.Add(new AirdropNode(vector, num3));
                 }
                 else if (enodeType == ENodeType.EFFECT)
                 {
                     byte newShape = 0;
                     if (b > 2)
                     {
                         newShape = river.readByte();
                     }
                     float   newRadius5 = river.readSingle();
                     Vector3 newBounds  = Vector3.one;
                     if (b > 2)
                     {
                         newBounds = river.readSingleVector3();
                     }
                     ushort newID2        = river.readUInt16();
                     bool   newNoWater    = river.readBoolean();
                     bool   newNoLighting = false;
                     if (b > 3)
                     {
                         newNoLighting = river.readBoolean();
                     }
                     LevelNodes.nodes.Add(new EffectNode(vector, (ENodeShape)newShape, newRadius5, newBounds, newID2, newNoWater, newNoLighting));
                 }
             }
         }
         river.closeRiver();
     }
 }
Esempio n. 7
0
        private static void loadRegion(byte version, River river, StructureRegion region)
        {
            ushort num = river.readUInt16();

            for (ushort num2 = 0; num2 < num; num2 += 1)
            {
                ushort  num3   = river.readUInt16();
                ushort  num4   = river.readUInt16();
                Vector3 vector = river.readSingleVector3();
                byte    b      = 0;
                if (version > 4)
                {
                    b = river.readByte();
                }
                byte b2 = river.readByte();
                byte b3 = 0;
                if (version > 4)
                {
                    b3 = river.readByte();
                }
                ulong num5 = 0UL;
                ulong num6 = 0UL;
                if (version > 2)
                {
                    num5 = river.readUInt64();
                    num6 = river.readUInt64();
                }
                uint newObjActiveDate;
                if (version > 3)
                {
                    newObjActiveDate = river.readUInt32();
                    if (Provider.time - StructureManager.serverActiveDate > Provider.modeConfigData.Structures.Decay_Time / 2u)
                    {
                        newObjActiveDate = Provider.time;
                    }
                }
                else
                {
                    newObjActiveDate = Provider.time;
                }
                ItemStructureAsset itemStructureAsset;
                try
                {
                    itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, num3);
                }
                catch
                {
                    itemStructureAsset = null;
                }
                if (itemStructureAsset != null)
                {
                    if (version < 5)
                    {
                        Vector3 eulerAngles = Quaternion.Euler(-90f, (float)(b2 * 2), 0f).eulerAngles;
                        b  = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.x / 2f) * 2));
                        b2 = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.y / 2f) * 2));
                        b3 = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.z / 2f) * 2));
                    }
                    region.structures.Add(new StructureData(new Structure(num3, num4, itemStructureAsset), vector, b, b2, b3, num5, num6, newObjActiveDate));
                    StructureManager.manager.spawnStructure(region, num3, vector, b, b2, b3, (byte)Mathf.RoundToInt((float)num4 / (float)itemStructureAsset.health * 100f), num5, num6, StructureManager.instanceCount += 1u);
                }
            }
        }
Esempio n. 8
0
        public static void load()
        {
            bool flag = false;

            if (LevelSavedata.fileExists("/Structures.dat") && Level.info.type == ELevelType.SURVIVAL)
            {
                River river = LevelSavedata.openRiver("/Structures.dat", true);
                byte  b     = river.readByte();
                if (b > 3)
                {
                    StructureManager.serverActiveDate = river.readUInt32();
                }
                else
                {
                    StructureManager.serverActiveDate = Provider.time;
                }
                if (b > 1)
                {
                    for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1)
                    {
                        for (byte b3 = 0; b3 < Regions.WORLD_SIZE; b3 += 1)
                        {
                            StructureRegion region = StructureManager.regions[(int)b2, (int)b3];
                            StructureManager.loadRegion(b, river, region);
                        }
                    }
                }
                if (b < 6)
                {
                    flag = true;
                }
            }
            else
            {
                flag = true;
            }
            if (flag && LevelObjects.buildables != null)
            {
                for (byte b4 = 0; b4 < Regions.WORLD_SIZE; b4 += 1)
                {
                    for (byte b5 = 0; b5 < Regions.WORLD_SIZE; b5 += 1)
                    {
                        List <LevelBuildableObject> list = LevelObjects.buildables[(int)b4, (int)b5];
                        if (list != null && list.Count != 0)
                        {
                            StructureRegion structureRegion = StructureManager.regions[(int)b4, (int)b5];
                            for (int i = 0; i < list.Count; i++)
                            {
                                LevelBuildableObject levelBuildableObject = list[i];
                                if (levelBuildableObject != null)
                                {
                                    ItemStructureAsset itemStructureAsset = levelBuildableObject.asset as ItemStructureAsset;
                                    if (itemStructureAsset != null)
                                    {
                                        Vector3       eulerAngles   = levelBuildableObject.rotation.eulerAngles;
                                        byte          newAngle_X    = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.x / 2f) * 2));
                                        byte          newAngle_Y    = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.y / 2f) * 2));
                                        byte          newAngle_Z    = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.z / 2f) * 2));
                                        Structure     structure     = new Structure(itemStructureAsset.id, itemStructureAsset.health, itemStructureAsset);
                                        StructureData structureData = new StructureData(structure, levelBuildableObject.point, newAngle_X, newAngle_Y, newAngle_Z, 0UL, 0UL, uint.MaxValue);
                                        structureRegion.structures.Add(structureData);
                                        StructureManager.manager.spawnStructure(structureRegion, structure.id, structureData.point, structureData.angle_x, structureData.angle_y, structureData.angle_z, (byte)Mathf.RoundToInt((float)structure.health / (float)itemStructureAsset.health * 100f), 0UL, 0UL, StructureManager.instanceCount += 1u);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Level.isLoadingStructures = false;
        }
Esempio n. 9
0
 public static void load()
 {
     LevelObjects._models                 = new GameObject().transform;
     LevelObjects.models.name             = "Objects";
     LevelObjects.models.parent           = Level.level;
     LevelObjects.models.tag              = "Logic";
     LevelObjects.models.gameObject.layer = LayerMasks.LOGIC;
     LevelObjects._objects                = new List <LevelObject> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     LevelObjects._buildables             = new List <LevelBuildableObject> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     LevelObjects._total              = 0;
     LevelObjects._regions            = new bool[(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     LevelObjects._loads              = new int[(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     LevelObjects.shouldInstantlyLoad = true;
     LevelObjects.isHierarchyReady    = false;
     for (byte b = 0; b < Regions.WORLD_SIZE; b += 1)
     {
         for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1)
         {
             LevelObjects.loads[(int)b, (int)b2] = -1;
         }
     }
     for (byte b3 = 0; b3 < Regions.WORLD_SIZE; b3 += 1)
     {
         for (byte b4 = 0; b4 < Regions.WORLD_SIZE; b4 += 1)
         {
             LevelObjects.objects[(int)b3, (int)b4]    = new List <LevelObject>();
             LevelObjects.buildables[(int)b3, (int)b4] = new List <LevelBuildableObject>();
         }
     }
     if (Level.info.configData.Use_Legacy_Objects)
     {
         if (ReadWrite.fileExists(Level.info.path + "/Level/Objects.dat", false, false))
         {
             River river = new River(Level.info.path + "/Level/Objects.dat", false);
             byte  b5    = river.readByte();
             bool  flag  = true;
             if (b5 > 0)
             {
                 if (b5 > 1 && b5 < 3)
                 {
                     river.readSteamID();
                 }
                 if (b5 > 8)
                 {
                     LevelObjects.availableInstanceID = river.readUInt32();
                 }
                 else
                 {
                     LevelObjects.availableInstanceID = 1u;
                 }
                 for (byte b6 = 0; b6 < Regions.WORLD_SIZE; b6 += 1)
                 {
                     for (byte b7 = 0; b7 < Regions.WORLD_SIZE; b7 += 1)
                     {
                         ushort num = river.readUInt16();
                         for (ushort num2 = 0; num2 < num; num2 += 1)
                         {
                             Vector3    vector      = river.readSingleVector3();
                             Quaternion newRotation = river.readSingleQuaternion();
                             Vector3    newScale;
                             if (b5 > 3)
                             {
                                 newScale = river.readSingleVector3();
                             }
                             else
                             {
                                 newScale = Vector3.one;
                             }
                             ushort num3    = river.readUInt16();
                             string newName = string.Empty;
                             if (b5 > 5)
                             {
                                 newName = river.readString();
                             }
                             Guid newGUID = Guid.Empty;
                             if (b5 > 7)
                             {
                                 newGUID = river.readGUID();
                             }
                             ELevelObjectPlacementOrigin newPlacementOrigin = ELevelObjectPlacementOrigin.MANUAL;
                             if (b5 > 6)
                             {
                                 newPlacementOrigin = (ELevelObjectPlacementOrigin)river.readByte();
                             }
                             uint newInstanceID;
                             if (b5 > 8)
                             {
                                 newInstanceID = river.readUInt32();
                             }
                             else
                             {
                                 newInstanceID = LevelObjects.generateUniqueInstanceID();
                             }
                             if (num3 != 0)
                             {
                                 LevelObject levelObject = new LevelObject(vector, newRotation, newScale, num3, newName, newGUID, newPlacementOrigin, newInstanceID);
                                 if (levelObject.asset == null)
                                 {
                                     flag = false;
                                 }
                                 if (Level.isEditor)
                                 {
                                     byte b8;
                                     byte b9;
                                     Regions.tryGetCoordinate(vector, out b8, out b9);
                                     if (b8 != b6 || b9 != b7)
                                     {
                                         Debug.LogError(string.Concat(new object[]
                                         {
                                             num3,
                                             " should be in ",
                                             b8,
                                             ", ",
                                             b9,
                                             " but was in ",
                                             b6,
                                             ", ",
                                             b7,
                                             "!"
                                         }));
                                     }
                                     LevelObjects.objects[(int)b8, (int)b9].Add(levelObject);
                                 }
                                 else
                                 {
                                     LevelObjects.objects[(int)b6, (int)b7].Add(levelObject);
                                 }
                                 LevelObjects._total++;
                             }
                         }
                     }
                 }
             }
             if (flag)
             {
                 LevelObjects._hash = river.getHash();
             }
             else
             {
                 LevelObjects._hash = new byte[20];
             }
             river.closeRiver();
         }
         else
         {
             for (byte b10 = 0; b10 < Regions.WORLD_SIZE; b10 += 1)
             {
                 for (byte b11 = 0; b11 < Regions.WORLD_SIZE; b11 += 1)
                 {
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Objects/Objects_",
                         b10,
                         "_",
                         b11,
                         ".dat"
                     }), false, false))
                     {
                         River river2 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Objects/Objects_",
                             b10,
                             "_",
                             b11,
                             ".dat"
                         }), false);
                         byte b12 = river2.readByte();
                         if (b12 > 0)
                         {
                             ushort num4 = river2.readUInt16();
                             for (ushort num5 = 0; num5 < num4; num5 += 1)
                             {
                                 Vector3    position = river2.readSingleVector3();
                                 Quaternion rotation = river2.readSingleQuaternion();
                                 ushort     num6     = river2.readUInt16();
                                 string     empty    = string.Empty;
                                 Guid       empty2   = Guid.Empty;
                                 ELevelObjectPlacementOrigin placementOrigin = ELevelObjectPlacementOrigin.MANUAL;
                                 if (num6 != 0)
                                 {
                                     LevelObjects.addObject(position, rotation, Vector3.one, num6, empty, empty2, placementOrigin);
                                 }
                             }
                         }
                         river2.closeRiver();
                     }
                 }
             }
             LevelObjects._hash = new byte[20];
         }
     }
     else
     {
         LevelObjects._hash = new byte[20];
     }
     if ((Provider.isServer || Level.isEditor) && ReadWrite.fileExists(Level.info.path + "/Level/Buildables.dat", false, false))
     {
         River river3 = new River(Level.info.path + "/Level/Buildables.dat", false);
         river3.readByte();
         for (byte b13 = 0; b13 < Regions.WORLD_SIZE; b13 += 1)
         {
             for (byte b14 = 0; b14 < Regions.WORLD_SIZE; b14 += 1)
             {
                 ushort num7 = river3.readUInt16();
                 for (ushort num8 = 0; num8 < num7; num8 += 1)
                 {
                     Vector3    vector2      = river3.readSingleVector3();
                     Quaternion newRotation2 = river3.readSingleQuaternion();
                     ushort     num9         = river3.readUInt16();
                     if (num9 != 0)
                     {
                         LevelBuildableObject item = new LevelBuildableObject(vector2, newRotation2, num9);
                         if (Level.isEditor)
                         {
                             byte b15;
                             byte b16;
                             Regions.tryGetCoordinate(vector2, out b15, out b16);
                             if (b15 != b13 || b16 != b14)
                             {
                                 Debug.LogError(string.Concat(new object[]
                                 {
                                     num9,
                                     " should be in ",
                                     b15,
                                     ", ",
                                     b16,
                                     " but was in ",
                                     b13,
                                     ", ",
                                     b14,
                                     "!"
                                 }));
                             }
                             LevelObjects.buildables[(int)b15, (int)b16].Add(item);
                         }
                         else
                         {
                             LevelObjects.buildables[(int)b13, (int)b14].Add(item);
                         }
                         LevelObjects._total++;
                     }
                 }
             }
         }
         river3.closeRiver();
     }
     if (Level.info.configData.Use_Legacy_Objects && !Dedicator.isDedicated && !Level.isEditor)
     {
         for (byte b17 = 0; b17 < Regions.WORLD_SIZE; b17 += 1)
         {
             for (byte b18 = 0; b18 < Regions.WORLD_SIZE; b18 += 1)
             {
                 for (int i = 0; i < LevelObjects.objects[(int)b17, (int)b18].Count; i++)
                 {
                     LevelObject levelObject2 = LevelObjects.objects[(int)b17, (int)b18][i];
                     if (levelObject2.asset != null && !(levelObject2.transform == null))
                     {
                         if (levelObject2.asset.lod != EObjectLOD.NONE)
                         {
                             ObjectsLOD objectsLOD = levelObject2.transform.gameObject.AddComponent <ObjectsLOD>();
                             objectsLOD.lod    = levelObject2.asset.lod;
                             objectsLOD.bias   = levelObject2.asset.lodBias;
                             objectsLOD.center = levelObject2.asset.lodCenter;
                             objectsLOD.size   = levelObject2.asset.lodSize;
                             objectsLOD.calculateBounds();
                         }
                     }
                 }
             }
         }
     }
     if (Level.isEditor)
     {
         LevelObjects.reun  = new IReun[256];
         LevelObjects.step  = 0;
         LevelObjects.frame = 0;
     }
 }