1
- #define FOGCAMERAVERSION
1
+ // #define FOGCAMERAVERSION
2
2
using Il2CppDMM ;
3
- using Il2CppInterop . Common ;
4
3
using Il2CppInterop . Runtime . Injection ;
5
4
using Il2CppItemFiltering ;
6
- using Il2CppLE . Telemetry ;
7
- using Il2CppLE . UI ;
8
- using Il2CppSystem . Net ;
9
- using Il2CppTMPro ;
10
5
using MelonLoader ;
11
- using MelonLoader . Utils ;
12
- using UnityEngine . Networking ;
13
6
using Object = UnityEngine . Object ;
14
7
15
8
[ assembly: MelonInfo ( typeof ( kg_LastEpoch_Improvements . kg_LastEpoch_Improvements ) , "kg.LastEpoch.Improvements" , "1.3.7" , "KG" , "https://www.nexusmods.com/lastepoch/mods/8" ) ]
@@ -18,7 +11,6 @@ namespace kg_LastEpoch_Improvements;
18
11
19
12
public class kg_LastEpoch_Improvements : MelonMod
20
13
{
21
- private static kg_LastEpoch_Improvements _thistype ;
22
14
private static MelonPreferences_Category ImprovementsModCategory ;
23
15
private static MelonPreferences_Entry < bool > ShowAll ;
24
16
private static MelonPreferences_Entry < DisplayAffixType > AffixShowRoll ;
@@ -64,11 +56,10 @@ private void CreateCustomMapIcon()
64
56
65
57
public override void OnInitializeMelon ( )
66
58
{
67
- _thistype = this ;
68
59
ImprovementsModCategory = MelonPreferences . CreateCategory ( "kg_Improvements" ) ;
69
60
ShowAll = ImprovementsModCategory . CreateEntry ( "Show Override" , false , "Show Override" , "Show each filter rule on map" ) ;
70
- AffixShowRoll = ImprovementsModCategory . CreateEntry ( "Show Affix Roll New " , DisplayAffixType . None , "Show Affix Roll New" , "Show each affix roll on item" ) ;
71
- ShowAffixOnLabel = ImprovementsModCategory . CreateEntry ( "Show Affix On Label" , DisplayAffixType_GroundLabel . None , "Show Affix On Label Type" , "Show each affix roll on item label (ground)" ) ;
61
+ AffixShowRoll = ImprovementsModCategory . CreateEntry ( "Item Tooltip Style " , DisplayAffixType . New_Style , "Show Affix Roll New" , "Show each affix roll on item" ) ;
62
+ ShowAffixOnLabel = ImprovementsModCategory . CreateEntry ( "Item Ground Label Style " , DisplayAffixType_GroundLabel . With_Tier_Filter_Only , "Show Affix On Label Type" , "Show each affix roll on item label (ground)" ) ;
72
63
AutoStoreCraftMaterials = ImprovementsModCategory . CreateEntry ( "AutoStoreCraftMaterials" , false , "Auto storage craft materials" , "Automatic storage of craft materials from the inventory" ) ;
73
64
#if FOGCAMERAVERSION
74
65
FogOfWar = ImprovementsModCategory . CreateEntry ( "Fog of war" , false , "Clear fog on map on start" , "Clear fog of war when you 1th enter on map" ) ;
@@ -105,7 +96,7 @@ private static void Postfix(ItemDataUnpacked item, ItemAffix affix, ref string _
105
96
_ => __result
106
97
} ;
107
98
}
108
- }
99
+ }
109
100
110
101
[ HarmonyPatch ( typeof ( TooltipItemManager ) , nameof ( TooltipItemManager . UniqueBasicModFormatter ) ) ]
111
102
private static class TooltipItemManager_FormatUniqueModAffixString_Patch
@@ -126,7 +117,7 @@ private static void Postfix(ItemDataUnpacked item, ref string __result, int uniq
126
117
[ HarmonyPatch ( typeof ( TooltipItemManager ) , nameof ( TooltipItemManager . ImplicitFormatter ) ) ]
127
118
private static class TooltipItemManager_FormatMod_Patch
128
119
{
129
- private static void Postfix ( ItemDataUnpacked item , int implicitNumber , ref string __result , bool isComparsionItem )
120
+ private static void Postfix ( ItemDataUnpacked item , int implicitNumber , ref string __result )
130
121
{
131
122
if ( item == null || AffixShowRoll . Value is DisplayAffixType . None || item . isSet ( ) ) return ;
132
123
__result = AffixShowRoll . Value switch
@@ -150,19 +141,18 @@ private static void Postfix(Rule __instance, ItemDataUnpacked data, ref bool __r
150
141
if ( string . IsNullOrWhiteSpace ( ruleNameToLower ) ) return ;
151
142
int indexOf = ruleNameToLower . IndexOf ( "lpmin:" , StringComparison . Ordinal ) ;
152
143
if ( indexOf == - 1 ) return ;
153
- char number = ruleNameToLower [ indexOf + 6 ] ;
154
- if ( int . TryParse ( number . ToString ( ) , out int lpmin ) ) __result &= data . legendaryPotential >= lpmin ;
144
+ __result &= data . legendaryPotential >= ruleNameToLower [ indexOf + 6 ] . CharToIntFast ( ) ;
155
145
}
156
146
}
157
147
158
148
[ HarmonyPatch ( typeof ( GroundItemVisuals ) , nameof ( GroundItemVisuals . initialise ) , typeof ( ItemDataUnpacked ) , typeof ( uint ) , typeof ( GroundItemLabel ) , typeof ( GroundItemRarityVisuals ) , typeof ( bool ) ) ]
159
149
private static class GroundItemVisuals_initialise_Patch
160
150
{
151
+ private static readonly Dictionary < string , Sprite > IconCache = [ ] ;
161
152
private static bool ShouldShow ( Rule rule )
162
153
{
163
154
if ( ! rule . isEnabled || rule . type is Rule . RuleOutcome . HIDE ) return false ;
164
- if ( ShowAll . Value ) return true ;
165
- return rule . emphasized ;
155
+ return rule . emphasized || ShowAll . Value ;
166
156
}
167
157
168
158
private static void Prefix ( GroundItemVisuals __instance , ItemDataUnpacked itemData , GroundItemLabel label , GroundItemRarityVisuals groundItemRarityVisuals )
@@ -196,8 +186,13 @@ private static void Prefix(GroundItemVisuals __instance, ItemDataUnpacked itemDa
196
186
itemName = entry . name . Replace ( " " , "_" ) ;
197
187
}
198
188
}
199
-
200
- Sprite icon = Resources . Load < Sprite > ( $ "gear/{ path } /{ itemName } ") ;
189
+ string fullPath = $ "gear/{ path } /{ itemName } ";
190
+ if ( ! IconCache . TryGetValue ( fullPath , out var icon ) )
191
+ {
192
+ MelonLogger . Msg ( $ "Couldn't find icon for { itemName } ({ path } ), loading from resources") ;
193
+ icon = Resources . Load < Sprite > ( fullPath ) ;
194
+ IconCache [ fullPath ] = icon ;
195
+ } else MelonLogger . Msg ( $ "Found icon for { itemName } ({ path } ) in cache") ;
201
196
customMapIcon . GetComponent < Image > ( ) . sprite = ItemList . instance . defaultItemBackgroundSprite ;
202
197
customMapIcon . GetComponent < Image > ( ) . color = GetColorForItemRarity ( itemData ) ;
203
198
customMapIcon . transform . GetChild ( 0 ) . GetComponent < Image > ( ) . sprite = icon ;
@@ -214,11 +209,8 @@ private class CustomIconProcessor : MonoBehaviour
214
209
private Text _text ;
215
210
private RectTransform thisTransform ;
216
211
private GroundItemLabel _label ;
217
-
218
- private void Awake ( )
219
- {
220
- _text = transform . GetChild ( 1 ) . GetComponent < Text > ( ) ;
221
- }
212
+
213
+ private void Awake ( ) => _text = transform . GetChild ( 1 ) . GetComponent < Text > ( ) ;
222
214
223
215
public void Init ( GameObject toTrack , GroundItemLabel label )
224
216
{
@@ -250,7 +242,7 @@ private void PointerEnter()
250
242
}
251
243
252
244
private void PointerExit ( )
253
- {
245
+ {
254
246
if ( _label != null && _label && _label . tooltipItem ) _label . tooltipItem . OnPointerExit ( null ) ;
255
247
}
256
248
@@ -388,7 +380,7 @@ private static void Postfix(CameraManager __instance)
388
380
private static class InventoryPanelUI_Awake_Patch
389
381
{
390
382
public static int AwakeFrame ;
391
- private static void Postfix ( InventoryPanelUI __instance ) => AwakeFrame = Time . frameCount ;
383
+ private static void Postfix ( ) => AwakeFrame = Time . frameCount ;
392
384
}
393
385
[ HarmonyPatch ( typeof ( InventoryPanelUI ) , nameof ( InventoryPanelUI . OpenInventoryPanel ) ) ]
394
386
private static class InventoryPanelUI_OpenInventoryPanel_Patch
0 commit comments