public Clothes produceArmor()
        {
            Leather product = new Leather();

            product.Def = 5;
            return(product);
        }
示例#2
0
            public Clothes productClothes()
            {
                Clothes product = new Leather();

                product.setDef(5);
                return(product);
            }
示例#3
0
        public async Task <IActionResult> AddAnimals([FromBody] Animals obj)
        {
            Location location = db.Locations.FirstOrDefault(x => x.Id_location == obj.Location.Id_location);
            Leather  leather  = db.Leathers.FirstOrDefault(x => x.Id_leather == obj.Leather.Id_leather);

            obj.Location = location;
            obj.Leather  = leather;
            return(await base.Add(obj));
        }
    // Start is called before the first frame update
    void Start()
    {
        gameManager = GameObject.FindObjectOfType <GameManager>();
        plate       = new Plate();
        leather     = new Leather();

        gameManager.getSkills();
        gameManager.getStat();
        gameManager.showCharacterStats();

        armorArray = new Object[2] {
            plate, leather
        };

        greatSword = new GreatSword();
        longSword  = new LongSword();

        // GameManager.setWeapon(longSword);
        GameManager.setWeapon(greatSword);
        //GameManager.weaponInventory.Add(longSword);
        //GameManager.weaponInventory.Add(greatSword);
        GameManager.setArmor(plate);

        animator = GetComponent <Animator>();

        damage  = 0;
        isValid = true;
        counter = 0;

        enemyDamage = new Dictionary <string, double>();
        enemyObject = new Dictionary <string, GameObject>();
        enemyArmor  = new Dictionary <string, EnemyArmor>();
        enemyWeapon = new Dictionary <string, EnemyWeapon>();

        for (int i = 0; i < 3; i++)
        {
            skeletonArray[i] = new Skeleton("Skeleton" + i, 20); //= new Skeleton(i);


            gameObjectArray[i]      = (GameObject)Instantiate(skeletonObject, new Vector3(i * 2, 2, 0), transform.rotation);
            gameObjectArray[i].name = "Skeleton" + i;


            enemyDamage.Add(skeletonArray[i].Name, skeletonArray[i].Health);
            enemyObject.Add(skeletonArray[i].Name, gameObjectArray[i]);
            enemyArmor.Add(skeletonArray[i].Name, skeletonArray[i].setArmor(leather));
            enemyWeapon.Add(skeletonArray[i].Name, skeletonArray[i].setWeapon(longSword));
        }

        gameManager.getStat();

        //for (int i = 0; i < GameManager.Stats.Length; i++)
        //{
        //    Debug.Log("Stat " + i + ": " + GameManager.Stats[i]);
        //}
    }
示例#5
0
        public void Setup()
        {
            Mock <IRandom> random = new Mock <IRandom>();

            random.Setup(e => e.Next(6, 9)).Returns(1);
            random.Setup(e => e.Next(9, 12)).Returns(2);
            random.Setup(e => e.Next(12, 15)).Returns(3);
            GlobalReference.GlobalValues.Random = random.Object;
            material = new Leather();
        }
示例#6
0
    public Armours[] InitArmours()
    {
        Armours[] armArr = new Armours[4];

        armArr[0] = new Wool();
        armArr[1] = new Leather();
        armArr[2] = new Steel();
        armArr[3] = new Chainmail();

        return(armArr);
    }
示例#7
0
        public Dictionary <string, string> GetInfoPerso()
        {
            Dictionary <string, string> infoPerso = new Dictionary <string, string>();

            infoPerso.Add("Class", this.GetType().ToString().Substring(18));
            infoPerso.Add("Level", _Level.ToString());
            infoPerso.Add("Strength", Strengh.ToString());
            infoPerso.Add("Stamina", Stamina.ToString());
            infoPerso.Add("Gold", Gold.ToString());
            infoPerso.Add("Leather", Leather.ToString());
            infoPerso.Add("State", ((Alive) ? "ALIVE" : "DEAD"));

            return(infoPerso);
        }
示例#8
0
        public static bool wantsToCraft(Player p, int itemUsed, int usedWith)
        {
            int itemOne = itemUsed;
            int itemTwo = usedWith;

            for (int i = 0; i < 2; i++)
            {
                if (i == 1)
                {
                    itemOne = usedWith;
                    itemTwo = itemUsed;
                }
                if (itemOne == MOLTEN_GLASS && itemTwo == GLASSBLOWING_PIPE)
                {
                    resetCrafting(p);
                    Glass.displayGlassOption(p);
                    return(true);
                }
                for (int j = 0; j < TANNED_HIDE.Length; j++)
                {
                    if (itemOne == TANNED_HIDE[j] && itemTwo == NEEDLE)
                    {
                        resetCrafting(p);
                        Leather.openLeatherInterface(p, j);
                        return(true);
                    }
                }
                for (int j = 0; j < GEMS.Length; j++)
                {
                    if (itemOne == CHISEL && itemTwo == (int)GEMS[j][0])
                    {
                        resetCrafting(p);
                        Jewellery.showCutGemOption(p, j);
                        return(true);
                    }
                }
                for (int j = 0; j < AMULETS.Length; j++)
                {
                    if (itemOne == BALL_OF_WOOL && itemTwo == (int)AMULETS[j][0])
                    {
                        resetCrafting(p);
                        Jewellery.showStringAmulet(p, j);
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#9
0
    static public void testSettingWeapons()
    {
        LongSword  longSword  = new LongSword();
        GreatSword greatSword = new GreatSword();
        Dagger     dagger     = new Dagger();

        Plate   plate   = new Plate();
        Leather leather = new Leather();

        //setWeapon(longSword, "LongSword");
        //setWeapon(greatSword, "GreatSword");
        //setWeapon(dagger, "Dagger");

        armorCollection.Add("Plate", plate);
        armorCollection.Add("Leather", leather);
    }
示例#10
0
        public static void LocateLeather(Leather l, out bool found)
        {
            var _backpack = World.Player.FindItemByLayer(Layer.Backpack);
            var leather   = World.Player.FindItemByGraphic((ushort)l);

            found = false;

            if (_backpack == null)
            {
                found = false;
            }
            if (leather != null)
            {
                GameActions.DoubleClickQueued(leather);
                found = true;
            }
        }
示例#11
0
        public async Task <IActionResult> UpdateAnimals([FromBody] Animals obj)
        {
            if (obj == null)
            {
                BadRequest();
            }
            if (!entity.Any(x => x.Id_animal == obj.Id_animal))
            {
                return(NotFound());
            }
            Leather  leather  = db.Leathers.FirstOrDefault(x => x.Id_leather == obj.Leather.Id_leather);
            Location location = db.Locations.FirstOrDefault(x => x.Id_location == obj.Location.Id_location);

            obj.Location = location;
            obj.Leather  = leather;
            return(await base.Update(obj));
        }
示例#12
0
 public Character()
 {
     name   = "Nameless";
     title  = "";
     race   = "";
     hp     = 0;
     Str    = 0;
     Dex    = 0;
     Con    = 0;
     Int    = 0;
     Wis    = 0;
     Cha    = 0;
     weapon = new Dagger();
     armor  = new Leather();
     AC     = Helper.Helper.AC(this);
     Attack = new Attack();
     Block  = new Block();
     Evade  = new Evade();
 }
示例#13
0
        public void new_jacket_product(int _jacket_category)
        {
            _jacket_category = 0;
            _jacket_category = rnd.Next(1, 5);

            if (_jacket_category == 1)
            {
                Casual casual = new Casual();
            }
            else if (_jacket_category == 2)
            {
                DressJackets dressJackets = new DressJackets();
            }
            else if (_jacket_category == 3)
            {
                Leather leather = new Leather();
            }
            else if (_jacket_category == 4)
            {
                Winter winter = new Winter();
            }
        }
示例#14
0
        public static GameObject BuildGameObject(XmlElement element)
        {
            string type = element.GetAttribute("type");

            switch (type)
            {
            case "money": return(Money.Build(element));

            case "wood": return(Wood.Build(element));

            case "weapon": return(Weapon.Build(element));

            case "coal": return(Coal.Build(element));

            case "copper": return(Copper.Build(element));

            case "gold": return(Gold.Build(element));

            case "iron": return(Iron.Build(element));

            case "silver": return(Silver.Build(element));

            case "leather": return(Leather.Build(element));

            case "meat": return(Meat.Build(element));

            case "sand": return(Sand.Build(element));

            case "stone": return(Stone.Build(element));

            case "water": return(Water.Build(element));

            case "wheat": return(Wheat.Build(element));

            default: return(null);
            }
        }
示例#15
0
        static void PlayerChooseLoadout()
        {
            Render  code  = new Render();
            Program code1 = new Program();

            code.RenderPlayerChoosing(1);
            string info2 = Console.ReadLine();
            int    playerInput;

            try
            {
                playerInput = Int32.Parse(info2);
            }
            catch
            {
                Console.WriteLine("Creation Error... Shutting...Down....");
                PlayerChooseLoadout();
                return;
            }
            switch (playerInput)
            {
            case 1:
                player1.classType = "Warrior";
                Console.WriteLine("Warrior it is...");
                break;

            case 2:
                player1.classType = "Mage";
                Console.WriteLine("Mage it is...");
                break;

            case 3:
                player1.classType = "Rogue";
                Console.WriteLine("Rogue it is...");
                break;

            default:
                Console.WriteLine("Creation Error... Shutting...Down....");
                PlayerChooseLoadout();
                return;
            }

            code.RenderPlayerChoosing(2);
            string info = Console.ReadLine();

            try
            {
                playerInput = Int32.Parse(info);
            }
            catch
            {
                Console.WriteLine("Creation Error... Shutting...Down....");
                PlayerChooseLoadout();
                return;
            }

            int         weaponLevel = GetRandom(1, 5);
            ItemFactory code3       = new ItemFactory();

            switch (playerInput)
            {
            case 1:
                Broadsword PlayerWeapon = new Broadsword("", weaponLevel);
                player1.EntityWeapon = PlayerWeapon;
                Console.WriteLine("Broadsword it is...");
                break;

            case 2:
                Mace PlayerWeapon2 = new Mace("", weaponLevel);
                player1.EntityWeapon = PlayerWeapon2;
                Console.WriteLine("Mace it is...");
                break;

            case 3:
                Daggers PlayerWeapon3 = new Daggers("", weaponLevel);
                player1.EntityWeapon = PlayerWeapon3;
                Console.WriteLine("Twin Daggers it is...");
                break;

            case 4:
                Axe PlayerWeapon4 = new Axe("", weaponLevel);
                player1.EntityWeapon = PlayerWeapon4;
                Console.WriteLine("War Axe it is...");
                break;

            case 5:
                Weapon PlayerWeapon5 = code3.CreateRandomWeapon(weaponLevel);
                player1.EntityWeapon = PlayerWeapon5;
                Console.WriteLine(player1.EntityWeapon.name + " it is...");
                break;

            default:
                Console.WriteLine("Creation Error... Shutting...Down....");
                PlayerChooseLoadout();
                return;
            }

            code.RenderPlayerChoosing(3);
            string info1 = Console.ReadLine();

            try
            {
                playerInput = Int32.Parse(info1);
            }
            catch
            {
                Console.WriteLine("Creation Error... Restarting...");
                PlayerChooseLoadout();
                return;
            }
            int armorLevel = GetRandom(1, 5);

            switch (playerInput)
            {
            case 1:
                Chainmail PlayerArmor = new Chainmail("", armorLevel);
                player1.EntityArmor = PlayerArmor;
                Console.WriteLine("Chainmail it is...");
                break;

            case 2:
                Leather PlayerArmor2 = new Leather("", armorLevel);
                player1.EntityArmor = PlayerArmor2;
                Console.WriteLine("Thick Leather it is...");
                break;

            case 3:
                Cloth PlayerArmor3 = new Cloth("", armorLevel);
                player1.EntityArmor = PlayerArmor3;
                Console.WriteLine("Sleek Silken Thinking Cloth... is that even armor?");
                break;

            case 4:
                Plate PlayerArmor4 = new Plate("", armorLevel);
                player1.EntityArmor = PlayerArmor4;
                Console.WriteLine("Plate it is...");
                break;

            case 5:
                Armor PlayerArmor5 = code3.CreateRandomArmor(armorLevel);
                player1.EntityArmor = PlayerArmor5;
                Console.WriteLine(player1.EntityArmor.name + " it is...");
                break;

            default:
                Console.WriteLine("Creation Error... Restarting...");
                PlayerChooseLoadout();
                return;
            }
            code.RenderPlayerChoosing(4);
            string info3 = Console.ReadLine();

            try
            {
                playerInput = Int32.Parse(info3);
            }
            catch
            {
                Console.WriteLine("Creation Error... Restarting...");
                PlayerChooseLoadout();
                return;
            }
            int potionLevel = GetRandom(1, 5);

            switch (playerInput)
            {
            case 1:
                Health_Potion playerPotion = new Health_Potion("Health_Potion", potionLevel);
                player1.entityPotions.Add(playerPotion);
                Console.WriteLine("Health Potion it is...");
                break;

            case 2:
                Fire_Potion playerPotion1 = new Fire_Potion("Fire_Potion", potionLevel);
                player1.entityPotions.Add(playerPotion1);
                Console.WriteLine("Fire Potion it is...");
                break;

            default:
                Console.WriteLine("Creation Error... Restarting...");
                PlayerChooseLoadout();
                return;
            }
            while (player1.entityPotions.Count < 4)
            {
                Potion empty = new Potion("Empty_Potion", player1.entityPotions.Count + 1);
                player1.entityPotions.Add(empty);
            }
            ColorWriter(ConsoleColor.Gray, "ready yourself, Gladiator...\n");
            Thread.Sleep(1000);
            int howManyMonsters = GetRandom(1, 5);

            MonsterIntro(player1, howManyMonsters);
        }
        private void handleEnterAmount(Player player, Packet packet)
        {
            if (player.getTemporaryAttribute("interfaceVariable") == null)
            {
                player.getPackets().sendMessage("An error occured, please try again.");
                return;
            }
            EnterVariable var       = (EnterVariable)player.getTemporaryAttribute("interfaceVariable");
            int           craftType = (int)(player.getTemporaryAttribute("craftType") == null ? -1 : (int)player.getTemporaryAttribute("craftType")); // 'Category' of item to craft
            int           amount    = packet.readInt();

            switch (var.getInterfaceId())
            {
            case 675:                 // Jewellery crafting
                Jewellery.makeJewellery(player, var.getSlot(), amount, true);
                break;

            case 304:                                                                                                                                   // Dragonhide crafting.
                int leatherType = (int)(player.getTemporaryAttribute("leatherCraft") == null ? -1 : (int)player.getTemporaryAttribute("leatherCraft")); // Type of leather to craft.
                switch (var.getSlot())
                {
                case 0:
                    if (leatherType != -1)
                    {
                        Leather.craftDragonHide(player, 1, 0, leatherType, true);                                     // Body
                        break;
                    }
                    else if (craftType == 6)                                     // Ball of wool
                    {
                        Spinning.craftSpinning(player, amount, 0, true);
                        break;
                    }
                    break;

                case 1:
                    if (craftType == 6)                                   // Bowstring
                    {
                        Spinning.craftSpinning(player, amount, 1, true);
                        break;
                    }
                    break;

                case 2:
                    if (craftType == 6)                                    // Crossbow string
                    {
                        Spinning.craftSpinning(player, amount, 2, true);
                        break;
                    }
                    break;

                case 4:
                    Leather.craftDragonHide(player, 1, 4, leatherType, true);                                 // Vambraces
                    break;

                case 8:
                    Leather.craftDragonHide(player, 1, 8, leatherType, true);                                 // Chaps
                    break;
                }
                break;

            case 303:
                switch (var.getSlot())
                {
                case 120:                             // Unholy symbol
                    Silver.newSilverItem(player, amount, var.getSlot(), true);
                    break;

                case 121:                             // Tiara
                    Silver.newSilverItem(player, amount, var.getSlot(), true);
                    break;
                }
                break;

            case 154:                 // Craft normal leather.
                if (var.getSlot() >= 28 && var.getSlot() <= 34)
                {
                    Leather.craftNormalLeather(player, var.getSlot(), amount, true);
                    break;
                }
                break;

            case 542:                 // Glassblowing.
                switch (var.getSlot())
                {
                case 40:                             // Make X beer glass.
                    Glass.craftGlass(player, amount, 0, true);
                    break;

                case 41:                             // Make X candle lantern.
                    Glass.craftGlass(player, amount, 1, true);
                    break;

                case 42:                             // Make X oil lamp.
                    Glass.craftGlass(player, amount, 2, true);
                    break;

                case 38:                             // Make X vial.
                    Glass.craftGlass(player, amount, 3, true);
                    break;

                case 44:                             // Make X Fishbowl
                    Glass.craftGlass(player, amount, 4, true);
                    break;

                case 39:                             // Make X orb.
                    Glass.craftGlass(player, amount, 5, true);
                    break;

                case 43:                             // Make X lantern lens
                    Glass.craftGlass(player, amount, 6, true);
                    break;

                case 45:                             // Make X dorgeshuun light orb.
                    Glass.craftGlass(player, amount, 7, true);
                    break;
                }
                break;

            case 763:                 // Bank inventory - X.
                player.getBank().setLastXAmount(amount);
                player.getBank().deposit(var.getSlot(), amount);
                player.getBank().refreshBank();
                break;

            case 762:                 // Bank - X.
                player.getBank().setLastXAmount(amount);
                player.getBank().withdraw(var.getSlot(), amount);
                player.getBank().refreshBank();
                break;

            case 336:                 // Trade/stake inventory - trade X.
                if (player.getTrade() != null)
                {
                    player.getTrade().tradeItem(var.getSlot(), amount);
                    break;
                }
                if (player.getDuel() != null)
                {
                    player.getDuel().stakeItem(var.getSlot(), amount);
                    break;
                }
                break;

            case 631:
                if (player.getDuel() != null)
                {
                    player.getDuel().removeItem(var.getSlot(), amount);
                    break;
                }
                break;

            case 335:                 // Trade/stake interface - remove X.
                player.getTrade().removeItem(var.getSlot(), amount);
                break;

            case 620:                 // Shop - buy X.
                player.getShopSession().buyItem(var.getSlot(), amount);
                break;

            case 105:     //Grand Exchange custom quantity and price inputs.
                switch (var.getSlot())
                {
                case 0:         //custom enter quantity
                    player.getGESession().setCustomAmount(amount);
                    break;

                case 1:         //custom enter per price
                    player.getGESession().setCustomPrice(amount);
                    break;
                }
                break;

            case 305:                 // What would you like to make? - 4 options
                if (player.getTemporaryAttribute("fletchType") == null)
                {
                    return;
                }
                int logType = (int)player.getTemporaryAttribute("fletchType");
                switch (var.getSlot())
                {
                case 0:
                    MakeBows.cutLog(player, amount, logType, 0, (player.getTemporaryAttribute("stringingBow") == null ? false : (bool)player.getTemporaryAttribute("stringingBow")), true);
                    break;

                case 1:
                    MakeBows.cutLog(player, amount, logType, 1, (player.getTemporaryAttribute("stringingBow") == null ? false : (bool)player.getTemporaryAttribute("stringingBow")), true);
                    break;

                case 2:
                    MakeBows.cutLog(player, amount, 0, 2, false, true);
                    break;

                case 3:
                    MakeBows.cutLog(player, amount, 0, 3, false, true);
                    break;
                }
                break;

            case 306:                 // What would you like to make? - 5 options
                switch (var.getSlot())
                {
                case 0:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;

                case 1:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;

                case 2:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;

                case 3:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;

                case 4:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;
                }
                break;

            case 309:                                           // What would you like to make - 1 option
                if (var.getSlot() >= 50 && var.getSlot() <= 60) // Cut gem
                {
                    Jewellery.cutGem(player, craftType, amount, true);
                    break;
                }
                else if (var.getSlot() >= 100 && var.getSlot() <= 110)                         // String amulet
                {
                    Jewellery.stringAmulet(player, craftType, amount, true);
                    break;
                }
                switch (var.getSlot())
                {
                case 0:
                    MakeXbow.createXbow(player, amount, (int)(player.getTemporaryAttribute("bowType2") == null ? -1 : (int)player.getTemporaryAttribute("bowType2")), (bool)(player.getTemporaryAttribute("stringingBow") == null ? false :(bool)player.getTemporaryAttribute("stringingBow")), true);
                    break;

                case 1:
                    MakeBows.cutLog(player, amount, (int)(player.getTemporaryAttribute("fletchType") == null ? -1 : (int)player.getTemporaryAttribute("fletchType")), (int)(player.getTemporaryAttribute("bowType") == null ? -1 : (int)player.getTemporaryAttribute("bowType")), true, true);
                    break;

                case 2:
                    Herblore.grindIngredient(player, amount, true);
                    break;

                case 3:
                    Herblore.makeUnfinishedPotion(player, amount, true);
                    break;

                case 4:
                    Herblore.completePotion(player, amount, true);
                    break;

                case 5:
                    Cooking.cookItem(player, amount, true, player.getTemporaryAttribute("cookingFireLocation") != null);
                    break;

                case 6:
                    MakeAmmo.makeBoltTip(player, (int)(player.getTemporaryAttribute("boltTips") == null ? -1 : (int)player.getTemporaryAttribute("boltTips")), amount, true);
                    break;
                }
                break;

            case 311:                 // Smelting interface
                switch (var.getSlot())
                {
                case 13:                             // Bronze
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 17:                             // Blurite
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 21:                             // Iron
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 25:                             // Silver
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 29:                             // Steel
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 33:                             // Gold
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 37:                             // Mithril
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 41:                             // Adamant
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 45:                             // Rune
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;
                }
                break;

            case 300:                 // Smithing interface.
                if (player.getTemporaryAttribute("smithingItem") == null)
                {
                    return;
                }
                SmithBar item = (SmithBar)player.getTemporaryAttribute("smithingItem");
                if (item != null)
                {
                    item.setAmount(amount);
                }
                Smithing.smithItem(player, var.getSlot(), amount, false);
                break;
            }
            player.removeTemporaryAttribute("interfaceVariable");
        }
        private void handleClickThree(Player player, Packet packet)
        {
            int interfaceId = packet.readUShort();
            int child       = packet.readUShort();
            int slot        = packet.readUShort();

            Console.WriteLine("InterfaceOption 3: interfaceId: " + interfaceId);
            switch (interfaceId)
            {
            case 154:                 // Craft normal leather.
                Leather.craftNormalLeather(player, child, player.getInventory().getItemAmount(1741), true);
                break;

            case 542:                 // Glassblowing.
                int totalGlass = player.getInventory().getItemAmount(1775);
                switch (child)
                {
                case 40:                             // Make all beer glass.
                    Glass.craftGlass(player, totalGlass, 0, true);
                    break;

                case 41:                             // Make all candle lantern.
                    Glass.craftGlass(player, totalGlass, 1, true);
                    break;

                case 42:                             // Make all oil lamp.
                    Glass.craftGlass(player, totalGlass, 2, true);
                    break;

                case 38:                             // Make all vial.
                    Glass.craftGlass(player, totalGlass, 3, true);
                    break;

                case 44:                             // Make all Fishbowl
                    Glass.craftGlass(player, totalGlass, 4, true);
                    break;

                case 39:                             // Make all orb.
                    Glass.craftGlass(player, totalGlass, 5, true);
                    break;

                case 43:                             // Make all lantern lens
                    Glass.craftGlass(player, totalGlass, 6, true);
                    break;

                case 45:                             // Make all dorgeshuun light orb.
                    Glass.craftGlass(player, totalGlass, 7, true);
                    break;
                }
                break;

            case 763:                 // Bank inventory - 10.
                player.getBank().deposit(slot, 10);
                player.getBank().refreshBank();
                break;

            case 762:                 // Bank - 10.
                player.getBank().withdraw(slot, 10);
                player.getBank().refreshBank();
                break;

            case 336:                 // Trade/stake inventory - trade 10.
                if (player.getTrade() != null)
                {
                    player.getTrade().tradeItem(slot, 10);
                    break;
                }
                if (player.getDuel() != null)
                {
                    player.getDuel().stakeItem(slot, 10);
                    break;
                }
                break;

            case 335:                 // Trade interface - remove 10.
                player.getTrade().removeItem(slot, 10);
                break;

            case 631:                 // Duel interface - remove 10.
                if (player.getDuel() != null)
                {
                    player.getDuel().removeItem(slot, 5);
                    break;
                }
                break;

            case 620:                 // Shop - buy 5.
                player.getShopSession().buyItem(slot, 5);
                break;

            case 621:                 // Shop - sell 5.
                player.getShopSession().sellItem(slot, 5);
                break;

            case 590:                 // Clan chat setup
                Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
                if (clan == null)
                {
                    player.getPackets().sendMessage("Please create your clan chat before changing settings.");
                    break;
                }
                switch (child)
                {
                case 23:                             // "Who can enter chat" - recruit.
                    clan.setEnterRights(Clan.ClanRank.RECRUIT);
                    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
                    break;

                case 24:                             // "Who can talk in chat" - recruit.
                    clan.setTalkRights(Clan.ClanRank.RECRUIT);
                    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
                    break;

                case 26:                             // "Who can share loot" - recruit.
                    clan.setLootRights(Clan.ClanRank.RECRUIT);
                    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
                    break;
                }
                break;
            }
        }
        private void handleClickTwo(Player player, Packet packet)
        {
            int interfaceId = packet.readUShort();
            int child       = packet.readUShort();
            int slot        = packet.readUShort();

            Console.WriteLine("InterfaceOption 2: interfaceId: " + interfaceId);
            switch (interfaceId)
            {
            case 105:                 // GE Interface
                switch (child)
                {
                case 209:                             // "Collect" and "Collect-items" option
                    player.getGESession().collectSlot1(false);
                    break;

                case 211:                             // Left box "Collect" option (coins)
                    player.getGESession().collectSlot2();
                    break;
                }
                break;

            case 154:                 // Craft normal leather.
                Leather.craftNormalLeather(player, child, 5, true);
                break;

            case 542:                 // Glassblowing.
                switch (child)
                {
                case 40:                             // Make 5 beer glass.
                    Glass.craftGlass(player, 5, 0, true);
                    break;

                case 41:                             // Make 5 candle lantern.
                    Glass.craftGlass(player, 5, 1, true);
                    break;

                case 42:                             // Make 5 oil lamp.
                    Glass.craftGlass(player, 5, 2, true);
                    break;

                case 38:                             // Make 5 vial.
                    Glass.craftGlass(player, 5, 3, true);
                    break;

                case 44:                             // Make 5 Fishbowl
                    Glass.craftGlass(player, 5, 4, true);
                    break;

                case 39:                             // Make 5 orb.
                    Glass.craftGlass(player, 5, 5, true);
                    break;

                case 43:                             // Make 5 lantern lens
                    Glass.craftGlass(player, 5, 6, true);
                    break;

                case 45:                             // Make 5 dorgeshuun light orb.
                    Glass.craftGlass(player, 5, 7, true);
                    break;
                }
                break;

            case 763:                 // Bank inventory - 5.
                player.getBank().deposit(slot, 5);
                player.getBank().refreshBank();
                break;

            case 762:                 // Bank - 5.
                player.getBank().withdraw(slot, 5);
                player.getBank().refreshBank();
                break;

            case 336:                 // Trade/stake inventory - trade 5.
                if (player.getTrade() != null)
                {
                    player.getTrade().tradeItem(slot, 5);
                    break;
                }
                if (player.getDuel() != null)
                {
                    player.getDuel().stakeItem(slot, 5);
                    break;
                }
                break;

            case 631:                 // Duel interface - remove 5
                if (player.getDuel() != null)
                {
                    player.getDuel().removeItem(slot, 5);
                    break;
                }
                break;

            case 335:                 // Trade interface - remove 5.
                player.getTrade().removeItem(slot, 5);
                break;

            case 620:                 // Shop - buy 1.
                player.getShopSession().buyItem(slot, 1);
                break;

            case 621:                 // Shop - sell 1.
                player.getShopSession().sellItem(slot, 1);
                break;

            case 590:                 // Clan chat setup
                Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
                if (clan == null)
                {
                    player.getPackets().sendMessage("Please create your clan chat before changing settings.");
                    break;
                }
                switch (child)
                {
                case 23:                             // "Who can enter chat" - any friends.
                    clan.setEnterRights(Clan.ClanRank.FRIEND);
                    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
                    break;

                case 24:                             // "Who can talk in chat" - any friends.
                    clan.setTalkRights(Clan.ClanRank.FRIEND);
                    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
                    break;

                case 26:                             // "Who can share loot" - any friends.
                    clan.setLootRights(Clan.ClanRank.FRIEND);
                    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
                    break;
                }
                break;
            }
        }
示例#19
0
    //static public void setWeapon<W>(W iWeapon, string wName) where W : IWeapon
    //{
    //    weaponsCollection.Add(wName, iWeapon);
    //}


    void setWeapons()
    {
        // Stores names for searching in dictionary

        // Classes objects used in dictionary
        Plate   plate   = new Plate();
        Leather leather = new Leather();

        LongSword  longSword  = new LongSword();
        GreatSword greatSword = new GreatSword();
        Dagger     dagger     = new Dagger();

        LockPick lockPick = new LockPick();
        Book     book     = new Book();

        weaponsSelection = new string[3] {
            "LongSword", "GreatSword", "Dagger"
        };
        armorSelection = new string[2] {
            "Plate", "Leather"
        };
        itemSelection = new string[2] {
            "LockPick", "Book"
        };
        genericSelection = new string[3] {
            "LongSword", "Plate", "LockPick"
        };

        // genericCollection.Add("LongSword", longSword);
        // genericCollection.Add("Plate", plate);
        genericCollection.Add("LockPick", lockPick);

        // Add objects to each respective dictionary
        weaponsCollection.Add("LongSword", longSword);
        weaponsCollection.Add("GreatSword", greatSword);
        weaponsCollection.Add("Dagger", dagger);

        armorCollection.Add("Plate", plate);
        armorCollection.Add("Leather", leather);

        itemCollection.Add("LockPick", lockPick);
        itemCollection.Add("Book", book);


        // Add items into chest array based on dictionary keys found in the selection arrays
        for (int i = 0; i < weaponsCollection.Count; i++)
        {
            weaponsArray[i] = weaponsCollection[weaponsSelection[System.Convert.ToInt32(Random.Range(0, weaponsCollection.Count))]];
        }
        for (int i = 0; i < armorCollection.Count; i++)
        {
            armorArray[i] = armorCollection[armorSelection[System.Convert.ToInt32(Random.Range(0, armorCollection.Count))]];
        }
        for (int i = 0; i < itemCollection.Count; i++)
        {
            itemArray[i] = itemCollection[itemSelection[System.Convert.ToInt32(Random.Range(0, itemCollection.Count))]];
        }
        for (int i = 0; i < itemCollection.Count; i++)
        {
            genericArray[i] = genericCollection[genericSelection[System.Convert.ToInt32(Random.Range(0, genericCollection.Count))]];
        }
    }
示例#20
0
        public void FindResources(Mobile from)
        {
            if (from == null)
            {
                return;
            }

            int minAmount = 0;
            int maxAmount = 0;

            Item   item     = null;
            string itemName = "";

            switch (Utility.RandomMinMax(1, 5))
            {
            //Gold
            case 1:
                minAmount = ((int)m_Rarity + 1) * 150;
                maxAmount = ((int)m_Rarity + 1) * 250;

                item     = new Gold(Utility.RandomMinMax(minAmount, maxAmount));
                itemName = "some gold";
                break;

            //Iron Ingots
            case 2:
                minAmount = ((int)m_Rarity + 1) * 25;
                maxAmount = ((int)m_Rarity + 1) * 50;

                item     = new IronIngot(Utility.RandomMinMax(minAmount, maxAmount));
                itemName = "some iron ingots";
                break;

            //Boards
            case 3:
                minAmount = ((int)m_Rarity + 1) * 25;
                maxAmount = ((int)m_Rarity + 1) * 50;

                item     = new Board(Utility.RandomMinMax(minAmount, maxAmount));
                itemName = "some boards";
                break;

            //Cloth
            case 4:
                minAmount = ((int)m_Rarity + 1) * 25;
                maxAmount = ((int)m_Rarity + 1) * 50;

                item     = new Cloth(Utility.RandomMinMax(minAmount, maxAmount));
                itemName = "some cloth";
                break;

            //Cut Leather
            case 5:
                minAmount = ((int)m_Rarity + 1) * 25;
                maxAmount = ((int)m_Rarity + 1) * 50;

                item     = new Leather(Utility.RandomMinMax(minAmount, maxAmount));
                itemName = "some leather";
                break;
            }

            if (item != null)
            {
                if (from.AddToBackpack(item))
                {
                    from.SendMessage("You retrieve " + itemName + " from the shipwreck and place it in your backpack.");
                }

                else
                {
                    from.SendMessage("You retrieve " + itemName + " from the shipwreck, and place it at your feet.");
                    item.MoveToWorld(from.Location, from.Map);
                }
            }
        }
示例#21
0
    private void Start()
    {
        LongSword  longSword  = new LongSword();
        GreatSword greatSword = new GreatSword();
        Dagger     dagger     = new Dagger();

        Plate   plate   = new Plate();
        Leather leather = new Leather();

        LockPick lockPick = new LockPick();
        Book     book     = new Book();

        weaponsArray1.Add(new LongSword());
        weaponsArray1.Add(new GreatSword());
        weaponsArray1.Add(new LongSword());
        weaponsArray1.Add(new GreatSword());
        weaponsArray1.Add(new Dagger());

        playerWeaponsArray.Add(new LongSword());
        playerWeaponsArray.Add(new GreatSword());

        //itemCollection.Add("LongSword", longSword);
        //itemCollection.Add("GreatSword", greatSword);
        //itemCollection.Add("Dagger", dagger);
        //itemCollection.Add("Plate", plate);
        //itemCollection.Add("Plate", leather);

        // Sets up weapons to be stored inside weaponsCollection dictionary
        weaponsSelection = new string[3] {
            "LongSword", "GreatSword", "Dagger"
        };
        armorSelection = new string[2] {
            "Plate", "Leather"
        };
        itemSelection = new string[2] {
            "LockPick", "Book"
        };

        weaponsCollection.Add("LongSword", longSword);
        weaponsCollection.Add("GreatSword", greatSword);
        weaponsCollection.Add("Dagger", dagger);

        armorCollection.Add("Plate", plate);
        armorCollection.Add("Leather", leather);

        itemCollection.Add("LockPick", lockPick);
        itemCollection.Add("Book", book);

        //setWeapon(longSword,"LongSword");
        //setWeapon(greatSword, "GreatSword");
        //setWeapon(dagger, "Dagger");

        //armorCollection[0] = plate;
        //armorCollection[1] = leather;

        //weaponsArray[0] = weaponsCollection["LongSword"];
        //weaponsArray[1] = weaponsCollection["GreatSword"];
        //weaponsArray[2] = weaponsCollection["Dagger"];

        //Debug.Log("Weapon in gameManager: " + weaponsArray[0].Cost);
        //Debug.Log("Weapon in gameManager: " + weaponsArray[1].Cost);
        //Debug.Log("Weapon in gameManager: " + weaponsArray[2].Cost);
    }
示例#22
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            PersonOne personOne = new PersonOne()
            {
                Name = "小黑"
            };

            personOne.Show();

            Console.WriteLine();
            SuitPersonOne suitPersonOne = new SuitPersonOne()
            {
                Name = "小黑"
            };

            suitPersonOne.Show();
            Console.WriteLine();

            TShirtPersonOne shirtPersonOne = new TShirtPersonOne()
            {
                Name = "小黑"
            };

            shirtPersonOne.Show();
            Console.WriteLine();

            Console.WriteLine();
            Console.WriteLine("==============================");

            // 首先要有打扮的人
            AbstractPerson xiaoXin = new Person()
            {
                Name = "小新"
            };
            // 然后准备要穿的衣服
            Finery personWithSuit     = new Suit();     // 西装
            Finery personWithTie      = new Tie();      // 领带
            Finery personWithTrousers = new Trousers(); // 长裤
            Finery personWithLeather  = new Leather();  // 皮鞋

            // 最后按顺序把衣服穿上
            // 先穿裤子
            personWithTrousers.SetPerson(xiaoXin);
            // 再让穿裤子的小新穿西装
            personWithSuit.SetPerson(personWithTrousers);
            // 最后把鞋子领带都穿上
            personWithTie.SetPerson(personWithSuit);
            personWithLeather.SetPerson(personWithTie);

            // 照下镜子
            personWithLeather.Show();

            Console.WriteLine();
            Console.WriteLine("==============================");

            AbstractPerson xiaoHei = new Person()
            {
                Name = "小黑"
            };

            Finery personWithTShirt  = new TShirt();  // 大t恤
            Finery personWithSneaker = new Sneaker(); // 网鞋

            personWithTShirt.SetPerson(xiaoHei);
            personWithSneaker.SetPerson(personWithTShirt);

            personWithSneaker.Show();



            Console.ReadKey();
        }
示例#23
0
        public JsonResult Save(LeatherViewModel model)
        {
            Response response;

            try
            {
                string oldFileName = "";

                int    status  = 200;
                string message = string.Empty;
                using (var db = new KiaGalleryContext())
                {
                    if (string.IsNullOrEmpty(model.name))
                    {
                        status  = 500;
                        message = "وارد کردن نام چرم اجباری است.";
                    }
                    else
                    {
                        if (model.id != null && model.id > 0)
                        {
                            var entity = db.Leather.Single(x => x.Id == model.id);
                            entity.Name         = model.name.Trim();
                            entity.LeatherType  = model.leatherType;
                            entity.Order        = model.order;
                            entity.FileName     = model.fileName?.Trim();
                            entity.Active       = model.active;
                            entity.ModifyUserId = GetAuthenticatedUserId();
                            entity.ModifyDate   = DateTime.Now;
                            entity.Ip           = Request.UserHostAddress;

                            if (!string.IsNullOrEmpty(entity.FileName) && entity.FileName != model.fileName)
                            {
                                oldFileName = entity.FileName;
                            }

                            message = "چرم با موفقیت ویرایش شد.";
                        }
                        else
                        {
                            var entity = new Leather()
                            {
                                Name         = model.name.Trim(),
                                LeatherType  = model.leatherType,
                                Order        = model.order,
                                FileName     = model.fileName?.Trim(),
                                Active       = model.active,
                                CreateUserId = GetAuthenticatedUserId(),
                                ModifyUserId = GetAuthenticatedUserId(),
                                CreateDate   = DateTime.Now,
                                ModifyDate   = DateTime.Now,
                                Ip           = Request.UserHostAddress
                            };

                            db.Leather.Add(entity);
                            message = "چرم با موفقیت ایجاد شد.";
                        }
                        db.SaveChanges();

                        if (!string.IsNullOrEmpty(oldFileName) && System.IO.File.Exists(Server.MapPath("~/Upload/Leather/" + oldFileName)))
                        {
                            System.IO.File.Delete(Server.MapPath("~/Upload/Leather/" + oldFileName));
                        }
                    }
                }

                response = new Response()
                {
                    status  = status,
                    message = message
                };
            }
            catch (Exception ex)
            {
                response = Core.GetExceptionResponse(ex);
            }

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
示例#24
0
        public static void Armor()
        {
            int _slot = random.Next(0, 8);

            string[] gearSlot = new string[8];
            gearSlot[0] = "Head"; //helmet
            gearSlot[1] = "Shoulders";
            gearSlot[2] = "Chest";
            gearSlot[3] = "Waist"; // belt
            gearSlot[4] = "Arms";  // bracer
            gearSlot[5] = "Hands"; // gloves
            gearSlot[6] = "Legs";  // pants
            gearSlot[7] = "Feet";  // boots

            string prefixName;
            int    prefixValue;
            string prefixStat;

            (prefixName, prefixStat, prefixValue) = Prefix.Generate("Armor");

            string suffixName;
            string suffixStat;
            int    suffixValue;

            (suffixName, suffixStat, suffixValue) = Suffix.Generate("Armor");


            int _armorType = random.Next(1, 11);

            switch (_armorType)
            {
            case 1:
                Rags rags = new Rags(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                rags.ArmorAddToInventory();
                break;

            case 2:
                Quilted cloak = new Quilted(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                cloak.ArmorAddToInventory();
                break;

            case 3:
                Leather leather = new Leather(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                leather.ArmorAddToInventory();
                break;

            case 4:
                HardLeather hardLeather = new HardLeather(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                hardLeather.ArmorAddToInventory();
                break;

            case 5:
                StuddedLeather studdedLeather = new StuddedLeather(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                studdedLeather.ArmorAddToInventory();
                break;

            case 6:
                RingMail ringMail = new RingMail(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                ringMail.ArmorAddToInventory();
                break;

            case 7:
                ChainMail chainMail = new ChainMail(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                chainMail.ArmorAddToInventory();
                break;

            case 8:
                ScaleMail scaleMail = new ScaleMail(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                scaleMail.ArmorAddToInventory();
                break;

            case 9:
                FieldPlate fieldPlate = new FieldPlate(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                fieldPlate.ArmorAddToInventory();
                break;

            case 10:
                GothicPlate gothicPlate = new GothicPlate(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                gothicPlate.ArmorAddToInventory();
                break;
            }
        }