コード例 #1
0
        // Should only input SimulationProperties as a parameter
        public void Add(Amplitude.StaticString name, float value)
        {
            SingleSimulationModifierDescriptor modif = new SingleSimulationModifierDescriptor(name, SimulationModifierDescriptor.ModifierOperation.Addition, value);

            Properties.Add(new SimulationPropertyDescriptor(name));
            Modifiers.Add(modif);
        }
コード例 #2
0
        public SimulationDescriptor GetDescriptor(string name, Amplitude.StaticString type)
        {
            var temp = GetDescriptor(name);

            if (type != null)
            {
                temp.SetType(type);
            }
            return(temp);
        }
コード例 #3
0
        public void Add(Amplitude.StaticString name, float startingValue, SimulationModifierDescriptor modif = null)
        {
            SimulationPropertyDescriptor desc = new SimulationPropertyDescriptor(name);

            new DynData <SimulationPropertyDescriptor>(desc).Set <float>("BaseValue", startingValue);
            Properties.Add(desc);
            if (modif != null)
            {
                Modifiers.Add(modif);
            }
        }
コード例 #4
0
        // This uses default animation for Pod
        private void GameSelectionPanel_LaunchSelectedShipInAnimation(On.GameSelectionPanel.orig_LaunchSelectedShipInAnimation orig, GameSelectionPanel self)
        {
            DynData <GameSelectionPanel> d = new DynData <GameSelectionPanel>(self);

            Amplitude.StaticString temp = d.Get <Amplitude.StaticString>("selectedShipName");
            if (temp == GetName())
            {
                d.Set <Amplitude.StaticString>("selectedShipName", AnimationPodWrapper.Value);
            }
            orig(self);
            d.Set <Amplitude.StaticString>("selectedShipName", temp);
        }
コード例 #5
0
        private void GameSelectionPanel_LaunchSelectedShipOutAnimation(On.GameSelectionPanel.orig_LaunchSelectedShipOutAnimation orig, GameSelectionPanel self, bool nextOrPrevious, bool playOutSFX)
        {
            DynData <GameSelectionPanel> d = new DynData <GameSelectionPanel>(self);

            Amplitude.StaticString temp = d.Get <Amplitude.StaticString>("selectedShipName");
            if (temp == GetName())
            {
                d.Set <Amplitude.StaticString>("selectedShipName", AnimationPodWrapper.Value);
            }
            orig(self, nextOrPrevious, playOutSFX);
            d.Set <Amplitude.StaticString>("selectedShipName", temp);
        }
コード例 #6
0
 private SpriteAnimationRuntime2 GameSelectionPanel_GetShipAnimation(On.GameSelectionPanel.orig_GetShipAnimation orig, GameSelectionPanel self, Amplitude.StaticString shipName)
 {
     Log("Getting an animation for: " + shipName);
     if (shipName == GetName())
     {
         return(orig(self, AnimationPodWrapper.Value));
     }
     return(orig(self, shipName));
 }
コード例 #7
0
 private void GameSelectionPanel_UpdateShip(On.GameSelectionPanel.orig_UpdateShip orig, GameSelectionPanel self, Amplitude.StaticString shipName, bool nextOrPrevious, bool syncOverNetwork, bool refreshContent)
 {
     if (shipName == GetName())
     {
         orig(self, shipName, nextOrPrevious, syncOverNetwork, refreshContent);
         DynData <GameSelectionPanel> d       = new DynData <GameSelectionPanel>(self);
         GameNetworkManager           manager = d.Get <GameNetworkManager>("gameNetManager");
         Dungeon.SetShip(GetName());
         if (syncOverNetwork && manager.IsServer())
         {
             global::Session session = manager.GetSession();
             session.SetLobbyData(global::Session.LOBBYDATA_GAME_SHIP, GetName());
             // Values["AssumedPod"]
         }
         return;
     }
     orig(self, shipName, nextOrPrevious, syncOverNetwork, refreshContent);
 }
コード例 #8
0
        private System.Collections.IEnumerator DungeonGenerator2_GenerateDungeonUsingSeedCoroutine(On.DungeonGenerator2.orig_GenerateDungeonUsingSeedCoroutine orig, DungeonGenerator2 self, int level, int randomSeed, Amplitude.StaticString shipName)
        {
            if (shipName == GetName())
            {
                DynData <DungeonGenerator2> d = new DynData <DungeonGenerator2>(self);
                d.Set <int>("randomSeed", randomSeed);
                Log("Calling GenerateDungeonUsingSeedCoroutine!");

                yield return(typeof(DungeonGenerator2).GetMethod("GenerateDungeonCoroutine", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(self, new object[] { level, new Amplitude.StaticString(DungeonPodWrapper.Value) }));

                yield break;
            }
            Log("Calling Original GenerateDungeonUsingSeedCoroutine!");
            yield return(orig(self, level, randomSeed, shipName));
        }
コード例 #9
0
 private void Hero_Init(On.Hero.orig_Init orig, Hero self, ulong ownerPlayerID, Amplitude.StaticString heroDescName, Room spawnRoom, bool isRecruited, bool registerRecruitment, int initLevel, int unlockLevel, bool hasOperatingBonus, Dictionary <Amplitude.StaticString, List <ItemPersistentData> > initItemsByCategory, bool displayRecruitmentDialog, bool consumeLevelUpFood, bool updateDiscoverableHeroPool, int floorRecruited, Amplitude.StaticString[] permanentDescriptors, bool isStartingHero, int currentRespawnRoomCount, bool recruitable)
 {
     orig(self, ownerPlayerID, heroDescName, spawnRoom, isRecruited, registerRecruitment, initLevel, unlockLevel, hasOperatingBonus, initItemsByCategory, displayRecruitmentDialog, consumeLevelUpFood, updateDiscoverableHeroPool, floorRecruited, permanentDescriptors, isStartingHero, currentRespawnRoomCount, recruitable);
     if ((mod.settings as CustomHeroTestSettings).LogHeroData)
     {
         LogHeroData(self, heroDescName);
     }
     if ((mod.settings as CustomHeroTestSettings).ReplaceHero && (mod.settings as CustomHeroTestSettings).HeroToReplace == self.LocalizedName)
     {
         // We are matching Heroes! Start to change data!
         SetHeroStats(self);
         //self.HealthCpnt.SetHealth((float)Convert.ToDouble(mod.Values["Hero HP"]));
     }
     SetHeroRankName(self);
 }
コード例 #10
0
        private void LogHeroData(Hero self, Amplitude.StaticString heroDescName)
        {
            mod.Log("HeroDescName: " + heroDescName + " with real name: " + self.LocalizedName);
            mod.Log("Current Level: " + self.Level);
            // Possibly important information below:

            /*
             * activeSkills, passiveSkills: Lists
             * FilteredActiveSkills: List of ActiveSkills
             * FilteredPassiveSkills: List of PassiveSkills
             * Config: Database of HeroConfig, found by using heroDescName
             * SituationDialogCount seems like dialogs that the hero says during the game
             * spriteAnim, tacticalMapElementAnim, crystalSprite: All seem to be animations/graphics
             * self.transform.position: Real position
             * heroAttackTargetCpnt: The attacker componenet, init is called on this with Config.AITargetType passed in (if it is recruited by a player)
             * mobsAggroAttackTargetCpnt: Seems to be something that determines aggro of mobs
             * levelConfigs: List<HeroLevelConfig>
             * levelUpModifiersByLevel: List<Dictionary<StaticString, float>>()
             * GetLevelDescriptorName: returns a name for a given level, used to populate the above dict
             * levelConfigs contains a list of data (including passive/active skills with unique naming)
             * leveUpModifiersByLevel contains Dictionaries created by:
             * 1. Finding a SimulationDescriptor from a SimMonoBehavior (found by using levelDescriptorName)
             * 2. Finding a simObj (self.GetSimObj())
             * 3. Iterating over each SimulationModifierDescriptor in the SimulationDescriptor.SimulationModifierDescriptors list
             * - And adding to the dictionary: TargetPropertyName of the current SimulationModifierDescriptor, current.ComputeValue(simObj, simObj, SimulationPropertyRefreshContext.GetContext(-1))
             * permanentDescriptors contain SimulationDescriptors
             *
             */
            mod.Log("Active Skills:");
            foreach (ActiveSkill a in self.FilteredActiveSkills)
            {
                mod.Log("- " + GetSkillNameFromSkill(a) + " with desc name: " + a.name);
            }
            mod.Log("Passive Skills:");
            foreach (PassiveSkill p in self.FilteredPassiveSkills)
            {
                string label = GetSkillNameFromSkill(p);
                mod.Log("GUI Label: " + label + " with desc name: " + p.name);
                if (p.OwnerSimDesc == null)
                {
                    continue;
                }
                if (p.OwnerSimDesc.SimulationModifierDescriptors != null)
                {
                    mod.Log("- All ModifierDescriptors:");
                    foreach (SimulationModifierDescriptor d in p.OwnerSimDesc.SimulationModifierDescriptors)
                    {
                        if (d != null)
                        {
                            mod.Log("-- " + d.TargetPropertyName);
                        }
                    }
                }
                if (p.OwnerSimDesc.SimulationPropertyDescriptors != null)
                {
                    mod.Log("- All PropertyDescriptors:");
                    foreach (SimulationPropertyDescriptor d in p.OwnerSimDesc.SimulationPropertyDescriptors)
                    {
                        if (d != null)
                        {
                            mod.Log("-- " + d.Name);
                        }
                    }
                }
            }
            mod.Log("Level Configs:");
            foreach (HeroLevelConfig h in new DynData <Hero>(self).Get <List <HeroLevelConfig> >("levelConfigs"))
            {
                if (h == null)
                {
                    continue;
                }
                mod.Log("Food Cost: " + h.FoodCost + " Skills:");
                try
                {
                    foreach (string s in h.Skills)
                    {
                        //SkillConfig skc = Databases.GetDatabase<SkillConfig>(false).GetValue(s);
                        //skc.Init();
                        string label = GetSkillNameFromSkillKey(s);
                        mod.Log("- " + label + " with desc name: " + s);
                    }
                }
                catch (NullReferenceException e)
                {
                    // There are no Skills from this levelConfig
                }
            }
            mod.Log("Level Up Modifiers By Level:");
            List <Dictionary <Amplitude.StaticString, float> > list = new DynData <Hero>(self).Get <List <Dictionary <Amplitude.StaticString, float> > >("levelUpModifiersByLevel");

            foreach (Dictionary <Amplitude.StaticString, float> d in list)
            {
                if (d == null)
                {
                    continue;
                }
                mod.Log("Dictionary:");
                foreach (Amplitude.StaticString s in d.Keys)
                {
                    mod.Log("- Key: " + s + ", Value: " + d[s]);
                }
            }
            mod.Log("=======================================================================");
        }
コード例 #11
0
        private System.Collections.IEnumerator DungeonGenerator2_GenerateDungeonCoroutine(On.DungeonGenerator2.orig_GenerateDungeonCoroutine orig, DungeonGenerator2 self, int level, Amplitude.StaticString shipName)
        {
            if (new DynData <DungeonGenerator2>(self).Get <bool>("IsGeneratingForRuntime"))
            {
                GameConfig c = GameConfig.GetGameConfig();
                if (capRoomsWrapper.Value && (int)c.DungeonRoomCountMax.GetValue() != maxRoomWrapper.Value)
                {
                    mod.Log("Setting DungeonRoomCountMax to: " + maxRoomWrapper.Value);
                    CurveDefinedValue v = c.DungeonRoomCountMax;
                    mod.Log("Original: " + v.GetValue());
                    CurveOperation op = v.CurveOperation;
                    mod.Log("Setting Max for CurveOperation...");
                    typeof(CurveOperation).GetProperty("Max").SetValue(op, (float)maxRoomWrapper.Value, null);
                    //new DynData<CurveOperation>(op).Set<float>("Max", maxRoomWrapper.Value);
                    mod.Log("Setting curveoperation...");
                    mod.Log("CurveOperation Max: " + op.Max);
                    //new DynData<CurveDefinedValue>(v).Set("CurveOperation", op);
                    typeof(CurveDefinedValue).GetProperty("CurveOperation").SetValue(v, op, null);
                    mod.Log("CurveDefinedValue.CurveOperation.Max: " + v.CurveOperation.Max);
                    mod.Log("Setting DungeonRoomCountMax...");
                    //new DynData<GameConfig>(c).Set("DungeonRoomCountMax", v);
                    typeof(GameConfig).GetProperty("DungeonRoomCountMax").SetValue(c, v, null);
                    mod.Log("Final value: " + c.DungeonRoomCountMax.GetValue());

                    // Need to also set min to be the same...
                    mod.Log("Setting DungeonRoomCountMin to: " + maxRoomWrapper.Value);
                    CurveDefinedValue m = c.DungeonRoomCountMin;
                    mod.Log("Original min: " + m.GetValue());
                    CurveOperation op2 = m.CurveOperation;
                    typeof(CurveOperation).GetProperty("Max").SetValue(op2, (float)maxRoomWrapper.Value, null);
                    typeof(CurveDefinedValue).GetProperty("CurveOperation").SetValue(m, op2, null);
                    typeof(GameConfig).GetProperty("DungeonRoomCountMin").SetValue(c, m, null);
                    mod.Log("Final min: " + c.DungeonRoomCountMin.GetValue());
                }
            }
            yield return(orig(self, level, shipName));
        }
コード例 #12
0
        private IEnumerator DungeonGenerator2_GenerateDungeonCoroutine(On.DungeonGenerator2.orig_GenerateDungeonCoroutine orig, DungeonGenerator2 self, int level, Amplitude.StaticString shipName)
        {
            SeedData seeds = TASInput.seeds.GetSeedForShipLevel(shipName, level);

            if (seeds != null)
            {
                // Then we need to set the seed accordingly!
                seeds.SetSeedData();
                mod.Log("Set seed to: " + seeds + " for level: " + level);
            }
            else
            {
                // Add the seed!
                SeedData data = new SeedData();
                mod.Log("Creating new SeedData for level: " + level + " with data: " + data);
                TASInput.AddSeed(level, data);
            }
            yield return(orig(self, level, shipName));
        }