コード例 #1
0
        private void LoadBlacklist()
        {
            TransferInletTileEntity.PickupBlacklist.Add(ItemID.Heart);
            TransferInletTileEntity.PickupBlacklist.Add(ItemID.CandyApple);
            TransferInletTileEntity.PickupBlacklist.Add(ItemID.CandyCane);

            TransferInletTileEntity.PickupBlacklist.Add(ItemID.Star);
            TransferInletTileEntity.PickupBlacklist.Add(ItemID.SugarPlum);
            TransferInletTileEntity.PickupBlacklist.Add(ItemID.SoulCake);

            TransferInletTileEntity.PickupBlacklist.Add(ItemID.NebulaPickup1);
            TransferInletTileEntity.PickupBlacklist.Add(ItemID.NebulaPickup2);
            TransferInletTileEntity.PickupBlacklist.Add(ItemID.NebulaPickup3);

            TransferInletTileEntity.PickupBlacklist.Add(ItemID.DD2EnergyCrystal);

            for (int i = 0; i < ItemLoader.ItemCount; i++)
            {
                ModItem item = ItemLoader.GetItem(i);
                if (item != null &&
                    (item.GetType().GetMethod("ItemSpace").DeclaringType != typeof(ModItem) ||
                     item.GetType().GetMethod("OnPickup").DeclaringType != typeof(ModItem)))
                {
                    TransferInletTileEntity.PickupBlacklist.Add(item.item.type);
                }
            }
        }
コード例 #2
0
        private void LoadBagFilter()
        {
            Bags = new HashSet <int>();

            Bags.Add(ItemID.HerbBag);

            Bags.Add(ItemID.GoodieBag);
            Bags.Add(ItemID.Present);
            Bags.Add(ItemID.BluePresent);
            Bags.Add(ItemID.GreenPresent);
            Bags.Add(ItemID.YellowPresent);

            Bags.Add(ItemID.KingSlimeBossBag);
            Bags.Add(ItemID.EyeOfCthulhuBossBag);
            Bags.Add(ItemID.EaterOfWorldsBossBag);
            Bags.Add(ItemID.BrainOfCthulhuBossBag);
            Bags.Add(ItemID.QueenBeeBossBag);
            Bags.Add(ItemID.WallOfFleshBossBag);
            Bags.Add(ItemID.SkeletronBossBag);
            Bags.Add(ItemID.DestroyerBossBag);
            Bags.Add(ItemID.TwinsBossBag);
            Bags.Add(ItemID.SkeletronPrimeBossBag);
            Bags.Add(ItemID.PlanteraBossBag);
            Bags.Add(ItemID.GolemBossBag);
            Bags.Add(ItemID.FishronBossBag);
            Bags.Add(ItemID.CultistBossBag);
            Bags.Add(ItemID.MoonLordBossBag);
            Bags.Add(ItemID.BossBagBetsy);
            Bags.Add(ItemID.BossBagDarkMage);
            Bags.Add(ItemID.BossBagOgre);

            Bags.Add(ItemID.LockBox);
            Bags.Add(ItemID.WoodenCrate);
            Bags.Add(ItemID.IronCrate);
            Bags.Add(ItemID.GoldenCrate);
            Bags.Add(ItemID.JungleFishingCrate);
            Bags.Add(ItemID.FloatingIslandFishingCrate);
            Bags.Add(ItemID.CorruptFishingCrate);
            Bags.Add(ItemID.CrimsonFishingCrate);
            Bags.Add(ItemID.HallowedFishingCrate);
            Bags.Add(ItemID.DungeonFishingCrate);

            for (int i = 0; i < ItemLoader.ItemCount; i++)
            {
                ModItem item = ItemLoader.GetItem(i);
                if (item != null && item.GetType().GetMethod("OpenBossBag").DeclaringType != typeof(ModItem))
                {
                    Bags.Add(i);
                }
            }
        }
コード例 #3
0
ファイル: ModConf.cs プロジェクト: heloman1/WeaponOut
        /// <returns> true is loaded successfully </returns>
        internal static bool ReadConfig()
        {
            if (ModConfig.Load())
            {
                int readVersion = 0;
                ModConfig.Get("version", ref readVersion);
                if (readVersion != configVersion)
                {
                    bool canUpdate = false;
                    if (readVersion == 0)
                    {
                        canUpdate = true;
                    }
                    if (!canUpdate)
                    {
                        return(false);
                    }
                }

                List <string> allKeys = ModConfig.GetAllKeys();
                foreach (string key in allKeys)
                {
                    customHoldPositions.Add(key, ModConfig.Get(key, -1));
                }

                for (int i = 0; i < ItemLoader.ItemCount; i++)
                {
                    ModItem item = ItemLoader.GetItem(i);
                    if (item != null)
                    {
                        string typeString = item.GetType().ToString();
                        if (customHoldPositions.ContainsKey(typeString))
                        {
                            customHoldStyleArray[i] = customHoldPositions[typeString];
                        }
                    }
                    else
                    {
                        if (customHoldPositions.ContainsKey(i.ToString()))
                        {
                            customHoldStyleArray[i] = customHoldPositions[i.ToString()];
                        }
                    }
                }

                return(true);
            }
            return(false);
        }
コード例 #4
0
ファイル: Entropy.cs プロジェクト: Tyfyter/Entropy
 public static short SetStaticDefaultsGlowMask(ModItem modItem, string suffix = "_Glow")
 {
     if (!Main.dedServ)
     {
         Texture2D[] glowMasks = new Texture2D[Main.glowMaskTexture.Length + 1];
         for (int i = 0; i < Main.glowMaskTexture.Length; i++)
         {
             glowMasks[i] = Main.glowMaskTexture[i];
         }
         glowMasks[glowMasks.Length - 1] = mod.GetTexture("Items/" + modItem.GetType().Name + suffix);
         Main.glowMaskTexture            = glowMasks;
         return((short)(glowMasks.Length - 1));
     }
     else
     {
         return(0);
     }
 }
コード例 #5
0
ファイル: Light.cs プロジェクト: Tyfyter/Light
 public static short SetStaticDefaultsGlowMask(ModItem modItem)
 {
     if (Main.netMode != NetmodeID.Server)
     {
         Texture2D[] glowMasks = new Texture2D[Main.glowMaskTexture.Length + 1];
         for (int i = 0; i < Main.glowMaskTexture.Length; i++)
         {
             glowMasks[i] = Main.glowMaskTexture[i];
         }
         glowMasks[glowMasks.Length - 1] = Instance.GetTexture("Items/" + modItem.GetType().Name);
         Main.glowMaskTexture            = glowMasks;
         return((short)(glowMasks.Length - 1));
     }
     else
     {
         return(0);
     }
 }
コード例 #6
0
        public void QueryModOrigin()
        {
            Point mouseTile = Main.MouseWorld.ToTileCoordinates();

            int   closestNPCIndex    = -1;
            float closestNPCDistance = float.MaxValue;

            for (int l = 0; l < 200; l++)
            {
                if (Main.npc[l].active)
                {
                    float distance = Utils.Distance(Main.npc[l].getRect(), Main.MouseWorld);
                    if (distance < closestNPCDistance)
                    {
                        closestNPCDistance = distance;
                        closestNPCIndex    = l;
                    }
                }
            }

            int   closestItemIndex    = -1;
            float closestItemDistance = float.MaxValue;

            for (int i = 0; i < 400; i++)
            {
                if (Main.item[i].active)
                {
                    float distance = Utils.Distance(Main.item[i].getRect(), Main.MouseWorld);
                    if (distance < closestItemDistance)
                    {
                        closestItemDistance = distance;
                        closestItemIndex    = i;
                    }
                }
            }


            int hoverBuffIndex = -1;
            int hoverBuffID    = -1;

            for (int k = 0; k < 22; k++)
            {
                if (Main.player[Main.myPlayer].buffType[k] > 0)
                {
                    int buffID = Main.player[Main.myPlayer].buffType[k];
                    int buffX  = 32 + k * 38;
                    int buffY  = 76;
                    if (k >= 11)
                    {
                        buffX  = 32 + (k - 11) * 38;
                        buffY += 50;
                    }

                    if (Main.mouseX < buffX + Main.buffTexture[buffID].Width && Main.mouseY <buffY + Main.buffTexture[buffID].Height && Main.mouseX> buffX && Main.mouseY > buffY)
                    {
                        hoverBuffIndex = k;
                        hoverBuffID    = buffID;
                    }
                }
            }

            //Top to Bottom:

            // Hover Buff
            if (hoverBuffIndex > -1 && !Main.playerInventory)
            {
                if (hoverBuffID >= BuffID.Count)
                {
                    ModBuff hoverBuff = BuffLoader.GetBuff(hoverBuffID);
                    Main.NewText("This buff is from: " + hoverBuff.mod.DisplayName);
                    if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                    {
                        Main.NewText($"Developer Info: ModName: {hoverBuff.mod.Name}, InternalName: {hoverBuff.Name}, FullName: {hoverBuff.GetType().FullName}");
                    }
                }
                else
                {
                    Main.NewText("This is a vanilla buff.");
                }
            }

            // Item in inventory
            else if (Main.HoverItem.type > 0 && Main.HoverItem != null)
            {
                if (Main.HoverItem.modItem != null)
                {
                    Main.NewText("This item is from: " + Main.HoverItem.modItem.mod.DisplayName);
                    if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                    {
                        Main.NewText($"Developer Info: ModName: {Main.HoverItem.modItem.mod.Name}, InternalName: {Main.HoverItem.modItem.Name}, FullName: {Main.HoverItem.modItem.GetType().FullName}");
                    }
                }
                else
                {
                    Main.NewText("This is a vanilla item.");
                    if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                    {
                        Main.NewText($"Developer Info: ItemID: {ItemID.Search.GetName(Main.HoverItem.type)}, ItemID#: {Main.HoverItem.type}");
                    }
                }
            }

            // NPC
            else if (closestNPCDistance < 30)
            {
                NPC closestNPC = Main.npc[closestNPCIndex];
                if (closestNPC.modNPC != null)
                {
                    Main.NewText("This npc is from: " + closestNPC.modNPC.mod.DisplayName);
                    if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                    {
                        Main.NewText($"Developer Info: ModName: {closestNPC.modNPC.mod.Name}, InternalName: {closestNPC.modNPC.Name}, FullName: {closestNPC.modNPC.GetType().FullName}");
                    }
                }
                else
                {
                    Main.NewText("This is a vanilla npc.");
                    if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                    {
                        Main.NewText($"Developer Info: NPCID: {NPCID.Search.GetName(closestNPC.type)}, NPCID#: {closestNPC.type}");
                    }
                }
            }

            // Tile
            else if (Main.tile[mouseTile.X, mouseTile.Y].type >= TileID.Count)
            {
                ModTile modTile = TileLoader.GetTile(Main.tile[mouseTile.X, mouseTile.Y].type);
                Main.NewText("This tile is from: " + modTile.mod.DisplayName);
                if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                {
                    Main.NewText($"Developer Info: ModName: {modTile.mod.Name}, InternalName: {modTile.Name}, FullName: {modTile.GetType().FullName}");
                }
                //Main.NewText("This tile is active: " + Main.tile[mouseTile.X, mouseTile.Y].active());
                //Main.NewText("This tile is inactive: " + Main.tile[mouseTile.X, mouseTile.Y].inActive());
                //Main.NewText("This tile is nactive: " + Main.tile[mouseTile.X, mouseTile.Y].nactive());
            }

            // Wall
            else if (Main.tile[mouseTile.X, mouseTile.Y].wall >= WallID.Count)
            {
                ModWall modWall = WallLoader.GetWall(Main.tile[mouseTile.X, mouseTile.Y].wall);
                Main.NewText("This wall is from: " + modWall.mod.DisplayName);
                if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                {
                    Main.NewText($"Developer Info: ModName: {modWall.mod.Name}, InternalName: {modWall.Name}, FullName: {modWall.GetType().FullName}");
                }
            }

            // Item on ground
            else if (closestItemDistance < 5)
            {
                if (Main.item[closestItemIndex].modItem != null)
                {
                    ModItem modItem = Main.item[closestItemIndex].modItem;
                    Main.NewText("This item is from: " + modItem.mod.DisplayName);
                    if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                    {
                        Main.NewText($"Developer Info: ModName: {modItem.mod.Name}, InternalName: {modItem.Name}, FullName: {modItem.GetType().FullName}");
                    }
                }
                else
                {
                    Main.NewText("This is a vanilla item.");
                    if (HelpfulHotkeysClientConfig.Instance.ShowDeveloperInfoQueryModOrigin)
                    {
                        Main.NewText($"Developer Info: ItemID: {ItemID.Search.GetName(Main.item[closestItemIndex].type)}, ItemID#: {Main.item[closestItemIndex].type}");
                    }
                }
            }

            // How to Use
            else if (true)
            {
                Main.NewText("Hover over an item, npc, tile, or wall to identify which mod it is from.");
            }
        }
コード例 #7
0
        public static Types GetType(Item item)
        {
            //ThoriumMod Check

            if (ItemOverrideList.ContainsKey(item.Name))
            {
                return(ItemOverrideList[item.Name]);
            }

            ModItem mitem = item.modItem;

            if (mitem != null)
            {
                Type mitemtype = mitem.GetType();
                if (ItemOverrideList.ContainsKey(mitemtype.ToString()))
                {
                    return(ItemOverrideList[mitemtype.ToString()]);
                }
                if (Config.Instance.DebugMode && Config.Instance.DebugModeTooltips)
                {
                    ColoredDamageTypes.Log("Item: " + mitemtype.ToString());
                }
            }

            if (ColoredDamageTypes.ThoriumMod != null && mitem != null && mitem.mod == ColoredDamageTypes.ThoriumMod)
            {
                Type mitemType = mitem.GetType();

                /*
                 * ColoredDamageTypes.Log("---------------------------------------");
                 * foreach ( FieldInfo f in mitemType.GetFields() ) {
                 *      ColoredDamageTypes.Log(f.Name + ": " + f.FieldType+": "+f.Attributes+": "+f.GetValue(mitem));
                 * }
                 */
                var fieldRadiant   = mitemType.GetField("radiant");
                var fieldSymphonic = mitemType.GetField("Empowerments");
                var fieldThrowing  = mitemType.GetField("throwing");
                if (fieldRadiant != null && (bool)fieldRadiant.GetValue(mitem) == true)
                {
                    return(Types.Radiant);
                }
                else if (fieldSymphonic != null)
                {
                    return(Types.Symphonic);
                }
                else if (fieldThrowing != null && (bool)fieldThrowing.GetValue(mitem) == true)
                {
                    return(Types.Thrown);
                }
            }

            /*
             * if (ColoredDamageTypes.TremorMod != null && mitem != null && mitem.mod == ColoredDamageTypes.TremorMod) {
             *      Type mitemType = mitem.GetType();
             *      string mitemTypestr = mitemType.ToString();
             *      bool isAlchemic = mitemTypestr.Contains("Alchemist.") || mitemTypestr.Contains("Alchemic.") || mitemTypestr.Contains("NovaPillar.");
             *      if (mitemType != null && isAlchemic == true) return Types.Alchemic;
             * }
             */

            if (item.melee && !item.magic && !item.thrown)
            {
                return(Types.Melee);
            }
            else if (item.ranged && !item.magic && !item.thrown)
            {
                return(Types.Ranged);
            }
            else if (item.magic)
            {
                return(Types.Magic);
            }
            else if (item.thrown)
            {
                return(Types.Thrown);
            }
            else if (item.sentry)
            {
                return(Types.Sentry);
            }
            else if (item.summon)
            {
                return(Types.Summon);
            }

            return(Types.Unknown);
        }