游戏狂人
 
- 贡献度
- 105
- 金元
- 9044
- 积分
- 1344
- 精华
- 2
- 注册时间
- 2012-1-8
|
本帖最后由 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[index2].tag;
list.RemoveAt(index2);
index2 = Mathf.Min(mhrandom.GetInt(0, list.Count), mhrandom.GetInt(0, list.Count));
t2 = list[index2].tag;
list.RemoveAt(index2);
index2 = Mathf.Min(mhrandom.GetInt(0, list.Count), mhrandom.GetInt(0, list.Count));
t3 = list[index2].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[instanceFromDB.advancementSkills];
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[int2];
if (multitype.t1 == FInt.ZERO)
{
int2 = mhrandom.GetInt(0, list2.Count);
}
chosenSkills.Add(list2[int2]);
}
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[0].t0);
cItem.skill1New.SetActive(chosenSkills[0].t1 == FInt.ZERO);
cItem.skill1.isOn = this.IsSkill(character, chosenSkills[0].t0.dbName);
cItem.skill1.onValueChanged.AddListener(delegate(bool b)
{
if (b)
{
this.SetSkill(character, chosenSkills[0].t0.dbName);
cItem.levelUpIndicator.SetActive(false);
}
});
string dbName = chosenSkills[0].t0.dbName;
FInt t = chosenSkills[0].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[1].t0);
cItem.skill2New.SetActive(chosenSkills[1].t1 == FInt.ZERO);
cItem.skill2.isOn = this.IsSkill(character, chosenSkills[1].t0.dbName);
cItem.skill2.onValueChanged.AddListener(delegate(bool b)
{
if (b)
{
this.SetSkill(character, chosenSkills[1].t0.dbName);
cItem.levelUpIndicator.SetActive(false);
}
});
string dbName2 = chosenSkills[1].t0.dbName;
FInt t4 = chosenSkills[1].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[0];
}
return instanceFromDB.xpLevel[num] - instanceFromDB.xpLevel[num - 1];
}
等级
Thea2.Common NOCSLevelUpChars
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);
}
}
}
|
评分
-
1
查看全部评分
-
|