Esempio n. 1
0
        public IEnumerable <CommandData> CreateCommandData(string head)
        {
            List <CommandData> list = new List <CommandData>();
            string             str1 = head + "DesireTable";

            foreach (KeyValuePair <int, float> keyValuePair in this.DesireTable)
            {
                KeyValuePair <int, float> item = keyValuePair;
                AgentData agentData            = this;
                int       key = item.Key;
                list.Add(new CommandData(CommandData.Command.FLOAT, str1 + string.Format("[{0}]", (object)key), (Func <object>)(() => (object)item.Value), (System.Action <object>)(o => closure_0.DesireTable[key] = Mathf.Clamp((float)o, 0.0f, 100f))));
            }
            string head1 = head + "SickState";

            this.SickState.AddList(list, head1);
            if (Object.op_Inequality((Object)this.param.actor, (Object)null) && Object.op_Inequality((Object)this.param.actor.ChaControl, (Object)null) && this.param.actor.ChaControl.fileGameInfo != null)
            {
                string str2 = head + "StatsTable";
                foreach (KeyValuePair <int, float> keyValuePair in this.StatsTable)
                {
                    KeyValuePair <int, float> item = keyValuePair;
                    int key = item.Key;
                    list.Add(new CommandData(CommandData.Command.FLOAT, str2 + string.Format("[{0}]", (object)key), (Func <object>)(() => item.Key == 7 ? (object)this.param.actor.ChaControl.fileGameInfo.morality : (object)item.Value), (System.Action <object>)(o =>
                    {
                        AgentActor actor = this.param.actor as AgentActor;
                        if (!Object.op_Inequality((Object)actor, (Object)null))
                        {
                            return;
                        }
                        float num1 = (float)o;
                        if (key == 3)
                        {
                            StatusProfile statusProfile = Singleton <Resources> .Instance.StatusProfile;
                            int flavor = actor.ChaControl.fileGameInfo.flavorState[6];
                            float num2 = AgentActor.FlavorVariation(statusProfile.DarknessPhysicalBuffMinMax, statusProfile.DarknessPhysicalBuff, flavor);
                            num1      += num2;
                        }
                        actor.SetStatus(key, num1);
                    })));
                }
                ChaFileGameInfo            fileGameInfo = this.param.actor.ChaControl.fileGameInfo;
                ChaFileGameInfo.MinMaxInfo tempBound    = fileGameInfo.tempBound;
                string str3 = head + "tempBound";
                list.Add(new CommandData(CommandData.Command.FLOAT, str3 + ".low", (Func <object>)(() => (object)tempBound.lower), (System.Action <object>)null));
                list.Add(new CommandData(CommandData.Command.FLOAT, str3 + ".high", (Func <object>)(() => (object)tempBound.upper), (System.Action <object>)null));
                ChaFileGameInfo.MinMaxInfo MoodBound = fileGameInfo.moodBound;
                string str4 = head + "MoodBound";
                list.Add(new CommandData(CommandData.Command.FLOAT, str4 + ".low", (Func <object>)(() => (object)MoodBound.lower), (System.Action <object>)null));
                list.Add(new CommandData(CommandData.Command.FLOAT, str4 + ".high", (Func <object>)(() => (object)MoodBound.upper), (System.Action <object>)null));
                Dictionary <int, int> flavorState = fileGameInfo.flavorState;
                string str5 = head + "FlavorSkillTable";
                foreach (KeyValuePair <int, int> keyValuePair in flavorState)
                {
                    KeyValuePair <int, int> item = keyValuePair;
                    list.Add(new CommandData(CommandData.Command.Int, str5 + string.Format("[{0}]", (object)item.Key), (Func <object>)(() => (object)item.Value), (System.Action <object>)(o => this.SetFlavorSkill(item.Key, (int)o))));
                }
                string key1 = string.Format("{0}{1}", (object)head, (object)"TalkMotivation");
                list.Add(new CommandData(CommandData.Command.FLOAT, key1, (Func <object>)(() => (object)this.TalkMotivation), (System.Action <object>)(o =>
                {
                    float num           = this.StatsTable[5];
                    this.TalkMotivation = Mathf.Clamp((float)o, 0.0f, num);
                })));
                string key2 = string.Format("{0}InstructProb", (object)head);
                list.Add(new CommandData(CommandData.Command.FLOAT, key2, (Func <object>)(() =>
                {
                    int num1 = fileGameInfo.flavorState[1];
                    StatusProfile statusProfile  = Singleton <Resources> .Instance.StatusProfile;
                    float defaultInstructionRate = statusProfile.DefaultInstructionRate;
                    Threshold instructionMinMax  = statusProfile.FlavorReliabilityInstructionMinMax;
                    float t    = Mathf.InverseLerp(instructionMinMax.min, instructionMinMax.max, (float)num1);
                    float num2 = defaultInstructionRate + statusProfile.FlavorReliabilityInstruction.Lerp(t);
                    if (fileGameInfo.normalSkill.ContainsValue(27))
                    {
                        num2 += statusProfile.InstructionRateDebuff;
                    }
                    return((object)num2);
                }), (System.Action <object>)null));
                string key3 = string.Format("{0}FollowProb", (object)head);
                list.Add(new CommandData(CommandData.Command.FLOAT, key3, (Func <object>)(() =>
                {
                    int num1 = fileGameInfo.flavorState[1];
                    StatusProfile statusProfile = Singleton <Resources> .Instance.StatusProfile;
                    float defaultFollowRate     = statusProfile.DefaultFollowRate;
                    float t    = Mathf.InverseLerp(statusProfile.FollowReliabilityMinMax.min, statusProfile.FollowReliabilityMinMax.max, (float)num1);
                    float num2 = defaultFollowRate + statusProfile.FollowRateReliabilityBuff.Lerp(t);
                    if (fileGameInfo.normalSkill.ContainsValue(8))
                    {
                        num2 += statusProfile.FollowRateBuff;
                    }
                    return((object)num2);
                }), (System.Action <object>)null));
                int    TotalFlavor = fileGameInfo.totalFlavor;
                string key4        = head + "TotalFlavor";
                list.Add(new CommandData(CommandData.Command.Int, key4, (Func <object>)(() => (object)TotalFlavor), (System.Action <object>)null));
                Dictionary <int, float> desireDefVal = fileGameInfo.desireDefVal;
                string str6 = head + "DesireDef";
                foreach (KeyValuePair <int, float> keyValuePair in desireDefVal)
                {
                    KeyValuePair <int, float> item = keyValuePair;
                    int desireKey = Desire.GetDesireKey((Desire.Type)item.Key);
                    list.Add(new CommandData(CommandData.Command.FLOAT, str6 + string.Format("[{0}]", (object)desireKey), (Func <object>)(() => (object)item.Value), (System.Action <object>)null));
                }
                int    Phase = fileGameInfo.phase;
                string key5  = head + "Phase";
                list.Add(new CommandData(CommandData.Command.Int, key5, (Func <object>)(() => (object)Phase), (System.Action <object>)null));
                Dictionary <int, int> NormalSkill = fileGameInfo.normalSkill;
                string str7 = head + "NormalSkill";
                foreach (KeyValuePair <int, int> keyValuePair in NormalSkill)
                {
                    KeyValuePair <int, int> item = keyValuePair;
                    list.Add(new CommandData(CommandData.Command.Int, str7 + string.Format("[{0}]", (object)item.Key), (Func <object>)(() => (object)item.Value), (System.Action <object>)(o => NormalSkill[item.Key] = (int)o)));
                }
                Dictionary <int, int> HSkill = fileGameInfo.hSkill;
                string str8 = head + "HSkill";
                foreach (KeyValuePair <int, int> keyValuePair in HSkill)
                {
                    KeyValuePair <int, int> item = keyValuePair;
                    list.Add(new CommandData(CommandData.Command.Int, str8 + string.Format("[{0}]", (object)item.Key), (Func <object>)(() => (object)item.Value), (System.Action <object>)(o => HSkill[item.Key] = (int)o)));
                }
                int    FavoritePlace = fileGameInfo.favoritePlace;
                string key6          = head + "FavoritePlace";
                list.Add(new CommandData(CommandData.Command.Int, key6, (Func <object>)(() => (object)FavoritePlace), (System.Action <object>)null));
            }
            return((IEnumerable <CommandData>)list);
        }
Esempio n. 2
0
 public void Copy(AgentData source)
 {
     this.Version        = source.Version;
     this.OpenState      = source.OpenState;
     this.CharaFileName  = source.CharaFileName;
     this.PlayEnterScene = source.PlayEnterScene;
     if (!this.PlayEnterScene)
     {
         this.CharaFileName = (string)null;
     }
     this.StatsTable              = source.StatsTable.ToDictionary <KeyValuePair <int, float>, int, float>((Func <KeyValuePair <int, float>, int>)(x => x.Key), (Func <KeyValuePair <int, float>, float>)(x => x.Value));
     this.DesireTable             = source.DesireTable.ToDictionary <KeyValuePair <int, float>, int, float>((Func <KeyValuePair <int, float>, int>)(x => x.Key), (Func <KeyValuePair <int, float>, float>)(x => x.Value));
     this.MotivationTable         = source.MotivationTable.ToDictionary <KeyValuePair <int, float>, int, float>((Func <KeyValuePair <int, float>, int>)(x => x.Key), (Func <KeyValuePair <int, float>, float>)(x => x.Value));
     this.ChunkID                 = source.ChunkID;
     this.AreaID                  = source.AreaID;
     this.ReservedWaypointIDList  = source.ReservedWaypointIDList.ToList <int>();
     this.WalkRouteWaypointIDList = source.WalkRouteWaypointIDList.ToList <int>();
     this.ActionTargetID          = source.ActionTargetID;
     this.ModeType                = source.ModeType;
     this.TiredNumberTable        = source.TiredNumberTable.ToDictionary <KeyValuePair <int, int>, int, int>((Func <KeyValuePair <int, int>, int>)(x => x.Key), (Func <KeyValuePair <int, int>, int>)(x => x.Value));
     this.Position                = source.Position;
     this.Rotation                = source.Rotation;
     this.SickState               = new Sickness(source.SickState);
     this.ItemList.Clear();
     foreach (StuffItem source1 in source.ItemList)
     {
         this.ItemList.Add(new StuffItem(source1));
     }
     this.CarryingItem              = source.CarryingItem == null ? (StuffItem)null : new StuffItem(source.CarryingItem);
     this.EquipedGloveItem          = new StuffItem(source.EquipedGloveItem);
     this.EquipedShovelItem         = new StuffItem(source.EquipedShovelItem);
     this.EquipedPickelItem         = new StuffItem(source.EquipedPickelItem);
     this.EquipedNetItem            = new StuffItem(source.EquipedNetItem);
     this.EquipedFishingItem        = new StuffItem(source.EquipedFishingItem);
     this.EquipedHeadItem           = new StuffItem(source.EquipedHeadItem);
     this.EquipedBackItem           = new StuffItem(source.EquipedBackItem);
     this.EquipedNeckItem           = new StuffItem(source.EquipedNeckItem);
     this.EquipedLampItem           = new StuffItem(source.EquipedLampItem);
     this.EquipedUmbrellaItem       = new StuffItem(source.EquipedUmbrellaItem);
     this.FriendlyRelationShipTable = source.FriendlyRelationShipTable.ToDictionary <KeyValuePair <int, int>, int, int>((Func <KeyValuePair <int, int>, int>)(x => x.Key), (Func <KeyValuePair <int, int>, int>)(x => x.Value));
     this.CallCTCount              = source.CallCTCount;
     this.CalledCount              = source.CalledCount;
     this.Greeted                  = source.Greeted;
     this.TutorialModeType         = source.TutorialModeType;
     this.TalkMotivation           = source.TalkMotivation;
     this.FlavorAdditionAmount     = source.FlavorAdditionAmount;
     this.CheckCatEvent            = source.CheckCatEvent;
     this.NowCoordinateFileName    = source.NowCoordinateFileName;
     this.BathCoordinateFileName   = source.BathCoordinateFileName;
     this.PlayedDressIn            = source.PlayedDressIn;
     this.SearchActionLockTable    = source.SearchActionLockTable.ToDictionary <KeyValuePair <int, Environment.SearchActionInfo>, int, Environment.SearchActionInfo>((Func <KeyValuePair <int, Environment.SearchActionInfo>, int>)(x => x.Key), (Func <KeyValuePair <int, Environment.SearchActionInfo>, Environment.SearchActionInfo>)(x => x.Value));
     this.IsOtherCoordinate        = source.IsOtherCoordinate;
     this.ItemScrounge             = new ItemScrounge(source.ItemScrounge);
     this.LockTalk                 = source.LockTalk;
     this.TalkElapsedTime          = source.TalkElapsedTime;
     this.IsPlayerForBirthdayEvent = source.IsPlayerForBirthdayEvent;
     if (source.advEventCheck == null)
     {
         source.advEventCheck = new Dictionary <int, HashSet <string> >();
     }
     this.advEventCheck = source.advEventCheck.ToDictionary <KeyValuePair <int, HashSet <string> >, int, HashSet <string> >((Func <KeyValuePair <int, HashSet <string> >, int>)(v => v.Key), (Func <KeyValuePair <int, HashSet <string> >, HashSet <string> >)(v => new HashSet <string>((IEnumerable <string>)v.Value)));
     this.IsWet         = source.IsWet;
     if (source.advEventLimitation == null)
     {
         source.advEventLimitation = new HashSet <int>();
     }
     this.advEventLimitation   = new HashSet <int>((IEnumerable <int>)source.advEventLimitation);
     this.PrevMode             = source.PrevMode;
     this.CurrentActionPointID = source.CurrentActionPointID;
     this.ScheduleEnabled      = source.ScheduleEnabled;
     this.ScheduleElapsedTime  = source.ScheduleElapsedTime;
     this.ScheduleDuration     = source.ScheduleDuration;
     this.WeaknessMotivation   = source.WeaknessMotivation;
     if (source.ColdLockInfo != null)
     {
         this.ColdLockInfo = new SickLockInfo()
         {
             Lock        = source.ColdLockInfo.Lock,
             ElapsedTime = source.ColdLockInfo.ElapsedTime
         }
     }
     ;
     if (source.HeatStrokeLockInfo != null)
     {
         this.HeatStrokeLockInfo = new SickLockInfo()
         {
             Lock        = source.HeatStrokeLockInfo.Lock,
             ElapsedTime = source.HeatStrokeLockInfo.ElapsedTime
         }
     }
     ;
     this.MapID         = source.MapID;
     this.ParameterLock = source.ParameterLock;
     this.PrevMapID     = source.PrevMapID;
 }