Utilisez cette classe pour creer de nouvelle haches.
Наследование: Tool
Пример #1
1
		private void InitContents( BarrelType type )
		{
			Item item = null;
			byte count = (byte)Utility.RandomMinMax( 10, 30 );

			for( byte i = 0; i < count; i++ )
			{
				switch( type )
				{
					default:
					case BarrelType.Arrows: item = new Arrow( Utility.RandomMinMax( 2, 6 ) ); break;
					case BarrelType.Bolts: item = new Bolt( Utility.RandomMinMax( 2, 6 ) ); break;
					case BarrelType.Farming:
						{
							if( i > 3 )
								return;

							switch( Utility.Random( 3 ) )
							{
								case 0: item = new Shovel(); break;
								case 1: item = new Scythe(); break;
								case 2: item = new Pitchfork(); break;
							}
							break;
						}
					case BarrelType.LargeMining:
						{
							if( i > 5 )
								return;

							switch( Utility.Random( 5 ) )
							{
								case 0: item = new Pitchfork(); break;
								case 1:
								case 2: item = new Shovel(); break;
								case 3:
								case 4: item = new Pickaxe(); break;
							}
							break;
						}
					case BarrelType.LargeWeapon1:
					case BarrelType.LargeWeapon2:
					case BarrelType.LargeWeapon3:
						{
							if( i > 6 )
								return;

							switch( Utility.Random( 6 ) )
							{
								case 0: item = new Spear(); break;
								case 1: item = new Halberd(); break;
								case 2: item = new Axe(); break;
								case 3: item = new ThinLongsword(); break;
								case 4: item = new WarAxe(); break;
								case 5: item = new VikingSword(); break;
							}
							break;
						}
					case BarrelType.Mining:
						{
							if( i > 3 )
								return;

							item = new Pickaxe();
							break;
						}
					case BarrelType.Spears:
						{
							if( i > 4 )
								return;

							item = new Spear();
							break;
						}
					case BarrelType.Weapons:
						{
							if( i > 3 )
								return;

							switch( Utility.Random( 3 ) )
							{
								case 0: item = new WarAxe(); break;
								case 1: item = new WarMace(); break;
								case 2: item = new Maul(); break;
							}
							break;
						}
				}

				if( item != null )
					DropItem( item );
			}
		}
Пример #2
0
        protected void AddItem(string[] inputParams)
        {
            Character target = this.characterList.FirstOrDefault(x => x.Id == inputParams[1]);

            if (target == null)
            {
                throw new InvalidOperationException("Character does not exists!");
            }

            string itemClass = inputParams[2].ToLower();
            string itemID = inputParams[3];
            switch (itemClass)
            {
                case "axe":
                    Item currentAxe = new Axe(itemID, target);
                    break;
                case "shield":
                    Item currenShield = new Shield(itemID, target);
                    break;
                case "pill":
                    Bonus currentPill = new Pill(itemID, target);
                    this.timeoutItems.AddLast(currentPill);
                    break;
                case "injection":
                    Bonus currentInjection = new Injection(itemID, target);
                    this.timeoutItems.AddLast(currentInjection);
                    break;
                default:
                    {
                        throw new InvalidOperationException("Invalid input!");
                    }
            }
        }
Пример #3
0
 protected new void AddItem(string[] inputParams)
 {
     var character = GetCharacterById(inputParams[1]);
     Item item;
     switch (inputParams[2].ToLower())
     {
         case "axe":
             item = new Axe(inputParams[3]);
             character.AddToInventory(item);
             break;
         case "shield":
             item = new Shield(inputParams[3]);
             character.AddToInventory(item);
             break;
         case "pill":
             item = new Pill(inputParams[3]);
             character.AddToInventory(item);
             break;
         case "injection":
             item = new Injection(inputParams[3]);
             character.AddToInventory(item);
             break;
         default:
             break;
     }
 }
Пример #4
0
        protected new void AddItem(string[] inputParams)
        {
            // add character itemClass itemId
            string hero = inputParams[1];
            string itemClass = inputParams[2];
            string itemID = inputParams[3];
            Character temp = GetCharacterById(hero);

            switch (itemClass.ToLower())
            {
                case "axe":
                    Axe axe = new Axe(itemID);
                    temp.AddToInventory(axe);
                    break;
                case "shield":
                    Shield shield = new Shield(itemID);
                    temp.AddToInventory(shield);
                    break;
                case "injection":
                    Injection inj = new Injection(itemID);
                    temp.AddToInventory(inj);
                    break;
                case "pill":
                    Pill pill = new Pill(itemID);
                    temp.AddToInventory(pill);
                    break;
                default:
                    break;
            }
        }
Пример #5
0
        protected new void AddItem(string[] inputParams)
        {
            string characterId = inputParams[1];
            Character character = characterList.Find(x => x.Id == characterId);

            string itemClass = inputParams[2];
            string itemId = inputParams[3];

            Item item;
            switch (itemClass)
            {
                case "axe":
                    item = new Axe(itemId);
                    break;
                case "shield":
                    item = new Shield(itemId);
                    break;
                case "pill":
                    item = new Pill(itemId);
                    break;
                case "injection":
                default:
                    item = new Injection(itemId);
                    break;
            }

            character.AddToInventory(item);
        }
Пример #6
0
 protected void AddItem(string[] inputParams)
 {
     Character characterToAcceptIitem = GetCharacterById(inputParams[1]);
     Item itemToAdd;
     switch (inputParams[2])
     {
         case "axe":
             itemToAdd = new Axe(inputParams[3]);
             characterToAcceptIitem.AddToInventory(itemToAdd);
             break;
         case "shield":
             itemToAdd = new Shield(inputParams[3]);
             characterToAcceptIitem.AddToInventory(itemToAdd);
             break;
         case "injection":
             itemToAdd = new Injection(inputParams[3]);
             characterToAcceptIitem.AddToInventory(itemToAdd);
             break;
         case "pill":
             itemToAdd = new Pill(inputParams[3]);
             characterToAcceptIitem.AddToInventory(itemToAdd);
             break;
         default:
             break;
     }
 }
        protected new void AddItem(string[] inputParams)
        {
            Character characterToAcceptIthem = GetCharacterById(inputParams[1]);
            string itemId = inputParams[3];
            Item itemToAdd;

            switch (inputParams[2].Trim())
            {
                case "axe":
                    itemToAdd = new Axe(itemId);
                    characterToAcceptIthem.AddToInventory(itemToAdd);
                    break;
                case "pill":
                    itemToAdd = new Pill(itemId);
                    characterToAcceptIthem.AddToInventory(itemToAdd);
                    break;
                case "shield":
                    itemToAdd = new Shield(itemId);
                    characterToAcceptIthem.AddToInventory(itemToAdd);
                    break;
                case "injection":
                    itemToAdd = new Injection(itemId);
                    characterToAcceptIthem.AddToInventory(itemToAdd);
                    break;
            }
        }
Пример #8
0
        protected override void AddItem(string[] inputParams)
        {
            string character = inputParams[1];
            string itemClass = inputParams[2];
            string itemId = inputParams[3];

            Item item;
            switch (itemClass)
            {
                case "axe":
                    Item axe = new Axe(itemId);
                    characterList.Find(x => x.Id == character).AddToInventory(axe);
                    break;
                case "injection":
                    Item injection = new Injection(itemId);
                    characterList.Find(x => x.Id == character).AddToInventory(injection);
                    break;
                case "pill":
                    Item pill = new Pill(itemId);
                    characterList.Find(x => x.Id == character).AddToInventory(pill);
                    break;
                case "shield":
                    Item shield = new Shield(itemId);
                    characterList.Find(x => x.Id == character).AddToInventory(shield);
                    break;
                default:
                    throw new ArgumentException("Item missing", "No such an item exist.");
            }
        }
Пример #9
0
        protected override void AddItem(string[] inputParams)
        {
            Item currentItem;
            switch (inputParams[2])
            {
                case "axe":
                    currentItem = new Axe(inputParams[3]);
                    break;
                case "shield":
                    currentItem = new Shield(inputParams[3]);
                    break;
                case "pill":
                    currentItem = new Pill(inputParams[3]);
                    this.timeoutItems.Add((Bonus)currentItem);
                    break;
                case "injection":
                    currentItem = new Injection(inputParams[3]);
                    this.timeoutItems.Add((Bonus)currentItem);
                    break;
                default:
                    throw new InvalidOperationException();
                    break;
            }

            Character currentCharacter = this.characterList.First(x => x.Id == inputParams[1]);
            currentCharacter.AddToInventory(currentItem);
        }
Пример #10
0
        public void DeadDummyThrowsExceptionIfAttacked()
        {
            Axe   axe   = new Axe(AxeAttackPoints, AxeDurability);
            Dummy dummy = new Dummy(DummyHealth, DummyXP);

            axe.Attack(dummy);

            var ex = Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));

            Assert.That(ex.Message == "Dummy is dead.", "Dead dummy doesn't throw exception if attacked");
        }
Пример #11
0
    public void DurabilityAfterAttack()
    {
        //Arrange
        Axe axe = new Axe(2, 2);

        //Act
        axe.Attack(target);

        //Assert
        Assert.That(axe.DurabilityPoints, Is.EqualTo(1), "Axe does notlose durability");
    }
Пример #12
0
    public void AttackWithBrokenWeapon(
        int attack,
        int durability,
        int health,
        int experience)
    {
        Axe   axe   = new Axe(attack, durability);
        Dummy dummy = new Dummy(health, experience);

        Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));
    }
Пример #13
0
        public void Axe_Should_Throw_Exception_If_An_Attack_Is_Made_With_Broken_Weapon()
        {
            //Arrange
            Axe   axe   = new Axe(ATTACK_POINTS, 0);
            Dummy dummy = this.dummy;

            //Assert
            Assert.That(
                () => axe.Attack(dummy),                    //Act
                Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
        }
Пример #14
0
        public void CannotAttackWithBrokenAxe()
        {
            // Arrange
            Axe axe = new Axe(AtackPoints, 0);

            // Assert
            Assert.That(
                () => axe.Attack(this.dummy), // Act
                Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."),
                "Axe should throw exception if an attack is made with broken weapon.");
        }
Пример #15
0
        public void AttackWithBrokenWeapon()
        {
            var axe   = new Axe(0, 0);
            var dummy = new Dummy(10, 10);

            Exception exception = Assert.ThrowsException <InvalidOperationException>(
                () => axe.Attack(dummy),
                "Attack with a broken axe is not allowed!");

            Assert.AreEqual("Axe is broken.", exception.Message);
        }
Пример #16
0
        public void AxeLoosesDurabilityAfterAttack()
        {
            this.axe = new Axe(ATTACK_ENABLED, DURABILITY_ENABLED);

            int initialDurability = axe.DurabilityPoints;

            axe.Attack(this.target);
            int actualDurability = axe.DurabilityPoints;

            Assert.That(actualDurability, Is.LessThan(initialDurability), "Axe is not loosing durability points.");
        }
Пример #17
0
        public void BrokenAxeCantAttack()
        {
            Axe   axe   = new Axe(1, 1);
            Dummy dummy = new Dummy(10, 10);

            axe.Attack(dummy);

            var ex = Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));

            Assert.AreEqual("Axe is broken.", ex.Message);
        }
Пример #18
0
    public void BrokenAxeCantAttack()
    {
        //Arrange
        Axe axe = new Axe(555, 0);

        //Act
        Assert.That(() => axe.Attack(this.target), Throws
                    .InvalidOperationException
                    .With
                    .Message.EqualTo("Axe is broken."));
    }
Пример #19
0
        public void AxeLosesDurabilityAfterAttack()
        {
            // Arrange
            Axe axe = new Axe(AtackPoints, 10);

            // Act
            axe.Attack(this.dummy);

            // Assert
            Assert.That(axe.DurabilityPoints, Is.EqualTo(9), "Axe durability dosn't change after attack");
        }
Пример #20
0
        public void AttackShouldThrowInvalidOperationExceptionWhenAttackWithBrokenWeapon(
            int axeAttack, int axeDurability,
            int dummyHealth, int dummyExp)
        {
            //Arrange
            Axe   axe   = new Axe(axeAttack, axeDurability);
            Dummy dummy = new Dummy(dummyHealth, dummyExp);

            //Act - Assert
            Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));
        }
Пример #21
0
 public ActionResult Edit([Bind(Include = "AxeId,Name,Attack,Handler,EnchantmentId")] Axe axe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(axe).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EnchantmentId = new SelectList(db.Enchantments, "EnchantmentId", "Element", axe.EnchantmentId);
     return(View(axe));
 }
Пример #22
0
    public void Test1()
    {
        IWeapon weapon = new Axe(10, 10);
        ITarget target = new Dummy(10, 10);

        Hero hero = new Hero("Pesho", weapon);

        hero.Attack(target);

        Assert.That(hero.Experience, Is.EqualTo(10));
    }
Пример #23
0
    public void TestAttackWithBrokenWeapon()
    {
        //Arrange
        var axe    = new Axe(Attack, 0);
        var target = new Dummy(50, 100);

        //Act

        //Assert
        Assert.That(() => axe.Attack(target), Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
    }
        public void Setup()
        {
            dwarf = new Dwarf("Gimli");
            Axe    axe    = new Axe();
            Helmet helmet = new Helmet();
            Shield shield = new Shield();

            dwarf.Axe    = axe;
            dwarf.Helmet = helmet;
            dwarf.Shield = shield;
        }
Пример #25
0
        public void TestIfWeaponLosesDurabilityAfterEachAttack(int attackingPoints, int durability)
        {
            //Arrange
            Axe axe = new Axe(attackingPoints, durability);

            //Act
            axe.Attack(dummy);

            //Assert
            Assert.That(axe.DurabilityPoints, Is.EqualTo(9), "Axe durability doens't change after attack!");
        }
Пример #26
0
        public void TestIfWeaponLosesDurabilityAfterAttack()
        {
            Dummy dummy = new Dummy(10, 10);
            Axe   axe   = new Axe(10, 10);

            var expectedResult = 9;

            axe.Attack(dummy);

            Assert.AreEqual(expectedResult, axe.DurabilityPoints);
        }
Пример #27
0
    public void TestIfWeaponLosesDurabilityAfterAttack()
    {
        //Arrange
        var axe = new Axe(Attack, 2);

        //Act
        axe.Attack(new Dummy(100, 50));

        //Assert
        Assert.That(axe.DurabilityPoints, Is.EqualTo(1));
    }
    public void HeroGetsExpWhenTargetDies()
    {
        IWeapon fakeAxe    = new Axe(10, 10);
        ITarget fakeDummy  = new Dummy(10, 10);
        Hero    sut        = new Hero("Gosho", fakeAxe);
        int     expAtStart = sut.Experience;

        sut.Attack(fakeDummy);

        Assert.AreEqual((expAtStart + 10), sut.Experience);
    }
Пример #29
0
 public Warrior(string name, int level, int healthPoints)
 {
     this.name          = name;
     this.level         = level;
     this.healthPoints  = healthPoints;
     this.fatigue       = DEFAULT_FATIGUE;
     this.abilityPoints = DEFAULT_ABILITYPOINTS;
     this.faction       = "Melee";
     this.weapon        = new Axe();
     this.bodyArmor     = new Chainlink();
 }
    public void AxeAttackWithBrokenWeaponShouldThrowException()
    {
        this.axe = new Axe(InitialAxeAttack, 0);

        InvalidOperationException ex = Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));

        Assert.That(ex.Message, Is.EqualTo("Axe is broken."),
                    "Broken axe attacked.");

        //Assert.That(() => axe.Attack(dummy), Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
    }
Пример #31
0
        static void Main()
        {
            IWeapon    axe  = new Axe();
            ICharacter mage = new Mage(axe);

            IWeapon    sword   = new Sword();
            ICharacter warrior = new Warrior(sword);

            Console.WriteLine(mage);
            Console.WriteLine(warrior);
        }
Пример #32
0
        public void BrokenAxeCannotAttack()
        {
            Axe axe = new Axe(1, 1);

            Dummy dummy = new Dummy(10, 10);

            axe.Attack(dummy);

            Assert.That(() => axe.Attack(dummy), Throws.InvalidOperationException
                        .With.Message.EqualTo("Axe is broken."));
        }
Пример #33
0
        public void BrokenAxeCantAtack()
        {
            Axe   axe   = new Axe(2, 2);
            Dummy dummy = new Dummy(20, 20);

            axe.Attack(dummy);
            axe.Attack(dummy);
            var ex = Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));

            Assert.That(ex.Message, Is.EqualTo("Axe is broken."));
        }
        public void SetUp()
        {
            axe    = new Axe();
            shield = new Shield();
            helmet = new Helmet();

            dummy        = new Dwarf("Dummy");
            dummy.Axe    = axe;
            dummy.Shield = shield;
            dummy.Helmet = helmet;
        }
Пример #35
0
        public void DummyLosesHealth()
        {
            //Arange
            Dummy dummy = new Dummy(10, 10);
            Axe   axe   = new Axe(10, 10);

            //Action
            axe.Attack(dummy);

            Assert.IsTrue(dummy.Health == 0, "Dummy does not lose health when attacked!");
        }
Пример #36
0
        public void AxeShouldThrowExceptionIfAttackIsMadeWithBrokenWeapon()
        {
            Assert.Throws <InvalidOperationException>(() =>
            {
                //Assert
                var axe = new Axe(AttackPoints, 0);

                //Act
                axe.Attack(target);
            }, "Axe is broken");
        }
Пример #37
0
        public void AxeShouldLoseDurabilityAfterAttack()
        {
            //Assert
            var axe = new Axe(AttackPoints, 5);

            //Act
            axe.Attack(target);

            //Assert
            Assert.That(axe.DurabilityPoints, Is.EqualTo(4));
        }
Пример #38
0
        public void AxeLosesDurabilityAfterEachAtack()
        {
            Dummy dummy            = new Dummy(10, 10);
            Axe   axe              = new Axe(10, 10);
            var   durabilityPoints = axe.DurabilityPoints;

            axe.Attack(dummy);
            var durabilityPointsAfterAttack = axe.DurabilityPoints;

            Assert.IsTrue(durabilityPoints > durabilityPointsAfterAttack, "Axe does not loose Durability after attack");
        }
Пример #39
0
    public void AttackWithBrokenWeapon()
    {
        Axe   axe   = new Axe(3, 1);
        Dummy dummy = new Dummy(10, 10);

        axe.Attack(dummy);

        Exception ex = Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));

        Assert.AreEqual("Axe is broken.", ex.Message);
    }
Пример #40
0
        // add character itemClass itemId
        protected void AddItem(string[] inputParams)
        {
            Character champion = GetCharacterById(inputParams[1]);
            Item artifact;

            switch (inputParams[2].ToLower())
            {
                case "axe":
                    artifact = new Axe(
                        inputParams[3],
                        0,
                        0,
                        75);
                    champion.AddToInventory(artifact);
                    break;

                case "shield":
                    artifact = new Shield(
                        inputParams[3],
                        0,
                        50,
                        0);
                    champion.AddToInventory(artifact);
                    break;

                case "injection":
                    artifact = new Injection(
                        inputParams[3],
                        200,
                        0,
                        0);
                    champion.AddToInventory(artifact);
                    break;

                case "pill":
                    artifact = new Pill(
                        inputParams[3],
                        0,
                        0,
                        100);
                    champion.AddToInventory(artifact);
                    break;

                default :
                    break;
            }
        }
Пример #41
0
        private Item CreateItem(string[] inputParams)
        {
            Item item = null;
            switch (inputParams[2])
            {
                case "axe":
                    item = new Axe(inputParams[3]);
                    break;
                case "shield":
                    item = new Shield(inputParams[3]);
                    break;
                default:
                    item = this.CreateBonus(inputParams);
                    break;
            }

            return item;
        }
Пример #42
0
	void recreateItem(){
		if(selectedItem == healthIndex){
			sell[selectedItem] = new HealthPotion();
		}
		else if(selectedItem == manaIndex){
			sell[selectedItem] = new ManaPotion();
		}
		else if(selectedItem == swordIndex){
			sell[selectedItem] = new Sword();
		}
		else if(selectedItem == axeIndex){
			sell[selectedItem] = new Axe();
		}
		else if(selectedItem == chestIndex){
			sell[selectedItem] = new Chest();
		}
		else if(selectedItem == bootsIndex){
			sell[selectedItem] = new Boots();
		}
	}
Пример #43
0
        protected void AddItem(string[] inputParams)
        {
            string id = inputParams[3];
            Item item = null;

            switch (inputParams[2])
            {
                case "axe":
                    item = new Axe(id);
                    break;
                case "shield":
                    item = new Shield(id);
                    break;
                case "injection":
                    item = new Injection(id);
                    break;
                case "pill":
                    item = new Pill(id);
                    break;
            }

            this.GetCharacterById(inputParams[1]).AddToInventory(item);
        }
Пример #44
0
        public List<BaseItem> GetAllItemsInBag(byte bag, int characterId)
        {
            DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_BAGID_PARAMETER, bag);
            bagIdParameter.DbType = DbType.Byte;

            DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_CHARACTERID_PARAMETER, characterId);
            characterIdParameter.DbType = DbType.Int32;

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

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter);

            int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID);
            int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID);
            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA);
            int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS);
            int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL);
            int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES);
            int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES);
            int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE);
            int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES);
            int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE);
            int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE);
            int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING);
            int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE);
            int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF);
            int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER);
            int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE);
            int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_IMBUEDATA = reader.GetOrdinal(DbNames.ITEM_IMBUEDATA);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1);
            int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2);
            int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3);
            int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4);
            int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1);
            int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2);
            int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3);
            int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4);
            int ordinalITEM_PETID = reader.GetOrdinal(DbNames.ITEM_PETID);
            int ordinalITEM_DAMAGEABSORB = reader.GetOrdinal(DbNames.ITEM_DAMAGEABSORB);
            int ordinalITEM_DEFENSEABSORB = reader.GetOrdinal(DbNames.ITEM_DEFENSEABSORB);
            int ordinalITEM_ATTACKRATINGABSORB = reader.GetOrdinal(DbNames.ITEM_ATTACKRATINGABSORB);
            int ordinalITEM_LIFEABSORB = reader.GetOrdinal(DbNames.ITEM_LIFEABSORB);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape || BType == (byte)bType.Mirror)
                {

                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                        c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1);
                        c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1);
                        c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2);
                        c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2);
                        c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3);
                        c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3);
                        c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4);
                        c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4);
                    }
                    if (BType == (byte)bType.Mirror)
                    {
                        // bkind 4 = mirror, 0 = jar
                        b = new Mirror();
                        Mirror m = b as Mirror;

                        m.PetID = reader.GetInt32(ordinalITEM_PETID);
                        m.LifeAbsorb = reader.GetInt16(ordinalITEM_LIFEABSORB);
                        m.DamageAbsorb = reader.GetInt16(ordinalITEM_DAMAGEABSORB);
                        m.DefenseAbsorb = reader.GetInt16(ordinalITEM_DEFENSEABSORB);
                        m.AttackRatingAbsorb = reader.GetInt16(ordinalITEM_ATTACKRATINGABSORB);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt16(ordinalITEM_CURDURA);
                    e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt32(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt32(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.Plus = reader.GetByte(ordinalITEM_PLUS);
                    e.Slvl = reader.GetByte(ordinalITEM_SLVL);
                    e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES);
                    e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES);
                    e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE);
                    e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES);
                    e.DragonDamage = reader.GetInt32(ordinalITEM_DRAGONDAMAGE);
                    e.DragonDefence = reader.GetInt32(ordinalITEM_DRAGONDEFENCE);
                    e.DragonAttackRating = reader.GetInt32(ordinalITEM_DRAGONATTACKRATING);
                    e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE);
                    e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF);
                    e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER);
                    e.RebirthHole = reader.GetInt16(ordinalITEM_REBIRTHHOLE);
                    e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }
                    if (BKind == (byte)bKindStones.RbItem)
                    {
                        b = new RbHoleItem();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                    im.ImbueData = reader.GetByte(ordinalITEM_IMBUEDATA);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }
                    if (BKind == (byte)bKindBooks.RebirdBook)
                    {
                        b = new RebirthBook();
                    }
                    if (BKind == (byte)bKindBooks.FourthBook)
                    {
                        b = new FourthBook();
                    }
                    if (BKind == (byte)bKindBooks.FeSkillBook)
                    {
                        b = new FeSkillBook();
                    }
                    if (BKind == (byte)bKindBooks.FeBook)
                    {
                        b = new FiveElementBook();
                    }
                    if (BKind == (byte)bKindBooks.FocusBook)
                    {
                        b = new FocusBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }
                if (BType == (byte)bType.StoreTag)
                {
                    b = new StoreTag();

                    StoreTag tag = b as StoreTag;
                    tag.TimeLeft = reader.GetInt16(ordinalITEM_CURDURA);
                    tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA);
                }
                if (BType == (byte)bType.PetItem)
                {
                    if (BKind == (byte)bKindPetItems.Taming)
                        b = new TameItem();
                    if (BKind == (byte)bKindPetItems.Food)
                        b = new PetFood();
                    if (BKind == (byte)bKindPetItems.Potion)
                        b = new PetPotion();
                    if (BKind == (byte)bKindPetItems.Resurect)
                        b = new PetResurrectItem();

                    PetItem p = b as PetItem;
                    p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                    p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                }
                if (BType == (byte)bType.Pill)
                {
                    if (BKind == (byte)bKindPills.Rebirth)
                        b = new RebirthPill();

                    RebirthPill p = b as RebirthPill;
                    p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS);
                    p.ToRebirth = (byte)(p.RequiredRebirth + 1);
                    p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX);
                }

                b.ItemID = reader.GetInt32(ordinalITEM_ITEMID);
                b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID);
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);

                items.Add(b);
            }

            reader.Close();
            _db.Close();

            return items;
        }
Пример #45
0
        static void Main(string[] args)
        {
            var sword = new Sword("Sword of Destiny");
            sword.Equip();
            sword.Damage(30);
            sword.Sell();

            WriteLine();

            var axe = new Axe("Fury Axe");
            axe.Equip();
            axe.Damage(50);
            axe.Sell();

            WriteLine();

            // Create an inventory based on IItem which allows us
            // to store both swords and axes
            IItem[] inventory = new IItem[2];
            inventory[0] = sword;
            inventory[1] = axe;

            // Here we only turn in items if they implemented IPartOfQuest
            for (var i = 0; i < inventory.Length; i++)
            {
                IPartOfQuest questItem = inventory[i] as IPartOfQuest;
                if (questItem != null)
                {
                    questItem.TurnIn();
                }
            }

            ReadLine();
        }
	public void recreateEquipItem(int x, int y, int i){
		Item item;
		if(PlayerPrefs.GetString("Equiped Item type" + i) == "Axe"){
			item = new Axe();
			item.useItem(player);
			//add item to axe slot
		}
		else if(PlayerPrefs.GetString("Equiped Item type" + i) == "Ring"){
			item = new Ring();
			item.useItem(player);
			//add item to ring slot);
		}
		else if(PlayerPrefs.GetString("Equiped Item type" + i) == "Chest"){
			item = new Chest();
			item.useItem(player);
			//add item to chest slot
		}
		else if(PlayerPrefs.GetString("Equiped Item type" + i) == "Boots"){
			item = new Boots();
			item.useItem(player);
			//add item to boots slot
		}
		else if(PlayerPrefs.GetString("Equiped Item type" + i) == "Amulet"){
			item = new Amulet();
			item.useItem(player);
			//add item to amulet slot
		}
		else if(PlayerPrefs.GetString("Equiped Item type" + i) == "Sword"){
			item = new Sword();
			item.useItem(player);
			//add item to sword slot
		}
	}
Пример #47
0
        private new void AddItem(string[] inputParams)
        {
            Item item;
            switch (inputParams[2].ToLower())
            {
                case "axe":
                    item = new Axe(inputParams[3]);
                    break;
                case "shield":
                    item = new Shield(inputParams[3]);
                    break;
                case "injection":
                    item = new Injection(inputParams[3]);
                    break;
                case "pill":
                    item = new Pill(inputParams[3]);
                    break;
                default:
                    throw new ApplicationException("No such kind of item.");
            }

            var character = this.characterList.First(c => c.Id == inputParams[1]);
            character.AddToInventory(item);
        }
Пример #48
0
 public Axe(Axe axe)
     : base(axe)
 {
 }
Пример #49
0
        public List<BaseItem> GetAllItemsInNpcBag(byte bag, int npcId)
        {
            DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_BAGID_PARAMETER, bag);
            bagIdParameter.DbType = DbType.Byte;

            DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_NPCID_PARAMETER, npcId);
            characterIdParameter.DbType = DbType.Int32;

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

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLNPCITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter);

            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_PRICE = reader.GetOrdinal(DbNames.ITEM_PRICE);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_DURABILITY = reader.GetOrdinal(DbNames.ITEM_DURABILITY);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_MAXIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {

                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if(BKind == (byte)bKindWeapons.Hammer && BType == (byte)bType.Weapon)
                    {
                        b = new Hammer();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.Durability = reader.GetInt32(ordinalITEM_DURABILITY);
                    e.MaxDurability = e.Durability;
                    e.Damage = reader.GetInt16(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt16(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUETRIES);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }

                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_PRICE);

                items.Add(b);
            }

            reader.Close();
            _db.Close();

            return items;
        }
Пример #50
0
        public BaseItem GetRebirthPillDrop(Monster m)
        {
            DbParameter levelParameter = _db.CreateParameter(DbNames.GETPILLDROPITEM_LEVEL_PARAMETER, m.Level);
            levelParameter.DbType = DbType.Int32;

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

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETPILLDROPITEM_STOREDPROC, CommandType.StoredProcedure, levelParameter);

            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.DROPITEM_DURABILITY);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);
            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {

                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt32(ordinalITEM_MAXDURA);
                    e.MaxDurability = reader.GetInt32(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt32(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt32(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }
                    if (BKind == (byte)bKindStones.RbItem)
                    {
                        b = new RbHoleItem();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }
                    if (BKind == (byte)bKindBooks.RebirdBook)
                    {
                        b = new RebirthBook();
                    }
                    if (BKind == (byte)bKindBooks.FourthBook)
                    {
                        b = new FourthBook();
                    }
                    if (BKind == (byte)bKindBooks.FeSkillBook)
                    {
                        b = new FeSkillBook();
                    }
                    if (BKind == (byte)bKindBooks.FeBook)
                    {
                        b = new FiveElementBook();
                    }
                    if (BKind == (byte)bKindBooks.FocusBook)
                    {
                        b = new FocusBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }
                if (BType == (byte)bType.StoreTag)
                {
                    b = new StoreTag();

                    StoreTag tag = b as StoreTag;
                    tag.TimeLeft = reader.GetInt16(ordinalITEM_MAXDURA);
                    tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA);
                }
                if (BType == (byte)bType.PetItem)
                {
                    if (BKind == (byte)bKindPetItems.Taming)
                        b = new TameItem();
                    if (BKind == (byte)bKindPetItems.Food)
                        b = new PetFood();
                    if (BKind == (byte)bKindPetItems.Potion)
                        b = new PetPotion();
                    if (BKind == (byte)bKindPetItems.Resurect)
                        b = new PetResurrectItem();

                    PetItem p = b as PetItem;
                    p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                    p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                }
                if (BType == (byte)bType.Pill)
                {
                    if (BKind == (byte)bKindPills.Rebirth)
                        b = new RebirthPill();

                    RebirthPill p = b as RebirthPill;
                    p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS);
                    p.ToRebirth = (byte)(p.RequiredRebirth + 1);
                    p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX);
                }

                b.ItemID = 0;
                b.OwnerID = 0;
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = 0;
                b.Slot = 0;
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = 1;
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);
                items.Add(b);
            }

            reader.Close();
            _db.Close();

            if (items.Count > 0)
            {
                Random rand = new Random();
                int itemPos = rand.Next(0, items.Count);
                return items[itemPos];
            }
            else
                return null;
        }
 public King()
 {
     weapon = new Axe();
     name = "king";
 }
	public void recreateFighterItem(int x, int y, int i){
		Item item;
		if(PlayerPrefs.GetString("Fighter Item type" + i) == "ManaPotion"){
			item = new ManaPotion();
			inventory.addItem(x,y,item, inventorySlots, inventoryItems);
		}
		else if(PlayerPrefs.GetString("Fighter Item type"  + i) == "HealthPotion"){
			item = new HealthPotion();
			inventory.addItem(x,y,item, inventorySlots, inventoryItems);
		}
		else if(PlayerPrefs.GetString("Fighter Item type"  + i) == "Axe"){
			item = new Axe();
			inventory.addItem(x,y,item, inventorySlots, inventoryItems);
		}
		else if(PlayerPrefs.GetString( "Fighter Item type" + i) == "Ring"){
			item = new Ring();
			inventory.addItem(x,y,item, inventorySlots, inventoryItems);
		}
		else if(PlayerPrefs.GetString("Fighter Item type" + i) == "Chest"){
			item = new Chest();
			inventory.addItem(x,y,item, inventorySlots, inventoryItems);
		}
		else if(PlayerPrefs.GetString("Fighter Item type" + i) == "Boots"){
			item = new Boots();
			inventory.addItem(x,y,item, inventorySlots, inventoryItems);
		}
		else if(PlayerPrefs.GetString("Fighter Item type"  + i) == "Amulet"){
			item = new Amulet();
			inventory.addItem(x,y,item, inventorySlots, inventoryItems);
		}
		else if(PlayerPrefs.GetString( "Fighter Item type" + i) == "Sword"){
			item = new Sword();
			inventory.addItem(x,y,item, inventorySlots, inventoryItems);
		}
	}
Пример #53
0
         protected void AddItem(string[] inputParams)
         {
             string characterId;
             string itemId;
             string itemClass;

             Characters character;
             Item item;

             characterId = inputParams[1];
             character = characterList.Find(x => x.ID == characterId);

             itemClass = inputParams[2];
             itemId = inputParams[3];

             switch (itemClass)
             {
                 case "axe":
                     item = new Axe(itemId);
                     break;
                 case "shield":
                     item = new Shield(itemId);
                     break;
                 case "pill":
                     item = new Pill(itemId);
                     break;
                 case "injection":
                     item = new Injection(itemId);
                     break;
                 default:
                     break;
             }
         }
Пример #54
0
        public BaseItem GetItemByItemID(int itemID)
        {
            DbParameter itemIdParameter = _db.CreateParameter(DbNames.GETITEMBYITEMID_ITEMID_PARAMETER, itemID);
            itemIdParameter.DbType = DbType.Int32;

            BaseItem b = null;

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETITEMBYITEMID_STOREDPROC, CommandType.StoredProcedure, itemIdParameter);

            int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID);
            int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID);
            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA);
            int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS);
            int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL);
            int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES);
            int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES);
            int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE);
            int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES);
            int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE);
            int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE);
            int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING);
            int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE);
            int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF);
            int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER);
            int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE);
            int ordinalITEM_REBIRTHHOLEITEM = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLEITEM);
            int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1);
            int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2);
            int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3);
            int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4);
            int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1);
            int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2);
            int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3);
            int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {
                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                        c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1);
                        c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1);
                        c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2);
                        c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2);
                        c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3);
                        c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3);
                        c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4);
                        c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt16(ordinalITEM_CURDURA);
                    e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt16(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt16(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.Plus = reader.GetByte(ordinalITEM_PLUS);
                    e.Slvl = reader.GetByte(ordinalITEM_SLVL);
                    e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES);
                    e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES);
                    e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE);
                    e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES);
                    e.DragonDamage = reader.GetInt16(ordinalITEM_DRAGONDAMAGE);
                    e.DragonDefence = reader.GetInt16(ordinalITEM_DRAGONDEFENCE);
                    e.DragonAttackRating = reader.GetInt16(ordinalITEM_DRAGONATTACKRATING);
                    e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE);
                    e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF);
                    e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER);
                    e.RebirthHole = reader.GetByte(ordinalITEM_REBIRTHHOLE);
                    e.RebirthHoleItem = reader.GetByte(ordinalITEM_REBIRTHHOLEITEM);
                    e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }

                b.ItemID = reader.GetInt32(ordinalITEM_ITEMID);
                b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID);
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);
            }

            reader.Close();
            _db.Close();

            return b;
        }
Пример #55
0
        private new void AddItem(string[] inputParams)
        {
            Item item;
            switch (inputParams[2].ToLower())
            {
                case "axe":
                    item = new Axe(inputParams[3]);
                    break;
                case "shield":
                    item = new Shield(inputParams[3]);
                    break;
                case "injection":
                    item = new Injection(inputParams[3]);
                    break;
                case "pill":
                    item = new Pill(inputParams[3]);
                    break;
                default:
                    throw new ApplicationException("No such kind of item.");
            }

            string targetCharecterId = inputParams[1];

            var character = this.characterList.Where(ch => ch.IsAlive)
                .FirstOrDefault(c => c.Id == targetCharecterId);

            if (character == null)
                throw new ArgumentException("No character with id " + targetCharecterId);

            character.AddToInventory(item);
        }