示例#1
0
    void createItems()
    {
        Clothes clothes = new Clothes();
        clothes.name = "BLACK HANW >>> Number:" + character.name;
        clothes.id = 5;
        clothes.typeItem = _Item.Clothes;
        clothes.typeCloths = _Cloths.Chest;
        clothes.armor.armor = Random.Range(1, 100);
        clothes.armor.parry = Random.Range(1, 100);
        character.inventory.addItemInventory(clothes);


        character.life.life = 5000;
        character.life.currentLife = character.life.life;

        for (int i = 0; i < 2; i++)
        {
            Effect.StatesEffect state = new Effect.StatesEffect();
            state.value = 45 * (i + 1);
            state.cooldownEffects = 3 * (i + 1);
            state.effectsRemove = _EffectsRemove.Life;
            state.instante =   i != 0 ? true : false;

            Effect effect = new Effect();

            effect.effects.Add(state);
            effect.cooldown = 40;

            character.effects.Add(effect);
        }
    }
示例#2
0
 public ActionResult Update(Clothes clothes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(clothes).State = EntityState.Modified;
         clothes.ModifiedDate    = DateTime.Now;
         db.SaveChanges();
         return(RedirectToAction("ReadAll"));
     }
     return(View(clothes));
 }
示例#3
0
        private static void FoundClothing(Dictionary <string, List <Clothes> > records, string[] wantedItem)
        {
            string color        = wantedItem[0];
            string clothingName = wantedItem[1];

            if (records.ContainsKey(color) && records[color].Any(x => x.Name == clothingName))
            {
                Clothes wantedClothing = records[color].FirstOrDefault(x => x.Name == clothingName);
                wantedClothing.Found = "(found!)";
            }
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("Id,Marca,Quantidade,Valor,Tamanho")] Clothes clothes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clothes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(clothes));
        }
示例#5
0
    public virtual void Awake()
    {
        Skin    = transform.Find("Sprites/Skin").GetComponent <SpriteRenderer>();
        Hair    = transform.Find("Sprites/Hair").GetComponent <SpriteRenderer>();
        Face    = transform.Find("Sprites/Eyes").GetComponent <SpriteRenderer>();
        Clothes = transform.Find("Sprites/Clothes").GetComponent <SpriteRenderer>();

        this.level   = GameObject.FindObjectOfType <LevelController>();
        this.sprites = Resources.LoadAll <Sprite>("Sprites/CoMA People");
        this.trail   = Clothes.GetComponent <TrailRenderer>();
    }
        public async Task <IActionResult> Create([Bind("Id,Name,Price,Description,ImageUrl,IsPopularItem")] Clothes clothes)
        {
            if (ModelState.IsValid)
            {
                cr.Add(clothes);
                await cr.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(clothes));
        }
示例#7
0
        public ActionResult Create([Bind(Include = "ClothesID,ClothingType,ClothingAmount,Size")] Clothes clothes)
        {
            if (ModelState.IsValid)
            {
                db.Clothes.Add(clothes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(clothes));
        }
示例#8
0
        public ActionResult Create(Clothes clothes)
        {
            if (ModelState.IsValid)
            {
                clothes.ModifiedDate = DateTime.Now;
                db.Clothes.Add(clothes);
                db.SaveChanges();
                return(RedirectToAction("ReadAll"));
            }

            return(View(clothes));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Price,Description,ImageUrl,IsPopularItem,ServicesId")] Clothes clothes)
        {
            if (ModelState.IsValid)
            {
                cr.Add(clothes);
                await cr.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["ServicesId"] = new SelectList(sr.GetAll(), "Id", "Name", clothes.ServicesId);
            return(View(clothes));
        }
        public ActionResult Ramdom()
        {
            var clothes = new Clothes()
            {
                NameOfProduct = "Skirt", ID = 002, Price = 210000
            };

            //return View(model:clothes);
            //return RedirectToAction("Index", "Home");
            return(RedirectToAction("Ramdom2", "Clothes", new { page = "Edit", sortBy = "name" })); //Return to ../Clothes/Ramdom2 action.
                                                                                                    //And give some COMMENT for user to understand
        }
示例#11
0
        public async Task <IActionResult> Edit(Clothes clothes, int imgId)
        {
            if (_userManager.GetUserId(User) == adminId)
            {
                //if (ModelState.IsValid)
                //{
                if (clothes.Image.ImageFile != null)
                {
                    string wwwRootPath = _hostEnvironment.WebRootPath;
                    string fileName    = Path.GetFileNameWithoutExtension(clothes.Image.ImageFile.FileName);
                    string extention   = Path.GetExtension(clothes.Image.ImageFile.FileName);
                    clothes.Image.ImageName = fileName = fileName + DateTime.Now.ToString("yymmssfff") + extention;
                    string path = Path.Combine(wwwRootPath + "/Image/", fileName);

                    using (var fileStream = new FileStream(path, FileMode.Create))
                    {
                        await clothes.Image.ImageFile.CopyToAsync(fileStream);
                    }

                    Image img = new Image
                    {
                        ImageName = clothes.Image.ImageName,
                        Title     = clothes.Image.Title
                    };

                    await _context.Images.AddAsync(img);

                    await _context.SaveChangesAsync();

                    clothes.Image   = null;
                    clothes.ImageId = _context.Images.FirstOrDefault(i => i.ImageName == img.ImageName).Id;
                    _context.Entry(clothes).State = EntityState.Modified;
                    await _context.SaveChangesAsync();
                }
                else
                {
                    clothes.ImageId = imgId;
                    _context.Entry(clothes).State = EntityState.Modified;
                    //_context.Add(clothes);
                    await _context.SaveChangesAsync();
                }
                //}

                //_context.Entry(clothes).State = EntityState.Modified;
                //await _context.SaveChangesAsync();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(Permission());
            }
        }
示例#12
0
        public async Task <IActionResult> Create([Bind("Title,Description,CategoryId,Price,TypeId,Id,Created")] Clothes clothes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clothes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Id", clothes.CategoryId);
            ViewData["TypeId"]     = new SelectList(_context.Type, "Id", "Id", clothes.TypeId);
            return(View(clothes));
        }
示例#13
0
        public IActionResult Get(int id)
        {
            Clothes istore = _clothes.Find(i => i.Id == id);

            if (istore == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(istore));
            }
        }
示例#14
0
    public void LoadFeatures()
    {
        if (character.characterdata.Count == 0)
        {
            character.characterdata = new List <Clothes>();

            for (int i = 0; i < 3; i++)
            {
                Clothes newclothes = new Clothes(0, 0);
                character.characterdata.Add(newclothes);
            }
        }
    }
示例#15
0
        public Clothes AddCloth(Clothes clothes)
        {
            if (clothes?.id == 0)
            {
                var allClothes = GetAll();
                var number     = allClothes.Select(x => x.id).OrderByDescending(x => x).FirstOrDefault();
                clothes.id = number + 1;
            }

            GetDataFromDB.AddClothes(clothes);

            return(clothes);
        }
示例#16
0
 public ClothesExtended(Clothes clothes)
 {
     if (clothes.Id.HasValue)
     {
         this.Id    = clothes.Id.Value;
         this.Code  = clothes.Code;
         this.Label = clothes.Label;
     }
     else
     {
         throw new Exception("Cannot create ClothesExtended - the clothes id is null");
     }
 }
        public void DryAsync(Clothes wetClothes, Action <Clothes> callback)
        {
            var thread = new Thread(() =>
            {
                Thread.Sleep(1000);

                var dryClothes = wetClothes;

                callback(dryClothes);
            });

            thread.Start();
        }
示例#18
0
        public static void SetPlayerSkinClothes(Client player, int type, Character character, bool isFirstTime)
        {
            Clothes      playerClothes     = null;
            ClothesTypes playerTypeClothes = null;

            if (type == 0)
            {
                playerClothes = ContextFactory.Instance.Clothes.FirstOrDefault(x => x.CharacterId == character.Id);
            }
            else
            {
                playerTypeClothes = ContextFactory.Instance.ClothesTypes.FirstOrDefault(x => x.Type == type);
            }

            // FIRST REGISTARTION of character clothes:
            if (isFirstTime)
            {
                var isMale = character.Model == 1885233650;

                playerClothes = new Clothes();
                var typeClothes = isMale ?
                                  ContextFactory.Instance.ClothesTypes.FirstOrDefault(x => x.Type == 999) :
                                  ContextFactory.Instance.ClothesTypes.FirstOrDefault(x => x.Type == 9990);
                if (typeClothes == null)
                {
                    return;
                }

                playerClothes.CharacterId = character.Id;
                character.ActiveClothes   = isMale ? 999 : 9990;
                ClothesAssigment(playerClothes, typeClothes);

                ContextFactory.Instance.Clothes.Add(playerClothes);
                ContextFactory.Instance.SaveChanges();

                //API.shared.setPlayerClothes(player, 0, 0, 0);
                SetPlayerClothesAccessory(player, playerClothes);
            }

            // PLAYER CLOTHES (table Clothes):
            if (!isFirstTime && type == 0)
            {
                SetPlayerClothesAccessory(player, playerClothes);
            }

            // FRACTION CLOTHES (table ClothesTypes):
            if (!isFirstTime && type != 0)
            {
                SetPlayerTypeClothesAccessory(player, playerTypeClothes);
            }
        }
        static void Main(string[] args)
        {
            Clothes tshirt = new Clothes();

            tshirt.SetPrice(DefaultPrice);
            Book book = new Book();

            book.SetAuthor("Moorkock");
            Item[] items = new Item[] { tshirt, };
            foreach (Item item in items)
            {
                item.SetDiscount(DefaultDiscount);
            }
        }
示例#20
0
 // PRIVATE methods:
 private static void SetPlayerClothesAccessory(Client player, Clothes playerClothes)
 {
     API.shared.setPlayerClothes(player, 1, playerClothes.MaskSlot, playerClothes.MaskDraw);
     API.shared.setPlayerClothes(player, 3, playerClothes.TorsoSlot, playerClothes.TorsoDraw);
     API.shared.setPlayerClothes(player, 4, playerClothes.LegsSlot, playerClothes.LegsDraw);
     API.shared.setPlayerClothes(player, 5, playerClothes.BagsSlot, playerClothes.BagsDraw);
     API.shared.setPlayerClothes(player, 6, playerClothes.FeetSlot, playerClothes.FeetDraw);
     API.shared.setPlayerClothes(player, 7, playerClothes.AccessSlot, playerClothes.AccessDraw);
     API.shared.setPlayerClothes(player, 8, playerClothes.UndershirtSlot, playerClothes.UndershirtDraw);
     API.shared.setPlayerClothes(player, 9, playerClothes.ArmorSlot, playerClothes.ArmorDraw);
     API.shared.setPlayerClothes(player, 11, playerClothes.TopsSlot, playerClothes.TopsDraw);
     API.shared.setPlayerAccessory(player, 0, playerClothes.HatsSlot, playerClothes.HatsDraw);
     API.shared.setPlayerAccessory(player, 1, playerClothes.GlassesSlot, playerClothes.GlassesDraw);
 }
示例#21
0
        public IActionResult Create(Clothes record)
        {
            var clothes = new Clothes();

            clothes.ClothesName = record.ClothesName;
            clothes.Description = record.Description;
            clothes.Price       = record.Price;
            clothes.ClothesUrl  = record.ClothesUrl;
            clothes.Type        = record.Type;

            _context.Clothes.Add(clothes);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#22
0
        // GET: Clothes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Clothes clothes = db.Clothes.Find(id);

            if (clothes == null)
            {
                return(HttpNotFound());
            }
            return(View(clothes));
        }
示例#23
0
        public Task Run()
        {
            logWriter("Received a pile of dirty clothes.");

            var dirtyClothes = new Clothes();

            var laundry = new AsyncByHandLaundryWithTasks();

            var synchronizationContext = SynchronizationContext.Current;

            Action <Task <Clothes> > dryingContinuation = dryTask =>
            {
                var dryClothes = dryTask.Result;

                logWriter("Clothes dried!");
                logWriter("Clothes ready to collect!");
            };

            Action <Task <Clothes> > washingContinuation = washTask =>
            {
                logWriter("Clothes washed!");

                var cleanWetClothes = washTask.Result;

                laundry.DryAsync(cleanWetClothes).ContinueWith(dryTask =>
                {
                    if (synchronizationContext != null)
                    {
                        synchronizationContext.Post(_ => dryingContinuation(washTask), null);
                    }
                    else
                    {
                        dryingContinuation(washTask);
                    }
                });
            };

            return(laundry.WashAsync(dirtyClothes).ContinueWith(washTask =>
            {
                if (synchronizationContext != null)
                {
                    synchronizationContext.Post(_ => washingContinuation(washTask), null);
                }
                else
                {
                    washingContinuation(washTask);
                }
            }));
        }
示例#24
0
    }                        //返回主页

    //修改衣服状态
    protected void ChangeCondition_Click(object sender, EventArgs e)
    {
        int     id      = int.Parse(Request["__EVENTARGUMENT"]);
        Clothes clothes = new Clothes();

        if (clothes.UpdateOne(id))
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('修改成功');", true);
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('修改失败');", true);
        }
        BuildPage();
    }
        public void WriteDataToFileTests_IncorectFilePath_FileNotFoundExceptionThrow()
        {
            bool    actual  = false;
            Clothes clothes = new Clothes(5.21, "kofta n7", 16, 10);

            try
            {
                JsonFileManger.WriteDataToFile(new Product[] { clothes }, @"D:\Learn\EPAM\task2\ClassLibrary1\data.jso");
            }
            catch (FileNotFoundException)
            {
                actual = true;
            }
            Assert.IsTrue(actual);
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Clothes = await _context.Clothes.FirstOrDefaultAsync(m => m.ID == id);

            if (Clothes == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#27
0
 public BaseCivNpc(Vector2 positions)
 {
     Position    = positions;
     WayPoint    = Position.X;
     WayPoint   += Program.Game.Rand.Next(-Tile.TILE_MAX_SIZE, Tile.TILE_MAX_SIZE);
     Rect.Width  = Width;
     Rect.Height = Height;
     Drop.Clear();
     Drop.Add(new Item(1, 7));
     for (var i = 0; i < 6; i++)
     {
         ClothesSkin[i] = new Clothes();
     }
     Race = Race.Racelist[0];
 }
示例#28
0
 public static ClothesViewModel CreateClothesView(Clothes clothes)
 {
     return(new ClothesViewModel()
     {
         Id = clothes.Id,
         Name = clothes.Name,
         Description = clothes.Brand?.Name + " || " + " " + clothes.Name + " " + clothes.Material,
         Cost = clothes.Cost,
         Sizes = clothes.ClothesMarksInStock.Where(e => e.CountInStock > 0).Select(e => new SizeViewModel {
             SizeId = e.Size.Id, SizeMark = e.Size.Mark
         }),
         Image = clothes.ImageName,
         PromoutionPercent = clothes.PromoutionPercent
     });
 }
示例#29
0
    void createItems()
    {
        for (int i = 0; i < 3; i++)
        {
            Clothes clothes = new Clothes();
            clothes.id          = i;
            clothes.name        = "I AM : " + Random.Range(1, 5000).ToString();
            clothes.typeItem    = _Item.Clothes;
            clothes.typeCloths  = _Cloths.Chest;
            clothes.armor.armor = Random.Range(1, 100);
            clothes.armor.parry = Random.Range(1, 100);

            rpgCustomControl.bag.addItemInventory(clothes);
        }
    }
示例#30
0
        /// <summary>
        /// 装饰
        /// </summary>
        static void Decorator()
        {
            Console.WriteLine($"装饰{Environment.NewLine}-------------------------------------------");

            Component human = new Human();  //一个人

            human = new Clothes(human);     //穿衣服
            human = new Clothes(human);     //在穿一件衣服
            human = new Trouser(human);     //穿裤子
            human = new Shoe(human);        //穿鞋
            //Component human = new Shoe(new Trouser(new Clothes(new Human())));

            Console.WriteLine(human.ShowMyself());
            Console.ReadKey();
        }
示例#31
0
        public void TestClothesSerialization()
        {
            const string fileName = "clothes.xml";

            // assign
            var clothes = new Clothes
            {
                Title              = "Baseball Cap",
                Description        = "A very nice one",
                Price              = 11,
                Sold               = true,
                PaymentDistributed = false,
                Owner              = new Vendor
                {
                    FirstName  = "FirstName",
                    LastName   = "LastName",
                    PaymentDue = 11
                }
            };

            // action
            var str = NaiveXMLSerializer.Serialize(clothes);

            File.WriteAllText(fileName, str);

            // assert
            var serializer    = new XmlSerializer(typeof(Clothes));
            var reader        = new StreamReader(fileName);
            var targetClothes = (Clothes)serializer.Deserialize(reader);

            reader.Close();

            Assert.IsNotNull(targetClothes);
            Assert.AreEqual(targetClothes.Title, clothes.Title);
            Assert.AreEqual(targetClothes.Description, clothes.Description);
            Assert.AreEqual(targetClothes.Price, clothes.Price);
            Assert.AreEqual(targetClothes.Sold, clothes.Sold);
            Assert.AreEqual(targetClothes.PaymentDistributed, clothes.PaymentDistributed);
            Assert.AreEqual(targetClothes.ID, clothes.ID);
            Assert.AreEqual(targetClothes.Display, clothes.Display);
            Assert.AreEqual(targetClothes.Commission, clothes.Commission);
            Assert.AreEqual(targetClothes.Type, clothes.Type);

            Assert.IsNotNull(targetClothes.Owner);
            Assert.AreEqual(targetClothes.Owner.FirstName, clothes.Owner.FirstName);
            Assert.AreEqual(targetClothes.Owner.LastName, clothes.Owner.LastName);
            Assert.AreEqual(targetClothes.Owner.PaymentDue, clothes.Owner.PaymentDue);
        }
示例#32
0
    void createItems()
    {
        for (int i = 0; i < 3; i++)
        {

            Clothes clothes = new Clothes();
            clothes.id = i;
            clothes.name = "I AM : " + Random.Range(1, 5000).ToString();
            clothes.typeItem = _Item.Clothes;
            clothes.typeCloths = _Cloths.Chest;
            clothes.armor.armor = Random.Range(1, 100);
            clothes.armor.parry = Random.Range(1, 100);

            rpgCustomControl.bag.addItemInventory(clothes);
        }
    }
示例#33
0
    public override void Enemy_Init(EnemySettings settings, int laneId)
    {
        collider = GetComponent<BoxCollider2D>();
        clothes = GetComponent<Clothes>();
        clothes.Restart();

        distance = Game.Instance.gameManager.distance;
        speed = settings.speed;
        Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);

        if (speed < 0)
            scale.x *= -1;

        transform.localScale = scale;

        Walk();
    }
示例#34
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;
        }
示例#35
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;
        }
示例#36
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;
        }
示例#37
0
 /// <summary>
 /// Remover as caracteristicas dos vestimentos
 /// </summary>
 /// <param name="_cloths"></param>
 public void removeFeatures(Clothes _cloths)
 {
     this.armor -= _cloths.armor;
     this.attributes -= _cloths.attributes;
     /*
     this.armor.removeArmor(_cloths.armor);
     this.attributes.removeAttributes(_cloths.attributes);*/
 }
示例#38
0
 /// <summary>
 /// Adicionar caracteristicas dos vestimentos
 /// </summary>
 /// <param name="_cloths"></param>
 public void addFeatures(Clothes _cloths)
 {
     this.armor += _cloths.armor;
     this.attributes += _cloths.attributes;
     /*
     this.armor.addArmor(_cloths.armor);
     this.attributes.addAttributes(_cloths.attributes);*/
 }
示例#39
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;
        }