예제 #1
0
 public override void SetStaticDefaults()
 {
     base.bossID       = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:FallenDeathBeholder");
     base.worldDisplay = "ARareItemSwapJPANs/Parts/Thorium/Bosses/CoznixPart_World";
     base.DisplayName.SetDefault("Coznix Part");
     base.Tooltip.SetDefault("Reward for defeating Coznix, The Fallen Beholder. Swap a bunch for its drops or Treasure Bag.");
 }
예제 #2
0
 public override void SetStaticDefaults()
 {
     base.bossID       = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:RealityBreaker");
     base.worldDisplay = "ARareItemSwapJPANs/Parts/Thorium/Bosses/RagnarokPart_World";
     base.DisplayName.SetDefault("Primordials Part");
     base.Tooltip.SetDefault("Reward for defeating any of the Primordials. Swap a bunch for its drops or Treasure Bag.");
 }
예제 #3
0
        public override bool OnPickup(Item item, Player player)
        {
            if (!ARareItemSwapJPANs.tokenList.Contains(ARareItemSwapJPANs.ItemToTag(item)))
            {
                return(base.OnPickup(item, player));
            }

            int oldStack = item.stack;

            if (player.GetModPlayer <PartsPlayer>().addPart(item))
            {
                Mod rmod = ModLoader.GetMod("ResearchFrom14");
                if (rmod != null && ModContent.GetInstance <Configs.Config>().researchCompatInfPart)
                {
                    object o = rmod.Call("IsResearched", player, item);
                    if (o != null && o is int && (o as int?).Value == 0)
                    {
                        player.GetModPlayer <PartsPlayer>().parts[ARareItemSwapJPANs.ItemToTag(item)] = long.MaxValue;
                    }
                }
                Main.PlaySound(SoundID.Grab, player.position);
                ItemText.NewText(item, oldStack);
                return(false);
            }
            return(true);
        }
예제 #4
0
 public override void SetStaticDefaults()
 {
     base.bossID       = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:ThePrimeScouter");
     base.worldDisplay = "ARareItemSwapJPANs/Parts/Thorium/Bosses/StarScouterPart_World";
     base.DisplayName.SetDefault("Star Scouter Part");
     base.Tooltip.SetDefault("Reward for defeating the Start Scouter. Swap a bunch for its drops or Treasure Bag.");
 }
예제 #5
0
        public override object Run(object[] args, int start = 1)
        {
            if (args.Length - start <= 0)
            {
                return(false);
            }
            Item item = getItemFromObject(args[start]);

            if (item == null)
            {
                return(false);
            }

            ARareItemSwapJPANs.tokenList.Add(ARareItemSwapJPANs.ItemToTag(item));

            Mod rmod = ModLoader.GetMod("ResearchFrom14");

            if (rmod == null)
            {
                return(true);
            }
            rmod.Call("SetDefaultMaxResearch", item.type, 100);
            rmod.Call("SetDefaultCategories", item.type, "Parts");

            return(true);
        }
예제 #6
0
 public override void SetStaticDefaults()
 {
     base.bossID       = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:TheBuriedWarrior");
     base.worldDisplay = "ARareItemSwapJPANs/Parts/Thorium/Bosses/BuriedChampionPart_World";
     base.DisplayName.SetDefault("Buried Champion Part");
     base.Tooltip.SetDefault("Reward for defeating the Buried Champion. Swap a bunch for its drops or Treasure Bag.");
 }
예제 #7
0
 public override void SetStaticDefaults()
 {
     base.bossID       = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:HellBringerMimic");
     base.worldDisplay = "ARareItemSwapJPANs/Parts/Thorium/Bosses/HellBringerMimicPart_World";
     base.DisplayName.SetDefault("Hell Bringer Mimic Part");
     base.Tooltip.SetDefault("Reward for defeating a Mycelium Mimic. Swap a bunch for its drops.");
 }
예제 #8
0
 public static Item getItemFromObject(object o)
 {
     if (o == null)
     {
         return(null);
     }
     if (o is string)
     {
         return(ARareItemSwapJPANs.getItemFromTag(o as string));
     }
     else if (o is Item)
     {
         return(o as Item);
     }
     else if (o is ModItem)
     {
         return((o as ModItem).item);
     }
     else if (o is int)
     {
         Item itm = new Item();
         itm.SetDefaults((int)o);
         return(itm);
     }
     return(null);
 }
예제 #9
0
 public static NPC getNPCFromObject(object o)
 {
     if (o == null)
     {
         return(null);
     }
     if (o is string)
     {
         return(ARareItemSwapJPANs.getNPCFromTag(o as string));
     }
     else if (o is NPC)
     {
         return(o as NPC);
     }
     else if (o is ModNPC)
     {
         return((o as ModNPC).npc);
     }
     else if (o is int)
     {
         NPC npc = new NPC();
         npc.SetDefaults((int)o);
         return(npc);
     }
     return(null);
 }
예제 #10
0
        public override object Run(object[] args, int start = 1)
        {
            if (args.Length - start <= 3)
            {
                ARareItemSwapJPANs.LogError(name, "Requires at least 4 Arguments;\n" + Help());
                return(false);
            }
            Item item = getItemFromObject(args[start]);

            if (item == null || item.IsAir)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid item");
                return(false);
            }
            string modName  = args[start + 1] as string;
            string shopName = args[start + 2] as string;

            if (modName == null || modName.Trim().Length == 0)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid mod name");
                return(false);
            }
            if (shopName == null || shopName.Trim().Length == 0)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid shop name");
                return(false);
            }
            Func <bool> available = args[start + 3] as Func <bool>;


            PartRecipes.addAllRecipes(ModPartRepository.buildCommonShopRecipe(item.type, getListOfStringFromObjects(args, 4), shopName, available, modName));

            return(true);
        }
예제 #11
0
 public override void SetStaticDefaults()
 {
     base.bossID       = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:AbyssionReleased");
     base.worldDisplay = "ARareItemSwapJPANs/Parts/Thorium/Bosses/AbyssionPart_World";
     base.DisplayName.SetDefault("Abyssion Part");
     base.Tooltip.SetDefault("Reward for defeating Abyssion, The Forgotten One. Swap a bunch for its drops or Treasure Bag.");
 }
예제 #12
0
 public override void SetStaticDefaults()
 {
     base.bossID       = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:TheGrandThunderBirdv2");
     base.worldDisplay = "ARareItemSwapJPANs/Parts/Thorium/Bosses/GrandThunderBirdPart_World";
     base.DisplayName.SetDefault("Grand Thunder Bird Part");
     base.Tooltip.SetDefault("Reward for defeating the Grand Thunder Bird. Swap a bunch for its drops or Treasure Bag.");
 }
예제 #13
0
 public override void SetStaticDefaults()
 {
     base.bossID       = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:LichHeadless");
     base.worldDisplay = "ARareItemSwapJPANs/Parts/Thorium/Bosses/LichPart_World";
     base.DisplayName.SetDefault("Lich Part");
     base.Tooltip.SetDefault("Reward for defeating the Lich. Swap a bunch for its drops or Treasure Bag.");
 }
        public override object Run(object[] args, int start = 1)
        {
            if (args.Length == start)
            {
                ARareItemSwapJPANs.LogError(name, " Needs at least one item part tag as input.\n" + Help());
                return(null);
            }
            List <string> parts = getListOfStringFromObjects(args, 1);

            if (parts.Count == 0)
            {
                ARareItemSwapJPANs.LogError(name, " Needs at least one item part tag as input.\n" + Help());
                return(null);
            }
            List <Item> targets = new List <Item>();

            foreach (PartRecipe pr in PartRecipes.allRecipes)
            {
                bool allParts = true;
                foreach (Item itm in pr.parts)
                {
                    allParts = allParts && parts.Contains(ARareItemSwapJPANs.ItemToTag(itm));
                }
                if (allParts && pr.available())
                {
                    targets.Add(pr.result.Clone());
                }
            }
            return(targets);
        }
예제 #15
0
        private void dropBiomeParts(Terraria.NPC npc)
        {
            Config     c     = ModContent.GetInstance <Config>();
            Player     p     = ARareItemSwapJPANs.findNearestPlayer(npc.Center);
            List <int> parts = new List <int>();

            foreach (ModPartRepository mpr in modpacks)
            {
                foreach (int i in mpr.getBiomePartsDrops(npc, p, parts))
                {
                    if (!parts.Contains(i))
                    {
                        parts.Add(i);
                    }
                }
            }
            if (Main.rand.NextDouble() < c.partDropChance)
            {
                for (int i = 0; i < c.maxDifferentParts && parts.Count > 0; i++)
                {
                    int idx  = Main.rand.Next(parts.Count);
                    int prts = c.minParts + Main.rand.Next(c.randParts + 1);
                    Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, parts[idx], prts, false, 0, false, false);
                    parts.RemoveAt(idx);
                }
            }
        }
예제 #16
0
 public override int CompareTo(object obj)
 {
     if (obj == null || obj as PartItemSlot == null)
     {
         return(1);
     }
     return(ARareItemSwapJPANs.getItemFromTag(partTag).Name.CompareTo(ARareItemSwapJPANs.getItemFromTag((obj as PartItemSlot).partTag).Name));
 }
예제 #17
0
 public override bool UseItem(Item itm, Player player)
 {
     if (ARareItemSwapJPANs.tokenList.Contains(ARareItemSwapJPANs.ItemToTag(itm)))
     {
         ((ARareItemSwapJPANs)this.mod).ActivatePurchaseUI(player.whoAmI);
     }
     return(base.UseItem(itm, player));
 }
예제 #18
0
 public override bool ItemSpace(Item itm, Player player)
 {
     if (ARareItemSwapJPANs.tokenList.Contains(ARareItemSwapJPANs.ItemToTag(itm)))
     {
         return(true);
     }
     return(base.ItemSpace(itm, player));
 }
예제 #19
0
        public override void AddRecipes()
        {
            base.AddRecipes();
            ModRecipe recipe = new ModRecipe(mod);

            recipe.AddIngredient(ARareItemSwapJPANs.getItemTypeFromTag("ThoriumMod:VanquisherMedal"));
            recipe.AddTile(ModContent.GetInstance <PartBoothTile>());
            recipe.SetResult(this, 1);
            recipe.AddRecipe();
        }
예제 #20
0
        public override void AddRecipes()
        {
            base.AddRecipes();
            int p2 = ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:FallenDeathBeholder2");

            if (p2 > 0)
            {
                PartsGlobalNPC.addPartToNPC(p2, this);
            }
        }
예제 #21
0
        public override void AddRecipes()
        {
            ARareItemSwapJPANs.tokenList.Add(ARareItemSwapJPANs.ItemToTag(item));
            Mod rmod = ModLoader.GetMod("ResearchFrom14");

            if (rmod == null)
            {
                return;
            }
            rmod.Call("SetDefaultMaxResearch", item.type, 100);
            rmod.Call("SetDefaultCategories", item.type, "Parts");
        }
예제 #22
0
        public override object Run(object[] args, int start = 1)
        {
            if (args.Length - start <= 1)
            {
                ARareItemSwapJPANs.LogError(name, "Requires at least 2 Arguments;\n" + Help());
                return(null);
            }
            Player p = getPlayerFromObject(args[start]);

            if (p == null)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid player");
                return(null);
            }
            PartsPlayer pp = p.GetModPlayer <PartsPlayer>();

            if (pp == null)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid player");
                return(null);
            }
            Item itm = getItemFromObject(args[start + 1]);

            if (itm == null)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid item for part: null");
                return(null);
            }

            long total = pp.getPartAmount(ARareItemSwapJPANs.ItemToTag(itm));

            if (total == -1)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid item for part: item is not a part");
                return(null);
            }

            if (args.Length - start > 2)
            {
                long?toCheck = getLongFromObject(args[start + 2]);
                if (toCheck == null || !toCheck.HasValue)
                {
                    ARareItemSwapJPANs.LogError(name, "Invalid long for count");
                    return(null);
                }
                return(pp.decreasePart(ARareItemSwapJPANs.ItemToTag(itm), toCheck.Value));
            }
            else
            {
                return(pp.decreasePart(ARareItemSwapJPANs.ItemToTag(itm)));
            }
        }
예제 #23
0
        public override List <int> getStagePartsDrops(NPC npc, Player p, List <int> listSoFar = null)
        {
            List <int> ans = new List <int>();

            foreach (string s in dropsInStage.Keys)
            {
                if (dropsInStage[s]())
                {
                    ans.Add(ARareItemSwapJPANs.getItemTypeFromTag(s));
                }
            }
            return(ans);
        }
예제 #24
0
        public static PartRecipe makeSimpleEventPartRecipe(String mod, string biome, String itemTag, int amountItem, int partId, int amountPart, List <string> categories, Func <bool> available = null)
        {
            PartRecipe working = PartRecipe.SimplePartRecipe(partId, amountPart, ARareItemSwapJPANs.getItemTypeFromTag(itemTag), amountItem);

            if (available != null)
            {
                working.setAvailableFunction(available);
            }
            working.addCategoryAndSubcategories(categories);
            working.addCategoryAndSubcategories(makeByEventCategories(categories, biome));
            working.addCategoryAndSubcategories(makeByModCategories(categories, mod));
            return(working);
        }
예제 #25
0
        public override void Update(GameTime gameTime)
        {
            Item itm = Main.player[Main.myPlayer].GetModPlayer <PartsPlayer>().destroyingItem;

            if (ARareItemSwapJPANs.tokenList.Contains(ARareItemSwapJPANs.ItemToTag(itm)))
            {
                buttonText.SetText("Deposit");
            }
            else
            {
                buttonText.SetText("Refund All");
            }
            base.Update(gameTime);
        }
예제 #26
0
        public override object Run(object[] args, int start = 1)
        {
            if (args.Length - start <= 1)
            {
                ARareItemSwapJPANs.LogError(name, "Requires at least 2 Arguments;\n" + Help());
                return(false);
            }
            Item item = getItemFromObject(args[start]);

            if (item == null || item.type == 0)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid item");
                return(false);
            }
            NPC npc = getNPCFromObject(args[start + 1]);

            if (npc == null)
            {
                ARareItemSwapJPANs.LogError(name, "Invalid npc");
                return(false);
            }
            String tag = ARareItemSwapJPANs.ItemToTag(item);

            if (!ARareItemSwapJPANs.tokenList.Contains(tag))
            {
                ARareItemSwapJPANs.tokenList.Add(tag);

                Mod rmod = ModLoader.GetMod("ResearchFrom14");
                if (rmod != null)
                {
                    if (npc.boss)
                    {
                        rmod.Call("SetDefaultMaxResearch", item.type, 500);
                        rmod.Call("SetDefaultCategories", item.type, "Parts");
                        rmod.Call("SetDefaultCategories", item.type, "Parts/Boss Parts");
                    }
                    else
                    {
                        rmod.Call("SetDefaultMaxResearch", item.type, 100);
                        rmod.Call("SetDefaultCategories", item.type, "Parts");
                    }
                }
            }

            PartsGlobalNPC.addPartToNPC(npc.type, item);

            return(true);
        }
예제 #27
0
 public override void AddRecipes()
 {
     base.AddRecipes();
     int[] p2 = new int[] {
         ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:Aquaius"),
         ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:Omnicide"),
         ARareItemSwapJPANs.getNPCTypeFromTag("ThoriumMod:SlagFury")
     };
     foreach (int i in p2)
     {
         if (i != 0)
         {
             PartsGlobalNPC.addPartToNPC(i, this);
         }
     }
 }
예제 #28
0
        public override bool ItemSpace(Item item, Player player)
        {
            PartsPlayer p = player.GetModPlayer <PartsPlayer>();

            if (p.autoDestroy)
            {
                if (!ARareItemSwapJPANs.tokenList.Contains(ARareItemSwapJPANs.ItemToTag(item)) && PartRecipes.ContainsAsResult(item))
                {
                    foreach (PartRecipe pr in PartRecipes.recipesByResult[ARareItemSwapJPANs.ItemToTag(item)])
                    {
                        if (pr.isAvailable() && !pr.irreversible && item.stack > pr.result.stack)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(base.ItemSpace(item, player));
        }
예제 #29
0
        public override void Update(GameTime gameTime)
        {
            if (hasChanges || selected != parent.selectedRecipe || selected == null || !selected.Equals(parent.selectedRecipe))
            {
                selected = parent.selectedRecipe;

                internalGrid.Left.Set(0, 0);
                internalGrid.Top.Set(0, 0);
                internalGrid.Width.Set(this.Width.Pixels - 4, 0);
                internalGrid.Height.Set(this.Height.Pixels - 4, 0);
                internalGrid.Clear();

                float startX = 0;
                float startY = 0;
                if (selected != null)
                {
                    PartsPlayer prt = Main.player[Main.myPlayer].GetModPlayer <PartsPlayer>();
                    foreach (Item part in selected.parts)
                    {
                        PartItemSlot pt = new PartItemSlot(ARareItemSwapJPANs.ItemToTag(part), part.stack);
                        //pt.Left.Set(startX, 0);
                        // pt.Top.Set(startY, 0);

                        /*startX += pt.Width.Pixels + 2;
                         * if (startX + pt.Width.Pixels + 2 > this.Height.Pixels - 4)
                         * {
                         *  startX = 0;
                         *  startY += pt.Height.Pixels + 2;
                         * }*/
                        internalGrid.Add(pt);
                    }
                }
                //  internalGrid.Height.Set(Math.Max(this.Height.Pixels, startY + parent.destroySlot.Height.Pixels + 2), 0);
                internalGrid.Recalculate();
                Recalculate();
                hasChanges = false;
            }
            base.Update(gameTime);
        }
예제 #30
0
 public override void Click(UIMouseEvent evt)
 {
     if (IsMouseHovering)
     {
         if ((Main.mouseItem == null || Main.mouseItem.IsAir) && item != null)
         {
             Main.mouseItem = item;
             realItem       = new Item();
             Main.player[Main.myPlayer].GetModPlayer <PartsPlayer>().destroyingItem = realItem;
             ((ARareItemSwapJPANs)ModLoader.GetMod("ARareItemSwapJPANs")).ExchangeUISelectRecipe(null);
         }
         else if (Main.mouseItem != null && (PartRecipes.ContainsAsResult(Main.mouseItem) || ARareItemSwapJPANs.tokenList.Contains(ARareItemSwapJPANs.ItemToTag(Main.mouseItem))))
         {
             if (item == null || item.IsAir)
             {
                 realItem = Main.mouseItem;
                 Main.player[Main.myPlayer].GetModPlayer <PartsPlayer>().destroyingItem = Main.mouseItem;
                 Main.mouseItem = item;
                 if (!ARareItemSwapJPANs.tokenList.Contains(ARareItemSwapJPANs.ItemToTag(realItem)))
                 {
                     ((ARareItemSwapJPANs)ModLoader.GetMod("ARareItemSwapJPANs")).ExchangeUISelectRecipe(PartRecipes.recipesByResult[ARareItemSwapJPANs.ItemToTag(realItem)][0]);
                 }
             }
             else if (item.type == Main.mouseItem.type)
             {
                 if (item.stack + Main.mouseItem.stack <= item.maxStack)
                 {
                     item.stack += Main.mouseItem.stack;
                     Main.mouseItem.TurnToAir();
                 }
                 else
                 {
                     Main.mouseItem.stack -= (item.maxStack - item.stack);
                     item.stack            = item.maxStack;
                 }
             }
         }
     }
 }