Пример #1
0
        public override void Load()
        {
            HamstarHelpersMod.Instance = this;

            this.LoadConfigs();

            if (!this.HasUnhandledExceptionLogger && this.Config.DebugModeUnhandledExceptionLogging)
            {
                this.HasUnhandledExceptionLogger            = true;
                AppDomain.CurrentDomain.UnhandledException += HamstarHelpersMod.UnhandledLogger;
            }

            this.LoadHelpers = new TmlHelpers.LoadHelpers();
            this.Promises    = new Promises();

            this.Timers                    = new Timers();
            this.LogHelpers                = new DebugHelpers.LogHelpers();
            this.ModMetaDataManager        = new TmlHelpers.ModMetaDataManager();
            this.BuffHelpers               = new BuffHelpers.BuffHelpers();
            this.NetHelpers                = new NetHelpers.NetHelpers();
            this.ItemIdentityHelpers       = new ItemHelpers.ItemIdentityHelpers();
            this.NPCIdentityHelpers        = new NPCHelpers.NPCIdentityHelpers();
            this.ProjectileIdentityHelpers = new ProjectileHelpers.ProjectileIdentityHelpers();
            this.BuffIdentityHelpers       = new BuffHelpers.BuffIdentityHelpers();
            this.NPCBannerHelpers          = new NPCHelpers.NPCBannerHelpers();
            this.RecipeHelpers             = new RecipeHelpers.RecipeHelpers();
            this.TmlPlayerHelpers          = new TmlHelpers.TmlPlayerHelpers();
            this.WorldHelpers              = new WorldHelpers.WorldHelpers();
            this.ControlPanel              = new UIControlPanel();
            this.ModLockHelpers            = new TmlHelpers.ModHelpers.ModLockHelpers();
            this.EntityGroups              = new EntityGroups();
            this.PlayerMessages            = new PlayerMessages();
            this.Inbox           = new InboxControl();
            this.ModVersionGet   = new ModVersionGet();
            this.ServerBrowser   = new ServerBrowserReporter();
            this.MenuItemMngr    = new MenuItemManager();
            this.MenuUIMngr      = new MenuUIManager();
            this.OldMenuItemMngr = new Utilities.Menu.OldMenuItemManager();
            this.MusicHelpers    = new MusicHelpers();

#pragma warning disable 612, 618
            TmlHelpers.AltNPCInfo.DataInitialize();
            TmlHelpers.AltProjectileInfo.DataInitialize();
#pragma warning restore 612, 618

            if (!this.Config.DisableControlPanelHotkey)
            {
                this.ControlPanelHotkey = this.RegisterHotKey("Mod Helpers Control Panel", "O");
            }

            this.LoadModData();
        }
Пример #2
0
        public override void Unload()
        {
            this.UnloadModData();

            this.Promises.FulfillModUnloadPromises();

            try {
                if (this.HasUnhandledExceptionLogger)
                {
                    this.HasUnhandledExceptionLogger            = false;
                    AppDomain.CurrentDomain.UnhandledException -= HamstarHelpersMod.UnhandledLogger;
                }
            } catch { }

            this.ExceptionMngr             = null;
            this.Timers                    = null;
            this.ConfigJson                = null;
            this.PacketProtocols           = null;
            this.LogHelpers                = null;
            this.ModMetaDataManager        = null;
            this.BuffHelpers               = null;
            this.NetHelpers                = null;
            this.ItemIdentityHelpers       = null;
            this.NPCIdentityHelpers        = null;
            this.ProjectileIdentityHelpers = null;
            this.BuffIdentityHelpers       = null;
            this.NPCBannerHelpers          = null;
            this.RecipeHelpers             = null;
            this.TmlPlayerHelpers          = null;
            this.LoadHelpers               = null;
            this.ModVersionGet             = null;
            this.WorldHelpers              = null;
            this.ModLockHelpers            = null;
            this.EntityGroups              = null;
            this.AnimatedColors            = null;
            this.PlayerMessages            = null;
            this.Inbox = null;
            this.ControlPanelHotkey = null;
            this.ControlPanel       = null;
            this.ServerBrowser      = null;
            this.MenuItemMngr       = null;
            this.MenuUIMngr         = null;
            this.OldMenuItemMngr    = null;
            this.MusicHelpers       = null;
            this.Promises           = null;

            HamstarHelpersMod.Instance = null;
        }
Пример #3
0
        public static int GetVanillaSnapshotHash(Item item, bool no_context, bool minimal)
        {
            int hash = EntityHelpers.EntityHelpers.GetVanillaSnapshotHash(item, no_context);

            string id = ItemIdentityHelpers.GetUniqueId(item);

            hash ^= ("id" + id).GetHashCode();
            hash ^= ("prefix" + item.prefix).GetHashCode();
            hash ^= ("stack" + item.stack).GetHashCode();

            if (!no_context)
            {
                hash ^= ("owner" + item.owner).GetHashCode();
                hash ^= ("netID" + item.netID).GetHashCode();
                hash ^= ("favorited" + item.favorited).GetHashCode();
            }

            if (!minimal)
            {
                hash ^= ("mana" + item.mana).GetHashCode();
                //hash ^= ("buyOnce"+item.buyOnce).GetHashCode();	//?
                hash ^= ("manaIncrease" + item.manaIncrease).GetHashCode();
                hash ^= ("lifeRegen" + item.lifeRegen).GetHashCode();
                hash ^= ("notAmmo" + item.notAmmo).GetHashCode();
                hash ^= ("ammo" + item.ammo).GetHashCode();
                hash ^= ("shootSpeed" + item.shootSpeed).GetHashCode();
                hash ^= ("rare" + item.rare).GetHashCode();
                //hash ^= ( "noUseGraphic" + item.noUseGraphic ).GetHashCode();
                hash ^= ("useAmmo" + item.useAmmo).GetHashCode();
                hash ^= ("shieldSlot" + item.shieldSlot).GetHashCode();
                hash ^= ("stringColor" + item.stringColor).GetHashCode();
                hash ^= ("balloonSlot" + item.balloonSlot).GetHashCode();
                hash ^= ("faceSlot" + item.faceSlot).GetHashCode();
                hash ^= ("neckSlot" + item.neckSlot).GetHashCode();
                hash ^= ("noMelee" + item.noMelee).GetHashCode();
                hash ^= ("wingSlot" + item.wingSlot).GetHashCode();
                hash ^= ("waistSlot" + item.waistSlot).GetHashCode();
                hash ^= ("shoeSlot" + item.shoeSlot).GetHashCode();
                hash ^= ("frontSlot" + item.frontSlot).GetHashCode();
                hash ^= ("backSlot" + item.backSlot).GetHashCode();
                hash ^= ("handOffSlot" + item.handOffSlot).GetHashCode();
                //hash ^= ("ToolTip"+item.ToolTip).GetHashCode();
                //hash ^= ("release"+item.release).GetHashCode();
                hash ^= ("buffTime" + item.buffTime).GetHashCode();
                //hash ^= ("buy"+item.buy).GetHashCode();	//?
                //hash ^= ("newAndShiny"+item.newAndShiny).GetHashCode();	//?
                hash ^= ("reuseDelay" + item.reuseDelay).GetHashCode();
                hash ^= ("sentry" + item.sentry).GetHashCode();
                hash ^= ("summon" + item.summon).GetHashCode();
                hash ^= ("thrown" + item.thrown).GetHashCode();
                hash ^= ("ranged" + item.ranged).GetHashCode();
                hash ^= ("magic" + item.magic).GetHashCode();
                hash ^= ("melee" + item.melee).GetHashCode();
                hash ^= ("crit" + item.crit).GetHashCode();
                hash ^= ("DD2Summon" + item.DD2Summon).GetHashCode();
                hash ^= ("shopCustomPrice" + (item.shopCustomPrice == null ? -1 : (int)item.shopCustomPrice)).GetHashCode();
                hash ^= ("shopSpecialCurrency" + item.shopSpecialCurrency).GetHashCode();
                hash ^= ("uniqueStack" + item.uniqueStack).GetHashCode();
                hash ^= ("cartTrack" + item.cartTrack).GetHashCode();
                hash ^= ("mountType" + item.mountType).GetHashCode();
                hash ^= ("handOnSlot" + item.handOnSlot).GetHashCode();
                hash ^= ("buffType" + item.buffType).GetHashCode();
                hash ^= ("noWet" + item.noWet).GetHashCode();
                hash ^= ("material" + item.material).GetHashCode();
                hash ^= ("vanity" + item.vanity).GetHashCode();
                hash ^= ("social" + item.social).GetHashCode();
                hash ^= ("value" + item.value).GetHashCode();
                hash ^= ("legSlot" + item.legSlot).GetHashCode();
                hash ^= ("shoot" + item.shoot).GetHashCode();
                hash ^= ("headSlot" + item.headSlot).GetHashCode();
                hash ^= ("holdStyle" + item.holdStyle).GetHashCode();
                //////hash ^= ("type"+item.type).GetHashCode();
                //hash ^= ("keepTime"+item.keepTime).GetHashCode();
                //hash ^= ("ownTime"+item.ownTime).GetHashCode();
                //hash ^= ("ownIgnore"+item.ownIgnore).GetHashCode();
                hash ^= ("instanced" + item.instanced).GetHashCode();
                hash ^= ("paint" + item.paint).GetHashCode();
                hash ^= ("hairDye" + item.hairDye).GetHashCode();
                hash ^= ("expert" + item.expert).GetHashCode();
                hash ^= ("expertOnly" + item.expertOnly).GetHashCode();
                hash ^= ("useStyle" + item.useStyle).GetHashCode();
                hash ^= ("makeNPC" + item.makeNPC).GetHashCode();
                hash ^= ("fishingPole" + item.fishingPole).GetHashCode();
                hash ^= ("dye" + item.dye).GetHashCode();
                hash ^= ("wornArmor" + item.wornArmor).GetHashCode();
                hash ^= ("tileWand" + item.tileWand).GetHashCode();
                hash ^= ("spawnTime" + item.spawnTime).GetHashCode();
                //hash ^= ("isBeingGrabbed"+item.isBeingGrabbed).GetHashCode();
                //hash ^= ("beingGrabbed"+item.beingGrabbed).GetHashCode();
                //hash ^= ("noGrabDelay"+item.noGrabDelay).GetHashCode();
                hash ^= ("bodySlot" + item.bodySlot).GetHashCode();
                hash ^= ("flame" + item.flame).GetHashCode();
                hash ^= ("questItem" + item.questItem).GetHashCode();
                hash ^= ("bait" + item.bait).GetHashCode();
                hash ^= ("channel" + item.channel).GetHashCode();
                hash ^= ("mech" + item.mech).GetHashCode();
                hash ^= ("useAnimation" + item.useAnimation).GetHashCode();
                hash ^= ("defense" + item.defense).GetHashCode();
                //hash ^= ("UseSound"+item.UseSound).GetHashCode();
                hash ^= ("scale" + item.scale).GetHashCode();
                hash ^= ("glowMask" + item.glowMask).GetHashCode();
                hash ^= ("alpha" + item.alpha).GetHashCode();
                hash ^= ("color" + item.color).GetHashCode();
                hash ^= ("useTurn" + item.useTurn).GetHashCode();
                hash ^= ("autoReuse" + item.autoReuse).GetHashCode();
                hash ^= ("consumable" + item.consumable).GetHashCode();
                hash ^= ("potion" + item.potion).GetHashCode();
                hash ^= ("healMana" + item.healMana).GetHashCode();
                hash ^= ("knockBack" + item.knockBack).GetHashCode();
                hash ^= ("healLife" + item.healLife).GetHashCode();
                hash ^= ("placeStyle" + item.placeStyle).GetHashCode();
                hash ^= ("createWall" + item.createWall).GetHashCode();
                hash ^= ("createTile" + item.createTile).GetHashCode();
                hash ^= ("tileBoost" + item.tileBoost).GetHashCode();
                hash ^= ("hammer" + item.hammer).GetHashCode();
                hash ^= ("axe" + item.axe).GetHashCode();
                hash ^= ("pick" + item.pick).GetHashCode();
                hash ^= ("maxStack" + item.maxStack).GetHashCode();
                hash ^= ("useTime" + item.useTime).GetHashCode();
                hash ^= ("damage" + item.damage).GetHashCode();
                hash ^= ("accessory" + item.accessory).GetHashCode();
            }

            return(hash);
        }
 public static string GetUniqueId(Item item)
 {
     return(ItemIdentityHelpers.GetUniqueId(item));
 }