diff --git a/About/About.xml b/About/About.xml index 936aeeb..e1107e4 100644 --- a/About/About.xml +++ b/About/About.xml @@ -1,6 +1,6 @@  - Outfitter A18 + Outfitter 0.18.0 Killface 0.18.0 diff --git a/Assemblies/Outfitter.dll b/Assemblies/Outfitter.dll index a9968fc..3d852cd 100644 Binary files a/Assemblies/Outfitter.dll and b/Assemblies/Outfitter.dll differ diff --git a/Languages/English/Keyed/Outfitter_Keyed.xml b/Languages/English/Keyed/Outfitter_Keyed.xml index 397f2db..0c16585 100644 --- a/Languages/English/Keyed/Outfitter_Keyed.xml +++ b/Languages/English/Keyed/Outfitter_Keyed.xml @@ -26,7 +26,8 @@ Equipment and Inventory Worn Apparel Add Work Stats - Add Individual Stats + + Add Personal Stats (skills) Drop and Haul Set Prefered Gear Prefered Gear: diff --git a/Source/Outfitter/HarmonyPatches.cs b/Source/Outfitter/HarmonyPatches.cs index 4549670..6c35342 100644 --- a/Source/Outfitter/HarmonyPatches.cs +++ b/Source/Outfitter/HarmonyPatches.cs @@ -46,11 +46,15 @@ static HarmonyPatches() null, new HarmonyMethod(typeof(HarmonyPatches), nameof(UpdatePriorities))); - harmony.Patch( - AccessTools.Method(typeof(BillStack), nameof(BillStack.DoListing)), - new HarmonyMethod(typeof(ITab_Bills_Patch), nameof(ITab_Bills_Patch.DoListing)), - null); - + // harmony.Patch( + // AccessTools.Method(typeof(ITab_Bills), "FillTab"), + // new HarmonyMethod(typeof(ITab_Bills_Patch), nameof(ITab_Bills_Patch.FillTab_Prefix)), + // null); + // + // harmony.Patch( + // AccessTools.Method(typeof(ITab_Bills), "TabUpdate"), + // new HarmonyMethod(typeof(ITab_Bills_Patch), nameof(ITab_Bills_Patch.TabUpdate_Prefix)), + // null); // harmony.Patch( // AccessTools.Method(typeof(ThinkNode_JobGiver), nameof(ThinkNode_JobGiver.TryIssueJobPackage)), diff --git a/Source/Outfitter/Outfitter.csproj b/Source/Outfitter/Outfitter.csproj index 62f7391..1fbb7ac 100644 --- a/Source/Outfitter/Outfitter.csproj +++ b/Source/Outfitter/Outfitter.csproj @@ -73,7 +73,7 @@ - + diff --git a/Source/Outfitter/TabPatch/ITab_Bills_Patch.cs b/Source/Outfitter/TabPatch/ITab_Bills_Patch.cs index 3deee5d..5143807 100644 --- a/Source/Outfitter/TabPatch/ITab_Bills_Patch.cs +++ b/Source/Outfitter/TabPatch/ITab_Bills_Patch.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Linq; - using System.Reflection; using RimWorld; @@ -23,7 +22,111 @@ public static class ITab_Bills_Patch // RimWorld.ITab_Bills - public static bool DoListing(BillStack __instance, ref Bill __result, Rect rect, Func> recipeOptionsMaker, ref Vector2 scrollPosition, ref float viewHeight) + public static bool FillTab_Prefix() + { + Building_WorkTable selTable = (Building_WorkTable)Find.Selector.SingleSelectedThing; + if (selTable.def != ThingDef.Named("HandTailoringBench") + || selTable.def != ThingDef.Named("ElectricTailoringBench")) + { + return true; + } + PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.BillsTab, KnowledgeAmount.FrameDisplayed); + float x = WinSize.x; + Vector2 winSize2 = WinSize; + Rect rect2 = new Rect(0f, 0f, x, winSize2.y).ContractedBy(10f); + Func> recipeOptionsMaker = delegate + { + List list = new List(); + for (int i = 0; i < selTable.def.AllRecipes.Count; i++) + { + if (selTable.def.AllRecipes[i].AvailableNow) + { + RecipeDef recipe = selTable.def.AllRecipes[i]; + // Outfitter jump in here + { + for (int j = 0; j < recipe.products.Count; j++) + { + ThingCountClass rec = recipe.products[i]; + for (int k = 0; k < rec.thingDef.apparel.bodyPartGroups.Count; k++) + { + list.Add(new FloatMenuOption(rec.thingDef.apparel.bodyPartGroups[k].label, null)); + + } + + } + } + // Outfitter end + list.Add( + new FloatMenuOption( + recipe.LabelCap, + delegate + { + if (!selTable.Map.mapPawns.FreeColonists.Any( + col => recipe.PawnSatisfiesSkillRequirements(col))) + { + Bill.CreateNoPawnsWithSkillDialog(recipe); + } + + Bill bill = recipe.MakeNewBill(); + selTable.billStack.AddBill(bill); + if (recipe.conceptLearned != null) + { + PlayerKnowledgeDatabase.KnowledgeDemonstrated( + recipe.conceptLearned, + KnowledgeAmount.Total); + } + + if (TutorSystem.TutorialMode) + { + TutorSystem.Notify_Event("AddBill-" + recipe.LabelCap); + } + }, + MenuOptionPriority.Default, + null, + null, + 29f, + rect => Widgets.InfoCardButton( + (float)(rect.x + 5.0), + (float)(rect.y + (rect.height - 24.0) / 2.0), + recipe))); + } + } + + if (!list.Any()) + { + list.Add( + new FloatMenuOption( + "NoneBrackets".Translate(), + null)); + } + + return list; + }; + + mouseoverBill = DoListing(selTable.BillStack, rect2, recipeOptionsMaker, ref scrollPosition, ref viewHeight); + + return false; + + } + + public static bool TabUpdate_Prefix() + { + Building_WorkTable selTable = (Building_WorkTable)Find.Selector.SingleSelectedThing; + if (selTable.def != ThingDef.Named("HandTailoringBench") + || selTable.def != ThingDef.Named("ElectricTailoringBench")) + { + return true; + } + + if (mouseoverBill != null) + { + mouseoverBill.TryDrawIngredientSearchRadiusOnMap(Find.Selector.SingleSelectedThing.Position); + mouseoverBill = null; + } + return false; + } + + public static Bill DoListing(BillStack __instance, Rect rect, Func> recipeOptionsMaker, ref Vector2 scrollPosition, ref float viewHeight) { Bill result = null; GUI.BeginGroup(rect); @@ -33,6 +136,25 @@ public static bool DoListing(BillStack __instance, ref Bill __result, Rect rect, Rect rect2 = new Rect(0f, 0f, 150f, 29f); if (Widgets.ButtonText(rect2, "AddBill".Translate(), true, false, true)) { + // Outfitter Code + + // for (int i = 0; i < __instance.Bills.Count; i++) + // { + // Bill bill = __instance.Bills[i]; + // bill + // } + // + // List items = labeledSortingActions.Keys.Select( + // label => + // { + // List fmo = labeledSortingActions[label]; + // return Tools.MakeMenuItemForLabel(label, fmo); + // }).ToList(); + // + // Tools.LabelMenu = new FloatMenuLabels(items); + // Find.WindowStack.Add(Tools.LabelMenu); + + // Vanilla Find.WindowStack.Add(new FloatMenu(recipeOptionsMaker())); } UIHighlighter.HighlightOpportunity(rect2, "AddBill"); @@ -60,8 +182,8 @@ public static bool DoListing(BillStack __instance, ref Bill __result, Rect rect, } Widgets.EndScrollView(); GUI.EndGroup(); - __result= result; - return false; + return result; } + } } \ No newline at end of file