Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
configurable barter cooldown
Browse files Browse the repository at this point in the history
  • Loading branch information
Cytraen committed Jun 26, 2020
1 parent 39b15be commit e861a82
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 8 deletions.
22 changes: 17 additions & 5 deletions Patches/BarterManagerPatch.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
using System;
/*
Copyright (C) 2020 ashakoor
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using HarmonyLib;
using TaleWorlds.CampaignSystem;
using TaleWorlds.CampaignSystem.SandBox.GameComponents.Map;
using TaleWorlds.Core;

namespace UnlimitLord.Patches
{
Expand Down
19 changes: 18 additions & 1 deletion Patches/BarterablePatch.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
using HarmonyLib;
/*
Copyright (C) 2020 ashakoor
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

using HarmonyLib;
using TaleWorlds.CampaignSystem;

namespace UnlimitLord.Patches
Expand Down
40 changes: 40 additions & 0 deletions Patches/DefaultBarterModelPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright (C) 2020 ashakoor
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

using HarmonyLib;
using TaleWorlds.CampaignSystem.SandBox.GameComponents;

namespace UnlimitLord.Patches
{
[HarmonyPatch(typeof(DefaultBarterModel), "BarterCooldownWithHeroInDays")]
internal static class DefaultBarterModelPatch
{
public static Settings Setting => Settings.Instance;
public static bool Enabled => Setting.BarterCooldownEnabled;
public static int Cooldown => Setting.BarterCooldownDays;

internal static int Postfix(int result)
{
return Cooldown;
}

// internal static bool Prepare()
// {
// return Enabled;
// }
}
}
19 changes: 18 additions & 1 deletion Patches/DefaultMobilePartyFoodConsumptionModelPatch.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
using HarmonyLib;
/*
Copyright (C) 2020 ashakoor
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

using HarmonyLib;
using TaleWorlds.CampaignSystem;
using TaleWorlds.CampaignSystem.SandBox.GameComponents.Map;

Expand Down
19 changes: 18 additions & 1 deletion Patches/DefaultPersuasionModelPatch.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
using HarmonyLib;
/*
Copyright (C) 2020 ashakoor
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

using HarmonyLib;
using TaleWorlds.CampaignSystem.Conversation.Persuasion;
using TaleWorlds.CampaignSystem.SandBox.GameComponents;

Expand Down
8 changes: 8 additions & 0 deletions Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,5 +510,13 @@ internal sealed partial class Settings
[SettingPropertyGroup("Bartering")]
[SettingPropertyFloatingInteger("Barter Success Multiplier", 0.01f, 1000f, Order = 2, RequireRestart = false)]
public float BarterSuccessMultiplier { get; set; } = 1f;

[SettingPropertyGroup("Bartering")]
[SettingPropertyBool("Barter Cooldown Enabled", Order = 3, RequireRestart = false)]
public bool BarterCooldownEnabled { get; set; } = false;

[SettingPropertyGroup("Bartering")]
[SettingPropertyInteger("Number of Days Between Barters", 0, 120, Order = 4, RequireRestart = false)]
public int BarterCooldownDays { get; set; } = 3;
}
}
1 change: 1 addition & 0 deletions UnlimitLord.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=ashakoor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bannerlord/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Barterable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Consumptionf/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=crit/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hitpoints/@EntryIndexedValue">True</s:Boolean>
Expand Down

0 comments on commit e861a82

Please sign in to comment.