Пример #1
0
        public static RareAddonEntry GetRareAddonEntry(string name, string sourcefile)
        {
            // go through and see if there is an addon by that name
            string    msg = null;
            RaresFile value;

            if (ParsedFiles.TryGetValue(sourcefile, out value))
            {
                RaresFile file = value;
                foreach (RareAddonEntry entry in file.RareAddons)
                {
                    if (entry.Name == name)
                    {
                        return(entry);
                    }
                }
                msg = DateTime.UtcNow + ": Rare system ERROR: name=" + name + " sourcfile=" + sourcefile +
                      " ... did not match existing file and addon name!";
            }
            else
            {
                msg = DateTime.UtcNow + ": Rare system ERROR: name=" + name + " sourcfile=" + sourcefile +
                      " ... did not match any existing file!";
            }
            Console.WriteLine(msg);
            //LoggingCustom.Log("ERROR-RareSystem.txt", msg);
            return(null);
        }
Пример #2
0
        public static void SpawnRareFromFile_Command(CommandEventArgs e)
        {
            Mobile    from = e.Mobile;
            RaresFile value;

            if (ParsedFiles.TryGetValue(e.ArgString, out value))
            {
                RaresFile file    = value;
                Item      spawned = file.GetRandomRareEntry();
                if (spawned != null)
                {
                    from.Backpack.AddItem(spawned);
                }
                else
                {
                    from.SendMessage("There was some sort of problem so nothing was spawned. Check the file!");
                }
            }
            else
            {
                from.SendMessage("file did not exist... existingfiles: ");
                foreach (var pair in ParsedFiles)
                {
                }
            }
        }
Пример #3
0
 public RareItem(RareEntry entry)
     : base(entry.ItemID)
 {
     Hue  = entry.Hue;
     Name = entry.Name;
     RaresFile.AddScriptAttachments(this, entry.ScriptFiles);
 }
Пример #4
0
        public RareAddon(string name, string sourcefile)
        {
            Name       = name;
            SourceFile = sourcefile;
            RareAddonEntry rareAddonEntry = RareSystem.GetRareAddonEntry(name, sourcefile);

            if (rareAddonEntry == null)
            {
                // specification in file not found
                Delete();
                return;
            }
            foreach (RareAddonComponentEntry component in rareAddonEntry.Components)
            {
                AddonComponent newAddonComponent = new AddonComponent(component.ItemID)
                {
                    Hue     = component.Hue,
                    Visible = component.Visible
                };
                AddComponent(newAddonComponent, component.X, component.Y, component.Z);
            }
            RaresFile.AddScriptAttachments(this, rareAddonEntry.ScriptFiles);
        }