예제 #1
0
 public InstigatorListener(EventTypeId id, VectorBooter.Data vector, InstigatorBooter.Data instigator)
     : base(id, null)
 {
     mVector = vector;
     mInstigator = instigator;
 }
예제 #2
0
            public Data(string guid, BooterHelper.BootFile file, XmlDbRow row)
            {
                mGuid = guid;

                if (BooterLogger.Exists(row, "InitialStrength", guid))
                {
                    mInitialStrength = row.GetInt("InitialStrength", 0);
                }

                mInfectionScoring = row.GetString("InfectionScoring");
                if (string.IsNullOrEmpty(mInfectionScoring))
                {
                    BooterLogger.AddError(Guid + " Missing InfectionScoring: " + mInfectionScoring);
                }
                else if (ScoringLookup.GetScoring(mInfectionScoring) == null)
                {
                    BooterLogger.AddError(Guid + " Missing InfectionScoring: " + mInfectionScoring);
                }

                mInfectionMinimum = row.GetInt("InfectionMinimum", 0);

                VectorStageTable table = new VectorStageTable(file as BooterHelper.DataBootFile, guid);

                if (!table.IsValid)
                {
                    BooterLogger.AddError(Guid + " Missing Stages: " + guid);
                }
                else
                {
                    Dictionary <string, int> namesToStages = new Dictionary <string, int>();

                    for (int i = 0; i < table.Stages.Count; i++)
                    {
                        if (namesToStages.ContainsKey(table.Stages[i].Name))
                        {
                            BooterLogger.AddError(Guid + " Stage " + i + ": Duplicate Name " + table.Stages[i].Name);
                            continue;
                        }

                        namesToStages.Add(table.Stages[i].Name, i);
                    }

                    for (int i = 0; i < table.Stages.Count; i++)
                    {
                        BooterLogger.AddTrace("Stage " + i);

                        table.Stages[i].ValidateStages(namesToStages);
                    }
                }

                mStages = table.Stages;

                mInoculationRating = row.GetInt("InoculationRating", 10);
                mInoculationCost   = row.GetInt("InoculationCost", 0);
                mResistanceCost    = row.GetInt("ResistanceCost", 0);

                mCanOutbreak = row.GetBool("CanOutbreak");

                mHighProtectionCost = row.GetInt("HighProtectionCost", 0);
                mLowProtectionCost  = row.GetInt("LowProtectionCost", 0);

                mMinimumStrainDifference = row.GetInt("MinimumStrainDifference", 0);

                mStrainMutationRate = row.GetInt("StrainMutationRate", -1);

                int numInstigators = row.GetInt("NumInstigators", 0) + 1;

                for (int i = 1; i <= numInstigators; i++)
                {
                    if (i == numInstigators)
                    {
                        if (row.Exists("Instigator" + i))
                        {
                            BooterLogger.AddError(Guid + " More Instigator then NumInstigators");
                        }
                        break;
                    }

                    mInstigators.Add(InstigatorBooter.GetInstigator(row.GetString("Instigator" + i)));
                }
            }