Ejemplo n.º 1
0
        public override void BuildPacket()
        {
            PushIntoStack(userItemArray.Count);
            foreach (var item in userItemArray)
            {
                short isStrong = 0;
                int strongMoney = new UserItemHelper(item).StrongMoney;
                if (item.ItemLv >= ContextUser.UserLv || strongMoney > ContextUser.GameCoin)
                {
                    isStrong = 1;
                }
                ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(item.ItemID);
                DataStruct dsItem = new DataStruct();

                dsItem.PushIntoStack(item == null ? string.Empty : item.UserItemID.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? 0 : itemInfo.ItemID);
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                dsItem.PushIntoStack(item == null ? LanguageManager.GetLang().shortInt : item.ItemLv);
                dsItem.PushIntoStack(itemInfo == null ? LanguageManager.GetLang().shortInt : (short)itemInfo.QualityType);
                dsItem.PushIntoStack(item == null ? 0 : strongMoney);
                dsItem.PushIntoStack(coldTime);
                dsItem.PushIntoStack(isStrong);
                dsItem.PushIntoStack(UserHelper.StrongEquPayPrice(Uid, item.UserItemID));

                List<ItemEquAttrInfo> itemEquArray = new ConfigCacheSet<ItemEquAttrInfo>().FindAll(e => e.ItemID.Equals(item.ItemID));
                //当前等级装备属性
                dsItem.PushIntoStack(itemEquArray.Count);
                foreach (ItemEquAttrInfo equ in itemEquArray)
                {
                    DataStruct dsDetail = new DataStruct();
                    dsDetail.PushIntoStack((int)equ.AttributeID);
                    if (equ != null && item != null)
                    {
                        baseNum = MathUtils.Addition(equ.BaseNum, item.ItemLv * equ.IncreaseNum, int.MaxValue);
                    }
                    dsDetail.PushIntoStack(baseNum);
                    dsItem.PushIntoStack(dsDetail);
                }

                //下级别装备属性
                dsItem.PushIntoStack(itemEquArray.Count);
                foreach (ItemEquAttrInfo equ in itemEquArray)
                {
                    DataStruct dsDetail = new DataStruct();
                    dsDetail.PushIntoStack((int)equ.AttributeID);
                    if (equ != null && item != null)
                    {
                        stengBaseNum = MathUtils.Addition(equ.BaseNum, (int)(MathUtils.Addition(item.ItemLv, (short)1, short.MaxValue)) * equ.IncreaseNum, int.MaxValue);
                    }
                    dsDetail.PushIntoStack(stengBaseNum);
                    dsItem.PushIntoStack(dsDetail);
                }



                PushIntoStack(dsItem);
            }
        }
Ejemplo n.º 2
0
        public override void BuildPacket()
        {
            PushIntoStack(userItemList.Count);
            foreach (var item in userItemList)
            {
                List<ItemEquAttrInfo> itemEquList = new ConfigCacheSet<ItemEquAttrInfo>().FindAll(e => e.ItemID.Equals(item.ItemID));
                ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(item.ItemID);
                UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, item.GeneralID);
                int strongMoney = new UserItemHelper(item).StrongMoney;
                int isStrong = 0;
                if (strongMoney > ContextUser.GameCoin)
                {
                    isStrong = 1;
                }
                else if (item.ItemLv > ContextUser.UserLv)
                {
                    isStrong = 2;
                }

                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(item.UserItemID.ToNotNullString());
                dsItem.PushIntoStack(item.ItemID);
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                dsItem.PushIntoStack(item.ItemLv);
                dsItem.PushIntoStack(itemInfo == null ? (short)0 : itemInfo.QualityType.ToShort());
                dsItem.PushIntoStack(strongMoney);
                dsItem.PushIntoStack((short)isStrong);
                dsItem.PushIntoStack(UserHelper.StrongEquPayPrice(Uid, item.UserItemID));
                dsItem.PushIntoStack(userGeneral == null ? string.Empty : userGeneral.GeneralName.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemDesc.ToNotNullString());
                dsItem.PushIntoStack(itemEquList.Count);

                foreach (var itemEqu in itemEquList)
                {
                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(itemEqu.AttributeID.ToInt());
                    int strengNum = 0;
                    if (item != null) strengNum = MathUtils.Addition(itemEqu.BaseNum, (itemEqu.IncreaseNum * item.ItemLv), int.MaxValue);
                //    dsItem1.PushIntoStack(itemEqu.BaseNum);
                    dsItem1.PushIntoStack(strengNum);
                    dsItem.PushIntoStack(dsItem1);
                }
                PushIntoStack(dsItem);
            }
        }
Ejemplo n.º 3
0
        public override void BuildPacket()
        {
            PushIntoStack(_coldTime);
            PushIntoStack(_userGeneralArray.Count);
            foreach (UserGeneral general in _userGeneralArray)
            {
                UserGeneral general1 = general;
                List<UserItemInfo> userItemArray = UserItemHelper.GetItems(Uid).FindAll(u => u.GeneralID.Equals(general1.GeneralID) && u.ItemStatus == ItemStatus.YongBing);
                userItemArray.QuickSort((x, y) =>
                {
                    if (x == null && y == null) return 0;
                    if (x != null && y == null) return 1;
                    if (x == null) return -1;
                    return new ConfigCacheSet<ItemBaseInfo>().FindKey(x.ItemID).EquParts.CompareTo(new ConfigCacheSet<ItemBaseInfo>().FindKey(y.ItemID).EquParts);
                });

                DataStruct ds = new DataStruct();
                ds.PushIntoStack(general == null ? 0 : general.GeneralID);
                ds.PushIntoStack(general == null ? string.Empty : general.GeneralName.ToNotNullString());
                // List<UserItem> itemList = userItemDict.ContainsKey(general.UserID) ? userItemDict[general.UserID] : new List<UserItem>();

                ds.PushIntoStack(userItemArray.Count);
                foreach (UserItemInfo userItem in userItemArray)
                {
                    int equCodeTime = ConfigEnvSet.GetInt("UserItem.EquColdTime");
                    short isStrong = 0;
                    int strongMoney = new UserItemHelper(userItem).StrongMoney;
                    if (strongMoney > ContextUser.GameCoin)
                    {
                        isStrong = 1;
                    }
                    else if (userItem.ItemLv >= general.GeneralLv)
                    {
                        isStrong = 2;
                    }
                    ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(userItem.ItemID);
                    List<ItemSynthesisInfo> itemSynthesisInfosArray =
                        new ConfigCacheSet<ItemSynthesisInfo>().FindAll(m=>m.SynthesisID== userItem.ItemID);
                    if (itemSynthesisInfosArray.Count > 0 && itemInfo.DemandLv <= ContextUser.UserLv)
                    {
                        isSynthesis = 1;
                    }
                    else
                    {
                        isSynthesis = 2;
                    }

                    DataStruct dsItem = new DataStruct();
                    dsItem.PushIntoStack(userItem.UserItemID);
                    dsItem.PushIntoStack(itemInfo == null ? 0 : itemInfo.ItemID);
                    dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                    dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                    dsItem.PushIntoStack(userItem.ItemLv);
                    dsItem.PushIntoStack(itemInfo == null ? LanguageManager.GetLang().shortInt : (short)itemInfo.QualityType);
                    dsItem.PushIntoStack(strongMoney);
                    dsItem.PushIntoStack(equCodeTime);
                    dsItem.PushIntoStack(isStrong);
                    dsItem.PushIntoStack(isSynthesis);

                    if (itemInfo != null)
                    {
                        List<ItemEquAttrInfo> itemEquArray = new ConfigCacheSet<ItemEquAttrInfo>().FindAll(e => e.ItemID.Equals(itemInfo.ItemID));
                        dsItem.PushIntoStack(itemEquArray.Count);
                        foreach (ItemEquAttrInfo equ in itemEquArray)
                        {
                            DataStruct dsDetail = new DataStruct();
                            dsDetail.PushIntoStack((int)equ.AttributeID);
                            int baseNum;
                            {
                                baseNum = MathUtils.Addition(equ.BaseNum, userItem.ItemLv * equ.IncreaseNum, int.MaxValue);
                            }
                            dsDetail.PushIntoStack(baseNum);
                            dsItem.PushIntoStack(dsDetail);
                        }

                        dsItem.PushIntoStack(itemEquArray.Count);
                        foreach (ItemEquAttrInfo equ in itemEquArray)
                        {
                            DataStruct dsDetail = new DataStruct();
                            dsDetail.PushIntoStack((int)equ.AttributeID);
                            int baseNum;
                            {
                                baseNum = MathUtils.Addition(equ.BaseNum, (int)(MathUtils.Addition(userItem.ItemLv, (short)1, short.MaxValue)) * equ.IncreaseNum, int.MaxValue);
                            }
                            dsDetail.PushIntoStack(baseNum);
                            dsItem.PushIntoStack(dsDetail);
                        }
                    }

                    ds.PushIntoStack(dsItem);
                }

                PushIntoStack(ds);
            }
            PushIntoStack(queueID);
        }
Ejemplo n.º 4
0
 public override bool TakeAction()
 {
     UserGeneral general = new GameDataCacheSet<UserGeneral>().FindKey(Uid, _generalID);
     if (general != null)
     {
         var package = UserItemPackage.Get(Uid);
         _userItemArray = package.ItemPackage.FindAll(
             u =>
             {
                 var itemInfo = new UserItemHelper(u);
                 return !u.IsRemove && itemInfo.EquPartsID == _equParts &&
                        itemInfo.DemandLv <= general.GeneralLv &&
                       //u.ItemLv <= general.GeneralLv &&
                       u.ItemStatus.ToEnum<ItemStatus>() != ItemStatus.YongBing &&    //点击装备或者更换装备的时候,在筛选时去掉已经装备
                        itemInfo.CheckCareer(general.CareerID);
             });
         _userItemArray.QuickSort((a, b) => a.CompareTo(b));
     }
     //var package = UserItemPackage.Get(Uid);
     //_userItemArray = package.ItemPackage.FindAll(s=>s.ItemType==ItemType.ZhuangBei);
     return true;
 }
Ejemplo n.º 5
0
        public override bool TakeAction()
        {
            var cacheSetPack = new GameDataCacheSet<UserPack>();
            var userPack = cacheSetPack.FindKey(UserId.ToString());
            var pack = userPack != null && userPack.PackTypeList != null ? userPack.PackTypeList.Find(s => s.BackpackType == BackpackType.BeiBao) : null;
            _gridNum = pack != null ? pack.Position : 0;
            //int sellDate = (ConfigEnvSet.GetInt("UserItemSold.IntervalDate") * 60 * 60);

            var package = UserItemPackage.Get(Uid);
            var sellItem = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemStatus == ItemStatus.Sell && m.ItemType.ToInt() == _packType);
            _itemCount = package != null && package.ItemPackage != null
                            ? package.ItemPackage.FindAll(s => s.ItemType != ItemType.ZhuangBei).Count
                            : 0;
            foreach (var item in sellItem)
            {
                UserItemHelper.AddItemLog(ContextUser.UserID, item.ItemID, item.Num, item.ItemLv, 4, item.UserItemID);
                package.RemoveItem(item);
            }

            var itemSortArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemStatus == ItemStatus.BeiBao && m.ItemType.ToInt() == _packType);
            itemSortArray.QuickSort((x, y) =>
            {
                int result = 0;
                if (x == null && y == null) return 0;
                if (x != null && y == null) return 1;
                if (x == null) return -1;

                result = (y.CanUse).CompareTo(x.CanUse);
                if (result == 0)
                {
                    result = ((int)x.ItemType).CompareTo((int)y.ItemType);
                    if (result == 0)
                    {
                        result = x.ItemID.CompareTo(y.ItemID);
                        if (result == 0)
                        {
                            if (x.ItemType == ItemType.ZhuangBei)
                            {
                                UserItemHelper h1 = new UserItemHelper(y);
                                UserItemHelper h2 = new UserItemHelper(x);
                                result = ((int)h2.QualityType).CompareTo((int)h1.QualityType);
                                if (result == 0)
                                {
                                    result = ((int)y.ItemLv).CompareTo(x.ItemLv);
                                }
                            }
                            else
                            {
                                result = ((int)y.ItemLv).CompareTo(x.ItemLv);
                            }
                        }
                    }

                }
                return result;
            });

            mlist = itemSortArray.GetPaging(pageIndex, pageSize, out pageCount);
            return true;
        }
Ejemplo n.º 6
0
        public override bool TakeAction()
        {
            var package = UserItemPackage.Get(Uid);

            itemArray = package.ItemPackage.FindAll(
                u =>
                {
                    var helper = new UserItemHelper(u);
                    return !u.IsRemove && u.ItemType == ItemType.YaoJi &&
                           helper.DemandLv <= ContextUser.UserLv &&
                           helper.MedicineType == medicineType &&
                           (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu);
                });
            itemArray.QuickSort((x, y) =>
            {
                if (x == null && y == null) return 0;
                if (x != null && y == null) return 1;
                if (x == null) return -1;
                return x.ItemID.CompareTo(y.ItemID);
            });
            return true;
        }
Ejemplo n.º 7
0
        public override bool TakeAction()
        {
            //int maxEquNum = ConfigEnvSet.GetInt("UserQueue.EquStrengMaxNum");
            //int coldTime = ConfigEnvSet.GetInt("UserItem.EquColdTime");

            //铜钱不足
            var package = UserItemPackage.Get(Uid);
            userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID)) ?? new UserItemInfo();
            if (ops == StrongOnce)
            {
                // 强化 1 次用钱
                strongMoney = new UserItemHelper(userItem, 1).StrongMoney;
            }
            else if (ops == StrongTenTimes)
            {
                // 强化 10 次用钱
                strongMoney = new UserItemHelper(userItem, 10).StrongMoney;
            }
            short strongMaxLv = (ContextUser.UserLv * 3).ToShort(); //MathUtils.Addition(ContextUser.UserLv, 1.ToShort()); //强化最高等级
            if (ContextUser.GameCoin < strongMoney)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough;
                return false;
            }

            //UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, userItem.GeneralID);
            //if (userGeneral != null && userItem.ItemLv >= strongMaxLv)
            //{
            //    ErrorCode = LanguageManager.GetLang().ErrorCode;
            //    ErrorInfo = LanguageManager.GetLang().St1204_EquGeneralMaxLv;
            //    return false;
            //}

            if (userItem.ItemLv >= strongMaxLv)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1204_EquMaxLv;
                return false;
            }

            itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(userItem.ItemID);
            if (itemInfo != null)
            {
                itemEquArray = new ConfigCacheSet<ItemEquAttrInfo>().FindAll(m => m.ItemID == itemInfo.ItemID);
            }

            if (strongMoney > ContextUser.GameCoin)
            {
                isStrong = 1;
            }
            else if (userItem.ItemLv >= strongMaxLv)
            {
                isStrong = 2;
            }

            UpdateUserItem(ContextUser, userItem, strongMoney);
            //日常任务-强化
            TaskHelper.TriggerDailyTask(Uid, 4001);

            UserGeneral general = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, userItem.GeneralID);
            if (general != null)
            {
                general.RefreshMaxLife();
            }
            return true;
        }
Ejemplo n.º 8
0
        public override bool TakeAction()
        {
            var package = UserItemPackage.Get(Uid);
            var itemSortArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemStatus == ItemStatus.CangKu);
            itemSortArray.QuickSort((x, y) =>
            {
                int result = 0;
                if (x == null && y == null) return 0;
                if (x != null && y == null) return 1;
                if (x == null) return -1;
                result = ((int)x.ItemType).CompareTo((int)y.ItemType);
                if (result == 0)
                {
                    result = x.ItemID.CompareTo(y.ItemID);
                    if (result == 0)
                    {
                        if (x.ItemType == ItemType.ZhuangBei)
                        {
                            UserItemHelper h1 = new UserItemHelper(y);
                            UserItemHelper h2 = new UserItemHelper(x);
                            result = ((int)h1.QualityType).CompareTo((int)h2.QualityType);
                            if (result == 0)
                            {
                                result = ((int)y.ItemLv).CompareTo((int)x.ItemLv);
                            }
                        }
                        else
                        {
                            result = ((int)y.ItemLv).CompareTo((int)x.ItemLv);
                        }
                    }
                }
                return result;
            });

            mlist = itemSortArray.GetPaging(pageIndex, pageSize, out pageCount);
            return true;
        }
Ejemplo n.º 9
0
        public override bool TakeAction()
        {
            int maxEquNum = ConfigEnvSet.GetInt("UserQueue.EquStrengMaxNum");
            UserItemPackage package;
            if (!string.IsNullOrEmpty(_toUserId))
            {
                package = UserItemPackage.Get(_toUserId);
            }
            else
            {
                package = UserItemPackage.Get(ContextUser.UserID);
            }

             _userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(_userItemId)) ?? new UserItemInfo();

            _itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(_userItem.ItemID);
            if (_itemInfo == null)
            {
                SaveDebuLog(string.Format("玩家{0}物品ID={1}[{2}]不存在!", Uid, _userItem.UserItemID, _userItem.ItemID));
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                return false;
            }

            if (_userItem.ItemLv > _itemInfo.DemandLv)
            {
                _demandLv = _userItem.ItemLv;
            }
            else
            {
                _demandLv = _itemInfo.DemandLv;
            }

            _strongMoney = new UserItemHelper(_userItem, 1).StrongMoney;
            _tenTimesStrongMoney = new UserItemHelper(_userItem, 10).StrongMoney;  // 强化 10 次用钱
            _itemEquArray = new ConfigCacheSet<ItemEquAttrInfo>().FindAll(m => m.ItemID == _userItem.ItemID);

            if (_userItem.ItemLv >= ContextUser.UserLv || _strongMoney > ContextUser.GameCoin)
            {
                _isStrong = 1;
            }
            List<UserQueue> userQueueArray = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.EquipmentStrong);
            userQueueArray.QuickSort((x, y) =>
            {
                if (x == null && y == null) return 0;
                if (x != null && y == null) return 1;
                if (x == null) return -1;
                return y.Timing.CompareTo(x.Timing);
            });
            if (userQueueArray.Count == ContextUser.QueueNum)
            {
                DateTime minDateTime = DateTime.MinValue;
                foreach (UserQueue queue in userQueueArray)
                {
                    if (queue.DoRefresh() > 0 && !queue.IsSuspend && minDateTime < queue.Timing && queue.StrengNum >= maxEquNum)
                    {
                        _coldTime = queue.DoRefresh();
                    }
                }
            }
            UserHelper.SparePartPropertyList(Uid, _userItemId); //灵件属性
            return true;
        }