Beispiel #1
0
        public static AnvilOfArtifactsEntry GetAnvilEntry(Mobile m, bool create)
        {
            if (AnvilEntries.ContainsKey(m))
            {
                return(AnvilEntries[m]);
            }

            if (create)
            {
                var entry = new AnvilOfArtifactsEntry();

                AnvilEntries[m] = entry;

                return(entry);
            }

            return(null);
        }
Beispiel #2
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();
                int count   = 0;

                switch (version)
                {
                case 1:
                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        var m = reader.ReadMobile();

                        var anvilEntry = new AnvilOfArtifactsEntry();
                        anvilEntry.Deserialize(reader);

                        if (m != null)
                        {
                            AnvilEntries[m] = anvilEntry;
                        }
                    }
                    goto case 0;

                case 0:

                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        var context = new CraftContext(reader);
                        Contexts.Add(context);
                    }
                    break;
                }
            });
        }