示例#1
0
        public Trade(List <Property> properties, World world) : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "trader_hfid": Trader = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "trader_entity_id": TraderEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "source_site_id": SourceSite = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "dest_site_id": DestSite = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "production_zone_id": ProductionZoneId = Convert.ToInt32(property.Value); break;

                case "allotment": Allotment = Convert.ToInt32(property.Value); break;

                case "allotment_index": AllotmentIndex = Convert.ToInt32(property.Value); break;

                case "account_shift": AccountShift = Convert.ToInt32(property.Value); break;
                }
            }


            SourceSite.AddEvent(this);
            DestSite.AddEvent(this);
            Trader.AddEvent(this);
            TraderEntity.AddEvent(this);
        }
        public ArtifactCopied(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "artifact_id": Artifact = world.GetArtifact(Convert.ToInt32(property.Value)); break;

                case "dest_site_id": DestSite = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "dest_structure_id": DestStructureId = Convert.ToInt32(property.Value); break;

                case "dest_entity_id": DestEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "source_site_id": SourceSite = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "source_structure_id": SourceStructureId = Convert.ToInt32(property.Value); break;

                case "source_entity_id": SourceEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "from_original":
                    FromOriginal   = true;
                    property.Known = true;
                    break;
                }
            }

            if (DestSite != null)
            {
                DestStructure = DestSite.Structures.FirstOrDefault(structure => structure.Id == DestStructureId);
            }

            if (SourceSite != null)
            {
                SourceStructure = SourceSite.Structures.FirstOrDefault(structure => structure.Id == SourceStructureId);
            }

            Artifact.AddEvent(this);
            DestSite.AddEvent(this);
            DestStructure.AddEvent(this);
            DestEntity.AddEvent(this);
            SourceSite.AddEvent(this);
            SourceStructure.AddEvent(this);
            SourceEntity.AddEvent(this);
        }