Ejemplo n.º 1
0
 public void ChangeClassMode(ClassMode targetClassMode)
 {
     if (ClassMode != targetClassMode)
     {
         ClassMode = targetClassMode;
     }
 }
Ejemplo n.º 2
0
        public void Load(BinaryReader read)
        {
            CurrentSaveVersion = read.ReadString();
            float version = string.IsNullOrEmpty(CurrentSaveVersion) ? -1f : float.Parse(CurrentSaveVersion, NumberStyles.AllowDecimalPoint, NumberFormatInfo.InvariantInfo);

            if (version <= 0f)
            {
                Console.WriteLine($"Invalid or very outdated save data version detected: {version}");
                return;
            }
            SaveSlot       = read.ReadInt32();
            ProfileIconKey = read.ReadString();
            ProfileIconKey = string.IsNullOrEmpty(ProfileIconKey) ? "" : ProfileIconKey;
            IsNewGame      = read.ReadBoolean();
            if (version < 1.77f)
            {
                Difficulty = read.ReadBoolean() ? Difficulty.Hard : Difficulty.Normal;
            }
            else
            {
                Difficulty = (Difficulty)read.ReadByte();
            }
            IsMortal = read.ReadBoolean();
            Died     = read.ReadBoolean();
            int count = read.ReadInt32();

            Variables = new Dictionary <string, int>(count);
            for (int i = 0; i < count; i++)
            {
                string key   = read.ReadString();
                int    value = read.ReadInt32();
                Variables.Add(key, value);
            }
            PlayerSaveData = new PlayerSaveData();
            PlayerSaveData.Load(read, version);
            Seed        = read.ReadInt32();
            CurrentRoom = new CurrentRoomData();
            CurrentRoom.Load(read);
            Mode          = (GameMode)read.ReadInt32();
            count         = read.ReadInt32();
            AreasExplored = new List <string>(count);
            for (int j = 0; j < count; j++)
            {
                AreasExplored.Add(read.ReadString());
            }
            count            = read.ReadInt32();
            DungeonsExplored = new Dictionary <string, List <int> >(count);
            for (int k = 0; k < count; k++)
            {
                string     key        = read.ReadString();
                int        innerCount = read.ReadInt32();
                List <int> list       = new List <int>(innerCount);
                for (int l = 0; l < innerCount; l++)
                {
                    list.Add(read.ReadInt32());
                }
                DungeonsExplored.Add(key, list);
            }
            ScreensExplored = new HashSet <RoomCordinate>();
            count           = read.ReadInt32();
            for (int m = 0; m < count; m++)
            {
                ScreensExplored.Add(RoomCordinate.Load(read));
            }
            if (read.BaseStream.Position < read.BaseStream.Length)
            {
                PerchRoom = new CurrentRoomData();
                PerchRoom.Load(read);
            }
            if (read.BaseStream.Position < read.BaseStream.Length)
            {
                count         = read.ReadInt32();
                EnemiesKilled = new Dictionary <string, EnemyCounter>(count);
                for (int n = 0; n < count; n++)
                {
                    string typeName        = read.ReadString();
                    int    current         = read.ReadInt32();
                    int    needed          = read.ReadInt32();
                    bool   unlocked        = read.ReadBoolean();
                    bool   droppedUncommon = read.ReadBoolean();
                    bool   droppedRare     = read.ReadBoolean();
                    EnemiesKilled.Add(typeName, new EnemyCounter
                    {
                        Current         = current,
                        Needed          = needed,
                        Unlocked        = unlocked,
                        DroppedUncommon = droppedUncommon,
                        DroppedRare     = droppedRare
                    });
                }
            }
            OverworldFileName = read.ReadString();
            UniqueId          = Guid.Parse(read.ReadString());
            CratesKilled      = read.ReadInt32();
            CrateCount        = read.ReadInt32();
            if (version >= 1.77f)
            {
                int rmCount = read.ReadInt32();
                RoomMarks = new Dictionary <int, RoomMark>(rmCount);
                for (int num5 = 0; num5 < rmCount; num5++)
                {
                    int      roomkey  = read.ReadInt32();
                    RoomMark roomMark = RoomMark.Load(read);
                    RoomMarks.Add(roomkey, roomMark);
                }
                GameBuildVersion = version >= 1.79f ? read.ReadString() : null;
                ClassMode        = version >= 1.8f ? (ClassMode)read.ReadInt32() : 0;
            }
            bool hasOverworldData = read.ReadBoolean();

            if (hasOverworldData)
            {
                if (version >= 1.76f)
                {
                    OverworldFileVersion = read.ReadSingle();
                    var size = read.ReadInt32();
                    OverWorldSaveStateBytes = read.ReadBytes(size);
                }
                else
                {
                    OverworldFileVersion    = version;
                    OverWorldSaveStateBytes = read.ReadAllBytes();
                }
                OverWorldSaveState = new OverWorldSaveState();
                using (MemoryStream input = new MemoryStream(OverWorldSaveStateBytes))
                {
                    using (BinaryReader reader = new BinaryReader(input))
                    {
                        OverWorldSaveState.Load(reader, OverworldFileVersion);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public Class(ClassType type, DayOfWeek dayOfWeek, DateTime startTime, DateTime endTime, ClassMode mode, string room)
 {
     this.Type                  = type;
     this.DayOfWeek             = dayOfWeek;
     this.StartTime             = startTime;
     this.EndTime               = endTime;
     this.Room                  = room;
     this.Mode                  = mode;
     this.DisplayTime           = GenerateDisplayTime();
     this.DisplayMode           = GenerateDisplayMode();
     this.Registerd             = false;
     this.Planned               = false;
     this.Colour                = "#FFFFFF";
     this.ClashMessage          = "";
     this.ClashMessageIsVisible = false;
     GenerateTag();
 }