コード例 #1
0
 public override void RightClick(Item item, Player player)
 {
     if (CalamityChangesConfig.Instance.sulphurousShell && item.type == ModContent.ItemType <AbyssalCrate>())
     {
         DropHelper.DropItemChance(player, ModContent.ItemType <SulphurousShell>(), 0.1f, 1, 1);
     }
 }
コード例 #2
0
        public override void NPCLoot(NPC npc)
        {
            switch (npc.type)
            {
            case NPCID.Clinger:
                if (CalamityChangesConfig.Instance.daggerOfDecree)
                {
                    DropHelper.DropItemChance(npc, ModContent.ItemType <DaggerofDecree>(), Main.expertMode ? 100 : 150);
                }
                break;

            case NPCID.TravellingMerchant:
                if (CalamityChangesConfig.Instance.pulseBowDrop)
                {
                    DropHelper.DropItemCondition(npc, ItemID.PulseBow, Main.hardMode && Main.rand.NextBool(10));
                }
                break;
            }

            if (CalamityChangesConfig.Instance.npcsDropSharkFins)
            {
                if (npc.type == ModContent.NPCType <Frogfish>())
                {
                    DropHelper.DropItemChance(npc, ItemID.SharkFin, 1f / 3f);
                }

                if (npc.type == ModContent.NPCType <Catfish>())
                {
                    DropHelper.DropItemChance(npc, ItemID.SharkFin, 2f / 3f);
                }

                if (npc.type == ModContent.NPCType <DevilFish>() || npc.type == ModContent.NPCType <DevilFishAlt>())
                {
                    DropHelper.DropItemChance(npc, ItemID.SharkFin, 0.75f, 1, 3);
                }

                if (npc.type == ModContent.NPCType <FusionFeeder>())
                {
                    DropHelper.DropItemChance(npc, ItemID.SharkFin, 0.125f);
                }

                if (npc.type == ModContent.NPCType <Sunskater>())
                {
                    DropHelper.DropItemChance(npc, ItemID.SharkFin, 0.10f);
                }
            }

            if (CalamityChangesConfig.Instance.angryDogSpawnBuff && npc.type == ModContent.NPCType <AngryDog>())
            {
                DropHelper.DropItemCondition(npc, ModContent.ItemType <Cryophobia>(), CalamityChangesConfig.Instance.angryDogSpawnBuff, 0.15f);
            }

            if (CalamityChangesConfig.Instance.grandSharkRepellent && npc.type == ModContent.NPCType <GreatSandShark>() && Main.rand.NextBool(3))
            {
                Item.NewItem(npc.Hitbox, ModContent.ItemType <GrandSharkRepellent>());
            }
        }
コード例 #3
0
 public virtual void Drop(Transform transform)
 {
     DropHelper.DropItem(GetType(), transform, item =>
     {
         item.InventaryItemName = InventaryItemName;
         item.InventarSprite    = InventarSprite;
         item.PickUpPrefab      = PickUpPrefab;
         OnCreateCopy(item);
     });
 }
コード例 #4
0
        public void OnDrop(object sender, DragEventArgs e)
        {
            var filename = DropHelper.FileNameFromDrop(sender, e);

            if (!string.IsNullOrEmpty(filename))
            {
                var selected = DropHelper.SelectedItemFromDrop <T>(sender, e);
                selected.Filename = filename;
                Save(selected);
            }
        }
コード例 #5
0
        public void ReorderItemInFullStructure_WhenCalled_ProperlyInserts()
        {
            var collection = new ObservableCollection <String> {
                "ABC", "DEF", "GHI", "JKL"
            };

            DropHelper.ReorderItemInFullStructure <String>("ABC", collection, 3, 0);

            Assert.Equal("JKL", collection[0]);
            Assert.Equal("DEF", collection[1]);
            Assert.Equal("GHI", collection[2]);
        }
コード例 #6
0
        public void ReorderItemInNotFullStructure_WhenTargetIsClosestToSource_ProperlyInserts()
        {
            var collection = new ObservableCollection <String> {
                "ABC", "DEF", "GHI", null
            };

            DropHelper.ReorderItemInNotFullStructure <String>("DEF", collection, 0, 1);

            Assert.Equal("DEF", collection[0]);
            Assert.Equal("ABC", collection[1]);
            Assert.Equal("GHI", collection[2]);
        }
コード例 #7
0
        public void InsertItemIntoNotFullStructure_WhenCalled_ProperlyInserts()
        {
            var collection = new ObservableCollection <String> {
                "ABC", "DEF", null, "GHI"
            };

            DropHelper.InsertItemIntoNotFullStructure <String>("JKL", collection, 0);

            Assert.Equal("JKL", collection[0]);
            Assert.Equal("ABC", collection[1]);
            Assert.Equal("DEF", collection[2]);
        }
コード例 #8
0
        private bool Validate(ProjectEditor editor, object sender, DragEventArgs e, bool bExecute)
        {
            var point = DropHelper.GetPosition(sender, e);

            switch (sender)
            {
            case ListBox list:
                return(ValidateListBox(editor, e, bExecute, list));
            }

            return(false);
        }
コード例 #9
0
        private bool Validate(ProjectEditor editor, object sender, DragEventArgs e, bool bExecute)
        {
            var point = DropHelper.GetPosition(sender, e);

            switch (sender)
            {
            case TreeView tree:
                return(ValidateTreeView(editor, e, bExecute, tree));
            }

            return(false);
        }
コード例 #10
0
        private bool Validate(IProjectEditor editor, object sender, DragEventArgs e, bool bExecute)
        {
            var point = DropHelper.GetPosition(sender, e);

            if (e.Data.Contains(DataFormats.Text))
            {
                var text = e.Data.GetText();

                if (bExecute)
                {
                    editor?.OnTryPaste(text);
                }

                return(true);
            }

            foreach (var format in e.Data.GetDataFormats())
            {
                var data = e.Data.Get(format);

                switch (data)
                {
                case IBaseShape shape:
                    return(editor?.OnDropShape(shape, point.X, point.Y, bExecute) == true);

                case IRecord record:
                    return(editor?.OnDropRecord(record, point.X, point.Y, bExecute) == true);

                case IShapeStyle style:
                    return(editor?.OnDropStyle(style, point.X, point.Y, bExecute) == true);

                case IPageContainer page:
                    return(editor?.OnDropTemplate(page, point.X, point.Y, bExecute) == true);

                default:
                    break;
                }
            }

            if (e.Data.Contains(DataFormats.FileNames))
            {
                var files = e.Data.GetFileNames().ToArray();
                if (bExecute)
                {
                    editor?.OnDropFiles(files, point.X, point.Y);
                }
                return(true);
            }

            return(false);
        }
コード例 #11
0
        public override void OpenBossBag(Player player)
        {
            List <int> types = new List <int>();

            types.Insert(types.Count, ItemID.SharkFin);
            types.Insert(types.Count, ItemID.Seashell);
            types.Insert(types.Count, ItemID.Starfish);
            types.Insert(types.Count, ItemID.SoulofFlight);
            types.Insert(types.Count, ItemID.Coral);

            /*
             * for (int f = 0; f < (Main.expertMode ? 150 : 75); f = f + 1)
             * {
             *      player.QuickSpawnItem(types[Main.rand.Next(0, types.Count)]);
             * }*/

            DropHelper.DropFixedItemQuanity(types.ToArray(), Main.expertMode ? 150 : 75, Vector2.Zero, player);

            player.TryGettingDevArmor();
            int lLoot = (Main.rand.Next(0, 4));

            player.QuickSpawnItem(mod.ItemType("SerratedTooth"));
            if (lLoot == 0)
            {
                player.QuickSpawnItem(mod.ItemType("SkytoothStorm"));
            }
            if (lLoot == 1)
            {
                player.QuickSpawnItem(mod.ItemType("Jaws"));
            }
            if (lLoot == 2)
            {
                player.QuickSpawnItem(mod.ItemType("SnappyShark"));
                player.QuickSpawnItem(mod.ItemType("SharkTooth"), 150);
            }
            if (lLoot == 3)
            {
                player.QuickSpawnItem(mod.ItemType("SharkBait"), Main.rand.Next(60, 150));
            }
            player.QuickSpawnItem(mod.ItemType("SharkTooth"), Main.rand.Next(100, 200));
        }
コード例 #12
0
        public MappingControl()
        {
            this.InitializeComponent();

            this.TargetList = new ObservableCollection <ListViewItem>();
            this.SourceList = new ObservableCollection <ListViewItem>();
            this.Mapping    = new List <DataMapping>();

            InitializeComponent();
            this.mainCanvas.AllowDrop = true;

            ListBoxDragDropDataProvider callback = new ListBoxDragDropDataProvider(this.ListBoxSource);

            dragHelper = new DragHelper(this.ListBoxSource, callback, this.LayoutRoot);
            dropHelper = new DropHelper(this.ListBoxTarget, this);

            ListBoxTarget.SelectedIndex = -1;

            ListBoxSource.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
            ListBoxTarget.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
        }
コード例 #13
0
        public TestDroppableViewModel()
        {
            IProfile exProfile = new FileSystemInfoExProfile(null, null);

            DropHelper = new DropHelper <IEntryModel>(
                () => "Test Droppable",
                (ems, eff) =>
                QueryDropResult.CreateNew(DragDropEffects.Copy),
                da =>
                exProfile.DragDrop().GetEntryModels(da),
                (ems, da, eff) =>
            {
                if (ems.Count() > 1)
                {
                    Label = ems.Count() + " items.";
                }
                else
                {
                    Label = ems.First().FullPath;
                }
                return(DragDropEffects.Copy);
            }, em => EntryViewModel.FromEntryModel(em));
        }
コード例 #14
0
        public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
        {
            //HOW TO SEE DROP RATES IN THE BESTIARY:

            /*
             * 1. Get the "GamerMod (Debug Tools)" mod
             * 2. Enter a world, type "/bestiary" in chat
             * 3. If it says "done?", leave the world (so that the 100% progress saves on that world)
             * 4. ???
             * 5. profit (check bestiary for drops)
             *
             * You need to do this for every world you are using (ideally a normal and an expert world)
             * You only have to do this once or when new NPCs get added. New drops to existing NPCs do not need redoing the steps
             */

            //This method is called once when the game loads (per NPC), so you can't make dynamic checks based on world state like "npc.value > 0f" here
            if (npc.type == NPCID.GoblinSorcerer)
            {
                //20 is the chanceDenominator argument, meaning its a 1/20 roll aka old Main.rand.NextBool(20)
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <ShadowyClicker>(), 20));
            }
            else if (npc.type == NPCID.Frankenstein || npc.type == NPCID.SwampThing)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <EclipticClicker>(), 25));
            }
            else if (npc.type == NPCID.BloodZombie || npc.type == NPCID.Drippler)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <HemoClicker>(), 25));
            }
            else if (npc.type == NPCID.DarkCaster)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <Milk>(), 15));
            }
            else if (npc.type == NPCID.IceMimic)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <AimAssistModule>(), 4));
            }
            else if (npc.type == NPCID.Gastropod)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <ChocolateChip>(), 20));
            }
            else if (npc.type == NPCID.SandElemental)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <SandstormClicker>(), 2));
            }
            else if (npc.type == NPCID.IceGolem)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <BlizzardClicker>(), 2));
            }
            else if (npc.type == NPCID.PirateCaptain)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <CaptainsClicker>(), 8));
            }
            else if (npc.type == NPCID.PirateShip)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <GoldenTicket>(), 4));
            }
            else if (npc.type == NPCID.Pumpking)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <LanternClicker>(), 10));
            }
            else if (npc.type == NPCID.MourningWood)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <WitchClicker>(), 10));
            }
            else if (npc.type == NPCID.SantaNK1)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <NaughtyClicker>(), 10));
            }
            else if (npc.type == NPCID.IceQueen)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <FrozenClicker>(), 10));
            }
            else if (npc.type == NPCID.DD2DarkMageT1 || npc.type == NPCID.DD2DarkMageT3)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <ArcaneClicker>(), 5));
            }
            else if (npc.type == NPCID.DD2OgreT2 || npc.type == NPCID.DD2OgreT3)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <SnottyClicker>(), 5));
            }
            else if (npc.type == NPCID.MaggotZombie)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <TriggerFinger>(), 18));
            }
            else if (npc.type == NPCID.MartianSaucerCore)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <HighTechClicker>(), 4));
            }
            else if (npc.type == NPCID.WindyBalloon)
            {
                npcLoot.Add(ItemDropRule.Common(ModContent.ItemType <BalloonClicker>(), 10));
            }
            else if (npc.type == NPCID.BloodNautilus)
            {
                npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType <SpiralClicker>(), 2, 1));
            }
            else if (npc.type == NPCID.FireImp)
            {
                DropHelper.NPCExpertGetsRerolls(npcLoot, ModContent.ItemType <ImpishClicker>(), 35);
            }
            else if (npc.type == NPCID.TorchGod)
            {
                LeadingConditionRule neverDropsRule = new LeadingConditionRule(new Conditions.NeverTrue());
                neverDropsRule.OnSuccess(ItemDropRule.Common(ModContent.ItemType <TorchClicker>()));
                npcLoot.Add(neverDropsRule);
            }

            //Here go drops for normal mode that mirror through boss bags in expert mode (see ClickerItemGlobal)
            Conditions.NotExpert notExpert = new Conditions.NotExpert();
            if (npc.type == NPCID.MoonLordCore)
            {
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <LordsClicker>()));
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <TheClicker>(), 5));
            }
            else if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime || npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism)
            {
                var ruleToAdd = ItemDropRule.ByCondition(notExpert, ModContent.ItemType <BottomlessBoxofPaperclips>(), 4);

                if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime)
                {
                    npcLoot.Add(ruleToAdd);
                }
                else
                {
                    LeadingConditionRule missingTwinRule = new LeadingConditionRule(new Conditions.MissingTwin());
                    missingTwinRule.OnSuccess(ruleToAdd);
                    npcLoot.Add(missingTwinRule);
                }
            }
            else if (npc.type == NPCID.DD2Betsy)
            {
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <DraconicClicker>(), 4));
            }
            else if (npc.type == NPCID.Deerclops)
            {
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <CyclopsClicker>(), 4));
            }
            else if (npc.type == NPCID.HallowBoss)
            {
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <RainbowClicker>(), 4));
            }
            else if (npc.type == NPCID.DukeFishron)
            {
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <SeafoamClicker>(), 5));
            }
            else if (npc.type == NPCID.WallofFlesh)
            {
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <ClickerEmblem>(), 4));
            }
            else if (npc.type == NPCID.KingSlime)
            {
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <StickyKeychain>(), 4));
            }
            else if (npc.type == NPCID.QueenSlimeBoss)
            {
                npcLoot.Add(ItemDropRule.ByCondition(notExpert, ModContent.ItemType <ClearKeychain>(), 4));
            }
            else if (npc.type == NPCID.LunarTowerStardust || npc.type == NPCID.LunarTowerSolar || npc.type == NPCID.LunarTowerVortex || npc.type == NPCID.LunarTowerNebula)
            {
                int miceFragment = ModContent.ItemType <MiceFragment>();

                var pNormal = default(DropOneByOne.Parameters);
                pNormal.ChanceDenominator              = 1;
                pNormal.ChanceNumerator                = 1;
                pNormal.MinimumStackPerChunkBase       = 1;
                pNormal.MaximumStackPerChunkBase       = 1;
                pNormal.BonusMinDropsPerChunkPerPlayer = 0;
                pNormal.BonusMaxDropsPerChunkPerPlayer = 0;

                pNormal.MinimumItemDropsCount = 3;
                pNormal.MaximumItemDropsCount = 15;

                var pExpert = pNormal;                 //Since DropOneByOne.Parameters is a struct, this is a copy/new assignment
                pExpert.MinimumItemDropsCount = 5;
                pExpert.MaximumItemDropsCount = 22;

                var normalModeRule = new DropOneByOne(miceFragment, pNormal);
                var expertModeRule = new DropOneByOne(miceFragment, pExpert);
                npcLoot.Add(new DropBasedOnExpertMode(normalModeRule, expertModeRule));
            }
        }
コード例 #15
0
        public override void NPCLoot()
        {
            List <int> types = new List <int>();

            /*WorldGen.CopperTierOre = 7;
             * WorldGen.IronTierOre = 6;
             * WorldGen.SilverTierOre = 9;
             * WorldGen.GoldTierOre = 8;*/

            if (SGAWorld.craftwarning < 30)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrueCopperWraithNotch"));
            }
            if (Main.expertMode)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WraithTargetingGamepad"));
            }

            int shardtype = ModContent.ItemType <WraithFragment>();

            /*if (SGAWorld.WorldIsTin)
             * {
             *      shardtype = mod.ItemType("WraithFragment2");
             *      //npc.GivenName = "Tin Wraith";
             * }*/



            types.Insert(types.Count, shardtype);
            types.Insert(types.Count, SGAmod.WorldOres[0, SGAWorld.oretypesprehardmode[0] == TileID.Copper ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[0, SGAWorld.oretypesprehardmode[0] == TileID.Copper ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[1, SGAWorld.oretypesprehardmode[1] == TileID.Iron ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[1, SGAWorld.oretypesprehardmode[1] == TileID.Iron ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[2, SGAWorld.oretypesprehardmode[2] == TileID.Silver ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[2, SGAWorld.oretypesprehardmode[2] == TileID.Silver ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[3, SGAWorld.oretypesprehardmode[3] == TileID.Gold ? 1 : 0]);

            DropHelper.DropFixedItemQuanity(types.ToArray(), (Main.expertMode ? 50 : 30) * (Main.hardMode ? 2 : 1), npc.Center);



            if (shardtype > 0)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, shardtype, (Main.expertMode ? 60 : 30) * (Main.hardMode ? 2 : 1));
            }

            /*
             * WeightedItemSet[] sets = {
             *                              new WeightedItemSet(new (int,int)[]{ (ItemID.CopperPlating, 15),(ItemID.CopperBar, 25)  }),
             * new WeightedItemSet(new (int,int)[]{ (ItemID.SunStone, 1) }),
             * new WeightedItemSet(new (int,int)[]{ (ItemID.MoonStone, 1) }),
             * new WeightedItemSet(new (int,int)[]{ (ItemID.FragmentNebula, 10),(ItemID.FragmentSolar, 10),(ItemID.FragmentStardust, 10),(ItemID.FragmentVortex, 10) },3),
             *
             *      };
             *
             * DropHelper.DropFromItemSets(npc.Center, sets,2);
             */



            /*for (int f = 0; f < (Main.expertMode ? 50 : 30); f += 1)
             * {
             *      Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, types[Main.rand.Next(0, types.Count)]);
             * }*/

            Achivements.SGAAchivements.UnlockAchivement("Copper Wraith", Main.LocalPlayer);
            if (SGAWorld.downedWraiths < 1)
            {
                SGAWorld.downedWraiths = 1;
                Idglib.Chat("You may now craft bars without being attacked", 150, 150, 70);
            }
        }