psyduck197 发表于 2019-1-28 20:29

Thea2:The Shattering 0332 升级点增强方法

本帖最后由 psyduck197 于 2019-2-17 16:53 编辑

修改Thea 2 The Shattering Build 0332\Thea2_Data\Managed\Assembly-CSharp.dll
                Thea2.Client:                                  CharacterProgression:








private void ItemUpdate(GameObject item, object source, object data, int index)
                {
                        CharacterProgressionListItem cItem = item.GetComponent<CharacterProgressionListItem>();
                        ClientTurnSummaryData clientTurnSummaryData = source as ClientTurnSummaryData;
                        ClientGroupData @for = ClientGroupData.GetFor(clientTurnSummaryData.groupID);
                        ClientEntityCharacter character = null;
                        if (@for != null)
                        {
                              character = (@for.GetEntity(clientTurnSummaryData.relatedValue) as ClientEntityCharacter);
                        }
                        if (character == null)
                        {
                              foreach (KeyValuePair<int, ClientGroupData> keyValuePair in ClientGroupData.GetAll())
                              {
                                        if (keyValuePair.Value != null && keyValuePair.Value.GetOwnerID() == RootNetworkManager.GetMyPlayerID())
                                        {
                                                ClientEntity entity = keyValuePair.Value.GetEntity(clientTurnSummaryData.relatedValue);
                                                if (entity != null)
                                                {
                                                      character = (entity as ClientEntityCharacter);
                                                }
                                        }
                              }
                        }
                        if (character == null)
                        {
                              return;
                        }
                        int seed = World.gameSeed ^ character.Id ^ character.Level << 3;
                        MHRandom mhrandom = new MHRandom(seed);
                        string instanceName = character.SubraceName;
                        Subrace instanceFromDB = Globals.GetInstanceFromDB<Subrace>(instanceName);
                        DBDef.Tag t1 = null;
                        DBDef.Tag t2 = null;
                        DBDef.Tag t3 = null;
                        List<Multitype<Skill, FInt>> chosenSkills = null;
                        bool flag = character.Level % 2 == 1;
                        if (flag)
                        {
                              List<CountedTag> list = new List<CountedTag>(instanceFromDB.mainSubraceAttributes);
                              list.Sort((CountedTag a, CountedTag b) => -a.amount.CompareTo(b.amount));
                              int index2 = Mathf.Min(new int[]
                              {
                                        mhrandom.GetInt(0, list.Count),
                                        mhrandom.GetInt(0, list.Count),
                                        mhrandom.GetInt(0, list.Count)
                              });
                              t1 = list.tag;
                              list.RemoveAt(index2);
                              index2 = Mathf.Min(mhrandom.GetInt(0, list.Count), mhrandom.GetInt(0, list.Count));
                              t2 = list.tag;
                              list.RemoveAt(index2);
                              index2 = Mathf.Min(mhrandom.GetInt(0, list.Count), mhrandom.GetInt(0, list.Count));
                              t3 = list.tag;
                              list.RemoveAt(index2);
                        }
                        if (!flag)
                        {
                              List<Multitype<Skill, FInt>> list2 = new List<Multitype<Skill, FInt>>();
                              if (!NetType.IsNullOrEmpty(character.LearnedSkills))
                              {
                                        foreach (NetType netType in character.LearnedSkills.value)
                                        {
                                                NetStringFInt2 netStringFInt = (NetStringFInt2)netType;
                                                Skill instanceFromDB2 = Globals.GetInstanceFromDB<Skill>(netStringFInt.name);
                                                FInt value = netStringFInt.value;
                                                if (value < 5 && netStringFInt.value2 == FInt.ZERO)
                                                {
                                                      list2.Add(new Multitype<Skill, FInt>(instanceFromDB2, value));
                                                }
                                        }
                              }
                              if (instanceFromDB.advancementSkills != null && SkillInstance.skillPacks.ContainsKey(instanceFromDB.advancementSkills))
                              {
                                        List<Skill> list3 = SkillInstance.skillPacks;
                                        using (List<Skill>.Enumerator enumerator3 = list3.GetEnumerator())
                                        {
                                                while (enumerator3.MoveNext())
                                                {
                                                      Skill v = enumerator3.Current;
                                                      if (list2.Find((Multitype<Skill, FInt> o) => o.t0 == v) == null)
                                                      {
                                                                list2.Add(new Multitype<Skill, FInt>(v, FInt.ZERO));
                                                      }
                                                }
                                        }
                              }
                              list2 = list2.FindAll((Multitype<Skill, FInt> o) => o.t1 * o.t1 < character.Level);
                              if (list2.Count > 2)
                              {
                                        chosenSkills = new List<Multitype<Skill, FInt>>();
                                        int @int = mhrandom.GetInt(0, list2.Count);
                                        Multitype<Skill, FInt> multitype = list2[@int];
                                        if (multitype.t1 == FInt.ZERO)
                                        {
                                                @int = mhrandom.GetInt(0, list2.Count);
                                        }
                                        chosenSkills.Add(list2[@int]);
                                        list2.RemoveAt(@int);
                                        int int2 = mhrandom.GetInt(0, list2.Count);
                                        multitype = list2;
                                        if (multitype.t1 == FInt.ZERO)
                                        {
                                                int2 = mhrandom.GetInt(0, list2.Count);
                                        }
                                        chosenSkills.Add(list2);
                              }
                              else
                              {
                                        chosenSkills = list2;
                              }
                        }
                        cItem.characterName.text = character.GetName();
                        cItem.previousLevel.text = character.Level.ToString();
                        cItem.newLevel.text = (character.Level + 1).ToString();
                        cItem.characterIcon.texture = character.GetIcon();
                        cItem.levelUpIndicator.SetActive(!this.IsSet(character));
                        RolloverCharacterTooltip.SetCharacter(cItem.characterInputCatch, character);
                        if (flag)
                        {
                              cItem.tagGroup.SetActive(true);
                              cItem.skillGroup.SetActive(false);
                              cItem.attribute1Icon.texture = AssetManager.GetTexture(t1);
                              cItem.attribute2Icon.texture = AssetManager.GetTexture(t2);
                              cItem.attribute3Icon.texture = AssetManager.GetTexture(t3);
                              cItem.attribute1Value.text = "+2";
                              cItem.attribute2Value.text = "+1";
                              cItem.attribute3Value.text = "+1";
                              cItem.attribute1.onValueChanged.RemoveAllListeners();
                              cItem.attribute2.onValueChanged.RemoveAllListeners();
                              cItem.attribute3.onValueChanged.RemoveAllListeners();
                              cItem.attribute1.isOn = this.IsTag(character, t1);
                              cItem.attribute2.isOn = this.IsTag(character, t2);
                              cItem.attribute3.isOn = this.IsTag(character, t3);
                              cItem.attribute1.onValueChanged.AddListener(delegate(bool b)
                              {
                                        this.SetTag(character, t1, 2);      //升级点
                                        cItem.levelUpIndicator.SetActive(false);
                              });
                              RolloverTooltip.SetTag(cItem.attribute1.gameObject, t1);
                              cItem.attribute2.onValueChanged.AddListener(delegate(bool b)
                              {
                                        this.SetTag(character, t2, 1);      // 升级点
                                        cItem.levelUpIndicator.SetActive(false);
                              });
                              RolloverTooltip.SetTag(cItem.attribute2.gameObject, t2);
                              cItem.attribute3.onValueChanged.AddListener(delegate(bool b)
                              {
                                        this.SetTag(character, t3, 1);      // 升级点
                                        cItem.levelUpIndicator.SetActive(false);
                              });
                              RolloverTooltip.SetTag(cItem.attribute3.gameObject, t3);
                        }
                        else
                        {
                              cItem.tagGroup.SetActive(false);
                              cItem.skillGroup.SetActive(true);
                              cItem.skill1.onValueChanged.RemoveAllListeners();
                              cItem.skill2.onValueChanged.RemoveAllListeners();
                              if (chosenSkills.Count > 0)
                              {
                                        cItem.skill1Group.SetActive(true);
                                        cItem.skill1Icon.texture = AssetManager.GetTexture(chosenSkills.t0);
                                        cItem.skill1New.SetActive(chosenSkills.t1 == FInt.ZERO);
                                        cItem.skill1.isOn = this.IsSkill(character, chosenSkills.t0.dbName);
                                        cItem.skill1.onValueChanged.AddListener(delegate(bool b)
                                        {
                                                if (b)
                                                {
                                                      this.SetSkill(character, chosenSkills.t0.dbName);
                                                      cItem.levelUpIndicator.SetActive(false);
                                                }
                                        });
                                        string dbName = chosenSkills.t0.dbName;
                                        FInt t = chosenSkills.t1;
                                        if (t == FInt.ZERO)
                                        {
                                                RolloverSkillTooltip component = cItem.skill1Icon.gameObject.GetComponent<RolloverSkillTooltip>();
                                                if (component != null)
                                                {
                                                      UnityEngine.Object.Destroy(component);
                                                }
                                        }
                                        else
                                        {
                                                RolloverSkillTooltip.SetSkill(cItem.skill1Icon.gameObject, new NetStringFInt2(dbName, t, FInt.ZERO), character);
                                        }
                                        RolloverSkillTooltip.SetSkill(cItem.skill1.gameObject, new NetStringFInt2(dbName, t + 1, FInt.ZERO), character);
                              }
                              else
                              {
                                        cItem.skill1Group.SetActive(false);
                              }
                              if (chosenSkills.Count > 1)
                              {
                                        cItem.skill2Group.SetActive(true);
                                        cItem.skill2Icon.texture = AssetManager.GetTexture(chosenSkills.t0);
                                        cItem.skill2New.SetActive(chosenSkills.t1 == FInt.ZERO);
                                        cItem.skill2.isOn = this.IsSkill(character, chosenSkills.t0.dbName);
                                        cItem.skill2.onValueChanged.AddListener(delegate(bool b)
                                        {
                                                if (b)
                                                {
                                                      this.SetSkill(character, chosenSkills.t0.dbName);
                                                      cItem.levelUpIndicator.SetActive(false);
                                                }
                                        });
                                        string dbName2 = chosenSkills.t0.dbName;
                                        FInt t4 = chosenSkills.t1;
                                        if (t4 == FInt.ZERO)
                                        {
                                                RolloverSkillTooltip component2 = cItem.skill2Icon.gameObject.GetComponent<RolloverSkillTooltip>();
                                                if (component2 != null)
                                                {
                                                      UnityEngine.Object.Destroy(component2);
                                                }
                                        }
                                        else
                                        {
                                                RolloverSkillTooltip.SetSkill(cItem.skill2Icon.gameObject, new NetStringFInt2(dbName2, t4, FInt.ZERO), character);
                                        }
                                        RolloverSkillTooltip.SetSkill(cItem.skill2.gameObject, new NetStringFInt2(dbName2, t4 + 1, FInt.ZERO), character);
                              }
                              else
                              {
                                        cItem.skill2Group.SetActive(false);
                              }
                        }
                }经验公式
Thea2   GameplayUtils
       public static int RPRequiredForAdvancement(int curentLevel)
      {
            XpCharacterLevel instanceFromDB = Globals.GetInstanceFromDB<XpCharacterLevel>(EXP_LVL.RP);
            if (instanceFromDB == null || instanceFromDB.xpLevel == null || instanceFromDB.xpLevel.Length < curentLevel)
            {
                return 99999;
            }
            int num = Mathf.Max(0, curentLevel - 1);
            if (num == 0)
            {
                return instanceFromDB.xpLevel;
            }
            return instanceFromDB.xpLevel - instanceFromDB.xpLevel;
      }




等级
Thea2.CommonNOCSLevelUpChars


public override void Activate(NONetworkOrder source)
      {
            if (this.levelupData != null)
            {
                HashSet<int> hashSet = new HashSet<int>();
                foreach (Multitype<int, int, string, string> multitype in this.levelupData)
                {
                  Character character = EntityManager.Get<Character>(multitype.t0, true);
                  if (!string.IsNullOrEmpty(multitype.t2))
                  {
                        DBDef.Tag instanceFromDB = Globals.GetInstanceFromDB<DBDef.Tag>(multitype.t2);
                        character.attributes.AddToBase(instanceFromDB, new FInt(multitype.t1), true, false);
                  }
                  if (!string.IsNullOrEmpty(multitype.t3))
                  {
                        character.LearnSkill(Character.SkillCategory.Personal, (Skill)multitype.t3, FInt.ONE, true, 1);
                  }
                  character.Xp -= GameplayUtils.XPRequiredForNextLevel(character.level);
                  character.level++;
                  hashSet.Add(character.GetGroup().ID);
                }
                foreach (int group in hashSet)
                {
                  new NOCSRequestGroupDetails
                  {
                        group = group,
                        addEntityInfo = true
                  }.Activate(source);
                }
            }
      }


zhangyihell 发表于 2021-7-10 23:27

学习下~~

TINNK 发表于 2023-2-3 17:32

.CS文件修改完采集范围进去UI就崩了

psyduck197 发表于 2023-2-14 22:44

TINNK 发表于 2023-2-3 17:32
.CS文件修改完采集范围进去UI就崩了

因年代久远我不太记了 印象中变数规格要对 或者版变迁失效

TINNK 发表于 2023-2-15 18:12

psyduck197 发表于 2023-2-14 22:44
因年代久远我不太记了 印象中变数规格要对 或者版变迁失效

我用CT搞定了
页: [1]
查看完整版本: Thea2:The Shattering 0332 升级点增强方法