Exemple #1
0
        public ActorType(pActorType a)
        {
            switch (a.Owner)
            {
                case "Hostile":
                    this.owner = ScoringDB.ActorInfo.OwnerInfo.OwnerType.HostileDM;
                    break;
                case "Friendly":
                    this.owner = ScoringDB.ActorInfo.OwnerInfo.OwnerType.FriendlyDM;
                    break;
                case "This":
                    this.owner = ScoringDB.ActorInfo.OwnerInfo.OwnerType.Myself;
                    break;
                default:
                    throw new ApplicationException("Scoring rule contains unknown actor specifier " + a.Owner);
            }

            if ("Any" == a.Id)
            {
                this.id = new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Any, a.Id);
            }
            else if (NameLists.speciesNames.ContainsKey(a.Id))
            {
                this.id = new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Species, a.Id); ;
            }
            else if (NameLists.unitNames.ContainsKey(a.Id))
            {
                this.id = new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Instance, a.Id); ;
            }
            else
            {
                throw new ApplicationException("Unknown scoring rule identifier " + a.Id);
            }
            if (null != a.Region)
            {
                this.region = new ScoringLocationType(a.Region);
            }
            else
            {
                List<string> anywhere = new List<string>();
                anywhere.Add("Anywhere");
                this.region = new ScoringLocationType(anywhere, ScoringDB.ActorInfo.LocationInfo.LocationType.Anywhere);
            }
        }
Exemple #2
0
 public pScoringRuleType(string name, pActorType unit)
 {
     this.name = name;
     this.unit = unit;
     this.objectID = null;
     this.newState = "";
     this.from = "";
 }
Exemple #3
0
 public pScoringRuleType(string name, pActorType unit, pActorType objectID, string newState)
 {
     this.name = name;
     this.unit = unit;
     this.objectID = objectID;
     this.newState = newState;
     this.from = "";
 }
Exemple #4
0
 public override pActorType pGetActor()
 {
     pActorType returnValue;
     pScoringLocationType region;
     string id;
     string owner = "Unknown owner";
     try
     {
         reader.Read();
         owner = pGetString();
         id = pGetString();
         if ("Region" != reader.Name)
         {
             returnValue = new pActorType(owner, id);
         }
         else
         {
             region = pGetScoringLocation();
             returnValue = new pActorType(owner, id, region);
         }
         reader.ReadEndElement();
         return returnValue;
     }
     catch (SystemException e)
     {
         throw new ApplicationException("Failure reading Actor with owner " + owner, e);
     }
 }