Пример #1
0
        public override bool GetValue()
        {
            bool result;

            if (!Application.isPlaying)
            {
                result = false;
            }
            else
            {
                if (this.value < 1)
                {
                    return(false);
                }
                for (int i = 0; i < this.value; i++)
                {
                    Props s = Randomizer.GetOneFromData <Props>((i == 0) ? this.propsReg : "*");
                    if (s == null)
                    {
                        return(false);
                    }
                    Game.GameData.Inventory.Add(s.Id, 1, true);
                    if (base.Graph != null && (bool)base.Graph.GetVariable("IsShowMessage"))
                    {
                        this.ShowMessage(s.Name, 1);
                    }
                }
                result = true;
            }
            return(result);
        }
Пример #2
0
        public static bool ModPatch_BattleAction(BattleAction __instance, ref bool __result)
        {
            if (!Application.isPlaying || __instance.battleId.IsNullOrEmpty())
            {
                __result = false;
                return(false);
            }
            string     battleId   = __instance.battleId;
            BattleArea battleArea = Game.Data.Get <BattleArea>(battleId);
            BattleGrid battleGrid = Game.Data.Get <BattleGrid>(battleArea?.BattleMap);

            if (battleGrid == null)
            {
                battleGrid = Randomizer.GetOneFromData <BattleGrid>(battleArea?.BattleMap);
                if (battleGrid != null)
                {
                    BattleArea battleAreaClone = battleArea.Clone <BattleArea>();
                    battleAreaClone.Id        = "!" + battleAreaClone.Id;
                    battleAreaClone.BattleMap = battleGrid.Id;  // 复写mapId
                    ModExtensionSaveData.AddTempItem(battleAreaClone);
                    battleId = battleAreaClone.Id;
                }
            }
            string mapId = battleGrid?.MapId;

            Console.WriteLine("当前MapId=" + Game.GameData.MapId);
            Console.WriteLine("需要MapId=" + mapId);
            if (mapId == Game.GameData.MapId)
            {
                Game.FSM.SendEvent("BATTLE", new Heluo.FSM.Main.BattleEventArgs()
                {
                    BattleId = battleId
                });
                __result = true;
            }
            else
            {
                CachedBattleId = battleId;
                Console.WriteLine("设置BattleId=" + CachedBattleId);
                Game.FSM.SendEvent("LOADING", new LoadingEventArgs
                {
                    MapId       = mapId,
                    CinematicId = null,
                    TimeStage   = Heluo.Manager.TimeStage.None,
                    LoadType    = LoadType.Default
                });
                __result = true;
            }
            return(false);
        }
 // Token: 0x06002C7B RID: 11387 RVA: 0x000F030C File Offset: 0x000EE50C
 public override Status GetValue()
 {
     if (WuxiaBattleManager == null)
     {
         return(Status.Error);
     }
     for (int i = 0; i < Count; i++)
     {
         string pattern = (i == 0) ? Pattern : "*";
         Console.WriteLine("Random Pattern " + pattern);
         Npc npc = Randomizer.GetOneFromData <Npc>(pattern);
         if (npc == null)
         {
             return(Status.Error);
         }
         int       tileNumber = (i == 0) ? CellNumber : -Range - 1;
         WuxiaUnit wuxiaUnit  = WuxiaBattleManager.AddUnit(npc.Id, Faction, tileNumber, !FullHealth);
         WuxiaBattleManager.FacedToNearestEnemy(wuxiaUnit);
     }
     return(Status.Success);
 }
Пример #4
0
        static bool ModExt_DropProps_UI(WGRewardList __instance, List <BattleDropProp> list)
        {
            int uid     = 0;
            var newlist = new List <BattleDropProp>();

            if (list != null)
            {
                newlist.AddRange(list);
            }
            for (int i = 0; i < newlist.Count; i++)
            {
                BattleDropProp_Ext battleDropProp = newlist[i] as BattleDropProp_Ext;  // 改成Ext版
                if (battleDropProp.Id == "Money")
                {
                    Sprite icon = Game.Resource.Load <Sprite>(string.Format(GameConfig.PropsCategoryPath, 0));
                    // 这里稍微加强下打工天赋,战斗的金钱也增加
                    int     value   = (int)(battleDropProp.Amount * Game.GameData.Character[GameConfig.Player].Trait.GetTraitEffect(TraitEffectType.WorkMoney));
                    WGProps wgprops = __instance.PropsList[uid++];
                    wgprops.SetProps(icon, value.ToString(), Game.Data.Get <StringTable>("NurturanceProperty_Money").Text);
                    Game.GameData.Money += value;
                    if (uid > 9)
                    {
                        break;             // 只有10个格子
                    }
                }
                else if (battleDropProp.Id.StartsWith("re"))
                {
                    Reward r = Game.Data.Get <Reward>(battleDropProp.Id) ?? Randomizer.GetOneFromData <Reward>(battleDropProp.Id);
                    if (r != null)
                    {
                        r.GetValue();
                    }
                }
                else if (battleDropProp.Id == "ExtDrop")
                {
                    newlist.AddRange(ExtDrops);   // 将战场掉落物也加进去
                }
                else
                {
                    Props props = Game.Data.Get <Props>(battleDropProp.Id) ?? Randomizer.GetOneFromData <Props>(battleDropProp.Id);
                    if (props != null)
                    {
                        int dropCount = 0;
                        for (int k = 0; k < battleDropProp.Amount; ++k)
                        {
                            if (UnityEngine.Random.value <= battleDropProp.Rate)
                            {
                                ++dropCount;
                            }
                        }
                        if (dropCount > 0)
                        {
                            Sprite  icon    = Game.Resource.Load <Sprite>(string.Format(GameConfig.PropsCategoryPath, (int)props.PropsCategory));
                            WGProps wgprops = __instance.PropsList[uid++];
                            wgprops.SetProps(icon, dropCount.ToString(), props.Name);
                            Game.GameData.Inventory.Add(props.Id, dropCount, true);
                            if (uid > 9)
                            {
                                break;             // 只有10个格子
                            }
                        }
                    }
                }
            }
            for (; uid < 10; ++uid)
            {
                WGProps wgprops = __instance.PropsList[uid];
                wgprops.gameObject.SetActive(false);
            }
            return(false);
        }
Пример #5
0
        // Token: 0x0600423A RID: 16954 RVA: 0x00170F7C File Offset: 0x0016F17C
        public override bool GetValue()
        {
            bool result;

            if (!Application.isPlaying)
            {
                result = false;
            }
            else
            {
                if (this.count < 1)
                {
                    return(false);
                }
                string[] array = this.extraIds.Trim().Split(new char[]
                {
                    ','
                });
                for (int i = 0; i < this.count; i++)
                {
                    Props props = Game.Data.Get <Props>(sourceId) ?? Randomizer.GetOneFromData <Props>(sourceId);
                    if (props == null)
                    {
                        return(false);
                    }
                    Props props2 = props.Clone <Props>();
                    props2.Id   = "$fp_" + props.Id;
                    props2.Name = string.Format("<color=#FFEEDD>{0}+</color>", props.Name);
                    if (props2.PropsEffect == null)
                    {
                        props2.PropsEffect = new List <PropsEffect>();
                    }
                    if (props2.BuffList == null)
                    {
                        props2.BuffList = new List <string>();
                    }
                    if (props2.PropsEffectDescription == null)
                    {
                        props2.PropsEffectDescription = "";
                    }
                    foreach (string id in array)
                    {
                        Props props3 = Game.Data.Get <Props>(id) ?? Randomizer.GetOneFromData <Props>(id);
                        if (props3 == null)
                        {
                            continue;
                        }
                        if (props3.PropsEffect != null)
                        {
                            props2.PropsEffect.AddRange(props3.PropsEffect);
                        }
                        if (props3.BuffList != null)
                        {
                            props2.BuffList.AddRange(props3.BuffList);
                        }
                        if (!props3.PropsEffectDescription.IsNullOrEmpty())
                        {
                            Props props4 = props2;
                            props4.PropsEffectDescription += string.Format("\n附加:{0}", props3.PropsEffectDescription);
                        }
                    }
                    ModExtensionSaveData.AddUniqueItem(props2);
                    Game.GameData.Inventory.Add(props2.Id, 1, true);
                    if (base.Graph != null && (bool)base.Graph.GetVariable("IsShowMessage"))
                    {
                        this.ShowMessage(props2.Name, 1);
                    }
                }
                result = true;
            }
            return(result);
        }
Пример #6
0
        public override bool GetValue()
        {
            bool result;

            if (!Application.isPlaying)
            {
                result = false;
            }
            else
            {
                if (this.count < 1)
                {
                    return(false);
                }
                for (int i = 0; i < this.count; i++)
                {
                    Props props;
                    if (!this.isMantra)
                    {
                        Skill skill = Game.Data.Get <Skill>(sourceId) ?? Randomizer.GetOneFromData <Skill>(sourceId);
                        props = new Props
                        {
                            Id            = "scroll_" + skill.Id,
                            Description   = skill.Description,
                            PropsType     = PropsType.Medicine,
                            PropsCategory = skill.Type - 101 + 401,
                            Name          = skill.Name + "秘籍",
                            PropsEffect   = new List <PropsEffect>
                            {
                                new PropsLearnSkill(skill.Id)
                            },
                            PropsEffectDescription = "学会独特招式:" + skill.Name
                        };
                    }
                    else
                    {
                        Mantra mantra = Game.Data.Get <Mantra>(sourceId) ?? Randomizer.GetOneFromData <Mantra>(sourceId);
                        props = new Props
                        {
                            Id            = "scroll_" + mantra.Id,
                            Description   = mantra.Description,
                            PropsType     = PropsType.Medicine,
                            PropsCategory = PropsCategory.InternalStyle_Secret_Scroll,
                            Name          = mantra.Name + "秘籍",
                            PropsEffect   = new List <PropsEffect>
                            {
                                new PropsLearnMantra(mantra.Id)
                            },
                            PropsEffectDescription = "学会独特心法:" + mantra.Name
                        };
                    }
                    ModExtensionSaveData.AddUniqueItem(props);
                    Game.GameData.Inventory.Add(props.Id, 1, true);
                    if (base.Graph != null && (bool)base.Graph.GetVariable("IsShowMessage"))
                    {
                        this.ShowMessage(props.Name, 1);
                    }
                }
                result = true;
            }
            return(result);
        }
Пример #7
0
        public static Props CreateUniquePropsByValue(string sourceId, int value)
        {
            Props props = Game.Data.Get <Props>(sourceId) ?? Randomizer.GetOneFromData <Props>(sourceId);

            if (props == null)
            {
                return(null);
            }
            Props props2 = props.Clone <Props>();

            if (props2.PropsEffect == null)
            {
                props2.PropsEffect = new List <PropsEffect>();
            }
            if (props2.BuffList == null)
            {
                props2.BuffList = new List <string>();
            }
            if (props2.PropsEffectDescription == null)
            {
                props2.PropsEffectDescription = "";
            }
            List <CharacterProperty> list = ((CharacterProperty[])Enum.GetValues(typeof(CharacterProperty))).ToList();

            list.Remove(CharacterProperty.Affiliation);
            list.Remove(CharacterProperty.Contribution);
            list.Remove(CharacterProperty.HP);
            list.Remove(CharacterProperty.MP);
            int           num   = value;
            List <string> list2 = new List <string>();

            while (num > 0 && list.Count > 0)
            {
                CharacterProperty characterProperty = list.Random();
                int num2;
                int num3;
                if (characterProperty < CharacterProperty.Attack)
                {
                    num2 = UnityEngine.Random.Range(0, num + value / 2);
                    num3 = num2 * 3 / 20 * 20;
                    num2 = num3 / 3;
                }
                else if (characterProperty < CharacterProperty.Hit)
                {
                    num2 = UnityEngine.Random.Range(-value / 2, num + value);
                    num3 = num2 / 5 * 5;
                    num2 = num3;
                }
                else if (characterProperty < CharacterProperty.Move)
                {
                    num2 = UnityEngine.Random.Range(-value / 2, num + value);
                    num3 = num2 / 5;
                    num2 = num3 * 5;
                }
                else
                {
                    num2 = UnityEngine.Random.Range(0, num + value / 2);
                    num3 = (num2 + 40) / 100;
                    num2 = Math.Max(0, num3 * 100 - 40);
                }
                if (num3 != 0)
                {
                    list.Remove(characterProperty);
                    PropsBattleProperty propsBattleProperty = new PropsBattleProperty
                    {
                        Type      = PropsEffectType.BattleProperty,
                        Property  = characterProperty,
                        isForever = false,
                        Value     = num3
                    };
                    props2.PropsEffect.Add(propsBattleProperty);
                    list2.Add(string.Format("{0}{1}{2}", Game.Data.Get <StringTable>("Property_" + Enum.GetName(typeof(CharacterProperty), characterProperty)).Text, (num3 > 0) ? "+" : "", num3));
                    num -= num2;
                }
            }
            Props props3 = props2;

            props3.PropsEffectDescription = string.Concat(new object[]
            {
                props3.PropsEffectDescription,
                "\n附加:",
                string.Join(",", list2)
            });
            ModExtensionSaveData.AddUniqueItem(props2);
            return(props2);
        }