示例#1
0
 internal override void Link()
 {
     if (WritingId.HasValue && World.WrittenContents.ContainsKey(WritingId.Value))
     {
         WrittenContent = World.WrittenContents[WritingId.Value];
     }
     ArtifactItem?.Link();
     if (SubregionId.HasValue && World.Regions.ContainsKey(SubregionId.Value))
     {
         Subregion = World.Regions[SubregionId.Value];
     }
     if (HfId_Holder.HasValue && World.HistoricalFigures.ContainsKey(HfId_Holder.Value))
     {
         Hf_Holder = World.HistoricalFigures[HfId_Holder.Value];
     }
     if (SiteId.HasValue && World.Sites.ContainsKey(SiteId.Value))
     {
         Site = World.Sites[SiteId.Value];
         if (StructureLocalId.HasValue)
         {
             StructureLocal = Site.GetStructure(StructureLocalId.Value);
         }
     }
     if (SubregionId.HasValue && World.Regions.ContainsKey(SubregionId.Value))
     {
         Subregion = World.Regions[SubregionId.Value];
     }
     if (SubregionId.HasValue && World.Regions.ContainsKey(SubregionId.Value))
     {
         Subregion = World.Regions[SubregionId.Value];
     }
 }
示例#2
0
        public Artifact(XDocument xdoc, World world)
            : base(xdoc, world)
        {
            foreach (var element in xdoc.Root.Elements())
            {
                var val = element.Value;
                int valI;
                int.TryParse(val, out valI);
                switch (element.Name.LocalName)
                {
                case "id":
                    break;

                case "name":
                    Name = val;
                    break;

                case "item":
                    ArtifactItem = new ArtifactItem(element, world, this);
                    break;

                case "site_id":
                    SiteId = valI;
                    break;

                case "structure_local_id":
                    StructureLocalId = valI;
                    break;

                case "holder_hfid":
                    HfId_Holder = valI;
                    break;

                case "abs_tile_x":
                    AbsTileX = valI;
                    break;

                case "abs_tile_y":
                    AbsTileY = valI;
                    break;

                case "abs_tile_z":
                    AbsTileZ = valI;
                    break;

                case "subregion_id":
                    if (valI != -1)
                    {
                        SubregionId = valI;
                    }
                    break;

                default:
                    DFXMLParser.UnexpectedXmlElement(xdoc.Root.Name.LocalName, element, xdoc.Root.ToString());
                    break;
                }
            }
        }
示例#3
0
        public override void Select(MainForm frm)
        {
            if (frm.grpArtifact.Text == ToString() && frm.MainTab.SelectedTab == frm.tabArtifact)
            {
                return;
            }
            Program.MakeSelected(frm.tabArtifact, frm.lstArtifact, this);

            frm.grpArtifact.Text = ToString();
#if DEBUG
            frm.grpArtifact.Text += $" - ID: {Id}";
#endif
            frm.grpArtifact.Show();

            frm.lblArtifactName.Text = Name.ToTitleCase();
            frm.lblArtifactItem.Text = ArtifactItem.ToString();

            frm.lblArtifactDescription.Text = (Mat.HasValue ? Item.Materials[Mat.Value] + " " : "") +
                                              (ItemSubType.HasValue
                                                  ? Item.ItemSubTypes[ItemSubType.Value]
                                                  : (ItemType.HasValue
                                                      ? Item.ItemTypes[ItemType.Value]
                                                      : ""));

            frm.lblArtifactValue.Text = ItemValue?.ToString() ?? "";

            frm.grpArtifactCreated.Visible = CreatedEvent != null;
            if (CreatedEvent != null)
            {
                frm.lblArtifactCreatedBy.Data   = CreatedEvent.Hf;
                frm.lblArtifactCreatedSite.Data = CreatedEvent.Site;
                frm.lblArtifactCreatedTime.Data = CreatedEvent;
                frm.lblArtifactCreatedTime.Text = CreatedEvent.Time.ToString();
            }

            frm.grpArtifactLost.Visible = LostEvent != null;
            if (LostEvent != null)
            {
                frm.lblArtifactLostSite.Data = LostEvent.Site;
                frm.lblArtifactLostTime.Data = LostEvent;
                frm.lblArtifactLostTime.Text = LostEvent.Time.ToString();
            }

            frm.grpArtifactEvents.FillListboxWith(frm.lstArtifactEvents, ArtifactEvents);
            frm.lblArtifactWCLabel.Visible = AssociatedWrittenContent != null;

            frm.lblArtifactWC.Data = AssociatedWrittenContent;
            frm.lblArtifactWC.Text = AssociatedWrittenContent == null ? "" : $"{AssociatedWrittenContent}";

            frm.lblArtifactHolder.Data = Hf_Holder;
            frm.lblArtifactSite.Data   = Site;
            frm.lblArtifactRegion.Data = Subregion;
        }