////////////////

		public void LoadGameMode() {
			if( LicensesMod.Config.DebugModeInfo ) {
				LogHelpers.Alert( "Loading game mode..." );
			}

			NihilismAPI.InstancedFiltersOn();
			NihilismAPI.OnSyncOrWorldLoad( ( isSync ) => {
				if( isSync ) { return; }
				this.LoadNihilismFilters();
				NihilismAPI.NihilateCurrentWorld( true );
			}, 0f );

			LoadHooks.AddWorldLoadEachHook( () => {
				if( LicensesMod.Config.RemoveRewardsGrinding ) {
					RewardsPointsConfig rewConfig = ModContent.GetInstance<RewardsPointsConfig>();
					rewConfig.GrindKillMultiplier = 0f;
				}
				if( LicensesMod.Config.ForceSpawnWayfarer ) {
					RewardsAPI.SpawnWayfarer( false );
				}
				
				this.LoadLicensePacks();
			} );

			this.PostLoadGameMode();

			if( LicensesMod.Config.DebugModeInfo ) {
				LogHelpers.Alert( "Finished loading game mode" );
			}
		}
Esempio n. 2
0
		////////////////

		public override void Action( CommandCaller caller, string input, string[] args ) {
			var myworld = ModContent.GetInstance<NihilismWorld>();

			if( NihilismAPI.UnnihilateCurrentWorld(false) ) {
				caller.Reply( "Current world is no longer nihilated.", Color.YellowGreen );
			} else {
				caller.Reply( "Current world is already unnihilated.", Color.Yellow );
				return;
			}
		}
Esempio n. 3
0
        ////////////////

        internal void ResetLicenses()
        {
            foreach (ItemDefinition itemDef in this.LicensedItems)
            {
                NihilismAPI.UnsetItemWhitelistEntry(itemDef, true);
            }

            this.TrialLicensedItem = null;
            this.TrialLicensedItems.Clear();
            this.LicensedItems.Clear();
            this.PendingLoadTrialLicenses.Clear();
            this.PendingLoadLicenses.Clear();
        }
Esempio n. 4
0
        internal void LicenseItemByDefinition(ItemDefinition itemDef, bool playSound)
        {
            this.LicensedItems.Add(itemDef);

            NihilismAPI.SetItemWhitelistEntry(itemDef, true);

            if (!LicensesMod.Config.FreeRecipes)
            {
                NihilismAPI.SetRecipeWhitelistEntry(itemDef, true);
            }

            if (playSound)
            {
                Main.PlaySound(SoundID.Unlock, player.position);
            }
        }
Esempio n. 5
0
        ////////////////

        internal void TrialLicenseItemByDefinition(ItemDefinition itemDef, bool playSound)
        {
            var mymod = (LicensesMod)this.mod;

            if (this.TrialLicensedItem != null)
            {
                string itemName = ItemAttributeHelpers.GetQualifiedName(this.TrialLicensedItem.Type);

                Main.NewText(itemName + " trial cancelled.", Color.Yellow);

                if (!this.LicensedItems.Contains(itemDef))
                {
                    NihilismAPI.UnsetItemWhitelistEntry(this.TrialLicensedItem, true);
                }
            }

            this.TrialLicensedItems.Add(itemDef);
            this.TrialLicensedItem = itemDef;

            NihilismAPI.SetItemWhitelistEntry(itemDef, true);

            Timers.UnsetTimer("LicensesTrialPeriod");
            Timers.SetTimer("LicensesTrialPeriod", LicensesMod.Config.TrialLicenseDurationInTicks, () => {
                var myplayer = (LicensesPlayer)TmlHelpers.SafelyGetModPlayer(Main.LocalPlayer, mymod, "LicensesPlayer");

                if (!myplayer.LicensedItems.Contains(itemDef))
                {
                    string itemName = ItemAttributeHelpers.GetQualifiedName(itemDef.Type);

                    Main.NewText(itemName + " trial has expired.", Color.Yellow);
                    NihilismAPI.UnsetItemWhitelistEntry(itemDef, true);

                    myplayer.TrialLicensedItem = null;
                }
                return(false);
            });

            if (playSound)
            {
                Main.PlaySound(SoundID.Unlock, player.position);
            }
        }
		////

		private void LoadNihilismFilters() {
			if( LicensesMod.Config.OverrideNihilismDefaultFilters ) {
				NihilismAPI.ClearFiltersForCurrentWorld( true );
			}
			
			NihilismAPI.SetItemBlacklistGroupEntry( "Any Item", true );

			if( !LicensesMod.Config.FreeRecipes ) {
				NihilismAPI.SetRecipeBlacklistGroupEntry( "Any Item", true );
			}

			if( LicensesMod.Config.FreeMaterials ) {
				NihilismAPI.SetItemWhitelistGroupEntry( "Any Plain Material", true );
			}
			if( LicensesMod.Config.FreePlaceables ) {
				NihilismAPI.SetItemWhitelistGroupEntry( "Any Placeable", true );
			}

			foreach( ItemDefinition itemDef in LicensesMod.Config.FreeStarterItems ) {
				NihilismAPI.SetItemWhitelistEntry( itemDef, true );
			}
		}
        ////////////////

        public override void Action(CommandCaller caller, string input, string[] args)
        {
            NihilismAPI.SetCurrentFiltersAsDefaults(false);

            caller.Reply("Current world's filters as the new defaults.", Color.YellowGreen);
        }
Esempio n. 8
0
        ////////////////

        public override void Action(CommandCaller caller, string input, string[] args)
        {
            NihilismAPI.ClearFiltersForCurrentWorld(false);

            caller.Reply("Cleared all blacklists and whitelists.", Color.YellowGreen);
        }
Esempio n. 9
0
        ////////////////

        public override void Action(CommandCaller caller, string input, string[] args)
        {
            NihilismAPI.ResetFiltersFromDefaults(false);

            caller.Reply("Current world's filters reset to defaults.", Color.YellowGreen);
        }