Skip to content

Commit

Permalink
添加项目文件。
Browse files Browse the repository at this point in the history
  • Loading branch information
cnedwin committed Sep 5, 2020
1 parent 0554c51 commit 65fe88d
Show file tree
Hide file tree
Showing 14 changed files with 807 additions and 0 deletions.
94 changes: 94 additions & 0 deletions CharacterReload.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Main Project Properties -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<PlatformTarget Condition=" '$(PlatformTarget)' == '' ">x64</PlatformTarget>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1C77395D-11EA-41F9-843C-067173E5685D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CharacterReload</RootNamespace>
<AssemblyName>CharacterReload</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<!-- Debug Configuration Properties -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\CharacterReload\bin\Win64_Shipping_Client</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Release Configuration Properties -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\CharacterReload\bin\Win64_Shipping_Client</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Debugging Properties -->
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\Bannerlord.exe</StartProgram>
<StartArguments>/singleplayer _MODULES_*Bannerlord.Harmony*Bannerlord.ButterLib*Bannerlord.UIExtenderEx*Bannerlord.MBOptionScreen*Bannerlord.MBOptionScreen.MCMv3*Bannerlord.MBOptionScreen.ModLib*Native*SandBoxCore*Sandbox*CustomBattle*StoryMode*CharacterReload*_MODULES_</StartArguments>
<StartWorkingDirectory>D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client</StartWorkingDirectory>
</PropertyGroup>
<!-- Bannerlord Native Assemblies -->
<ItemGroup>
<Reference Include="0Harmony, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Lib.Harmony.2.0.2\lib\net472\0Harmony.dll</HintPath>
</Reference>
<Reference Include="D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds*.dll">
<HintPath>%(Identity)</HintPath>
<Private>False</Private>
</Reference>
<!-- Bannerlord Module Assemblies -->
<Reference Include="D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\Native\bin\Win64_Shipping_Client\TaleWorlds*.dll">
<HintPath>%(Identity)</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\SandBox\bin\Win64_Shipping_Client\SandBox*.dll">
<HintPath>%(Identity)</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\StoryMode\bin\Win64_Shipping_Client\StoryMode*.dll">
<HintPath>%(Identity)</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="D:\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\CustomBattle\bin\Win64_Shipping_Client\TaleWorlds*.dll">
<HintPath>%(Identity)</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
</ItemGroup>
<!-- Files & Classes -->
<ItemGroup>
<Compile Include="MBBindingLordItemListInterceptor.cs" />
<Compile Include="path\ClanMemberPath.cs" />
<Compile Include="path\LocationPath.cs" />
<Compile Include="SubModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="vm\MyClanLordItemVM.cs" />
<Content Include="Readme.txt" />
<Content Include="resource\GUI\Prefabs\Clan\ClanMembers.xml" />
<Content Include="resource\ModuleData\Languages\CNs\std_module_stringsl.xml" />
<Content Include="resource\ModuleData\Languages\English\std_module_stringsl.xml" />
<Content Include="resource\SubModule.xml" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<!-- Post-Build -->
<PropertyGroup>
<PostBuildEvent>xcopy /Y /S "$(MSBuildProjectDirectory)\resource" "D:\Steam\steamapps\common\Mount &amp;amp; Blade II Bannerlord\Modules\CharacterReload\"</PostBuildEvent>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
25 changes: 25 additions & 0 deletions CharacterReload.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CharacterReload", "CharacterReload.csproj", "{1C77395D-11EA-41F9-843C-067173E5685D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1C77395D-11EA-41F9-843C-067173E5685D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C77395D-11EA-41F9-843C-067173E5685D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C77395D-11EA-41F9-843C-067173E5685D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C77395D-11EA-41F9-843C-067173E5685D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E7B9F39D-329D-424A-B51B-04697755EEB1}
EndGlobalSection
EndGlobal
29 changes: 29 additions & 0 deletions MBBindingLordItemListInterceptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using CharacterReload.View;
using HarmonyLib;
using System;
using TaleWorlds.CampaignSystem.ViewModelCollection.ClanManagement;
using TaleWorlds.Library;

namespace CharacterReload
{
internal class MBBindingLordItemListInterceptor : MBBindingList<ClanLordItemVM>
{
protected override void InsertItem(int index, ClanLordItemVM item)
{
try
{
if (item != null)
{
Traverse traverse = Traverse.Create(item);
Action<ClanLordItemVM> value = traverse.Field<Action<ClanLordItemVM>>("_onCharacterSelect").Value;
MyClanLordItemVM lordItem = new MyClanLordItemVM(item.GetHero(), value);
base.InsertItem(index, lordItem);
}
}
catch (Exception e)
{
FileLog.Log(e.ToString());
}
}
}
}
36 changes: 36 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CharacterReload")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CharacterReload")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1c77395d-11ea-41f9-843c-067173e5685d")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
10 changes: 10 additions & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This is a work in progress!

Helpful information:

(CTRL+Left Click on link to open in your browser)
Bannerlord Modding Documentation: https://docs.bannerlordmodding.com/
Harmony Patching Documentation: https://harmony.pardeike.net/articles/patching.html
TaleWorlds Modding Forums: https://forums.taleworlds.com/index.php?pages/modding/
Mount and Blade Discord: https://discordapp.com/invite/mountandblade
TW Forum - Modding Discord: https://discordapp.com/invite/ykFVJGQ
44 changes: 44 additions & 0 deletions SubModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using HarmonyLib;
using System;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.MountAndBlade;

namespace CharacterReload
{
public class SubModule : MBSubModuleBase
{
protected override void OnSubModuleLoad()
{
try
{
base.OnSubModuleLoad();
new Harmony("mod.CharacterReload.cnedwin").PatchAll();
}
catch (Exception)
{
InformationManager.DisplayMessage(new InformationMessage(new TextObject("{=misc_cr_loaderro}Error Initialising CharacterReload", null).ToString(), Color.FromUint(ModuleColors.green)));
}
}

protected override void OnBeforeInitialModuleScreenSetAsRoot()
{
InformationManager.DisplayMessage(new InformationMessage(new TextObject("{=misc_cr_onmapload}Loaded CharacterReload succeeded", null).ToString(), Color.FromUint(ModuleColors.green)));
}
}


public static class ModuleColors
{
public static readonly uint modMainColor = 14906114U;

public static readonly uint green = 4282569842U;

public static readonly uint red = 12517376U;

public static readonly uint grey = 14606046U;

public static readonly uint yellow = 15120402U;
}
}
4 changes: 4 additions & 0 deletions packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Lib.Harmony" version="2.0.2" targetFramework="net472" />
</packages>
22 changes: 22 additions & 0 deletions path/ClanMemberPath.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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
{
[HarmonyPatch(typeof(ClanMembersVM), "RefreshMembersList")]
public class PatchClanMembersVM
{
public static void Prefix(ref ClanMembersVM __instance)
{

__instance.Family = new MBBindingLordItemListInterceptor(); ;
__instance.Companions = new MBBindingLordItemListInterceptor(); ;

}
}
}
84 changes: 84 additions & 0 deletions path/LocationPath.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Reflection;
using TaleWorlds.CampaignSystem;
using TaleWorlds.Core;

namespace SueMoreSpouses.patch
{
[HarmonyPatch(typeof(Location), "DeserializeDelegate")]
class LocatonDeserializeDelegatePath
{

public static bool Prefix(ref Location __instance, string text)
{
if (null == text)
{
return false;
}
else
{
// InformationManager.DisplayMessage(new InformationMessage(text));
}

return true;

}
}

[HarmonyPatch(typeof(Location), "CanAIExit")]
class LocatonCanAIExitPath
{

public static bool Prefix(ref Location __instance, LocationCharacter character)
{
if (null == character || null == __instance || null == __instance.Name)
{
if (null != __instance && null != __instance.Name)
{
InformationManager.DisplayMessage(new InformationMessage("CanAIExit" + __instance.Name.ToString() + " LocationCharacter= null "));

}
return false;
}
return true;

}
}

[HarmonyPatch(typeof(LocationComplex), "GetLocationOfCharacter", new Type[] { typeof(LocationCharacter) })]
class LocationComplexGetLocationOfCharacterPath
{

[HarmonyPrefix]
public static bool Prefix(ref Location __result, ref LocationComplex __instance, LocationCharacter character)
{

FieldInfo fieldInfo = __instance.GetType().GetField("_locations", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
Dictionary<string, Location> loations = null;
IEnumerable<LocationCharacter> list = __instance.GetListOfCharacters();
if (null != fieldInfo)
{
loations = (Dictionary<string, Location>)fieldInfo.GetValue(__instance);
if (null != loations)
{
foreach (KeyValuePair<string, Location> current in loations)
{
if (current.Value.ContainsCharacter(character))
{
__result = current.Value;
}
}
}
}
if (null != __result)
{
return false;
}
return true;
}
}


}
Loading

0 comments on commit 65fe88d

Please sign in to comment.