Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("PouchID,Name,Description,Amount,Weight,UsagePerDay,StockOut")] Pouch pouch)
        {
            if (id != pouch.PouchID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pouch);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PouchExists(pouch.PouchID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pouch));
        }
Example #2
0
        public virtual void UseTrapPouch(Mobile from)
        {
            Pouch pouch = FindPouch(from);

            if (pouch != null && pouch.TrapType == TrapType.MagicTrap)
            {
                pouch.ExecuteTrap(from);
            }
        }
Example #3
0
        public virtual void TrapPouch(Mobile from)
        {
            Spell spell = null;
            Pouch pouch = FindPouch(from);

            if (pouch != null && pouch.TrapType == TrapType.None)
            {
                spell = new MagicTrapSpell(from, null);
                spell.Cast();
            }
        }
Example #4
0
 private void GiveMoney(Pouch p, IEnumerable <Hero> heroes)
 {
     foreach (Hero h in heroes)
     {
         h.Inventory.Pouch[CoinType.Copper]    += p[CoinType.Copper];
         h.Inventory.Pouch[CoinType.Silver]    += p[CoinType.Silver];
         h.Inventory.Pouch[CoinType.Gold]      += p[CoinType.Gold];
         h.Inventory.Pouch[CoinType.Platinium] += p[CoinType.Platinium];
         MessageBox.Show($"{p.TotalValue} added to {h.Name}'s main inventory.");
     }
 }
Example #5
0
        public async Task <IActionResult> Create([Bind("PouchID,Name,Description,Amount,Weight,UsagePerDay,StockOut")] Pouch pouch)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pouch);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pouch));
        }
Example #6
0
        public static void BlowPouch_OnCommand(CommandEventArgs e)
        {
            bool   nopouch = true;
            Mobile from    = e.Mobile;

            if (from.Backpack != null)
            {
                List <Pouch> pouches = from.Backpack.FindItemsByType <Pouch>();

                for (int i = 0; nopouch && i < pouches.Count; ++i)
                {
                    Pouch pouch = pouches[i];

                    if (pouch.TrapType == TrapType.MagicTrap)
                    {
                        DoubleClickCommand.CommandUseReq(from, pouch);
                        nopouch = false;
                    }
                }
                List <TPouch> pouches2 = from.Backpack.FindItemsByType <TPouch>();

                for (int i = 0; nopouch && i < pouches2.Count; ++i)
                {
                    TPouch pouch2 = pouches2[i];

                    if (pouch2.TrapType == TrapType.MagicTrap)
                    {
                        DoubleClickCommand.CommandUseReq(from, pouch2);
                        nopouch = false;
                    }
                }

                List <ChargeableTrapPouch> pouches3 = from.Backpack.FindItemsByType <ChargeableTrapPouch>();

                for (int i = 0; nopouch && i < pouches3.Count; ++i)
                {
                    ChargeableTrapPouch pouch3 = pouches3[i];

                    if (pouch3.TrapType == TrapType.MagicTrap)
                    {
                        DoubleClickCommand.CommandUseReq(from, pouch3);
                        nopouch = false;
                    }
                }

                if (nopouch)
                {
                    from.SendMessage("You do not have any magically trapped pouches.");
                }
            }
        }
            public InternalSellInfo()
            {
                Add(typeof(VendorRentalContract), VendorRentalContract.GetSBSellValue());

                Add(typeof(Torch), Torch.GetSBSellValue());
                Add(typeof(Candle), Candle.GetSBSellValue());
                Add(typeof(Backpack), Backpack.GetSBSellValue());
                Add(typeof(Bag), Bag.GetSBSellValue());
                Add(typeof(Pouch), Pouch.GetSBSellValue());

                Add(typeof(Chessboard), Chessboard.GetSBSellValue());
                Add(typeof(CheckerBoard), CheckerBoard.GetSBSellValue());
                Add(typeof(Backgammon), Backgammon.GetSBSellValue());
                Add(typeof(Dices), Dices.GetSBSellValue());
            }
Example #8
0
            public InternalBuyInfo()
            {
                Add(new GenericBuyInfo("Lockpick", typeof(Lockpick), Lockpick.GetSBPurchaseValue(), 100, 0x14FC, 0));
                Add(new GenericBuyInfo("Dagger", typeof(Dagger), Dagger.GetSBPurchaseValue(), 25, 0xF52, 0));

                Add(new GenericBuyInfo("Lantern", typeof(Lantern), Lantern.GetSBPurchaseValue(), 25, 0xA25, 0));
                Add(new GenericBuyInfo("Torch", typeof(Torch), Torch.GetSBPurchaseValue(), 25, 0xF6B, 0));
                Add(new GenericBuyInfo("Candle", typeof(Candle), Candle.GetSBPurchaseValue(), 25, 0xA28, 0));
                Add(new GenericBuyInfo("Bedroll", typeof(Bedroll), Bedroll.GetSBPurchaseValue(), 25, 0xA57, 0));
                Add(new GenericBuyInfo("Backpack", typeof(Backpack), Backpack.GetSBPurchaseValue(), 25, 0x9B2, 0));
                Add(new GenericBuyInfo("Bag", typeof(Bag), Bag.GetSBPurchaseValue(), 25, 0xE76, 0));
                Add(new GenericBuyInfo("Pouch", typeof(Pouch), Pouch.GetSBPurchaseValue(), 25, 0xE79, 0));
                Add(new GenericBuyInfo("Wooden Box", typeof(WoodenBox), WoodenBox.GetSBPurchaseValue(), 25, 0xE7D, 0));

                Add(new GenericBuyInfo("Hair Dye", typeof(HairDye), HairDye.GetSBPurchaseValue(), 10, 0xEFF, 0));
            }
            public InternalBuyInfo()
            {
                Add(new GenericBuyInfo("Vendor Rental Contract", typeof(VendorRentalContract), VendorRentalContract.GetSBPurchaseValue(), 25, 0x14F0, 0));

                Add(new GenericBuyInfo("Lantern", typeof(Lantern), Lantern.GetSBPurchaseValue(), 25, 0xA25, 0));
                Add(new GenericBuyInfo("Torch", typeof(Torch), Torch.GetSBPurchaseValue(), 25, 0xF6B, 0));
                Add(new GenericBuyInfo("Candle", typeof(Candle), Candle.GetSBPurchaseValue(), 25, 0xA28, 0));
                Add(new GenericBuyInfo("Backpack", typeof(Backpack), Backpack.GetSBPurchaseValue(), 25, 0x9B2, 0));
                Add(new GenericBuyInfo("Bag", typeof(Bag), Bag.GetSBPurchaseValue(), 25, 0xE76, 0));
                Add(new GenericBuyInfo("Pouch", typeof(Pouch), Pouch.GetSBPurchaseValue(), 25, 0xE79, 0));

                Add(new GenericBuyInfo("Chess Board", typeof(Chessboard), Chessboard.GetSBPurchaseValue(), 25, 0xFA6, 0));
                Add(new GenericBuyInfo("Checker Board", typeof(CheckerBoard), CheckerBoard.GetSBPurchaseValue(), 25, 0xFA6, 0));
                Add(new GenericBuyInfo("Backgammon", typeof(Backgammon), Backgammon.GetSBPurchaseValue(), 25, 0xE1C, 0));
                Add(new GenericBuyInfo("Dice", typeof(Dices), Dices.GetSBPurchaseValue(), 25, 0xFA7, 0));
            }
Example #10
0
            public InternalSellInfo()
            {
                Add(typeof(Lockpick), Lockpick.GetSBSellValue());
                Add(typeof(Dagger), Dagger.GetSBSellValue());

                Add(typeof(Lantern), Lantern.GetSBSellValue());
                Add(typeof(Torch), Torch.GetSBSellValue());
                Add(typeof(Candle), Candle.GetSBSellValue());
                Add(typeof(Bedroll), Bedroll.GetSBSellValue());
                Add(typeof(Backpack), Backpack.GetSBSellValue());
                Add(typeof(Bag), Bag.GetSBSellValue());
                Add(typeof(Pouch), Pouch.GetSBSellValue());
                Add(typeof(WoodenBox), WoodenBox.GetSBSellValue());

                Add(typeof(HairDye), HairDye.GetSBSellValue());
            }
Example #11
0
        public async Task <IActionResult> Create([Bind("DialysisID,PouchID,DialysisDate,DialysisTime,OutWeight")] Dialysis dialysis)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dialysis);
                await _context.SaveChangesAsync();

                Pouch pou = _context.Pouch.First(p => p.PouchID == dialysis.PouchID);
                pou.StockOut -= 1;

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PouchID"] = new SelectList(_context.Pouch, "PouchID", "Name", dialysis.PouchID);
            return(View(dialysis));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DeliveryPouchID,DeliveryID,PouchID,OrderQuantity,Delivered")] DeliveryPouch deliveryPouch)
        {
            if (id != deliveryPouch.DeliveryPouchID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(deliveryPouch);
                    await _context.SaveChangesAsync();

                    if (deliveryPouch.Delivered)
                    {
                        Pouch pouch = _context.Pouch.First(p => p.PouchID == deliveryPouch.PouchID);
                        pouch.StockOut += deliveryPouch.OrderQuantity;
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeliveryPouchExists(deliveryPouch.DeliveryPouchID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DeliveryID"] = new SelectList(_context.Delivery, "DeliveryID", "DeliveryID", deliveryPouch.DeliveryID);
            ViewData["PouchID"]    = new SelectList(_context.Pouch, "PouchID", "PouchID", deliveryPouch.PouchID);
            return(View(deliveryPouch));
        }
Example #13
0
        public static void BlowPouch_OnCommand(CommandEventArgs e)
        {
            bool   nopouch = true;
            Mobile m       = e.Mobile;

            List <Pouch> pouches = m.Backpack.FindItemsByType <Pouch>();

            for (int i = 0; nopouch && i < pouches.Count; ++i)
            {
                Pouch pouch = pouches[i];

                if (pouch.TrapType == TrapType.MagicTrap)
                {
                    pouch.ExecuteTrap(m);
                    nopouch = false;
                }
            }

            if (nopouch)
            {
                m.SendMessage("You have no trapped pouchs.");
            }
        }
Example #14
0
        public static void BlowPouch_OnCommand(CommandEventArgs e)
        {
            bool pouchfound = false;

            Item[] pouchs = e.Mobile.Backpack.FindItemsByType(typeof(Pouch));

            for (int i = 0; i < pouchs.Length; ++i)
            {
                Pouch pouch = pouchs[i] as Pouch;

                if ((int)pouch.TrapType == 1)
                {
                    pouch.OnDoubleClick(e.Mobile);
                    pouchfound = true;
                    break;
                }
            }

            if (!pouchfound)
            {
                e.Mobile.SendMessage("You have no trapped pouchs left.");
            }
        }
            public InternalSellInfo()
            {
                Add(typeof(Arrow), Arrow.GetSBSellValue());
                Add(typeof(Bolt), Bolt.GetSBSellValue());
                Add(typeof(Bandage), Bandage.GetSBSellValue());

                Add(typeof(Scissors), Scissors.GetSBSellValue());
                Add(typeof(SewingKit), SewingKit.GetSBSellValue());
                Add(typeof(Dyes), Dyes.GetSBSellValue());
                Add(typeof(DyeTub), DyeTub.GetSBSellValue());

                Add(typeof(Lockpick), Lockpick.GetSBSellValue());
                Add(typeof(Skillet), Skillet.GetSBSellValue());
                Add(typeof(Dagger), Dagger.GetSBSellValue());

                Add(typeof(Lantern), Lantern.GetSBSellValue());
                Add(typeof(Torch), Torch.GetSBSellValue());
                Add(typeof(Candle), Candle.GetSBSellValue());
                Add(typeof(Bedroll), Bedroll.GetSBSellValue());
                Add(typeof(Backpack), Backpack.GetSBSellValue());
                Add(typeof(Bag), Bag.GetSBSellValue());
                Add(typeof(Pouch), Pouch.GetSBSellValue());
                Add(typeof(WoodenBox), WoodenBox.GetSBSellValue());
            }
            public InternalBuyInfo()
            {
                Add(new GenericBuyInfo("Arrow", typeof(Arrow), Arrow.GetSBPurchaseValue(), 500, 0xF3F, 0));
                Add(new GenericBuyInfo("Bolt", typeof(Bolt), Bolt.GetSBPurchaseValue(), 500, 0x1BFB, 0));
                Add(new GenericBuyInfo("Bandage", typeof(Bandage), Bandage.GetSBPurchaseValue(), 250, 0xE21, 0));

                Add(new GenericBuyInfo("Scissors", typeof(Scissors), Scissors.GetSBPurchaseValue(), 25, 0xF9F, 0));
                Add(new GenericBuyInfo("Sewing Kit", typeof(SewingKit), SewingKit.GetSBPurchaseValue(), 50, 0xF9D, 0));
                Add(new GenericBuyInfo("Dyes", typeof(Dyes), Dyes.GetSBPurchaseValue(), 25, 0xFA9, 0));
                Add(new GenericBuyInfo("Dye Tub", typeof(DyeTub), DyeTub.GetSBPurchaseValue(), 25, 0xFAB, 0));

                Add(new GenericBuyInfo("Lockpick", typeof(Lockpick), Lockpick.GetSBPurchaseValue(), 100, 0x14FC, 0));
                Add(new GenericBuyInfo("Skillet", typeof(Skillet), Skillet.GetSBPurchaseValue(), 50, 0x97F, 0));
                Add(new GenericBuyInfo("Dagger", typeof(Dagger), Dagger.GetSBPurchaseValue(), 25, 0xF52, 0));

                Add(new GenericBuyInfo("Lantern", typeof(Lantern), Lantern.GetSBPurchaseValue(), 25, 0xA25, 0));
                Add(new GenericBuyInfo("Torch", typeof(Torch), Torch.GetSBPurchaseValue(), 25, 0xF6B, 0));
                Add(new GenericBuyInfo("Candle", typeof(Candle), Candle.GetSBPurchaseValue(), 25, 0xA28, 0));
                Add(new GenericBuyInfo("Bedroll", typeof(Bedroll), Bedroll.GetSBPurchaseValue(), 25, 0xA57, 0));
                Add(new GenericBuyInfo("Backpack", typeof(Backpack), Backpack.GetSBPurchaseValue(), 25, 0x9B2, 0));
                Add(new GenericBuyInfo("Bag", typeof(Bag), Bag.GetSBPurchaseValue(), 25, 0xE76, 0));
                Add(new GenericBuyInfo("Pouch", typeof(Pouch), Pouch.GetSBPurchaseValue(), 25, 0xE79, 0));
                Add(new GenericBuyInfo("Wooden Box", typeof(WoodenBox), WoodenBox.GetSBPurchaseValue(), 25, 0xE7D, 0));
            }
Example #17
0
        public override void ProcessTarget(Target targ)
        {
            bool isDispel     = (targ is DispelSpell.InternalTarget);
            bool isParalyze   = (targ is ParalyzeSpell.InternalTarget);
            bool isTeleport   = (targ is TeleportSpell.InternalTarget);
            bool isCrossHeal  = (targ is GreaterHealSpell.InternalTarget);
            bool isTrap       = (targ is MagicTrapSpell.InternalTarget);
            bool teleportAway = false;
            bool isReveal     = (targ is RevealSpell.InternalTarget || targ is DetectHidden.InternalTarget);

            Mobile toTarget = null;
            Mobile toHeal   = null;

            if (isReveal)
            {
                targ.Invoke(m_Mobile, m_Mobile);
            }

            if (isTrap)
            {
                Pouch p = FindPouch(m_Mobile);
                if (p != null)
                {
                    targ.Invoke(m_Mobile, p);
                }
                else
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }

            if (isDispel)
            {
                toTarget = FindDispelTarget(false);

                if (toTarget != null && m_Mobile.InRange(toTarget, 10) && !toTarget.Paralyzed)
                {
                    RunFrom(toTarget);
                }
            }

            if (CrossHeals && isCrossHeal)
            {
                toHeal = FindHealTarget(true);

                if (toHeal != null && !m_Mobile.InRange(toHeal, 8))
                {
                    RunTo(toHeal, CanRun);
                }
            }

            else if (isParalyze || isTeleport)
            {
                toTarget = FindDispelTarget(true);

                if (toTarget == null)
                {
                    toTarget = m_Mobile.Combatant;

                    if (toTarget != null && !m_Mobile.InRange(toTarget, 8))
                    {
                        RunTo(toTarget, CanRun);
                    }
                }
                else if (m_Mobile.InRange(toTarget, 10))
                {
                    RunFrom(toTarget);
                    teleportAway = true;
                }
                else
                {
                    teleportAway = true;
                }
            }

            else
            {
                if (m_Mobile.ControlOrder == OrderType.Come && isTeleport)
                {
                    toTarget = m_Mobile.ControlMaster;
                }
                else
                {
                    toTarget = m_Mobile.Combatant;
                }

                if (toTarget != null)
                {
                    RunTo(toTarget, CanRun);
                }
            }

            if ((targ.Flags & TargetFlags.Harmful) != 0 && toTarget != null)
            {
                if ((m_Mobile.InRange(toTarget, 10)) && m_Mobile.CanSee(toTarget) && m_Mobile.InLOS(toTarget))
                {
                    targ.Invoke(m_Mobile, toTarget);
                }
                else if (isDispel)
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }

            else if ((targ.Flags & TargetFlags.Beneficial) != 0 && toHeal != null)
            {
                if ((m_Mobile.InRange(toHeal, 10)) && m_Mobile.CanSee(toHeal) && m_Mobile.InLOS(toHeal) && NeedGHeal(toHeal))
                {
                    targ.Invoke(m_Mobile, toHeal);
                }
                else
                {
                    Targeting.Target.Cancel(m_Mobile);
                }
            }

            else if ((targ.Flags & TargetFlags.Beneficial) != 0)
            {
                if (!isCrossHeal)
                {
                    targ.Invoke(m_Mobile, m_Mobile);
                }
                if ((isCrossHeal) && (NeedGHeal(m_Mobile)))
                {
                    targ.Invoke(m_Mobile, m_Mobile);
                }
                else
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                }
            }
            else if (isTeleport && toTarget != null)
            {
                Map map = m_Mobile.Map;

                if (map == null)
                {
                    targ.Cancel(m_Mobile, TargetCancelType.Canceled);
                    return;
                }

                int px, py;

                if (teleportAway)
                {
                    int rx = m_Mobile.X - toTarget.X;
                    int ry = m_Mobile.Y - toTarget.Y;

                    double d = m_Mobile.GetDistanceToSqrt(toTarget);

                    px = toTarget.X + (int)(rx * (10 / d));
                    py = toTarget.Y + (int)(ry * (10 / d));
                }
                else
                {
                    px = toTarget.X;
                    py = toTarget.Y;
                }

                for (int i = 0; i < m_Offsets.Length; i += 2)
                {
                    int x = m_Offsets[i], y = m_Offsets[i + 1];

                    Point3D p = new Point3D(px + x, py + y, 0);

                    LandTarget lt = new LandTarget(p, map);

                    if ((targ.Range == -1 || m_Mobile.InRange(p, targ.Range)) && m_Mobile.InLOS(lt) && map.CanSpawnMobile(px + x, py + y, lt.Z) && !SpellHelper.CheckMulti(p, map))
                    {
                        targ.Invoke(m_Mobile, lt);
                        return;
                    }
                }

                int teleRange = targ.Range;

                if (teleRange < 0)
                {
                    teleRange = 12;
                }

                for (int i = 0; i < 10; ++i)
                {
                    Point3D randomPoint = new Point3D(m_Mobile.X - teleRange + Utility.Random(teleRange * 2 + 1), m_Mobile.Y - teleRange + Utility.Random(teleRange * 2 + 1), 0);

                    LandTarget lt = new LandTarget(randomPoint, map);

                    if (m_Mobile.InLOS(lt) && map.CanSpawnMobile(lt.X, lt.Y, lt.Z) && !SpellHelper.CheckMulti(randomPoint, map))
                    {
                        targ.Invoke(m_Mobile, new LandTarget(randomPoint, map));
                        return;
                    }
                }

                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }
            else
            {
                targ.Cancel(m_Mobile, TargetCancelType.Canceled);
            }
        }
        public override void OnCast()
        {
            if (CheckSequence())
            {
                Item   item = new Dagger();
                string msg  = "You conjure a dagger.";

                switch (Utility.RandomMinMax(1, 28))
                {
                case 1: item = new Apple(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some apples."; break;

                case 2: item = new Arrow(); item.Amount = Utility.RandomMinMax(1, 10); msg = "You conjure some arrows."; break;

                case 3: item = new Backpack(); msg = "You conjure a backpack."; break;

                case 4: item = new Bag(); msg = "You conjure a bag."; break;

                case 5: item = new Bandage(); item.Amount = Utility.RandomMinMax(1, 10); msg = "You conjure some bandages."; break;

                case 6: item = new Bedroll(); msg = "You conjure a bedroll."; break;

                case 7: item = new Beeswax(); msg = "You conjure some beeswax."; break;

                case 8: item = new BlueBook(); msg = "You conjure a book."; break;

                case 9: item = new Bolt(); item.Amount = Utility.RandomMinMax(1, 10); msg = "You conjure some crossbow bolts."; break;

                case 10: item = new Bottle(); msg = "You conjure a bottle."; break;

                case 11: item = new BreadLoaf(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some bread."; break;

                case 12: item = new Candle(); msg = "You conjure a candle."; break;

                case 13: item = new Club(); msg = "You conjure a club."; break;

                case 14: item = new Dagger(); msg = "You conjure a dagger."; break;

                case 15: item = new DarkYarn(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some yarn."; break;

                case 16: item = new FloppyHat(); msg = "You conjure a hat."; break;

                case 17: item = new Jar(); msg = "You conjure a jar."; break;

                case 18: item = new Kindling(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some kindling."; break;

                case 19: item = new Lantern(); msg = "You conjure a lantern."; break;

                case 20: item = new Lockpick(); msg = "You conjure a lockpick."; break;

                case 21: item = new OilCloth(); msg = "You conjure an oil cloth."; break;

                case 22: item = new Pouch(); msg = "You conjure a pouch."; break;

                case 23: item = new Robe(); msg = "You conjure a robe."; break;

                case 24: item = new Shoes(); msg = "You conjure some shoes."; break;

                case 25: item = new SpoolOfThread(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some thread."; break;

                case 26: item = new TenFootPole(); msg = "You conjure a ten foot pole."; break;

                case 27: item = new Torch(); msg = "You conjure a torch."; break;

                case 28: item = new Waterskin(); msg = "You conjure a waterskin."; break;
                }

                Caster.SendMessage(msg);

                Caster.AddToBackpack(item);

                Caster.FixedParticles(0, 10, 5, 2003, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, EffectLayer.RightHand);
                Caster.PlaySound(0x1E2);

                Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, true);
            }

            FinishSequence();
        }
Example #19
0
 public Pouch SetSuccessor(Pouch mainPouch)
 {
     this.pouch = mainPouch;
     return(mainPouch);
 }
    // // null - remove drop | else - add equip
    // public void SetEquipped(base_item item)
    // {
    //     // drop
    //     if (item == null)
    //     {
    //         // unequipped
    //         if (!controller_player.Instance.Data.Equipped)
    //             // ignore
    //             return;
    //         // // player
    //         // if (gameObject.layer == game_variables.Instance.LayerPlayer)
    //         // {
    //         //     // remove
    //         //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : drop " + controller_player.Instance.Data.Equipped?.gameObject.name, game_variables.Instance.ColorItem);
    //         //     InventoryModify(controller_player.Instance.Data.Equipped, false);
    //         // }
    //         // clear reference
    //         // controller_player.Instance.Data.Equipped.SetParent(null);
    //         // controller_player.Instance.Data.Equipped.SetActive(true);
    //         // controller_player.Instance.Data.SetEquipped(null);
    //     }
    //     // pickup
    //     else
    //     {
    //         // equipped
    //         if (controller_player.Instance.Data.Equipped)
    //         {
    //             // // space or match
    //             // if (IsEmptyOrContains(item))
    //                 // // holster ?
    //                 // controller_player.Instance.Data.Equipped.SetActive(false);
    //                 // ignore
    //                 // return;
    //             // // player
    //             // if (gameObject.layer == game_variables.Instance.LayerPlayer)
    //             // {
    //             //     // remove
    //             //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : drop " + controller_player.Instance.Data.Equipped?.gameObject.name, game_variables.Instance.ColorItem);
    //             //     InventoryModify(controller_player.Instance.Data.Equipped, false);
    //             // }
    //             // clear reference
    //             // controller_player.Instance.Data.Equipped.SetParent(null);
    //             // controller_player.Instance.Data.Equipped.SetActive(true);
    //             controller_player.Instance.Data.SetEquipped(null);
    //         }
    //         // else if (menu_inventory.Instance.IsEmptyOrContains(item))
    //         // {
    //         //     //
    //         // }
    //         // // player
    //         // if (gameObject.layer == game_variables.Instance.LayerPlayer)
    //         // {
    //         //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : equip " + item.gameObject.name, game_variables.Instance.ColorItem);
    //         //     // menu_inventory.Instance.SetEquipped(item, true);
    //         //     // controller_player.Instance.Data.SetEquipped(item);
    //         //     InventoryModify(item, true);
    //         // }
    //         // store reference
    //         controller_player.Instance.Data.SetEquipped(item);
    //         // controller_player.Instance.Data.Equipped.SetActive(true);
    //         // controller_player.Instance.Data.Equipped.SetParent(controller_player.Instance.Motor._anchor);
    //     }
    // }
    // true - add | false - remove
    public bool Modify(base_item item, bool equip)
    {
        Pouch remove = new Pouch();

        for (int i = 0; i < _equipment.Count; i++)
        {
            if (_equipment[i].Item == item)
            {
                if (equip)
                {
                    // match - duplicate
                    feedback_toaster.Instance.RegisterMessage("Equip : " + item.gameObject.name, game_variables.Instance.ColorItem);
                    return(true);
                }
                else
                {
                    // match - remove
                    remove = _equipment[i];
                }
                break;
            }
        }
        if (_equipment.Contains(remove))
        {
            _equipment.Remove(remove);
            // drop item
            feedback_toaster.Instance.RegisterMessage("Drop : " + remove.Item.gameObject.name, game_variables.Instance.ColorItem);
            remove.Slot.GetComponent <SelfDestruct>().Trigger();
            return(true);
        }
        if (equip)
        {
            // if (_equipment.Count < 5)
            if (IsEmpty)
            {
                // no match, space - add
                Pouch pouch = new Pouch();
                pouch.Slot = Instantiate(_pouch, transform.position, transform.rotation).transform;
                pouch.Slot.SetParent(transform);
                pouch.Slot.gameObject.SetActive(true);
                pouch.Slot.GetComponent <button_pouch>().ID = _equipment.Count;
                pouch.Item   = item;
                pouch.Status = pouch.Slot.GetChild(0).GetComponent <Text>();
                _equipment.Add(pouch);
                feedback_toaster.Instance.RegisterMessage("Equip : " + item.gameObject.name, game_variables.Instance.ColorItem);
                return(true);
            }
            else
            {
                // full - warning
                feedback_toaster.Instance.RegisterMessage("Inventory Full - Cannot Equip Item", game_variables.Instance.ColorDefault);
            }
            // {
            //     for (int i = 0; i < _equipment.Count; i++)
            //     {
            //         if (_equipment[i].Item == controller_player.Instance.Data.Equipped)
            //         {
            //             // full, equipped - replace
            //             feedback_toaster.Instance.RegisterMessage("Drop : " + _equipment[i].Item.gameObject.name, game_variables.Instance.ColorItem);
            //             Pouch pouch = new Pouch();
            //             pouch.Slot = _equipment[i].Slot;
            //             pouch.Item = item;
            //             pouch.Status = _equipment[i].Status;
            //             // _equipment[i].Item.SetActive(true);
            //             _equipment[i] = pouch;
            //             feedback_toaster.Instance.RegisterMessage("Equip : " + item.gameObject.name, game_variables.Instance.ColorItem);
            //             return true;
            //         }
            //     }
            // }
        }
        return(false);
    }
Example #21
0
 public void TurnAuthorityOff()
 {
     authority    = false;
     m_localPouch = m_authorityPouch;
 }
        private static void GiveItems(Mobile m)
        {
            Container pack = m.Backpack;

            if (pack == null)
            {
                return;
            }

            // Frog Drop

            /*
             * MetalBox box = new MetalBox();
             * box.Name = "<BASEFONT COLOR='#007FFF'>Frog Drop Collection";
             * box.LootType = LootType.Blessed;
             * box.Locked = true;
             * box.RequiredSkill = box.LockLevel = 1000;
             * box.DropItem( new WorldMap() );
             * box.DropItem( new RedLeaves() );
             * box.DropItem( new Sand() );
             * box.DropItem( new SpecialHairDye() );
             * box.DropItem( new Rope() );
             * box.DropItem( new Vines() );
             * box.DropItem( new TribalPaint() );
             * box.DropItem( new RockArtifact() );
             * box.DropItem( new Runebook() );
             * box.DropItem( new Gold( 500 ) );
             */
            pack.DropItem(new FrogDropBag(true));

            // Angel's Snack
            Pouch pouch = new Pouch();

            pouch.DropItem(new HealPotion(25));
            pouch.DropItem(new CurePotion(25));
            pouch.DropItem(new RefreshPotion(25));
            pack.DropItem(pouch);

            // Forks
            Bag bag = new Bag();

            bag.Name = "Forks";
            bag.DropItem(new BistroFork());
            bag.DropItem(new GastroFork());
            bag.DropItem(new SilverFork());
            pack.DropItem(bag);

            // Spellcasting Stuff
            bag      = new Bag();
            bag.Name = "Spell Casting Stuff";
            TomeOfLostKnowledge tome = new TomeOfLostKnowledge();

            tome.Name    = "Tome Of Lost Knowledge [Replica]";
            tome.Content = 18446744073709551615;
            bag.DropItem(tome);
            bag.DropItem(new CompleteNecromancerSpellbook());
            bag.DropItem(new BagOfAllReagents());
            CrystallineRing ring = new CrystallineRing();

            ring.Name = "Crystalline Ring [Replica]";
            bag.DropItem(ring);
            OrnamentOfTheMagician brace = new OrnamentOfTheMagician();

            brace.Name = "Ornament Of The Magician [Replica]";
            bag.DropItem(brace);
            pack.DropItem(bag);

            // Blue Clothing
            MetalBox box = new MetalBox();

            box.Name = "Blue Clothing";
            box.DropItem(new BlueHat());
            box.DropItem(new BlueArms());
            box.DropItem(new BlueShirt());
            box.DropItem(new BluePants());
            box.DropItem(new BlueBoots());
            box.DropItem(new BlueCloak());
            box.DropItem(new BlueSash());
            box.DropItem(new BlueBelt());

            WoodenBox wood = new WoodenBox();

            wood.Name = "Tier One Deeds";
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    wood.DropItem(new BlueEnhanceDeed((BlueEnhance)(i + 1), 1));
                }
            }
            box.DropItem(wood);

            wood      = new WoodenBox();
            wood.Name = "Tier Two Deeds";
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    wood.DropItem(new BlueEnhanceDeed((BlueEnhance)(j + 1), 2));
                }
            }
            box.DropItem(wood);
            pack.DropItem(box);
        }