Example #1
0
 void CraftItem(NPC npc)
 {
     if (underAmount > 0)
     {
         npc.RemoveInvItem(FindMaterial(npc, underMat, underAmount), underAmount);
     }
     if (mainAmount > 0)
     {
         npc.RemoveInvItem(FindMaterial(npc, mainMat, mainAmount), mainAmount);
     }
     if (tyingAmount > 0)
     {
         npc.RemoveInvItem(FindMaterial(npc, tyingMat, tyingAmount), tyingAmount);
     }
     if (secondaryAmount > 0)
     {
         npc.RemoveInvItem(FindMaterial(npc, secondaryMat, secondaryAmount), secondaryAmount);
     }
     if (specialAmount > 0)
     {
         npc.RemoveInvItem(FindMaterial(npc, specialMat, specialAmount), specialAmount);
     }
     if (skaviAmount > 0)
     {
         npc.RemoveInvItem(FindMaterial(npc, skaviMat, skaviAmount), skaviAmount);
     }
     npc.AddItemToInv(Item.LoadItem(path));
     npc.XpGain(100 * npc.level);
 }
Example #2
0
        void AddItem(NPC bounty, string name, int count)
        {
            Item item             = Item.LoadItem(name, "Event Items", "Item");
            int  amountMultiplier = item.Scale(bounty.level * 5);

            bounty.AddItemToInv(item, count * amountMultiplier, true);
        }
Example #3
0
        public static NPC GetBoss(Area dungeon)
        {
            NPC boss = Utils.RunMethod <NPC>(dungeon.name.Split(':')[1].Replace(" ", "") + "_Boss",
                                             typeof(Dungeons), dungeon);

            boss.level = dungeon.GetAreaFloorLevel(Program.rng);
            boss.Evolve(2, true, false);
            if (Program.Chance(50))
            {
                boss.AddItemToInv(Item.RandomItem(boss.level, 5));
            }
            return(boss);
        }
        public async Task New_Bounty(string areaName, string creatureName = null, int floor = 0, int level = 1, string grantDrop = null)
        {
            if (IsGMLevel(4).Result)
            {
                areaName = StringM.UpperAt(areaName);
                //areaName = Area.AreaDataExist(areaName);
                if (areaName != null)
                {
                    Area area = Area.LoadFromName(areaName);
                    floor = Verify.MinMax(floor, area.floors);
                    //
                    NPC mob = null;
                    if (creatureName != null)
                    {
                        mob = NPC.GenerateNPC(Verify.Min(level, 0),
                                              StringM.UpperAt(creatureName));
                    }
                    if (mob == null)
                    {
                        mob = area.GetAMob(Program.rng, floor);
                    }
                    //
                    if (grantDrop != null)
                    {
                        Item grant = Item.LoadItem(grantDrop);
                        if (grant != null)
                        {
                            mob.AddItemToInv(grant, 1, true);
                        }
                    }

                    //
                    PopulationHandler.Add(area, mob);

                    await DUtils.DeleteContextMessageAsync(Context);
                }
                else
                {
                    await DUtils.Replydb(Context, "Area not found.");
                }
            }
        }