Skip to content

Commit

Permalink
Added new fountion that can improve hero's traits
Browse files Browse the repository at this point in the history
  • Loading branch information
cnedwin committed Sep 5, 2020
1 parent 65fe88d commit 1ca5b43
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 19 deletions.
5 changes: 0 additions & 5 deletions path/ClanMemberPath.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaleWorlds.CampaignSystem.ViewModelCollection.ClanManagement.Categories;

namespace CharacterReload.path
Expand Down
5 changes: 5 additions & 0 deletions resource/GUI/Prefabs/Clan/ClanMembers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@
<TextWidget WidthSizePolicy="StretchToParent" HeightSizePolicy="StretchToParent" Brush="Popup.Button.Text" Text="@ResetPerkText" />
</Children>
</ButtonWidget>
<ButtonWidget DoNotPassEventsToChildren="true" WidthSizePolicy="Fixed" SuggestedWidth="200" HeightSizePolicy="Fixed" SuggestedHeight="64" Brush="Popup.Cancel.Button" Command.Click="DoRefleshTraits" >
<Children>
<TextWidget WidthSizePolicy="StretchToParent" HeightSizePolicy="StretchToParent" Brush="Popup.Button.Text" Text="@ResetTraitsText" />
</Children>
</ButtonWidget>

</Children>
</ListPanel>
Expand Down
14 changes: 9 additions & 5 deletions resource/ModuleData/Languages/CNs/std_module_stringsl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@

<strings>
<string id="misc_cr_loaderro" text="角色重建遇到错误无法加载" />
<string id="misc_cr_onmapload" text="角色重建已成功加载" />
<string id="bottom_ReAttHero" text="重置属性" />
<string id="bottom_RefocusHero" text="重置专精" />
<string id="bottom_RePerksHero" text="重选技能" />
<string id="misc_cr_onmapload" text="角色重建已成功加载" />
<string id="misc_cr_DoRefleshAPoint" text="英雄的属性点已经重置" />
<string id="misc_cr_DoRefleshFPoint" text="英雄的专精点已经重置" />
<string id="misc_cr_DoRefleshFPoint" text="英雄的专精点已经重置" />
<string id="misc_cr_DoRefleshPerk" text="英雄的技能树已经重置" />
<string id="misc_cr_DoRefleshTraits" text="英雄的特质已提升到最高值" />
<string id="bottom_ReAttHero" text="重置属性" />
<string id="bottom_RefocusHero" text="重置专精" />
<string id="bottom_RePerksHero" text="重选技能" />
<string id="bottom_ReTraitsHero" text="提升特质" />
<string id="tips_cr_DoRefleshPerks" text="重置英雄的技能后,您必须保存并重新加载存档才能生效!" />
<string id="tips_cr_DoRefleshTrait" text="升级英雄的特质后,您需要关闭氏族屏幕并重新打开以生效!" />
</strings>
</base>
10 changes: 7 additions & 3 deletions resource/ModuleData/Languages/English/std_module_stringsl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
<strings>
<string id="misc_cr_loaderro" text="CharacterReload encountered an error and could not be loaded" />
<string id="misc_cr_onmapload" text="CharacterReload has been successfully loaded" />
<string id="bottom_ReAttHero" text="ResetAttributes" />
<string id="bottom_RefocusHero" text="ResetFocuspoint" />
<string id="bottom_RePerksHero" text="ResetPerk" />
<string id="misc_cr_DoRefleshAPoint" text="The hero's Attribute points have been reset" />
<string id="misc_cr_DoRefleshFPoint" text="The hero's Focus points have been reset" />
<string id="misc_cr_DoRefleshPerk" text="The hero's skill tree has been reset" />
<string id="misc_cr_DoRefleshTraits" text="The hero's traits have been upgrade" />
<string id="bottom_ReAttHero" text="ResetAttributes" />
<string id="bottom_RefocusHero" text="ResetFocuspoint" />
<string id="bottom_RePerksHero" text="ResetPerk" />
<string id="bottom_ReTraitsHero" text="Improve traits" />
<string id="tips_cr_DoRefleshPerks" text="After reset the hero’s skill perk, you must save and reload the saves to take effect!" />
<string id="tips_cr_DoRefleshTrait" text="After upgrading the hero’s traits, you need to close the clan screen and reopen it to take effect!" />
</strings>
</base>
2 changes: 1 addition & 1 deletion resource/SubModule.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Module>
<Name value="Character Reloadd"/>
<Id value="CharacterReload"/>
<Version value="v1.1.1"/>
<Version value="v1.1.4"/>
<SingleplayerModule value="true"/>
<MultiplayerModule value="false"/>
<DependedModules>
Expand Down
41 changes: 36 additions & 5 deletions vm/MyClanLordItemVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,19 @@ public void DoRefleshFPoint()
public void DoRefleshPerks()
{
TextObject textObject = new TextObject("{=misc_cr_DoRefleshPerk}The hero's skill tree has been reset", null);
// InformationManager.DisplayMessage(new InformationMessage(textObject.ToString()));
this.ShowComfirDialog(textObject, () => RePerksHero(GetHero()));

InformationManager.DisplayMessage(new InformationMessage(new TextObject("{=tips_cr_DoRefleshPerks}After reset the hero’s skill perk, you must save and reload the saves to take effect!", null).ToString()));


}

public void DoRefleshTraits()
{
TextObject textObject = new TextObject("{=misc_cr_DoRefleshTraits}The hero's traits have been improved", null);
this.ShowComfirDialog(textObject, () => ReTraits(GetHero()));
InformationManager.DisplayMessage(new InformationMessage(new TextObject("{=tips_cr_DoRefleshTrait}After upgrading the hero’s traits, you need to close the clan screen and reopen it to take effect!", null).ToString()));


}

private void ShowComfirDialog(TextObject tip, Action action)
Expand Down Expand Up @@ -106,8 +116,17 @@ public string ResetPerkText
}
}

[DataSourceProperty]
public string ResetTraitsText
{
get
{
return new TextObject("{=bottom_ReTraitsHero}ImproveTraits", null).ToString();
}
}

private void RePerksHero(Hero hero)

private void RePerksHero(Hero hero)
{
foreach (SkillObject skill in DefaultSkills.GetAllSkills())
{
Expand All @@ -116,7 +135,7 @@ private void RePerksHero(Hero hero)
hero.ClearPerks();
}

public void RefocusHero(Hero hero)
public void RefocusHero(Hero hero)
{
int num = 0;
int num2 = 0;
Expand All @@ -134,7 +153,7 @@ public void RefocusHero(Hero hero)
}


public void ReAttHero(Hero hero)
public void ReAttHero(Hero hero)
{
int num = 0;
for (CharacterAttributesEnum characterAttributesEnum = CharacterAttributesEnum.Vigor; characterAttributesEnum < CharacterAttributesEnum.NumCharacterAttributes; characterAttributesEnum++)
Expand All @@ -146,6 +165,18 @@ public void ReAttHero(Hero hero)
hero.HeroDeveloper.UnspentAttributePoints += MBMath.ClampInt(num, 0, 999);
}

public void ReTraits(Hero hero)
{
int num = 2;
hero.ClearTraits();
hero.SetTraitLevel(DefaultTraits.Honor, num);
hero.SetTraitLevel(DefaultTraits.Valor, num);
hero.SetTraitLevel(DefaultTraits.Mercy, num);
hero.SetTraitLevel(DefaultTraits.Generosity, num);
hero.SetTraitLevel(DefaultTraits.Calculating, num);

}

}


Expand Down

0 comments on commit 1ca5b43

Please sign in to comment.