コード例 #1
0
        public void TestAddMultipleItemsToBag()
        {
            Bag bag = new Bag();

            bag.AddItem(Listof_Items.LongSword, 1);
            bag.AddItem(Listof_Items.LongSword, 1);
            Assert.AreEqual(2, bag.CheckForItem(Listof_Items.LongSword));
        }
コード例 #2
0
        private static void OnClean(CommandEventArgs e)
        {
            Mobile       from     = e.Mobile;
            bool         r_active = false;
            Bag          c_bag    = new Bag();
            ClassOrb     c_orb    = null;
            RaceOrb      r_orb    = null;
            BonusPackOrb b_orb    = null;

            foreach (Item i in World.Items.Values)
            {
                if (i is RCChest)
                {
                    r_active = true;
                }
            }

            if (r_active)
            {
                foreach (Item i in World.Items.Values)
                {
                    if (i is ClassOrb)
                    {
                        c_orb = i as ClassOrb;
                        if (!c_orb.Activated)
                        {
                            c_bag.AddItem(c_orb);
                        }
                    }
                }

                foreach (Item i in World.Items.Values)
                {
                    if (i is RaceOrb)
                    {
                        r_orb = i as RaceOrb;
                        if (!r_orb.Activated)
                        {
                            c_bag.AddItem(r_orb);
                        }
                    }
                }

                foreach (Item i in World.Items.Values)
                {
                    if (i is BonusPackOrb)
                    {
                        b_orb = i as BonusPackOrb;
                        if (!b_orb.Activated)
                        {
                            c_bag.AddItem(b_orb);
                        }
                    }
                }

                c_bag.Delete();
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: johndpotts/RPGInventory
        private static void BagTest()
        {
            Bag myBag = new Bag(3);
            var item1 = new Sword();
            var item2 = new Potion();

            myBag.AddItem(item1);
            myBag.AddItem(item2);

            myBag.DisplayContents();
        }
コード例 #4
0
        public void TestGetAllItemsFromBag()
        {
            Bag bag = new Bag();

            bag.AddItem(Listof_Items.LongSword, 1);
            bag.AddItem(Listof_Items.ShortSword, 1);
            var list = bag.GetAllItems();

            Assert.AreEqual(Listof_Items.LongSword, list[0].Name);
            Assert.AreEqual(1, list[0].Quanity);

            Assert.AreEqual(Listof_Items.ShortSword, list[1].Name);
            Assert.AreEqual(1, list[1].Quanity);
        }
コード例 #5
0
ファイル: PlayerController.cs プロジェクト: Xwilarg/Isathos
 private void Start()
 {
     _rb          = GetComponent <Rigidbody2D>();
     _sr          = GetComponent <SpriteRenderer>();
     _dir         = Direction.UP;
     _toSpeak     = null;
     _canMove     = true;
     _isCinematic = false;
     Inventory    = new Bag();
     Inventory.AddItem(ItemID.HUD);
     Inventory.AddItem(ItemID.HOUSE_KEY);
     Inventory.AddItem(ItemID.FOLDED_PAPER);
     Inventory.AddItem(ItemID.CELLPHONE);
 }
コード例 #6
0
 void Update()
 {
     //Envio da Interação com o objeto
     if (Input.GetButtonDown("Interact") && currentInterObj)
     {
         if (currentInterObjScript.baggable)
         {
             bag.AddItem(currentInterObj);
         }
         if (currentInterObjScript.openable)
         {
             if (currentInterObjScript.itemneeded)
             {
                 if (bag.Finditem(currentInterObjScript.ItemNeeded))
                 {
                     Debug.Log("cookie has been put on the " + currentInterObj);
                     //Play scene
                 }
                 else
                 {
                     Debug.Log("Fail");
                 }
             }
         }
     }
 }
コード例 #7
0
        public void TestCheckForItemInBag()
        {
            Bag bag = new Bag();

            bag.AddItem(Listof_Items.LongSword, 1);
            Assert.AreEqual(1, bag.CheckForItem(Listof_Items.LongSword));
        }
コード例 #8
0
 void Update()
 {
     if (GameManager.mainCamRendered)
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Input.GetMouseButton(0) && Physics.Raycast(ray, out hit))
         {
             //Debug.DrawLine(Camera.main.transform.position, hit.transform.position, Color.red, 0.1f, true);
             //Debug.Log(hit.transform.name);
             if (hit.distance <= 50)
             {
                 //Debug.Log(hit.transform.gameObject.name);
                 if (hit.transform.gameObject == this.gameObject)
                 {
                     if (item.id != 0)
                     {
                         bag = GameManager.bag;
                         bag.AddItem(item, unit);
                         GameManager.inGameLog.AddLog("You have collected " + item.itemName + ".", Color.blue);
                     }
                     else
                     {
                         int temp = Random.Range(10, 20);
                         item.unit += temp;
                         GameManager.inGameLog.AddLog("You have earned " + temp + " coin.", Color.yellow);
                     }
                     GameManager.AudioManager.GetComponent <BGMcontrol>().Playsound("PickUpObject");
                     Destroy(this.gameObject);
                 }
             }
         }
     }
 }
コード例 #9
0
ファイル: PickUpItem.cs プロジェクト: laterrain/WitchSpring2
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.Q))
     {
         Item item = itemModel.itemList[Random.Range(0, itemModel.itemList.Count)];
         bag.AddItem(item);
     }
 }
コード例 #10
0
ファイル: GreedyTimes.cs プロジェクト: mindball/CSharpOOP
 private static void InsertItem(string key, long value, Bag bag)
 {
     if (key.Length == 3)
     {
         Currency cash = new Currency(key, value);
         bag.AddItem("cash", cash);
     }
     else if (key.Length >= 4 && key.ToLower().EndsWith("gem"))
     {
         Gems gem = new Gems(key, value);
         bag.AddItem("Gem", gem);
     }
     else if (key.ToLower().Equals("gold"))
     {
         Gold gold = new Gold(key, value);
         bag.AddItem("Gold", gold);
     }
 }
コード例 #11
0
ファイル: Program.cs プロジェクト: johndpotts/RPGInventory
        private static void RemoveTest()
        {
            Bag myBag = new Bag(3);
            var item1 = new Sword();
            var item2 = new Potion();
            var item3 = new Sword();

            myBag.AddItem(item1);
            myBag.AddItem(item2);
            myBag.AddItem(item3);

            myBag.DisplayContents();

            var removed = myBag.RemoveItem();

            Console.WriteLine("Removed a {0}", removed.Name);

            myBag.DisplayContents();
        }
コード例 #12
0
    /// <summary>
    /// Responsible for trying to put an item into an empty slot in the bag.
    /// </summary>
    /// <param name="item">The item to check</param>
    /// <param name="bag">The bag to check</param>

    void AddToBag(Item item, Bag bag)
    {
        if (bag.AddItem(item))
        {
            Debug.Log(item + " was added in " + bag);
            return;
        }

        Debug.Log("Something went wrong, " + item + " was not put in " + bag);
    }
コード例 #13
0
        public void TestGetItemFromBag()
        {
            Bag bag = new Bag();

            bag.AddItem(Listof_Items.LongSword, 3);
            Assert.IsTrue(bag.GetItem(Listof_Items.LongSword));
            Assert.IsTrue(bag.GetItem(Listof_Items.LongSword));
            Assert.IsTrue(bag.GetItem(Listof_Items.LongSword));
            Assert.IsFalse(bag.GetItem(Listof_Items.LongSword));
        }
コード例 #14
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from      = sender.Mobile;
            ClassOrb     c_orb     = null;
            RCCONTROL    rc        = null;
            ClassControl c_control = null;
            Bag          d_bag     = new Bag();

            foreach (Item h in World.Items.Values)
            {
                if (h is ClassControl)
                {
                    c_control = h as ClassControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (info.ButtonID == c_orb.ClassNumber)
                    {
                        foreach (Item j in World.Items.Values)
                        {
                            if (j is RCCONTROL)
                            {
                                rc = j as RCCONTROL;
                                if (rc.P_Class == c_orb.ClassName)
                                {
                                    d_bag.AddItem(rc);
                                }
                            }
                        }
                        d_bag.Delete();
                        foreach (Item k in World.Items.Values)
                        {
                            if (k is Bag && k.Name == c_orb.ClassName + " Class")
                            {
                                k.Delete();
                                break;
                            }
                        }
                        c_control.A_Classes -= 1;
                        resetCOrbNums();
                        break;
                    }
                }
            }


            if (info.ButtonID == 0)
            {
            }
        }
コード例 #15
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile           from      = sender.Mobile;
            BonusPackOrb     b_orb     = null;
            RCCONTROL        rc        = null;
            BonusPackControl b_control = null;
            Bag d_bag = new Bag();

            foreach (Item h in World.Items.Values)
            {
                if (h is BonusPackControl)
                {
                    b_control = h as BonusPackControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is BonusPackOrb)
                {
                    b_orb = i as BonusPackOrb;
                    if (info.ButtonID == b_orb.BPNumber)
                    {
                        foreach (Item j in World.Items.Values)
                        {
                            if (j is RCCONTROL)
                            {
                                rc = j as RCCONTROL;
                                if (rc.BonusPack == b_orb.BPName)
                                {
                                    d_bag.AddItem(rc);
                                }
                            }
                        }
                        d_bag.Delete();
                        foreach (Item k in World.Items.Values)
                        {
                            if (k is Bag && k.Name == b_orb.BPName + " Bonus Pack")
                            {
                                k.Delete();
                                break;
                            }
                        }
                        b_control.A_BP -= 1;
                        resetBOrbNums();
                        break;
                    }
                }
            }


            if (info.ButtonID == 0)
            {
            }
        }
コード例 #16
0
 public void ReceiveItem(Item item)
 {
     if (IsAlive)
     {
         Bag.AddItem(item);
     }
     else
     {
         throw new InvalidOperationException("Must be alive to perform this action!");
     }
 }
コード例 #17
0
 private void OnTriggerEnter2D(Collider2D target)
 {
     if (target.gameObject.tag == "Item")
     {
         bool checkAddItem = bag.AddItem(target.GetComponent <Item>());
         if (checkAddItem)
         {
             Destroy(target.gameObject);
         }
     }
 }
コード例 #18
0
ファイル: ArmedEquipment.cs プロジェクト: TeamNull/FYP
    public void RemoveEquipment(int bagId)
    {
        equipmentList[bagId].RemoveAction();
        bag.AddItem(equipmentList[bagId], 1);

        equipmentList[bagId] = null;
        equipmentUIList[bagId].GetComponent <RawImage>().enabled          = true;
        equipmentUIList[bagId].GetChild(2).GetComponent <Image>().enabled = false;
        //equipmentUIList[Equipment.equipmentType].GetChild(2).GetComponent<Image>().sprite = Equipment.sprite;
        equipmentUIList[bagId].GetChild(1).gameObject.SetActive(false);
        equipmentUIList[bagId].GetComponent <ArmedEquipmentSlot>().item = null;
    }
コード例 #19
0
        private static void OnInitRaceClass(CommandEventArgs e)
        {
            Mobile from        = e.Mobile;
            bool   RaceClassOn = false;

            foreach (Item items in World.Items.Values)
            {
                if (items is RCChest)
                {
                    RaceClassOn = true;
                }
            }
            if (RaceClassOn)
            {
                from.SendMessage(6, "Race Class System is Already Active");
            }
            else
            {
                RCChest chest = new RCChest();
                chest.Location = new Point3D(from.X + 1, from.Y + 1, from.Z);
                chest.Map      = from.Map;
                chest.AddItem(new RaceControl());
                chest.AddItem(new ClassControl());

                Container r_bag = new Bag();
                r_bag.Name = "RACES";
                chest.AddItem(r_bag);

                Container c_bag = new Bag();
                c_bag.Name = "CLASSES";
                chest.AddItem(c_bag);

                Container b_bag = new Bag();
                b_bag.Name = "BONUS PACKS";
                c_bag.AddItem(b_bag);
                c_bag.AddItem(new BonusPackControl());
            }
        }
コード例 #20
0
        public override void OnSlotDragEnd(Slot originalSlot, Slot targetSlot, PointerEventData eventData)
        {
            base.OnSlotDragEnd(originalSlot, targetSlot, eventData);

            BagSlot originalBagSlot = (BagSlot)originalSlot;

            if (targetSlot != null && originalBagSlot.ItemGroup != null)
            {
                if (targetSlot.Manager == this) // 在同一SlotManager中拖拽
                {
                    BagSlot targetBagSlot = (BagSlot)targetSlot;
                    Bag.MoveItemGroup(originalBagSlot.Index, targetBagSlot.Index);
                }
                else if (targetSlot.Manager.Flag == SlotManagerFlag.ShopBagPanel) // 拖到商店的格子上
                {
                    BagSlot targetBagSlot = (BagSlot)targetSlot;

                    // 出售
                    BagPanel shopBagPanel = targetBagSlot.Manager;
                    Bag      shopBag      = shopBagPanel.Bag;

                    ItemGroup selling = Bag.RemoveItemGroup(originalBagSlot.Index);
                    selling.Count = shopBagPanel.Bag.AddItemGroup(targetBagSlot.Index, selling);

                    if (selling.Count > 0) // 没卖完
                    {
                        Bag.AddItemGroup(originalBagSlot.Index, selling);
                    }
                }
                else if (targetSlot.Manager.Flag == SlotManagerFlag.PlayerEquipmentsPanel) // 拖到装备槽上
                {
                    EquipmentSlot targetEquipmentSlot = (EquipmentSlot)targetSlot;
                    Character     character           = targetEquipmentSlot.Manager.Character;
                    Item          equipment           = originalBagSlot.ItemGroup.Item;
                    // 替换装备
                    Item replaceEquipment = targetEquipmentSlot.Item;

                    if (character.Equip(equipment, targetEquipmentSlot.EquipmentSlotType)) // 装备成功
                    {
                        Bag.RemoveItemGroup(originalBagSlot.Index);
                        if (replaceEquipment != null)
                        {
                            Bag.AddItem(originalBagSlot.Index, replaceEquipment, 1);
                        }
                    }
                }
            }
        }
コード例 #21
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from      = sender.Mobile;
            RaceOrb     r_orb     = null;
            RCCONTROL   rc        = null;
            RaceControl r_control = null;
            Bag         d_bag     = new Bag();

            foreach (Item h in World.Items.Values)
            {
                if (h is RaceControl)
                {
                    r_control = h as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (info.ButtonID == r_orb.RaceNumber)
                    {
                        foreach (Item j in World.Items.Values)
                        {
                            if (j is RCCONTROL)
                            {
                                rc = j as RCCONTROL;
                                if (rc.Race == r_orb.RaceName)
                                {
                                    d_bag.AddItem(rc);
                                }
                            }
                        }
                        d_bag.Delete();
                        r_orb.Delete();
                        r_control.A_Races -= 1;
                        resetROrbNums();
                        break;
                    }
                }
            }

            if (info.ButtonID == 0)
            {
            }
        }
コード例 #22
0
        public void TestGetRandomItemFromBag()
        {
            Bag bag = new Bag();

            bag.AddItem(Listof_Items.LongSword, 1);
            bag.AddItem(Listof_Items.ShortSword, 1);
            bag.AddItem(Listof_Items.LargeHealthPotion, 10);
            bag.AddItem(Listof_Items.SmallHealthPotion, 2);
            bag.AddItem(Listof_Items.Mushrooms, 1);
            bag.AddItem(Listof_Items.SmallHealthPotion, 4);
            bag.AddItem(Listof_Items.TwigOfWood, 7);
            bag.AddItem(Listof_Items.IronOre, 14);
            bag.AddItem(Listof_Items.LogOfWood, 12);

            var listOfItems = bag.GetAllItems();

            for (int i = 0; i < 52; i++)
            {
                var takenItem = bag.GetRandomItem();
            }
            Assert.AreEqual(Listof_Items.Nothing, bag.GetRandomItem());
        }
コード例 #23
0
 public void MonsterDead()
 {
     BGM_cench.Play();
     bgmBattle.Stop();
     for (int i = 0; i < itemModel.itemList.Count; i++)
     {
         if (monsterInfo.lostItem.Equals(itemModel.itemList[i].id))
         {
             bag.AddItem(itemModel.itemList[i]);
             GameObject.Find("GetItem").GetComponent <Animator>().SetBool("IsOpen", true);
             getSound.Play();
             ico.sprite   = Resources.Load <Sprite>(itemModel.itemList[i].sprite);
             name.text    = itemModel.itemList[i].name;
             explain.text = itemModel.itemList[i].explain;
             break;
         }
     }
     Destroy(gameObject);
 }
コード例 #24
0
ファイル: EffectsEntity.cs プロジェクト: Zipcore/7Dmods
        public static bool AddItem(Bag bag, ItemStack stack, bool merge = true)
        {
            /* Bag.onBackpackChanged() is private, so I need SetSlot() to call it */
            if (merge)
            {
                return(bag.AddItem(stack));
            }
            if (bag.GetSlots() == null)
            {
                return(false);
            }
            int index = GetNextIndex(bag);

            if (index == -1)
            {
                return(false);
            }
            bag.SetSlot(index, stack, true); // true for update
            return(true);
        }
コード例 #25
0
ファイル: DMStone.cs プロジェクト: rberiot/imaginenation
        private void ReadyPlayer(Mobile m)
        {
            if (!m_ScoreTable.ContainsKey(m.Serial))
            {
                m_ScoreTable.Add(m.Serial, new ScoreKeeper(m));
            }

            if (!m_UseSphereRules)
            {
                #region DistroCode

                bool MagicWeapons = MagicWeaponRule == pMagicWeaponRule.Allowed;
                bool MagicArmor   = MagicArmorRule == pMagicArmorRule.Allowed;
                bool Potions      = PotionRule == pPotionRule.Allowed;
                bool Bandages     = BandageRule == pBandaidRule.Allowed;
                bool Pets         = PetRule == pPetRule.Allowed;
                bool Mounts       = MountRule == pMountRule.Allowed;

                if (!m.Alive)
                {
                    m.Resurrect();
                }

                Container bp  = m.Backpack;
                Container bag = new Bag();
                bag.Hue = 38;
                BankBox bank   = m.BankBox;
                Item    oncurs = m.Holding;

                if (oncurs != null)
                {
                    bp.DropItem(oncurs);
                }

                m.CurePoison(m);

                m.Hits = m.HitsMax;
                m.Mana = m.ManaMax;
                m.Stam = m.StamMax;

                m.StatMods.Clear();

                List <Item> items = new List <Item>();

                foreach (Layer layer in PvpCore.EquipmentLayers)
                {
                    Item item = m.FindItemOnLayer(layer);

                    if (item != null)
                    {
                        if (item is BaseWeapon && !MagicWeapons)
                        {
                            BaseWeapon weapon = (BaseWeapon)item;

                            if (weapon.AccuracyLevel != WeaponAccuracyLevel.Regular)
                            {
                                items.Add(weapon);
                            }
                            else if (weapon.DamageLevel != WeaponDamageLevel.Regular)
                            {
                                items.Add(weapon);
                            }
                            else if (weapon.DurabilityLevel != WeaponDurabilityLevel.Regular)
                            {
                                items.Add(weapon);
                            }
                        }
                        else if (item is BaseArmor && !MagicArmor)
                        {
                            BaseArmor armor = (BaseArmor)item;

                            if (armor.Durability != ArmorDurabilityLevel.Regular)
                            {
                                items.Add(armor);
                            }
                            else if (armor.ProtectionLevel != ArmorProtectionLevel.Regular)
                            {
                                items.Add(armor);
                            }
                        }
                    }
                }

                if (m.Backpack != null)
                {
                    foreach (Item item in m.Backpack.Items)
                    {
                        if (item != null)
                        {
                            if (item is BaseWeapon && !MagicWeapons)
                            {
                                BaseWeapon weapon = (BaseWeapon)item;

                                if (weapon.AccuracyLevel != WeaponAccuracyLevel.Regular)
                                {
                                    items.Add(weapon);
                                }
                                else if (weapon.DamageLevel != WeaponDamageLevel.Regular)
                                {
                                    items.Add(weapon);
                                }
                                else if (weapon.DurabilityLevel != WeaponDurabilityLevel.Regular)
                                {
                                    items.Add(weapon);
                                }
                            }
                            else if (item is BaseArmor && !MagicArmor)
                            {
                                BaseArmor armor = (BaseArmor)item;

                                if (armor.Durability != ArmorDurabilityLevel.Regular)
                                {
                                    items.Add(armor);
                                }
                                else if (armor.ProtectionLevel != ArmorProtectionLevel.Regular)
                                {
                                    items.Add(armor);
                                }
                            }
                            else if (item is BasePotion && !Potions)
                            {
                                items.Add(item);
                            }
                            else if (item is EtherealMount && !Mounts)
                            {
                                items.Add(item);
                            }
                            else if (item is Bandage && !Bandages)
                            {
                                items.Add(item);
                            }
                        }
                    }
                }

                if (!Mounts)
                {
                    if (m.Mount != null)
                    {
                        IMount mount = m.Mount;
                        mount.Rider = null;
                        if (mount is BaseMount)
                        {
                            if (mount is BaseCreature)
                            {
                                BaseCreature bc = (BaseCreature)mount;
                                bc.ControlTarget = null;
                                bc.ControlOrder  = OrderType.Stay;
                                bc.Internalize();

                                bc.SetControlMaster(null);
                                bc.SummonMaster = null;

                                bc.IsStabled = true;
                                m.Stabled.Add(bc);
                                MountCollection.Add(m.Serial, bc);
                                m.SendMessage(38, "Your mount has been moved to the your stables");
                            }
                        }
                    }
                }

                if (items.Count > 0)
                {
                    m.SendMessage(38, "You had items that did not meet the requirements for the deathmatch and were thus moved to your bank.");
                }

                foreach (Item item in items)
                {
                    bag.AddItem(item);
                }

                if (bag.Items.Count > 0)
                {
                    bank.DropItem(bag);
                }
                else
                {
                    bag.Delete();
                }

                #endregion
            }

            if (m_EventSupplier != null)
            {
                m_EventSupplier.OnMoveOver(m);
            }

            Contestants.Add(m);

            SpawnMobile(m);

            if (m_GiveHorses)
            {
                DMHorse.TryGiveHorse(m);
            }

            if (m.NetState != null)
            {
                m.SendMessage(38, "You have joined a deathmatch");
                m.SendMessage(38, "You can check the score with \".DMScore\"");
            }
        }
コード例 #26
0
ファイル: Character.cs プロジェクト: Ceappie/SoftUni-1
 public void ReceiveItem(Item item)
 {
     CheckIfAlive();
     Bag.AddItem(item);
 }
コード例 #27
0
ファイル: Character.cs プロジェクト: IliaValov/CSharp-OOP
 public void ReceiveItem(Item item)
 {
     Bag.AddItem(item);
 }
コード例 #28
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from      = sender.Mobile;
            ClassControl c_control = null;
            ClassOrb     c_orb     = null;

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassControl)
                {
                    c_control = i as ClassControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (c_orb.ClassNumber == c_control.C_Current)
                    {
                        break;
                    }
                }
            }

            for (int i = 0; i < 54; i++)
            {
                if ((i + 1) == info.ButtonID)
                {
                    if (c_orb.Amount_Restricted != 10)
                    {
                        c_orb.Restricted_Skills[c_orb.Amount_Restricted] = from.Skills[i].Name;
                        c_orb.Amount_Restricted += 1;
                        m_From.SendGump(new RestrictedSkillsGump(from, c_orb));
                        m_From.SendMessage(6, from.Skills[i].Name + " has been Restricted");
                    }

                    else
                    {
                        m_From.SendMessage(0x35, "You have reached the Maximum Restricted Skills");
                        m_From.SendGump(new RestrictedSkillsGump(from, c_orb));
                    }
                }
            }

            if (info.ButtonID == 0)
            {
                for (int i = 0; i < 10; i++)
                {
                    c_orb.Restricted_Skills[i] = null;
                    c_orb.Primary_Skills[i]    = null;
                }
                m_From.SendGump(new AddClassGump(from, c_orb));
            }

            if (info.ButtonID == 60)
            {
                Container class_bag = new Bag();
                class_bag.Name = c_orb.ClassName + " Class";

                Container equip = new Bag();
                equip.Name = c_orb.ClassName + " Equip";

                Container items = new Bag();
                items.Name = c_orb.ClassName + " Items";

                Container r_arm = new Bag();
                r_arm.Name = c_orb.ClassName + " Restricted Armors";

                Container r_wea = new Bag();
                r_wea.Name = c_orb.ClassName + " Restricted Weapons";

                class_bag.AddItem(equip);
                class_bag.AddItem(items);
                class_bag.AddItem(r_arm);
                class_bag.AddItem(r_wea);
                class_bag.AddItem(c_orb);

                c_orb.Name = c_orb.ClassName + " Orb";

                foreach (Item i in World.Items.Values)
                {
                    if (i is Bag && i.Name == "CLASSES")
                    {
                        i.AddItem(class_bag);
                    }
                }
                c_control.A_Classes += 1;
                c_orb.Activated      = true;
                m_From.SendMessage(6, "Class Generated");
            }
        }
コード例 #29
0
 public LootBag5()
 {
     // bag.AddItem(ItemID., Amounts.);
     // Basic Resources
     bag.AddItem(ItemID.GreaterHealingPotion, 3, 5, Amounts.common);
     bag.AddItem(ItemID.SuperHealingPotion, 3, 5, Amounts.uncommon);
     // Pillars/Moonlord
     bag.AddItem(ItemID.FragmentSolar, 15, 30, Amounts.common);
     bag.AddItem(ItemID.FragmentVortex, 15, 30, Amounts.common);
     bag.AddItem(ItemID.FragmentNebula, 15, 30, Amounts.common);
     bag.AddItem(ItemID.FragmentStardust, 15, 30, Amounts.common);
     bag.AddItem(ItemID.CelestialSigil, Amounts.uncommon);
     bag.AddItem(ItemID.LunarBar, Amounts.barMin, Amounts.barMax, Amounts.common);
     // Martian Madness
     bag.AddItem(ItemID.LaserDrill, Amounts.uncommon);
     bag.AddItem(ItemID.ChargedBlasterCannon, Amounts.uncommon);
     bag.AddItem(ItemID.AntiGravityHook, Amounts.uncommon);
     bag.AddItem(ItemID.BrainScrambler, Amounts.uncommon);
 }
コード例 #30
0
        private static void EventSink_CharacterCreated(CharacterCreatedEventArgs args)
        {
            if (!VerifyProfession(args.Profession))
            {
                args.Profession = 0;
            }

            NetState state = args.State;

            if (state == null)
            {
                return;
            }

            Mobile newChar = CreateMobile(args.Account as Account);

            args.Mobile = newChar;
            m_Mobile    = newChar;

            if (newChar == null)
            {
                Console.WriteLine("Login: {0}: Character creation failed, account full", state);
                return;
            }

            if (newChar is Player)
            {
                Player pm = (Player)newChar;
                pm.Profession = args.Profession;
            }

            newChar.Player      = true;
            newChar.AccessLevel = args.Account.AccessLevel;
            newChar.Female      = args.Female;
            newChar.Body        = newChar.Female ? 0x191 : 0x190;
            newChar.Hue         = Utility.ClipSkinHue(args.Hue & 0x3FFF) | 0x8000;
            newChar.Hunger      = 20;
            newChar.Thirst      = 20;
            newChar.SkillsCap   = 8000;
            newChar.StatCap     = 250;
            newChar.Name        = args.Name;

            ((Player)newChar).EoC += 20000;
            ((Player)newChar).Race = Race.Human;

            newChar.CantWalk = false;
            newChar.Frozen   = false;

            newChar.Hits = newChar.HitsMax;
            newChar.Mana = newChar.ManaMax;
            newChar.Stam = newChar.StamMax;

            AddBackpack(newChar);

            newChar.AddToBackpack(new Verite(150));

            Bag bag = new Bag();

            bag.Name = "A torn bag";
            bag.Hue  = Utility.RandomNeutralHue();
            newChar.AddToBackpack(bag);

            //bag.TryDropItem(newChar, new ShepherdsCrook(), false);
            //bag.TryDropItem(newChar, new Bandage(Utility.Random(20,30)), false);
            //bag.TryDropItem(newChar, new Kindling(15), false);
            //bag.TryDropItem(newChar, new Torch(), false);
            //bag.TryDropItem(newChar, new Dagger(), false);
            //bag.TryDropItem(newChar, new TotalRefreshPotion(), false);
            //bag.TryDropItem(newChar, new GreaterHealPotion(), false);
            //bag.TryDropItem(newChar, new GreaterCurePotion(), false);
            //bag.TryDropItem(newChar, new IDWand(Utility.Random(10,15)), false);
            //bag.TryDropItem(newChar, new Pitcher(BeverageType.Water), false);

            bag.AddItem(new Bandage(30));
            bag.AddItem(new Kindling(10));
            bag.AddItem(new Torch());
            bag.AddItem(new Dagger());
            bag.AddItem(new Scissors());
            bag.AddItem(new TotalRefreshPotion());
            bag.AddItem(new GreaterCurePotion());
            bag.AddItem(new GreaterHealPotion());
            bag.AddItem(new IDWand());
            bag.AddItem(new Pitcher());

            newChar.AddToBackpack(new SkillScroll());

            for (int i = 0; i < SkillInfo.Table.Length; i++)
            {
                newChar.Skills[i].Base = 0;

                if (SkillInfo.Table[i].SkillID > (int)SkillName.Ninjitsu)
                {
                    newChar.Skills[i].Cap = 0;
                }
                else
                {
                    newChar.Skills[i].Cap = 100;
                }
            }

            newChar.HairItemID       = args.HairID;
            newChar.FacialHairItemID = args.BeardID;

            newChar.HairHue       = Utility.ClipHairHue(args.HairHue & 0x3FFF);
            newChar.FacialHairHue = Utility.ClipHairHue(args.BeardHue & 0x3FFF);

            AddShirt(newChar, args.ShirtHue);
            AddPants(newChar, args.PantsHue);
            AddShoes(newChar);

            SetStats(newChar, state, args.Str, args.Dex, args.Int);
            SetSkills(newChar, args.Skills, args.Profession);

            newChar.MoveToWorld(new Point3D(2756, 3808, 50), Map.Felucca); /// Isle of Kesna'buir
            ((Player)newChar).RespawnLocation = (new Point3D(2756, 3808, 50));
            ((Player)newChar).RespawnMap      = Map.Felucca;

            Console.WriteLine("Login: {0}: New character being created (account={1})", args.State, args.Account.Username);
            Console.WriteLine(" - Character: {0} (serial={1})", newChar.Name, newChar.Serial);
        }