@@ -14,7 +14,7 @@ public class Plugin : BaseUnityPlugin
1414 {
1515 private const string PluginGuid = "cyantist.inscryption.cardloader" ;
1616 private const string PluginName = "CardLoader" ;
17- private const string PluginVersion = "1.3 .0.0" ;
17+ private const string PluginVersion = "1.4 .0.0" ;
1818
1919 internal static ManualLogSource Log ;
2020
@@ -224,8 +224,8 @@ public class NewCard
224224
225225 public NewCard ( CardInfo card )
226226 {
227- Plugin . Log . LogInfo ( $ "Loaded custom card { card . name } !") ;
228227 NewCard . cards . Add ( card ) ;
228+ Plugin . Log . LogInfo ( $ "Loaded custom card { card . name } !") ;
229229 }
230230
231231 // TODO Implement a handler for custom appearanceBehaviour - in particular custom card backs
@@ -253,72 +253,257 @@ public NewCard(string name, List<CardMetaCategory> metaCategories, CardComplexit
253253 card . cost = cost ;
254254 card . bonesCost = bonesCost ;
255255 card . energyCost = energyCost ;
256- if ( gemsCost != null )
256+ if ( gemsCost is not null )
257257 {
258258 card . gemsCost = gemsCost ;
259259 }
260260 card . specialStatIcon = specialStatIcon ;
261- if ( tribes != null )
261+ if ( tribes is not null )
262262 {
263263 card . tribes = tribes ;
264264 }
265- if ( traits != null )
265+ if ( traits is not null )
266266 {
267267 card . traits = traits ;
268268 }
269- if ( specialAbilities != null )
269+ if ( specialAbilities is not null )
270270 {
271271 card . specialAbilities = specialAbilities ;
272272 }
273- if ( abilities != null )
273+ if ( abilities is not null )
274274 {
275275 card . abilities = abilities ;
276276 }
277- if ( appearanceBehaviour != null )
277+ if ( appearanceBehaviour is not null )
278278 {
279279 card . appearanceBehaviour = appearanceBehaviour ;
280280 }
281281 card . onePerDeck = onePerDeck ;
282282 card . hideAttackAndHealth = hideAttackAndHealth ;
283- if ( tex != null )
283+ if ( tex is not null )
284284 {
285285 tex . name = "portrait_" + name ;
286286 card . portraitTex = Sprite . Create ( tex , new Rect ( 0.0f , 0.0f , 114.0f , 94.0f ) , new Vector2 ( 0.5f , 0.5f ) ) ;
287287 card . portraitTex . name = "portrait_" + name ;
288288 }
289- if ( altTex != null )
289+ if ( altTex is not null )
290290 {
291291 altTex . name = "portrait_" + name ;
292292 card . alternatePortrait = Sprite . Create ( altTex , new Rect ( 0.0f , 0.0f , 114.0f , 94.0f ) , new Vector2 ( 0.5f , 0.5f ) ) ;
293293 card . alternatePortrait . name = "portrait_" + name ;
294294 }
295- if ( titleGraphic != null )
295+ if ( titleGraphic is not null )
296296 {
297297 card . titleGraphic = titleGraphic ;
298298 }
299- if ( pixelTex != null )
299+ if ( pixelTex is not null )
300300 {
301301 pixelTex . name = "portrait_" + name ;
302302 card . pixelPortrait = Sprite . Create ( pixelTex , new Rect ( 0.0f , 0.0f , 114.0f , 94.0f ) , new Vector2 ( 0.5f , 0.5f ) ) ;
303303 card . pixelPortrait . name = "portrait_" + name ;
304304 }
305- if ( animatedPortrait != null )
305+ if ( animatedPortrait is not null )
306306 {
307307 // TODO Provide a function to create animated card textures
308308 card . animatedPortrait = animatedPortrait ;
309309 }
310- if ( decals != null )
310+ if ( decals is not null )
311311 {
312312 // TODO Access and provide default decals
313313 card . decals = decals ;
314314 }
315315 card . name = name ;
316- Plugin . Log . LogInfo ( $ "Loaded custom card { name } !") ;
317316 NewCard . cards . Add ( card ) ;
317+ Plugin . Log . LogInfo ( $ "Loaded custom card { name } !") ;
318318 }
319319
320320 }
321321
322+ public class CustomRegion
323+ {
324+ public static List < CustomRegion > regions = new List < CustomRegion > ( ) ;
325+ public string name ;
326+ public int ? tier ;
327+ private List < CardInfo > terrainCards ;
328+ private List < ConsumableItemData > consumableItems ;
329+ private List < EncounterBlueprintData > encounters ;
330+ private List < Opponent . Type > bosses ;
331+ private List < CardInfo > likelyCards ;
332+ private List < Tribe > dominantTribes ;
333+ private PredefinedNodes predefinedNodes ;
334+ private EncounterBlueprintData bossPrepEncounter ;
335+ private StoryEventCondition bossPrepCondition ;
336+ private List < ScarceSceneryEntry > scarceScenery ;
337+ private List < FillerSceneryEntry > fillerScenery ;
338+ private PredefinedScenery predefinedScenery ;
339+ private string ambientLoopId ;
340+ private bool ? silenceCabinAmbience ;
341+ private Color ? boardLightColor ;
342+ private Color ? cardsLightColor ;
343+ private bool ? dustParticlesDisabled ;
344+ private bool ? fogEnabled ;
345+ private VolumetricFogAndMist . VolumetricFogProfile fogProfile ;
346+ private float ? fogAlpha ;
347+ private Texture mapAlbedo ;
348+ private Texture mapEmission ;
349+ private Color ? mapEmissionColor ;
350+ private List < GameObject > mapParticlesPrefabs ;
351+
352+ public CustomRegion ( string name , int ? tier = null , List < CardInfo > terrainCards = null , List < ConsumableItemData > consumableItems = null , List < EncounterBlueprintData > encounters = null ,
353+ List < Opponent . Type > bosses = null , List < CardInfo > likelyCards = null , List < Tribe > dominantTribes = null , PredefinedNodes predefinedNodes = null ,
354+ EncounterBlueprintData bossPrepEncounter = null , StoryEventCondition bossPrepCondition = null , List < ScarceSceneryEntry > scarceScenery = null ,
355+ List < FillerSceneryEntry > fillerScenery = null , PredefinedScenery predefinedScenery = null , string ambientLoopId = "" , bool ? silenceCabinAmbience = null ,
356+ Color ? boardLightColor = null , Color ? cardsLightColor = null , bool ? dustParticlesDisabled = null , bool ? fogEnabled = null , VolumetricFogAndMist . VolumetricFogProfile fogProfile = null ,
357+ float ? fogAlpha = null , Texture mapAlbedo = null , Texture mapEmission = null , Color ? mapEmissionColor = null , List < GameObject > mapParticlesPrefabs = null )
358+ {
359+ this . name = name ;
360+ this . tier = tier ;
361+ this . terrainCards = terrainCards ;
362+ this . consumableItems = consumableItems ;
363+ this . encounters = encounters ;
364+ this . bosses = bosses ;
365+ this . likelyCards = likelyCards ;
366+ this . dominantTribes = dominantTribes ;
367+ this . predefinedNodes = predefinedNodes ;
368+ this . bossPrepEncounter = bossPrepEncounter ;
369+ this . bossPrepCondition = bossPrepCondition ;
370+ this . scarceScenery = scarceScenery ;
371+ this . fillerScenery = fillerScenery ;
372+ this . predefinedScenery = predefinedScenery ;
373+ this . ambientLoopId = ambientLoopId ;
374+ this . silenceCabinAmbience = silenceCabinAmbience ;
375+ this . boardLightColor = boardLightColor ;
376+ this . cardsLightColor = cardsLightColor ;
377+ this . dustParticlesDisabled = dustParticlesDisabled ;
378+ this . fogEnabled = fogEnabled ;
379+ this . fogProfile = fogProfile ;
380+ this . fogAlpha = fogAlpha ;
381+ this . mapAlbedo = mapAlbedo ;
382+ this . mapEmission = mapEmission ;
383+ this . mapEmissionColor = mapEmissionColor ;
384+ this . mapParticlesPrefabs = mapParticlesPrefabs ;
385+ CustomRegion . regions . Add ( this ) ;
386+ }
387+
388+ public RegionData AdjustRegion ( RegionData region )
389+ {
390+ region . name = this . name ;
391+ if ( this . terrainCards is not null )
392+ {
393+ region . terrainCards = this . terrainCards ;
394+ }
395+ if ( this . consumableItems is not null )
396+ {
397+ region . consumableItems = this . consumableItems ;
398+ }
399+ if ( this . encounters is not null )
400+ {
401+ region . encounters = this . encounters ;
402+ }
403+ if ( this . bosses is not null )
404+ {
405+ region . bosses = this . bosses ;
406+ }
407+ if ( this . likelyCards is not null )
408+ {
409+ region . likelyCards = this . likelyCards ;
410+ }
411+ if ( this . dominantTribes is not null )
412+ {
413+ region . dominantTribes = this . dominantTribes ;
414+ }
415+ if ( this . predefinedNodes is not null )
416+ {
417+ region . predefinedNodes = this . predefinedNodes ;
418+ }
419+ if ( this . bossPrepEncounter is not null )
420+ {
421+ region . bossPrepEncounter = this . bossPrepEncounter ;
422+ }
423+ if ( this . bossPrepCondition is not null )
424+ {
425+ region . bossPrepCondition = this . bossPrepCondition ;
426+ }
427+ if ( this . scarceScenery is not null )
428+ {
429+ region . scarceScenery = this . scarceScenery ;
430+ }
431+ if ( this . fillerScenery is not null )
432+ {
433+ region . fillerScenery = this . fillerScenery ;
434+ }
435+ if ( this . predefinedScenery is not null )
436+ {
437+ region . predefinedScenery = this . predefinedScenery ;
438+ }
439+ if ( ! String . IsNullOrEmpty ( this . ambientLoopId ) )
440+ {
441+ region . ambientLoopId = this . ambientLoopId ;
442+ }
443+ if ( this . silenceCabinAmbience is not null )
444+ {
445+ region . silenceCabinAmbience = ( bool ) this . silenceCabinAmbience ;
446+ }
447+ if ( this . boardLightColor is not null )
448+ {
449+ region . boardLightColor = ( Color ) this . boardLightColor ;
450+ }
451+ if ( this . cardsLightColor is not null )
452+ {
453+ region . cardsLightColor = ( Color ) this . cardsLightColor ;
454+ }
455+ if ( this . dustParticlesDisabled is not null )
456+ {
457+ region . dustParticlesDisabled = ( bool ) this . dustParticlesDisabled ;
458+ }
459+ if ( this . fogEnabled is not null )
460+ {
461+ region . fogEnabled = ( bool ) this . fogEnabled ;
462+ }
463+ if ( this . fogProfile is not null )
464+ {
465+ region . fogProfile = this . fogProfile ;
466+ }
467+ if ( this . fogAlpha is not null )
468+ {
469+ region . fogAlpha = ( float ) this . fogAlpha ;
470+ }
471+ if ( this . mapAlbedo is not null )
472+ {
473+ region . mapAlbedo = this . mapAlbedo ;
474+ }
475+ if ( this . mapEmission is not null )
476+ {
477+ region . mapEmission = this . mapEmission ;
478+ }
479+ if ( this . mapEmissionColor is not null )
480+ {
481+ region . mapEmissionColor = ( Color ) this . mapEmissionColor ;
482+ }
483+ if ( this . mapParticlesPrefabs is not null )
484+ {
485+ region . mapParticlesPrefabs = this . mapParticlesPrefabs ;
486+ }
487+ Plugin . Log . LogInfo ( $ "Adjusted default region { name } !") ;
488+ return region ;
489+ }
490+
491+ }
492+
493+ public class NewRegion
494+ {
495+ public static List < NewRegion > regions = new List < NewRegion > ( ) ;
496+ public RegionData region ;
497+ public int tier ;
498+
499+ public NewRegion ( RegionData region , int tier ) {
500+ this . region = region ;
501+ this . tier = tier ;
502+ NewRegion . regions . Add ( this ) ;
503+ Plugin . Log . LogInfo ( $ "Loaded custom region { region . name } !") ;
504+ }
505+ }
506+
322507 [ HarmonyPatch ( typeof ( LoadingScreenManager ) , "LoadGameData" ) ]
323508 public class LoadingScreenManager_LoadGameData
324509 {
@@ -336,8 +521,8 @@ public static void Prefix()
336521 }
337522 else
338523 {
339- Plugin . Log . LogInfo ( $ "Loaded modified { card . name } into data") ;
340524 official [ index ] = card . AdjustCard ( official [ index ] ) ;
525+ Plugin . Log . LogInfo ( $ "Loaded modified { card . name } into data") ;
341526 }
342527 }
343528 ScriptableObjectLoader < CardInfo > . allData = official . Concat ( NewCard . cards ) . ToList ( ) ;
@@ -363,13 +548,65 @@ public static void Prefix()
363548 }
364549 else
365550 {
366- Plugin . Log . LogInfo ( $ "Loaded modified { card . name } into data") ;
367551 official [ index ] = card . AdjustCard ( official [ index ] ) ;
552+ Plugin . Log . LogInfo ( $ "Loaded modified { card . name } into data") ;
368553 }
369554 }
370555 ScriptableObjectLoader < CardInfo > . allData = official . Concat ( NewCard . cards ) . ToList ( ) ;
371556 Plugin . Log . LogInfo ( $ "Loaded custom cards into data") ;
372557 }
373558 }
374559 }
560+
561+ [ HarmonyPatch ( typeof ( RegionProgression ) , "Instance" , MethodType . Getter ) ]
562+ public class RegionProgression_get_Instance
563+ {
564+ public static void Prefix ( RegionProgression instance )
565+ {
566+ if ( instance == null )
567+ {
568+ RegionProgression official = ResourceBank . Get < RegionProgression > ( "Data/Map/RegionProgression" ) ;
569+ foreach ( CustomRegion region in CustomRegion . regions ) {
570+ int tier = 0 ;
571+ bool found = false ;
572+ foreach ( List < RegionData > regions in official . regions ) {
573+ int index = regions . FindIndex ( ( RegionData x ) => x . name == region . name ) ;
574+ if ( index != - 1 )
575+ {
576+ if ( region . tier == null || ( int ) region . tier == tier )
577+ {
578+ official . regions [ tier ] [ index ] = region . AdjustRegion ( regions [ index ] ) ;
579+ }
580+ else
581+ {
582+ RegionData officialRegion = regions [ index ] ;
583+ official . regions [ tier ] . Remove ( officialRegion ) ;
584+ while ( ( int ) region . tier >= official . regions . Count )
585+ {
586+ official . regions . Add ( new List < RegionData > ( ) ) ;
587+ }
588+ official . regions [ ( int ) region . tier ] . Add ( region . AdjustRegion ( officialRegion ) ) ;
589+ }
590+ found = true ;
591+ Plugin . Log . LogInfo ( $ "Loaded modified { region . name } into data") ;
592+ }
593+ tier ++ ;
594+ }
595+ if ( ! found )
596+ {
597+ Plugin . Log . LogInfo ( $ "Could not find region { region . name } to modify") ;
598+ }
599+ }
600+
601+ foreach ( NewRegion region in NewRegion . regions ) {
602+ while ( region . tier >= official . regions . Count )
603+ {
604+ official . regions . Add ( new List < RegionData > ( ) ) ;
605+ }
606+ official . regions [ region . tier ] . Add ( region . region ) ;
607+ }
608+ Plugin . Log . LogInfo ( $ "Loaded custom regions into data") ;
609+ }
610+ }
611+ }
375612}
0 commit comments