Exemplo n.º 1
0
        public void HandleGameRoomCreate(GSPacketIn pkg)
        {
            int roomId = pkg.ReadInt();
            int gameType = pkg.ReadInt();
            int count = pkg.ReadInt();

            IGamePlayer[] players = new IGamePlayer[count];
            for (int i = 0; i < count; i++)
            {
                PlayerInfo info = new PlayerInfo();
                info.ID = pkg.ReadInt();
                info.Attack = pkg.ReadInt();
                info.Defence = pkg.ReadInt();
                info.Agility = pkg.ReadInt();
                info.Luck = pkg.ReadInt();

                double baseAttack = pkg.ReadDouble();
                double baseDefence = pkg.ReadDouble();
                double baseAgility = pkg.ReadDouble();
                double baseBlood = pkg.ReadDouble();
                int templateId = pkg.ReadInt();

                ItemTemplateInfo itemTemplate = ItemMgr.FindItemTemplate(templateId);
                ItemInfo item = new ItemInfo(itemTemplate);

                players[i] = new ProxyPlayer(info, item, baseAttack, baseDefence, baseAgility, baseBlood);
            }

            ProxyRoomMgr.CreateRoom(players, roomId, this);
        }
Exemplo n.º 2
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int             numReadByte = packet.ReadByte();
            int             numReadInt  = packet.ReadInt();
            PlayerInventory caddyBag    = client.Player.CaddyBag;
            PlayerInventory propBag     = client.Player.PropBag;
            PlayerInventory storeBag    = client.Player.StoreBag;
            PlayerInventory mainBag     = client.Player.MainBag;

            for (int i = 0; i < caddyBag.Capalility; i++)
            {
                SqlDataProvider.Data.ItemInfo itemAt = caddyBag.GetItemAt(i);
                if (itemAt != null)
                {
                    if (((itemAt.Template.CategoryID == 10) || (itemAt.Template.CategoryID == 11)) || (itemAt.Template.CategoryID == 12))
                    {
                        caddyBag.MoveToStore(caddyBag, i, propBag.FindFirstEmptySlot(1), propBag, 999);
                    }
                    else if ((itemAt.Template.CategoryID == 7) && (mainBag.GetItemAt(6) == null))
                    {
                        caddyBag.MoveToStore(caddyBag, i, 6, mainBag, 999);
                    }
                    else
                    {
                        caddyBag.MoveToStore(caddyBag, i, mainBag.FindFirstEmptySlot(31), mainBag, 999);
                    }
                }
            }
            client.Lottery = -1;
            return(1);
        }
Exemplo n.º 3
0
 public  void  PropertyString(ItemInfo item, ref string Property)
 {
     if (item != null)
         Property = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", item.StrengthenLevel, item.Attack, item.Defence,
                    item.Agility, item.Luck, item.AttackCompose, item.DefendCompose, item.AgilityCompose, item.LuckCompose);
 
 }
Exemplo n.º 4
0
 public Box(int id,string model,ItemInfo item)
     : base(id,"",model,"",1,1)
 {
     _userID = 0;
     m_rect = new Rectangle(-15, -15, 30, 30);
     m_item = item;
 }
Exemplo n.º 5
0
 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     if (998 <= client.Player.PlayerCharacter.Money)
     {
         SqlDataProvider.Data.ItemInfo item  = this.getitem(client, 1, "", "", 1101801);
         SqlDataProvider.Data.ItemInfo info2 = this.getitem(client, 1, "", "", 1102001);
         SqlDataProvider.Data.ItemInfo info3 = this.getitem(client, 1, "", "", 1102401);
         SqlDataProvider.Data.ItemInfo info4 = this.getitem(client, 1, "", "", 1102401);
         SqlDataProvider.Data.ItemInfo info5 = this.getitem(client, 1, "", "", 1102401);
         PlayerInventory bag       = client.Player.GetInventory(eBageType.Store);
         PlayerInventory inventory = client.Player.GetInventory(eBageType.PropBag);
         List <SqlDataProvider.Data.ItemInfo> items = bag.GetItems();
         foreach (SqlDataProvider.Data.ItemInfo info6 in items)
         {
             bag.MoveToStore(bag, info6.Place, inventory.FindFirstEmptySlot(0), inventory, 50);
         }
         bag.AddItemTo(item, 4);
         bag.AddItemTo(info2, 3);
         bag.AddItemTo(info3, 2);
         bag.AddItemTo(info4, 1);
         bag.AddItemTo(info5, 0);
         client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserBuyItemHandler.Success", new object[0]));
         client.Player.RemoveMoney(998);
     }
     else
     {
         client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserBuyItemHandler.NoMoney", new object[0]));
     }
     return(0);
 }
Exemplo n.º 6
0
        public void AddProperty(ItemInfo item, ref int attack, ref int defence, ref int agility, ref  int lucky)
        {
            if (item != null)
            {

                if (item.Hole1 > 0)

                    AddBaseProperty(item.Hole1, ref attack, ref defence, ref agility, ref lucky);

                if (item.Hole2 > 0)
                    AddBaseProperty(item.Hole2, ref attack, ref defence, ref agility, ref lucky);

                if (item.Hole3 > 0)
                    AddBaseProperty(item.Hole3, ref attack, ref defence, ref agility, ref lucky);

                if (item.Hole4 > 0)
                    AddBaseProperty(item.Hole4, ref attack, ref defence, ref agility, ref lucky);

                if (item.Hole5 > 0)
                    AddBaseProperty(item.Hole5, ref attack, ref defence, ref agility, ref lucky);

                if (item.Hole6 > 0)
                    AddBaseProperty(item.Hole6, ref attack, ref defence, ref agility, ref lucky);

            }
        }
Exemplo n.º 7
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            //if (player.CurrentGame.Data.CurrentSpell != this)
            if (player.CurrentGame.Data.CurrentFire == null)
            {
                player.CurrentGame.Data.CurrentSpell = this;
                player.CurrentGame.Data.CurrentPorp = item;
                //player.CurrentGame.Data.CurrentBall = Bussiness.Managers.BallMgr.FindBall(1);
                player.CurrentGame.Data.SetCurrentBall(BallMgr.FindBall(1), false);

                player.CurrentGame.Data.AddAttack = -1;
                player.CurrentGame.Data.AddBall = 1;
            }
            else
            {
                if (player.CurrentGame.Data.Players[player].IsFrost == 0)
                {
                    IceFronzeEffect ice = new IceFronzeEffect(item.Template.Property2);
                    ice.Start(player);
                }
                else
                {
                    player.CurrentGame.Data.Players[player].SetFrost(item.Template.Property2);
                }

            }
        }
Exemplo n.º 8
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            TankData data = player.CurrentGame.Data;
            data.AddWound = (data.AddWound + (double)item.Template.Property2 / 100);

            GSPacketIn pkg = player.Out.SendAddWound(player);
            player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
        }
Exemplo n.º 9
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            TankData data = player.CurrentGame.Data;
            data.AddMultiple = (1- (double)item.Template.Property2 / 100);

            GSPacketIn pkg = player.Out.SendShootStraight(player);
            player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
        }
Exemplo n.º 10
0
        public bool AddItem(ItemInfo item, int minSlot)
        {
            if (item == null) return false;

            int place = FindFirstEmptySlot(minSlot);

            return AddItemTo(item, place);
        }
Exemplo n.º 11
0
 /// <summary>
 /// 成功返回物品的位置,失败返回-1
 /// </summary>
 /// <param name="item"></param>
 /// <param name="start"></param>
 /// <returns></returns>
 public override int AddItem(ItemInfo item,int start)
 {
     int place = base.AddItem(item,start);
     if (place != -1)
     {
         _player.Out.SendUpdatePropInventorySlot(place, true, item.TemplateID);
     }
     return place;
 }
Exemplo n.º 12
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            //TankData data = player.CurrentGame.Data;
            //data.AttackUp *= item.Property1;
            player.CurrentGame.Data.Players[player].SetDander( item.Template.Property2);

            GSPacketIn pkg = player.Out.SendAttackUp(player);
            player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
        }
Exemplo n.º 13
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            if (player.CurrentGame.Data.CurrentSpell != null)
                return;

            TankData data = player.CurrentGame.Data;
            data.BreachDefence = true;

        }
Exemplo n.º 14
0
 public override int RemoveItem(ItemInfo item)
 {
     int place = base.RemoveItem(item);
     if (place != -1)
     {
         _player.Out.SendUpdatePropInventorySlot(place, false, 0);
     }
     return place;
 }
Exemplo n.º 15
0
 public int AddItem(int showPlace, ItemInfo item)
 {
     int place = base.AddItem(item, 0);
     if (place != -1)
     {
         item.UserID = _player.PlayerCharacter.ID;
         _player.Out.SendUpdateInventorySlot(place, true, item, _bagType, showPlace);
     }
     return place;
 }
Exemplo n.º 16
0
 /// <summary>
 /// 从指定位置开始查找空位添加物品
 /// </summary>
 /// <param name="item"></param>
 /// <param name="start"></param>
 /// <returns></returns>
 public override int AddItem(ItemInfo item, int start)
 {
     int place = base.AddItem(item, start);
     if (place != -1)
     {
         item.UserID = _player.PlayerCharacter.ID;
         _player.Out.SendUpdateInventorySlot(place, true, item,_bagType);
     }
     return place;
 }
Exemplo n.º 17
0
        private SqlDataProvider.Data.ItemInfo getitem(GameClient client, int type, string color, string skin, int id)
        {
            ConsortiaInfo info             = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
            ShopItemInfo  shopItemInfoById = ShopMgr.GetShopItemInfoById(id);
            bool          flag             = false;

            SqlDataProvider.Data.ItemInfo info3 = null;
            if (shopItemInfoById != null)
            {
                info3 = SqlDataProvider.Data.ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(shopItemInfoById.TemplateID), 1, 102);
                if (0 == shopItemInfoById.BuyType)
                {
                    if (1 == type)
                    {
                        info3.ValidDate = shopItemInfoById.AUnit;
                    }
                    if (2 == type)
                    {
                        info3.ValidDate = shopItemInfoById.BUnit;
                    }
                    if (3 == type)
                    {
                        info3.ValidDate = shopItemInfoById.CUnit;
                    }
                }
                else
                {
                    if (1 == type)
                    {
                        info3.Count = shopItemInfoById.AUnit;
                    }
                    if (2 == type)
                    {
                        info3.Count = shopItemInfoById.BUnit;
                    }
                    if (3 == type)
                    {
                        info3.Count = shopItemInfoById.CUnit;
                    }
                }
                if ((info3 != null) || (shopItemInfoById != null))
                {
                    info3.Color = (color == null) ? "" : color;
                    info3.Skin  = (skin == null) ? "" : skin;
                    if (flag)
                    {
                        info3.IsBinds = true;
                        return(info3);
                    }
                    info3.IsBinds = Convert.ToBoolean(shopItemInfoById.IsBind);
                }
            }
            return(info3);
        }
Exemplo n.º 18
0
 public override int RemoveItem(ItemInfo item)
 {
     int start = item.Place;
     int place = base.RemoveItem(item);
     if (place != -1)
     {
         item.Place = start;
         _player.Out.SendUpdateTempInventorySlot(place, false,null);
     }
     return place;
 }
Exemplo n.º 19
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            //if (player.CurrentGame.Data.CurrentSpell != null)
            //    return;
            ItemInfo info = player.CurrentGame.Data.CurrentPorp;
            if (player.CurrentGame.Data.CurrentSpell != null && info.Template.Property1 != 10 && info.Template.Property1 != 8)
                return;

            TankData data = player.CurrentGame.Data;
            if (data.CurrentBall != data.CurrentIndex.Ball2)
                data.AddBall = item.Template.Property2;
        }
Exemplo n.º 20
0
 public override bool AddItemTo(ItemInfo item, int place)
 {
     if (base.AddItemTo(item, place))
     {
         item.UserID = m_player.PlayerCharacter.ID;
         item.IsExist = true;
         return true;
     }
     else
     {
         return false;
     }
 }
Exemplo n.º 21
0
        public virtual bool AddCountToStack(ItemInfo item, int count)
        {
            if (item == null) return false;
            if (count <= 0 || item.BagType != m_type) return false;

            if (item.Count + count > item.Template.MaxCount)
                return false;

            item.Count += count;

            OnPlaceChanged(item.Place);

            return true;
        }
Exemplo n.º 22
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            ItemInfo info = player.CurrentGame.Data.CurrentPorp;
            if (player.CurrentGame.Data.CurrentSpell != null && info.Template.Property1 != 10 && info.Template.Property1 != 8)
                return;

            TankData data = player.CurrentGame.Data;
            data.AddAttack = item.Template.Property2;

            if (item.Template.Property2 == 2)
                data.Modulus *= 0.6;
            else
                data.Modulus *= 0.9;
        }
Exemplo n.º 23
0
        public static List <SqlDataProvider.Data.ItemInfo> GetAllItemBoxAward(int DataId)
        {
            List <ItemBoxInfo> itemBox = ItemBoxMgr.FindItemBox(DataId);
            List <SqlDataProvider.Data.ItemInfo> list = new List <SqlDataProvider.Data.ItemInfo>();

            foreach (ItemBoxInfo itemBoxInfo in itemBox)
            {
                SqlDataProvider.Data.ItemInfo fromTemplate = SqlDataProvider.Data.ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(itemBoxInfo.TemplateId), itemBoxInfo.ItemCount, 105);
                fromTemplate.IsBinds   = itemBoxInfo.IsBind;
                fromTemplate.ValidDate = itemBoxInfo.ItemValid;
                list.Add(fromTemplate);
            }
            return(list);
        }
Exemplo n.º 24
0
        public static List <SqlDataProvider.Data.ItemInfo> SpiltGoodsMaxCount(SqlDataProvider.Data.ItemInfo itemInfo)
        {
            List <SqlDataProvider.Data.ItemInfo> list = new List <SqlDataProvider.Data.ItemInfo>();
            int num1 = 0;

            while (num1 < itemInfo.Count)
            {
                int num2 = itemInfo.Count < itemInfo.Template.MaxCount ? itemInfo.Count : itemInfo.Template.MaxCount;
                SqlDataProvider.Data.ItemInfo itemInfo1 = itemInfo.Clone();
                itemInfo1.Count = num2;
                list.Add(itemInfo1);
                num1 += itemInfo.Template.MaxCount;
            }
            return(list);
        }
Exemplo n.º 25
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            TankData data = player.CurrentGame.Data;

            if (player.CurrentGame.Data.Players[player].IsNoHole == 0)
            {
                NoHoleEffect noHole = new NoHoleEffect(item.Template.Property3);
                noHole.Start(player);
            }
            else
            {
                player.CurrentGame.Data.Players[player].SetNoHole(item.Template.Property3);
            }


        }
Exemplo n.º 26
0
 public ProxyPlayer(ServerClient client, PlayerInfo character, ItemTemplateInfo currentWeapon, ItemInfo secondweapon, double baseAttack, double baseDefence, double baseAglilty, double baseBoold, double gprate, double offerrate, double rate, List<BufferInfo> infos, int serverid)
 {
     m_client = client;
     m_character = character;
     m_baseAttack = baseAttack;
     m_baseDefence = baseDefence;
     m_baseAglilty = baseAglilty;
     m_baseBlood = baseBoold;
     m_currentWeapon = currentWeapon;
     m_secondWeapon = secondweapon;
     m_equipEffect = new List<int>();
     GPRate = gprate;
     OfferRate = offerrate;
     Rate = rate;
     Buffers = infos;
     m_serverid = serverid;
 }
Exemplo n.º 27
0
 /// <summary>
 /// 删除物品,物品的位置信息在Place上
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public virtual int RemoveItem(ItemInfo item)
 {
     if (item == null) return -1;
     lock (_lock)
     {
         for (int i = 0; i < _count; i++)
         {
             if (_items[i] != null && _items[i].Equals(item))
             {
                 item.Place = -1;
                 _items[i] = null;
                 return i;
             }
         }
         return -1;
     }
 }
        /// <summary>
        /// 从临时背包中的数据移到背包中
        /// </summary>
        /// <param name="player">玩家</param>
        /// <param name="item">物品</param>
        /// <param name="message">返回消息</param>
        private bool GetItem(GamePlayer player, ItemInfo item,ref string message)
        {
            if (item == null) return false;

            PlayerInventory bag = player.GetItemInventory(item.Template);
            if (bag.AddItem(item))
            {
                player.TempBag.RemoveItem(item);
                item.IsExist = true;
                return true;
            }
            else
            {
                bag.UpdateChangedPlaces();
                message = LanguageMgr.GetTranslation(item.GetBagName()) + LanguageMgr.GetTranslation("GameTakeTempItemsHandler.Msg");
            }
            return false;
        }
Exemplo n.º 29
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            PlayerInventory inventory = client.Player.GetInventory(eBageType.Store);
            PlayerInventory propBag   = client.Player.PropBag;

            for (int i = 1; i < 5; i++)
            {
                if (inventory.GetItemAt(i) != null)
                {
                    inventory.RemoveItemAt(i);
                }
            }
            int ItemRandom = ThreadSafeRandom.NextStatic(listItemRandom.Count);

            SqlDataProvider.Data.ItemInfo item = SqlDataProvider.Data.ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(listItemRandom[ItemRandom]), 1, 105);
            inventory.AddItemTo(item, 0);
            return(1);
        }
Exemplo n.º 30
0
 /// <summary>
 /// 从Start开始查找空位添加物品
 /// </summary>
 /// <param name="item"></param>
 /// <param name="start"></param>
 /// <returns></returns>
 public virtual int AddItem(ItemInfo item,int start)
 {
     if (item == null) return -1;
     lock (_lock)
     {
         for (int i = start; i < _count; i++)
         {
             if (_items[i] == null)
             {
                 _items[i] = item;
                 item.Place = i;
                 item.BagType = _bagType;
                 return i;
             }
         }
         return -1;
     }
 }
Exemplo n.º 31
0
        /// <summary>
        /// 添加铁匠铺操作:强化、合成、熔炼、镶嵌
        /// </summary>
        /// <param name="logItemInfo"></param>
        public static void LogItemAdd(int userId, LogItemType itemType, string beginProperty, ItemInfo item, string AddItem, int result)
        {
            try
            {
                string endProperty = "";
                if (item != null)
                    endProperty = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", item.StrengthenLevel, item.Attack, item.Defence, item.Agility, item.Luck, item.AttackCompose, item.DefendCompose, item.AgilityCompose, item.LuckCompose);

                object[] info = { _gameType, _serverId, _areaId, DateTime.Now, userId, (int)itemType, item == null ? "" : item.Template.Name, item == null ? 0 : item.ItemID, AddItem, beginProperty, endProperty, result };
                lock (m_LogItem)
                {
                    m_LogItem.Rows.Add(info);
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("LogMgr Error:ItemAdd @ " + e);
            }
        }
Exemplo n.º 32
0
        public virtual bool AddItemTo(ItemInfo item, int place)
        {
            if (item == null || place >= m_capalility || place < 0) return false;

            lock (m_lock)
            {
                if (m_items[place] != null)
                    place = -1;
                else
                {
                    m_items[place] = item;
                    item.Place = place;
                    item.BagType = m_type;
                }
            }
            if (place != -1)
                OnPlaceChanged(place);

            return place != -1;
        }
Exemplo n.º 33
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            TankData data = player.CurrentGame.Data;
            if (item.Template.Property2 == 0)
            {
                InvinciblyEffect hide = new InvinciblyEffect(item.Template.Property3);
                hide.Start(player);
            }

            if (item.Template.Property2 == 1)
            {
                foreach (GamePlayer p in data.Players.Keys)
                {
                    if (player.CurrentTeamIndex == p.CurrentTeamIndex)
                    {
                        InvinciblyEffect hide = new InvinciblyEffect(item.Template.Property3);
                        hide.Start(p);
                    }
                }
            }
        }
Exemplo n.º 34
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            TankData data = player.CurrentGame.Data;

            if (item.Template.Property2 == 0 && data.Players[player].Blood > 0)
            {
                data.Players[player].Blood = item.Template.Property3;
            }

            if (item.Template.Property2 == 1)
            {
                foreach (GamePlayer p in data.Players.Keys)
                {
                    if (player.CurrentTeamIndex == p.CurrentTeamIndex && data.Players[p].Blood > 0)
                    {
                        data.Players[p].Blood = item.Template.Property3;
                    }
                }
            }

        }
Exemplo n.º 35
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            //if (player.CurrentGame.Data.CurrentSpell != this)
            //{
            //    player.CurrentGame.Data.CurrentSpell = this;
            //    player.CurrentGame.Data.CurrentPorp = item;
            //    //player.CurrentGame.Data.CurrentBall = Bussiness.Managers.BallMgr.FindBall(2);
            //    player.CurrentGame.Data.SetCurrentBall(BallMgr.FindBall(2),false);

            //    player.CurrentGame.Data.AddAttack = -1;
            //    player.CurrentGame.Data.AddBall = 1;
            //}
            //else
            //{
            //    if (player == player.CurrentGame.Data.CurrentFire)
            //        return;

            //    player.CurrentGame.Data.Players[player].BeckonPoint();
            //    GSPacketIn pkg = player.Out.SendPlayerBeckon(player);
            //    player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
            //}
        }
Exemplo n.º 36
0
        public void Execute(GamePlayer player, ItemInfo item)
        {
            if (player.CurrentGame.Data.CurrentFire == null)
            {
                player.CurrentGame.Data.CurrentSpell = this;
                player.CurrentGame.Data.CurrentPorp = item;
                player.CurrentGame.Data.SetCurrentBall(BallMgr.FindBall(4), false);

            }
            //else
            //{
            //    if (player.CurrentGame.Data.Players[player].IsFrost == 0)
            //    {
            //        IceFronzeEffect ice = new IceFronzeEffect(item.Template.Property2);
            //        ice.Start(player);
            //    }
            //    else
            //    {
            //        player.CurrentGame.Data.Players[player].SetFrost(item.Template.Property2);
            //    }

            //}
        }
Exemplo n.º 37
0
        public static bool CreateItemBox(int DateId, List <SqlDataProvider.Data.ItemInfo> itemInfos, ref int gold, ref int point, ref int giftToken, ref int medal, ref int exp)
        {
            List <ItemBoxInfo> list1   = new List <ItemBoxInfo>();
            List <ItemBoxInfo> itemBox = ItemBoxMgr.FindItemBox(DateId);

            if (itemBox == null)
            {
                return(false);
            }
            List <ItemBoxInfo> list2 = Enumerable.ToList <ItemBoxInfo>(Enumerable.Where <ItemBoxInfo>((IEnumerable <ItemBoxInfo>)itemBox, (Func <ItemBoxInfo, bool>)(s => s.IsSelect)));
            int num1     = 1;
            int maxRound = 0;

            if (list2.Count < itemBox.Count)
            {
                maxRound = ThreadSafeRandom.NextStatic(Enumerable.Max(Enumerable.Select <ItemBoxInfo, int>(Enumerable.Where <ItemBoxInfo>((IEnumerable <ItemBoxInfo>)itemBox, (Func <ItemBoxInfo, bool>)(s => !s.IsSelect)), (Func <ItemBoxInfo, int>)(s => s.Random))));
            }
            List <ItemBoxInfo> list3 = Enumerable.ToList <ItemBoxInfo>(Enumerable.Where <ItemBoxInfo>((IEnumerable <ItemBoxInfo>)itemBox, (Func <ItemBoxInfo, bool>)(s => !s.IsSelect && s.Random >= maxRound)));
            int num2 = Enumerable.Count <ItemBoxInfo>((IEnumerable <ItemBoxInfo>)list3);

            if (num2 > 0)
            {
                int count = num1 > num2 ? num2 : num1;
                foreach (int index in ItemBoxMgr.GetRandomUnrepeatArray(0, num2 - 1, count))
                {
                    ItemBoxInfo itemBoxInfo = list3[index];
                    if (list2 == null)
                    {
                        list2 = new List <ItemBoxInfo>();
                    }
                    list2.Add(itemBoxInfo);
                }
            }
            foreach (ItemBoxInfo itemBoxInfo in list2)
            {
                if (itemBoxInfo == null)
                {
                    return(false);
                }
                int templateId = itemBoxInfo.TemplateId;
                if (templateId <= -900)
                {
                    if (templateId <= -1100)
                    {
                        if (templateId == -1200 || templateId == -1100)
                        {
                            giftToken += itemBoxInfo.ItemCount;
                            continue;
                        }
                    }
                    else if (templateId == -1000 || templateId == -900)
                    {
                        continue;
                    }
                }
                else if (templateId <= -300)
                {
                    if (templateId != -800)
                    {
                        if (templateId == -300)
                        {
                            medal += itemBoxInfo.ItemCount;
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                else if (templateId == -200)
                {
                    point += itemBoxInfo.ItemCount;
                    continue;
                }
                else if (templateId == -100)
                {
                    gold += itemBoxInfo.ItemCount;
                    continue;
                }
                else if (templateId == 11107)
                {
                    exp += itemBoxInfo.ItemCount;
                    continue;
                }
                SqlDataProvider.Data.ItemInfo fromTemplate = SqlDataProvider.Data.ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(itemBoxInfo.TemplateId), itemBoxInfo.ItemCount, 101);
                if (fromTemplate != null)
                {
                    fromTemplate.Count           = itemBoxInfo.ItemCount;
                    fromTemplate.IsBinds         = itemBoxInfo.IsBind;
                    fromTemplate.ValidDate       = itemBoxInfo.ItemValid;
                    fromTemplate.StrengthenLevel = itemBoxInfo.StrengthenLevel;
                    fromTemplate.AttackCompose   = itemBoxInfo.AttackCompose;
                    fromTemplate.DefendCompose   = itemBoxInfo.DefendCompose;
                    fromTemplate.AgilityCompose  = itemBoxInfo.AgilityCompose;
                    fromTemplate.LuckCompose     = itemBoxInfo.LuckCompose;
                    fromTemplate.IsTips          = itemBoxInfo.IsTips != 0;
                    fromTemplate.IsLogs          = itemBoxInfo.IsLogs;
                    if (itemInfos == null)
                    {
                        itemInfos = new List <SqlDataProvider.Data.ItemInfo>();
                    }
                    itemInfos.Add(fromTemplate);
                }
            }
            return(true);
        }
Exemplo n.º 38
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            eBageType       bageType   = (eBageType)packet.ReadByte();
            int             slot       = packet.ReadInt();
            eBageType       toBageType = (eBageType)packet.ReadByte();
            int             toSlot     = packet.ReadInt();
            int             count      = packet.ReadInt();
            PlayerInventory bag        = client.Player.GetInventory(bageType);
            PlayerInventory inventory  = client.Player.GetInventory(toBageType);

            if (toSlot < 0)
            {
                if ((inventory.BagType == (int)eBageType.Bank) || (inventory.BagType == (int)eBageType.PropBag))
                {
                    toSlot = inventory.FindFirstEmptySlot(0);
                }
                else
                {
                    toSlot = inventory.FindFirstEmptySlot(31);
                }
            }
            //==================================
            if (count > 0)
            {
                if ((bag == null) || (bag.GetItemAt(slot) == null))
                {
                    return(0);
                }
                if ((bageType == toBageType) && (slot != -1))
                {
                    if (bag.GetItemAt(slot).Count >= count)
                    {
                        Console.WriteLine("-----Stage 1 !");
                        bag.MoveItem(slot, toSlot, count);
                    }
                    else
                    {
                        Console.WriteLine("--" + client.Player.Account + " Hack = CE");
                        bag.MoveItem(slot, toSlot, bag.GetItemAt(slot).Count);
                    }
                    return(1);
                }

                if ((slot == -1) && (toSlot != -1))
                {
                    Console.WriteLine("-----Stage 2 !");
                    bag.RemoveItemAt(toSlot);
                    return(1);
                }

                if (((((slot != -1) && (toSlot == -1)) &&
                      ((bageType != eBageType.CaddyBag) &&
                       (toBageType != eBageType.Bank))) &&
                     (bageType != eBageType.Store)) &&
                    (toBageType != eBageType.Store))
                {
                    if (bageType == eBageType.MainBag)
                    {
                        Console.WriteLine("-----Stage 3 !");
                        bag.AddItem(client.Player.GetItemAt(bageType, slot), 31);
                    }
                    else
                    {
                        Console.WriteLine("-----Stage 4 !");
                        //bag.AddItem(client.Player.GetItemAt(bageType, slot), 0);
                        client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Full"));
                    }
                    return(1);
                }

                if ((((slot != -1) && (toBageType != bageType)) && (toBageType != eBageType.Store)) && (toBageType != eBageType.MainBag))
                {
                    ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
                    if (info != null)
                    {
                        if (toBageType == eBageType.Store)
                        {
                        }
                        Console.WriteLine("-----Stage 5 !");
                        bag.MoveToStore(bag, slot, toSlot, inventory, info.StoreLevel * 10);
                        return(1);
                    }
                }

                if ((toBageType == eBageType.Store) || (bageType == eBageType.Store))
                {
                    SqlDataProvider.Data.ItemInfo itemAt = client.Player.GetItemAt(bageType, slot);
                    if ((itemAt != null) && (itemAt.Count > 1))
                    {
                        itemAt.Count -= count;
                        bag.UpdateItem(itemAt);
                        SqlDataProvider.Data.ItemInfo item = itemAt.Clone();
                        item.Count = count;
                        if (inventory.GetItemAt(toSlot) == null)
                        {
                            Console.WriteLine("-----Stage 6 !");
                            inventory.AddItemTo(item, toSlot);
                        }
                        else
                        {
                            SqlDataProvider.Data.ItemInfo itemByTemplateID = bag.GetItemByTemplateID(0, inventory.GetItemAt(toSlot).TemplateID);
                            if (itemByTemplateID == null)
                            {
                                Console.WriteLine("-----Stage 7 !");
                                bag.MoveToStore(inventory, toSlot, bag.FindFirstEmptySlot(0), bag, 999);
                            }
                            else
                            {
                                Console.WriteLine("-----Stage 8 !");
                                itemByTemplateID.Count++;
                                bag.UpdateItem(itemByTemplateID);
                                inventory.RemoveItemAt(toSlot);
                            }
                            Console.WriteLine("-----Stage 9 !");
                            inventory.AddItemTo(item, toSlot);
                        }
                    }
                    else
                    {
                        if ((((toBageType != eBageType.Store) && (toBageType != eBageType.MainBag)) && ((bag.GetItemAt(slot) != null) && (bag.GetItemAt(slot).Template.CategoryID == 7))) && (((toSlot > 0) && (toSlot < 31)) && (toSlot != 6)))
                        {
                            return(1);
                        }
                        try
                        {
                            Console.WriteLine("-----Stage 10 !");
                            bag.MoveToStore(bag, slot, toSlot, inventory, 50);
                        }
                        catch (Exception)
                        {
                            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).InfoFormat("ERROR USER CHANGEITEM placce: {0},toplace: {1},bagType: {2},ToBagType {3}", new object[] { slot, toSlot, bageType, toBageType });
                            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).InfoFormat("item :{0}, toitem {1}", bag.GetItemAt(slot), inventory.GetItemAt(toSlot));
                        }
                    }
                    return(1);
                }
                if ((toBageType == eBageType.MainBag) && (bageType == eBageType.Bank))
                {
                    Console.WriteLine("-----Stage 11!");
                    bag.MoveToStore(bag, slot, toSlot, inventory, 50);
                    return(1);
                }
            }
            //==================================
            return(0);
        }
Exemplo n.º 39
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            eBageType       bageType  = (eBageType)packet.ReadByte();
            int             slot      = packet.ReadInt();
            eBageType       type2     = (eBageType)packet.ReadByte();
            int             toSlot    = packet.ReadInt();
            int             count     = packet.ReadInt();
            PlayerInventory bag       = client.Player.GetInventory(bageType);
            PlayerInventory inventory = client.Player.GetInventory(type2);

            if (toSlot < 0)
            {
                if ((inventory.BagType == 11) || (inventory.BagType == 1))
                {
                    toSlot = inventory.FindFirstEmptySlot(0);
                }
                else
                {
                    toSlot = inventory.FindFirstEmptySlot(0x1f);
                }
            }
            if (count > 0)
            {
                if ((bag == null) || (bag.GetItemAt(slot) == null))
                {
                    return(0);
                }
                if ((bageType == type2) && (slot != -1))
                {
                    if (bag.GetItemAt(slot).Count >= count)
                    {
                        bag.MoveItem(slot, toSlot, count);
                    }
                    else
                    {
                        Console.WriteLine("--" + client.Player.Account + " Hack = CE");
                        bag.MoveItem(slot, toSlot, bag.GetItemAt(slot).Count);
                    }
                    return(1);
                }
                if ((slot == -1) && (toSlot != -1))
                {
                    bag.RemoveItemAt(toSlot);
                    return(1);
                }
                if (((((slot != -1) && (toSlot == -1)) && ((bageType != eBageType.CaddyBag) && (type2 != eBageType.Bank))) && (bageType != eBageType.Store)) && (type2 != eBageType.Store))
                {
                    if (bageType == eBageType.MainBag)
                    {
                        bag.AddItem(client.Player.GetItemAt(bageType, slot), 0x1f);
                    }
                    else
                    {
                        bag.AddItem(client.Player.GetItemAt(bageType, slot), 0);
                    }
                    return(1);
                }
                if ((((slot != -1) && (type2 != bageType)) && (type2 != eBageType.Store)) && (type2 != eBageType.MainBag))
                {
                    ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
                    if (info != null)
                    {
                        if (type2 == eBageType.Store)
                        {
                        }
                        bag.MoveToStore(bag, slot, toSlot, inventory, info.StoreLevel * 10);
                        return(1);
                    }
                }
                if ((type2 == eBageType.Store) || (bageType == eBageType.Store))
                {
                    SqlDataProvider.Data.ItemInfo itemAt = client.Player.GetItemAt(bageType, slot);
                    if ((itemAt != null) && (itemAt.Count > 1))
                    {
                        itemAt.Count--;
                        bag.UpdateItem(itemAt);
                        SqlDataProvider.Data.ItemInfo item = itemAt.Clone();
                        item.Count = 1;
                        if (inventory.GetItemAt(toSlot) == null)
                        {
                            inventory.AddItemTo(item, toSlot);
                        }
                        else
                        {
                            SqlDataProvider.Data.ItemInfo itemByTemplateID = bag.GetItemByTemplateID(0, inventory.GetItemAt(toSlot).TemplateID);
                            if (itemByTemplateID == null)
                            {
                                bag.MoveToStore(inventory, toSlot, bag.FindFirstEmptySlot(0), bag, 0x3e7);
                            }
                            else
                            {
                                itemByTemplateID.Count++;
                                bag.UpdateItem(itemByTemplateID);
                                inventory.RemoveItemAt(toSlot);
                            }
                            inventory.AddItemTo(item, toSlot);
                        }
                    }
                    else
                    {
                        if ((((type2 != eBageType.Store) && (type2 != eBageType.MainBag)) && ((bag.GetItemAt(slot) != null) && (bag.GetItemAt(slot).Template.CategoryID == 7))) && (((toSlot > 0) && (toSlot < 0x1f)) && (toSlot != 6)))
                        {
                            return(1);
                        }
                        try
                        {
                            bag.MoveToStore(bag, slot, toSlot, inventory, 50);
                        }
                        catch (Exception)
                        {
                            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).InfoFormat("ERROR USER CHANGEITEM placce: {0},toplace: {1},bagType: {2},ToBagType {3}", new object[] { slot, toSlot, bageType, type2 });
                            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).InfoFormat("item :{0}, toitem {1}", bag.GetItemAt(slot), inventory.GetItemAt(toSlot));
                        }
                    }
                    return(1);
                }
                if ((type2 == eBageType.MainBag) && (bageType == eBageType.Bank))
                {
                    bag.MoveToStore(bag, slot, toSlot, inventory, 50);
                    return(1);
                }
            }
            return(0);
        }
Exemplo n.º 40
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            byte   b    = packet.ReadByte();
            string text = "Xu không đủ!";
            int    num  = 1;

            switch (b)
            {
            case 1:
                this.UpdatePetHandle(client, packet.ReadInt());
                break;

            case 2:
            {
                Console.WriteLine("//ADD_PET ");
                int place = packet.ReadInt();
                num = packet.ReadInt();
                int iD   = client.Player.PlayerCharacter.ID;
                int num2 = client.Player.PetBag.FindFirstEmptySlot();
                if (num2 == -1)
                {
                    client.Player.SendMessage("Số lượng pet đã đạt giới hạn!");
                }
                else
                {
                    ItemInfo        itemAt          = client.Player.GetItemAt((eBageType)num, place);
                    PetTemplateInfo petTemplateInfo = PetMgr.FindPetTemplate(itemAt.Template.Property5);
                    UsersPetinfo    usersPetinfo    = PetMgr.CreatePet(petTemplateInfo, iD, num2);
                    using (PlayerBussiness playerBussiness = new PlayerBussiness())
                    {
                        usersPetinfo.IsExit = false;
                        playerBussiness.AddUserAdoptPet(usersPetinfo, true);
                    }
                    usersPetinfo.IsExit = true;
                    PlayerInventory inventory = client.Player.GetInventory((eBageType)num);
                    if (inventory.RemoveCountFromStack(itemAt, 1))
                    {
                        client.Player.PetBag.AddPetTo(usersPetinfo, num2);
                        client.Player.SendMessage("Bạn nhận được 1 " + petTemplateInfo.Name);
                    }
                    client.Player.SaveIntoDatabase();
                }
                break;
            }

            case 3:
            {
                int num3 = packet.ReadInt();
                break;
            }

            case 4:
            {
                int place = packet.ReadInt();
                num = packet.ReadInt();
                int      num3    = packet.ReadInt();
                bool     flag    = false;
                ItemInfo itemAt2 = client.Player.GetItemAt((eBageType)num, place);
                if (itemAt2 == null)
                {
                    client.Player.SendMessage("Vật phẩm lạ không tìm thấy!!! Hack chăng???!!!");
                    return(0);
                }
                int          num4      = Convert.ToInt32(PetMgr.FindConfig("MaxHunger").Value);
                int          num5      = Convert.ToInt32(PetMgr.FindConfig("MaxLevel").Value);
                UsersPetinfo petAt     = client.Player.PetBag.GetPetAt(num3);
                int          num6      = itemAt2.Count;
                int          property  = itemAt2.Template.Property2;
                int          property2 = itemAt2.Template.Property3;
                int          num7      = num6 * property2;
                int          num8      = num7 + petAt.Hunger;
                int          num9      = num6 * property;
                text = "";
                if (itemAt2.TemplateID == 334100)
                {
                    num9 = itemAt2.DefendCompose;
                }
                if (petAt.Level > 11 && itemAt2.TemplateID == 334100)
                {
                    text = "Pet level 10 trở xuống mới dùng đuợc " + itemAt2.Template.Name;
                }
                else
                {
                    if (petAt.Level < num5)
                    {
                        num9 += petAt.GP;
                        int level  = petAt.Level;
                        int level2 = PetMgr.GetLevel(num9);
                        int gP     = PetMgr.GetGP(level2 + 1);
                        int gP2    = PetMgr.GetGP(num5);
                        int num10  = num9;
                        if (num9 > gP2)
                        {
                            num9 -= gP2;
                            if (num9 >= property && property != 0)
                            {
                                num6 = num9 / property;
                            }
                        }
                        petAt.GP     = ((num10 >= gP2) ? gP2 : num10);
                        petAt.Level  = level2;
                        petAt.MaxGP  = ((gP == 0) ? gP2 : gP);
                        petAt.Hunger = ((num8 > num4) ? num4 : num8);
                        flag         = client.Player.PetBag.UpGracePet(petAt, num3, true, level, level2, ref text);
                        if (itemAt2.TemplateID == 334100)
                        {
                            client.Player.StoreBag.RemoveItem(itemAt2);
                        }
                        else
                        {
                            client.Player.StoreBag.RemoveCountFromStack(itemAt2, num6);
                            client.Player.OnUsingItem(itemAt2.TemplateID);
                        }
                    }
                    else
                    {
                        int hunger = petAt.Hunger;
                        int num11  = num4 - hunger;
                        if (num8 >= num4 && num8 >= property2)
                        {
                            num6 = num8 / property2;
                        }
                        num8         = hunger + num11;
                        petAt.Hunger = num8;
                        if (hunger < num4)
                        {
                            client.Player.StoreBag.RemoveCountFromStack(itemAt2, num6);
                            flag = client.Player.PetBag.UpGracePet(petAt, num3, false, 0, 0, ref text);
                            text = "Ðộ vui vẻ tang thêm " + num11;
                        }
                        else
                        {
                            text = "Ðộ vui vui đã đạt mức tối da";
                        }
                    }
                }
                if (flag)
                {
                    UsersPetinfo[] pets = client.Player.PetBag.GetPets();
                    client.Player.Out.SendUpdatePetInfo(client.Player.PlayerCharacter, pets);
                }
                if (!string.IsNullOrEmpty(text))
                {
                    client.Player.SendMessage(text);
                }
                break;
            }

            case 5:
            {
                bool refreshBtn = packet.ReadBoolean();
                this.RefreshPetHandle(client, refreshBtn, text);
                break;
            }

            case 6:
            {
                int num3  = packet.ReadInt();
                int num12 = client.Player.PetBag.FindFirstEmptySlot();
                if (num12 == -1)
                {
                    client.Player.Out.SendRefreshPet(client.Player, client.Player.PetBag.GetAdoptPet(), null, false);
                    client.Player.SendMessage("Số lượng pet đã đạt giới hạn!");
                }
                else
                {
                    UsersPetinfo adoptPetAt = client.Player.PetBag.GetAdoptPetAt(num3);
                    if (client.Player.PetBag.AddPetTo(adoptPetAt, num12))
                    {
                        client.Player.PetBag.RemoveAdoptPet(adoptPetAt);
                        client.Player.OnAdoptPetEvent();
                    }
                }
                break;
            }

            case 7:
            {
                int num3      = packet.ReadInt();
                int killId    = packet.ReadInt();
                int killindex = packet.ReadInt();
                if (client.Player.PetBag.EquipSkillPet(num3, killId, killindex))
                {
                    UsersPetinfo[] pets = client.Player.PetBag.GetPets();
                    client.Player.Out.SendUpdatePetInfo(client.Player.PlayerCharacter, pets);
                }
                else
                {
                    client.Player.SendMessage("Skill này đã trang bị!");
                }
                break;
            }

            case 8:
            {
                int          num3   = packet.ReadInt();
                UsersPetinfo petAt2 = client.Player.PetBag.GetPetAt(num3);
                if (client.Player.PetBag.RemovePet(petAt2))
                {
                    using (PlayerBussiness playerBussiness2 = new PlayerBussiness())
                    {
                        playerBussiness2.UpdateUserAdoptPet(petAt2.ID);
                    }
                }
                client.Player.SendMessage("Thả pet thành công!");
                break;
            }

            case 9:
            {
                int    num3  = packet.ReadInt();
                string name  = packet.ReadString();
                int    num13 = Convert.ToInt32(PetMgr.FindConfig("ChangeNameCost").Value);
                if (client.Player.PlayerCharacter.Money >= num13)
                {
                    if (client.Player.PetBag.RenamePet(num3, name))
                    {
                        UsersPetinfo[] pets = client.Player.PetBag.GetPets();
                        client.Out.SendUpdatePetInfo(client.Player.PlayerCharacter, pets);
                        text = "Đổi tên thành công!";
                    }
                    client.Player.RemoveMoney(num13);
                }
                client.Player.SendMessage(text);
                break;
            }

            case 16:
            {
                Console.WriteLine("//PAY_SKILL ");
                int num3 = packet.ReadInt();
                break;
            }

            case 17:
            {
                int  num3    = packet.ReadInt();
                bool isEquip = packet.ReadBoolean();
                if (client.Player.PetBag.SetIsEquip(num3, isEquip))
                {
                    UsersPetinfo[] pets = client.Player.PetBag.GetPets();
                    client.Player.MainBag.UpdatePlayerProperties();
                    client.Player.Out.SendUpdatePetInfo(client.Player.PlayerCharacter, pets);
                }
                break;
            }

            case 18:
            {
                int num3 = packet.ReadInt();
                this.RevertPetHandle(client, num3, text);
                break;
            }

            case 19:
            {
                Console.WriteLine("//BUY_PET_EXP_ITEM ");
                bool         buyPetExpItem         = packet.ReadBoolean();
                int          GoodsID               = packet.ReadInt();
                int          count                 = 20 * 80;
                ShopItemInfo shopItem              = ShopMgr.GetShopItemInfoById(GoodsID);
                SqlDataProvider.Data.ItemInfo item = SqlDataProvider.Data.ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(334103), 20, 0x66);
                client.Player.RemoveMoney(count);
                client.Player.AddItem(item);
                text = "Mua thức ăn thành công.";
                client.Player.SendMessage(text);
                break;
            }
            }
            client.Player.PetBag.SaveToDatabase();
            return(0);
        }
Exemplo n.º 41
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int Lottery = client.Lottery;

            int[]           numArray = listRandomitem[Lottery];
            PlayerInventory caddyBag = client.Player.CaddyBag;
            PlayerInventory propBag  = client.Player.PropBag;

            SqlDataProvider.Data.ItemInfo itemByTemplateID = propBag.GetItemByTemplateID(0, 11444);
            try
            {
                ThreadSafeRandom random = new ThreadSafeRandom();
                int        num2         = random.Next(100) * random.Next(100);
                int        index        = 0;
                string[]   strArray     = client.tempData.Split(new char[] { ',' });
                List <int> list         = new List <int>();
                if (client.tempData != "start")
                {
                    foreach (string str in strArray)
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            list.Add(int.Parse(str));
                        }
                    }
                }
                IOrderedEnumerable <int> enumerable = from s in list
                                                      orderby s
                                                      select s;
                foreach (int num4 in RandomForGetItem)
                {
                    if (num2 < (num4 * num4))
                    {
                        foreach (int num5 in enumerable)
                        {
                            if (index == num5)
                            {
                                index++;
                            }
                        }
                        break;
                    }
                    index++;
                }
                if (itemByTemplateID.Count > strArray.Length)
                {
                    itemByTemplateID.Count -= strArray.Length;
                    propBag.UpdateItem(itemByTemplateID);
                }
                else if (itemByTemplateID.Count == strArray.Length)
                {
                    propBag.RemoveItem(itemByTemplateID);
                }
                if (client.tempData == "start")
                {
                    client.tempData = index + ",";
                }
                else
                {
                    client.tempData = client.tempData + index + ",";
                }
                if (index >= numArray.Length)
                {
                    index = 0;
                }
                SqlDataProvider.Data.ItemInfo item = SqlDataProvider.Data.ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(numArray[index]), 1, 105);
                item.BeginDate  = DateTime.Now;
                item.ValidDate  = 7;
                item.RemoveDate = DateTime.Now.AddDays(7.0);
                caddyBag.AddItem(item);
                GSPacketIn pkg = new GSPacketIn(30, client.Player.PlayerId);
                pkg.WriteInt(numArray[index]);
                pkg.WriteInt(0);
                pkg.WriteInt(0);
                pkg.WriteInt(0);
                pkg.WriteInt(0);
                pkg.WriteInt(0);
                pkg.WriteInt(0);
                pkg.WriteBoolean(false);
                pkg.WriteInt(7);
                pkg.WriteByte(1);
                client.SendTCP(pkg);
            }
            catch
            {
                Console.WriteLine("Error ");
            }
            return(1);
        }
Exemplo n.º 42
0
 public GSPacketIn SendRefineryPreview(Game.Server.GameObjects.GamePlayer player, int templateid, bool isbind, SqlDataProvider.Data.ItemInfo item)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 43
0
 public GSPacketIn SendAuctionRefresh(SqlDataProvider.Data.AuctionInfo info, int auctionID, bool isExist, SqlDataProvider.Data.ItemInfo item)
 {
     throw new NotImplementedException();
 }