示例#1
0
        /// <summary>
        /// 双倍材料,月饼道具使用
        /// </summary>
        /// <param name="userItem"></param>
        /// <param name="itemInfo"></param>
        /// <returns></returns>
        private bool DoCaiLiaoYueBingItem(UserItemInfo userItem, ItemBaseInfo itemInfo)
        {
            UserProps props = new GameDataCacheSet <UserProps>().FindKey(ContextUser.UserID, userItem.ItemID);

            if (props != null)
            {
                if (userItem.ItemID == 5200 && props.DoRefresh() > 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1608_CombatPowerNotEnough;
                    return(false);
                }

                props.SurplusNum += itemInfo.EffectNum;
                props.ChangeTime  = DateTime.Now;
                //props.Update();
            }
            else
            {
                UserProps uProps = new UserProps(ContextUser.UserID, itemInfo.ItemID)
                {
                    SurplusNum = itemInfo.EffectNum,
                    ChangeTime = DateTime.Now
                };
                new GameDataCacheSet <UserProps>().Add(uProps, GameEnvironment.CacheUserPeriod);
            }
            return(true);
        }
示例#2
0
        public override bool TakeAction()
        {
            int uItemID = 0;

            if (itemID == 0 && userItemID != "")
            {
                var          package  = UserItemPackage.Get(Uid);
                UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID));
                if (userItem != null)
                {
                    uItemID = userItem.ItemID;
                }
            }
            else
            {
                uItemID = itemID;
            }
            List <ItemSynthesisInfo> itemSynthesisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(u => u.SynthesisID.Equals(uItemID));

            if (itemSynthesisArray.Count > 0)
            {
                itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(itemSynthesisArray[0].ItemID); //合成物品的信息
                //synthesisArray = new ConfigCacheSet<ItemSynthesisInfo>().FindAll(u => u.ItemID.Equals(itemInfo.ItemID) && u.SynthesisID != itemID);
                synthesisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(u => u.ItemID.Equals(itemInfo.ItemID));
                equAttrInfo    = new ConfigCacheSet <ItemEquAttrInfo>().FindAll(u => u.ItemID.Equals(itemInfo.ItemID));
            }

            synthesisMinLv = ConfigEnvSet.GetInt("ItemInfo.SynthesisMinLv");
            return(true);
        }
示例#3
0
        private string DoBossItem(GameUser user, BossItem bossItem, int randId)
        {
            string prizeItemMsg = string.Empty;
            ////筛选物品
            var itemInfoList = new ConfigCacheSet <ItemBaseInfo>().FindAll(m => m.ItemType == bossItem.Type && m.MedicineLv == bossItem.ItemLv);

            if (itemInfoList.Count > 0)
            {
                for (int i = 0; i < bossItem.Num; i++)
                {
                    ItemBaseInfo itemInfo = itemInfoList[RandomUtils.GetRandom(0, itemInfoList.Count)];
                    if (itemInfo == null)
                    {
                        continue;
                    }
                    UserItemHelper.AddUserItem(user.UserID, itemInfo.ItemID, 1);
                    if (prizeItemMsg.Length > 0)
                    {
                        prizeItemMsg += " ";
                    }
                    prizeItemMsg += string.Format(LanguageManager.GetLang().St5405_CombatNum, itemInfo.ItemName, 1);
                }
            }
            return(prizeItemMsg);
        }
示例#4
0
 /// <summary>
 /// 获取配置信息
 /// </summary>
 /// <param name="itemInfo"></param>
 /// <returns></returns>
 public static List <PrizeInfo> GetPrizeInfo(ItemBaseInfo itemInfo)
 {
     if (itemInfo.ItemPack == null || itemInfo.ItemPack.Count <= 0)
     {
         return(null);
     }
     return(PrizeHelper.GetPrizeInfo(itemInfo.ItemPack).ToList());
 }
示例#5
0
        private string DoBossItem(GameUser user, BossItem bossItem, int randId)
        {
            string prizeItemMsg = string.Empty;
            //筛选物品
            var itemInfoList = new ConfigCacheSet <ItemBaseInfo>().FindAll(m =>
            {
                bool result = false;
                if (m.ItemType == bossItem.Type)
                {
                    if (m.ItemID == bossItem.ItemId)
                    {
                        return(true);
                    }
                    if (m.ItemType == ItemType.TuZhi)
                    {
                        result = m.MedicineLv <= bossItem.ItemLv;
                    }
                    else
                    {
                        if (bossItem.ItemLv > 0 && bossItem.Quality > 0)
                        {
                            result = m.DemandLv == bossItem.ItemLv && (short)m.QualityType == bossItem.Quality;
                        }
                        else if (bossItem.ItemLv > 0)
                        {
                            result = m.DemandLv == bossItem.ItemLv;
                        }
                        else if (bossItem.Quality > 0)
                        {
                            result = (short)m.QualityType == bossItem.Quality;
                        }
                    }
                }
                return(result);
            });

            if (itemInfoList.Count > 0)
            {
                for (int i = 0; i < bossItem.Num; i++)
                {
                    ItemBaseInfo itemInfo = itemInfoList[RandomUtils.GetRandom(0, itemInfoList.Count)];
                    if (itemInfo == null)
                    {
                        continue;
                    }
                    UserItemHelper.AddUserItem(user.UserID, itemInfo.ItemID, 1);
                    if (prizeItemMsg.Length > 0)
                    {
                        prizeItemMsg += " ";
                    }
                    prizeItemMsg += string.Format("{0}*{1}", itemInfo.ItemName, 1);
                }
            }
            return(prizeItemMsg);
        }
示例#6
0
    public virtual ItemBaseInfo Clone()
    {
        //Debug.Log("Do ItemBaseInfo.Clone");
        ItemBaseInfo cloneInfo = (ItemBaseInfo)CreateInstance(GetType());

        cloneInfo.itemName       = itemName;
        cloneInfo.itemID         = itemID;
        cloneInfo.maxCountInGrid = maxCountInGrid;
        cloneInfo.effectGroup    = effectGroup;
        cloneInfo.radius         = radius;
        return(cloneInfo);
    }
示例#7
0
        public void AddReward(ItemBaseInfo[] rewards, Vector3 startPos)
        {
            if (rewards != null)
            {
                List <ItemBaseInfo> list = new List <ItemBaseInfo>();

                foreach (var reward in rewards)
                {
                    var data = new TDataItemList();
                    if (TableManager.Get().ItemList.GetData(reward.ItemId, out data))
                    {
                        switch (data.id)
                        {
                        case 1:     // 골드
                            UserInfoManager.Get().GetUserInfo().gold += reward.Value;
                            UI_GetProduction.Get().Initialize(ITEM_TYPE.GOLD, startPos,
                                                              Mathf.Clamp(reward.Value, 5, 20));
                            break;

                        case 2:     // 다이아
                            UserInfoManager.Get().GetUserInfo().diamond += reward.Value;
                            UI_GetProduction.Get().Initialize(ITEM_TYPE.DIAMOND, startPos,
                                                              Mathf.Clamp(reward.Value, 5, 20));
                            break;

                        case 11:     // 열쇠
                            UserInfoManager.Get().GetUserInfo().key += reward.Value;
                            UI_GetProduction.Get().Initialize(ITEM_TYPE.KEY, startPos,
                                                              Mathf.Clamp(reward.Value, 5, 20));
                            break;

                        default:     // 주사위
                        {
                            ItemBaseInfo rw = new ItemBaseInfo();
                            rw.ItemId = reward.ItemId;
                            rw.Value  = reward.Value;
                            list.Add(rw);
                        }
                        break;
                        }
                    }
                }

                if (list.Count > 0)
                {
                    gerResult.Initialize(list.ToArray(), false, false);
                }
            }
        }
示例#8
0
    public bool CanPutIn(ItemGroup putInItemGroup, out ItemGroup extraItemGroup)
    {
        bool canPutIn = isEmpty || myItemGroup.itemCount > 0 && myItemGroup.CompareTo(putInItemGroup) == 0;

        extraItemGroup = null;
        if (canPutIn && myItemGroup != null)
        {
            ItemBaseInfo putInItemInfo = putInItemGroup.itemInfo;
            int          extraCount    = putInItemGroup.itemCount + myItemGroup.itemCount - putInItemInfo.maxCountInGrid;
            if (extraCount > 0)
            {
                extraItemGroup = new ItemGroup(putInItemInfo, extraCount);
            }
        }
        return(canPutIn);
    }
示例#9
0
        private static bool UseProps(string userID, ItemBaseInfo itemInfo)
        {
            var cacheSet = new GameDataCacheSet <UserProps>();
            List <UserProps> propsArray = cacheSet.FindAll(userID, u => u.PropType == itemInfo.PropType);

            if (itemInfo.PropType == 9 && propsArray.Count > 0)
            {
                int refreshNum = propsArray[0].DoRefresh();
                if (refreshNum > 0)
                {
                    return(false);
                }
            }
            bool isUsed = false;

            foreach (UserProps propse in propsArray)
            {
                if (propse.ItemID == 7003 || propse.ItemID == 5200)
                {
                    continue;
                }
                if (!isUsed && propse.ItemID == itemInfo.ItemID)
                {
                    isUsed             = true;
                    propse.SurplusNum += itemInfo.EffectNum;
                    propse.ChangeTime  = DateTime.Now;
                    //propse.Update();
                }
                else
                {
                    cacheSet.Delete(propse);
                }
            }
            //List<UserProps> propsArray1 = new GameDataCacheSet<UserProps>().FindAll(UserProps.Index_UserID, u => u.PropType == itemInfo.PropType && u.ItemID == itemInfo.ItemID, userID);
            if (!isUsed)
            {
                UserProps uProps = new UserProps(userID, itemInfo.ItemID)
                {
                    SurplusNum = itemInfo.EffectNum,
                    ChangeTime = DateTime.Now
                };
                new GameDataCacheSet <UserProps>().Add(uProps, GameEnvironment.CacheUserPeriod);
            }
            return(true);
        }
示例#10
0
        public static ItemBaseInfo ShowLairReward(LairTreasure lairTreasure, GameUser gameUser, LairTreasureType lairTreasureType)    //��ʾ��õ���Ʒ
        {
            var          cacheSetItem   = new ConfigCacheSet <ItemBaseInfo>();
            ItemBaseInfo itemBaseInfo   = null;
            var          lairRewardList = new ConfigCacheSet <LairRewardInfo>().FindAll(s => s.LairPosition == lairTreasure.LairPosition && s.LairTreasureType == lairTreasureType.ToInt());

            if (lairRewardList.Count > 0)
            {
                var lairRewardInfo = lairRewardList[RandomUtils.GetRandom(0, lairRewardList.Count)];
                itemBaseInfo = cacheSetItem.FindKey(lairRewardInfo.ItemID);
                if (itemBaseInfo != null)
                {
                    UserItemHelper.AddUserItem(gameUser.UserID, lairRewardInfo.ItemID, lairTreasure.Num);
                }
            }

            return(itemBaseInfo);
        }
示例#11
0
        public override bool TakeAction()
        {
            itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(itemID);
            List <MonsterInfo> monsterArray = new ShareCacheStruct <MonsterInfo>().FindAll(m => m.ItemID == itemID);

            if (monsterArray.Count > 0)
            {
                PlotNPCInfo npcInfo = new ShareCacheStruct <PlotNPCInfo>().FindKey(monsterArray[0].MonsterID);
                if (npcInfo != null)
                {
                    PlotInfo plotInfo = new ShareCacheStruct <PlotInfo>().FindKey(plotID);
                    if (plotInfo != null)
                    {
                        plotID   = plotInfo.PlotID;
                        plotName = plotInfo.PlotName;
                    }
                }
            }
            return(true);
        }
示例#12
0
        public override bool TakeAction()
        {
            curLevel = 1;
            itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(itemID);
            if (itemInfo == null)
            {
                return(false);
            }

            itemEquArray = new ShareCacheStruct <ItemEquAttrInfo>().FindAll(m => m.ItemID == itemID);

            if (mallType == ShopType.Blackmarket)
            {
                price = itemInfo.SalePrice;
            }
            else
            {
                MallItemsInfo mallitemsInfo = new ShareCacheStruct <MallItemsInfo>().FindKey(itemID, cityID, mallType);
                if (mallitemsInfo != null)
                {
                    ItemBaseInfo qishiItemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(mallitemsInfo.QishiID);
                    if (qishiItemInfo != null)
                    {
                        qiShiName = qishiItemInfo.ItemName;
                    }
                    price = mallitemsInfo.Price;
                }
            }
            if (itemInfo.ItemType == ItemType.TuZhi || itemInfo.ItemType == ItemType.ZhuangBei || itemInfo.ItemType == ItemType.TuZhi)
            {
                List <ItemSynthesisInfo> synthsisArray = new ShareCacheStruct <ItemSynthesisInfo>().FindAll(s => s.SynthesisID.Equals(itemID));
                if (synthsisArray.Count > 0)
                {
                    itemSynthsisArray =
                        new ShareCacheStruct <ItemSynthesisInfo>().FindAll(
                            s => s.ItemID.Equals(synthsisArray[0].ItemID) && s.SynthesisID != itemID);
                }
            }
            return(true);
        }
示例#13
0
 public override void BuildPacket()
 {
     this.PushIntoStack(strUserItemID.Length);
     foreach (var str in strUserItemID)
     {
         ItemBaseInfo itemInfo = string.IsNullOrEmpty(str) ? null : GetItemBaseInfo(ContextUser.UserID, str);
         DataStruct   dsItem   = new DataStruct();
         dsItem.PushIntoStack(str.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());
         PushIntoStack(dsItem);
     }
     this.PushIntoStack(userGeneral == null ? string.Empty : userGeneral.GeneralName.ToNotNullString());
     this.PushIntoStack(userGeneral == null ? (short)0 : userGeneral.GeneralLv);
     this.PushIntoStack((short)nextLv);
     this.PushIntoStack(userGeneral == null ? string.Empty : userGeneral.PicturesID.ToNotNullString());
     this.PushIntoStack(userGeneral == null ? 0 : userGeneral.LifeNum);
     this.PushIntoStack(userGeneral == null ? 0 : userGeneral.CurrExperience);
     this.PushIntoStack(userGeneral == null ? 0 : userGeneral.AbilityID);
     this.PushIntoStack((short)isUp);
 }
示例#14
0
        public bool Reset(GameBaseShopErrorCode errorCode, ShopInfo shopInfo, ItemBaseInfo payItemInfo)
        {
            UI_Main.Get().obj_IndicatorPopup.SetActive(false);

            if (errorCode == GameBaseShopErrorCode.Success)
            {
                if (payItemInfo != null)
                {
                    //리셋을 위해서 사용한 재화 연출 처리
                    //payItemInfo
                    switch ((ITEM_TYPE)payItemInfo.ItemId)
                    {
                    case ITEM_TYPE.GOLD:
                    {
                        UserInfoManager.Get().GetUserInfo().gold += payItemInfo.Value;
                    }
                    break;

                    case ITEM_TYPE.DIAMOND:
                    {
                        UserInfoManager.Get().GetUserInfo().diamond += payItemInfo.Value;
                    }
                    break;
                    }

                    UI_Main.Get().RefreshUserInfoUI();
                }

                UpdateContent(shopInfo);
                return(true);
            }
            else
            {
                Debug.LogError("에러발생");
                return(false);
            }
        }
示例#15
0
        /// <summary>
        /// 상점 인게임 재화 구매 처리
        /// </summary>
        /// <param name="errorCode"></param>
        /// <param name="shopId"></param>
        /// <param name="shopProductInfo"></param>
        /// <param name="payItemInfo"></param>
        /// <param name="arrayRewardItemInfo"></param>
        /// <returns></returns>
        public bool ShowBuyResult(GameBaseShopErrorCode errorCode, int shopId, ShopProductInfo shopProductInfo, ShopProductInfo changeProductInfo, ItemBaseInfo payItemInfo, ItemBaseInfo[] arrayRewardItemInfo, QuestData[] arrayQuestData)
        {
            UI_Main.Get().obj_IndicatorPopup.SetActive(false);

            if (errorCode == GameBaseShopErrorCode.Success)
            {
                //구매한 상품에 대한 정보
                //shopProductInfo
                switch (shopId)
                {
                case 1:
                case 2:
                case 3:
                case 5:
                case 6:
                    RefreshShop();
                    break;
                }

                if (payItemInfo != null)
                {
                    //소모한 재화에 대한 연출 처리
                    //payItemInfo
                    ITEM_TYPE type;
                    switch (payItemInfo.ItemId)
                    {
                    case 1:
                        type = ITEM_TYPE.GOLD;
                        UserInfoManager.Get().GetUserInfo().gold += payItemInfo.Value;
                        break;

                    case 2:
                        type = ITEM_TYPE.DIAMOND;
                        UserInfoManager.Get().GetUserInfo().diamond += payItemInfo.Value;
                        break;

                    case 11:
                        type = ITEM_TYPE.KEY;
                        UserInfoManager.Get().GetUserInfo().key += payItemInfo.Value;
                        break;

                    default:
                        type = ITEM_TYPE.NONE;
                        break;
                    }
                    UI_GetProduction.Get().RefreshProduct(type);
                }

                //구매한 상품에 대한 결과 값
                //arrayRewardItemInfo
                ItemBaseInfo[] arr = new ItemBaseInfo[arrayRewardItemInfo.Length];
                for (int i = 0; i < arrayRewardItemInfo.Length; i++)
                {
                    Debug.Log($"GET == ID:{arrayRewardItemInfo[i].ItemId}, Value:{arrayRewardItemInfo[i].Value}");
                    arr[i]        = new ItemBaseInfo();
                    arr[i].ItemId = arrayRewardItemInfo[i].ItemId;
                    arr[i].Value  = arrayRewardItemInfo[i].Value;
                }
                UI_Main.Get().AddReward(arr, ShopItem.pos);

                return(true);
            }
            else
            {
                Debug.Log($"에러 발생 : {errorCode}");
                UI_ErrorMessage.Get().ShowMessage($"Error : {errorCode}");
                return(false);
            }
        }
示例#16
0
        public override void BuildPacket()
        {
            this.PushIntoStack(_userTaskList.Count);
            foreach (UserTask userTask in _userTaskList)
            {
                StoryTaskInfo taskInfo = new ShareCacheStruct <StoryTaskInfo>().FindKey(userTask.TaskID);
                //CityNpcInfo reNpcInfo = new ShareCacheStruct<CityNpcInfo>().FindKey(taskInfo.ReleaseNpcID);

                CityNpcInfo  deNpcInfo          = null;
                PlotInfo     plotInfo           = null;
                PlotNPCInfo  npcInfo            = null;
                ItemBaseInfo itemInfo           = null;
                string[]     monsterList        = new string[0];
                string[]     monsterNumList     = new string[0];
                string[]     monsterCurrNumList = new string[0];
                if (taskInfo != null)
                {
                    deNpcInfo          = new ShareCacheStruct <CityNpcInfo>().FindKey(taskInfo.DeliveryNpcID);
                    plotInfo           = new ShareCacheStruct <PlotInfo>().FindKey(taskInfo.PlotID);
                    npcInfo            = new ShareCacheStruct <PlotNPCInfo>().FindKey(taskInfo.PlotNpcID);
                    itemInfo           = new ShareCacheStruct <ItemBaseInfo>().FindKey(taskInfo.TargetItemID);
                    monsterList        = taskInfo.TargetMonsterID.ToNotNullString().Split(new char[] { ',' });
                    monsterNumList     = taskInfo.TargetMonsterNum.ToNotNullString().Split(new char[] { ',' });
                    monsterCurrNumList = userTask.TaskTargetNum.ToNotNullString().Split(new char[] { ',' });
                }

                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.TaskID);
                dsItem.PushIntoStack(taskInfo == null ? string.Empty : taskInfo.TaskName.ToNotNullString());
                dsItem.PushIntoStack((short)userTask.TaskState);
                dsItem.PushIntoStack(taskInfo == null ? LanguageManager.GetLang().shortInt : (short)taskInfo.TaskType);
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.ReleaseNpcID);
                dsItem.PushIntoStack(taskInfo == null ? LanguageManager.GetLang().shortInt : (short)taskInfo.TermsType);
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.DeliveryNpcID);
                dsItem.PushIntoStack(deNpcInfo == null ? string.Empty : deNpcInfo.NpcName.ToNotNullString());

                dsItem.PushIntoStack(plotInfo == null ? 0 : plotInfo.CityID);
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.PlotID);
                dsItem.PushIntoStack(plotInfo == null ? string.Empty : plotInfo.PlotName.ToNotNullString());
                dsItem.PushIntoStack(npcInfo == null ? string.Empty : npcInfo.NpcName.ToNotNullString());


                dsItem.PushIntoStack(monsterList.Length);
                for (int i = 0; i < monsterList.Length; i++)
                {
                    int         monsterID   = monsterList[i].ToInt();
                    int         monsterNum  = monsterNumList[i].ToInt();
                    int         currNum     = monsterCurrNumList.Length > i ? monsterCurrNumList[i].ToInt() : 0;
                    MonsterInfo monsterInfo = new ShareCacheStruct <MonsterInfo>().FindKey(monsterID);

                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(monsterInfo != null ? monsterInfo.GeneralName.ToNotNullString() : string.Empty);
                    dsItem1.PushIntoStack(monsterNum);
                    dsItem1.PushIntoStack(currNum);
                    dsItem.PushIntoStack(dsItem1);
                }

                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.TargetItemNum);
                dsItem.PushIntoStack(UserItemHelper.CheckItemNum(ContextUser.UserID, taskInfo == null ? 0 : taskInfo.TargetItemID));
                this.PushIntoStack(dsItem);
            }
        }
示例#17
0
 public ItemGroup(ItemBaseInfo itemInfo, int itemCount)
 {
     this.itemInfo  = itemInfo;
     this.itemCount = itemCount;
 }
示例#18
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);
        }
示例#19
0
    private void ItemAnimation()
    {
        ItemBaseInfo reward = msg[Mathf.Clamp(openCount, 0, msg.Length - 1)];

        TDataItemList tDataItemList;

        if (TableManager.Get().ItemList.GetData(reward.ItemId, out tDataItemList) == false)
        {
            Debug.LogErrorFormat($"Failed to get table data from ItemList. ID:{reward.ItemId}");
            return;
        }

        if (crt_TextCount != null)
        {
            StopCoroutine(crt_TextCount);
        }

        if (ani_Item.GetCurrentAnimatorStateInfo(0).IsName("UI_getdice") ||
            ani_Item.GetCurrentAnimatorStateInfo(0).IsName("UI_getdice_legend"))
        {
            ani_Item.SetTrigger("End");
            iconChangeDelay = 0;

            if ((ITEM_TYPE)tDataItemList.itemType == ITEM_TYPE.DICE)
            {
                // dice
                TDataDiceInfo dataDiceInfo;
                if (TableManager.Get().DiceInfo.GetData(reward.ItemId, out dataDiceInfo) == false)
                {
                    return;
                }
                int level = 0;
                if (UserInfoManager.Get().GetUserInfo().dicGettedDice.ContainsKey(reward.ItemId))
                {
                    level = UserInfoManager.Get().GetUserInfo().dicGettedDice[reward.ItemId][0];
                }
                TDataDiceUpgrade dataDiceUpgrade;
                if (TableManager.Get().DiceUpgrade.GetData(x => x.diceLv == level + 1 && x.diceGrade == dataDiceInfo.grade, out dataDiceUpgrade) == false)
                {
                    return;
                }

                int needDiceCount = dataDiceUpgrade.needCard;
                int current       = UserInfoManager.Get().GetUserInfo().dicGettedDice[reward.ItemId][1];

                text_ItemGuageCount.text   = $"{current}/{needDiceCount}";
                image_ItemGuage.fillAmount = current / (float)needDiceCount;

                image_ItemGuage.color = current >= needDiceCount ? Color.green : UnityUtil.HexToColor("6AD3E5");
                if (image_UpgradeIcon.gameObject.activeSelf == false && current >= needDiceCount)
                {
                    image_UpgradeIcon.gameObject.SetActive(true);
                    image_UpgradeIcon.rectTransform.localScale = Vector3.zero;
                    image_UpgradeIcon.rectTransform.DOScale(1f, 0.25f);
                }
            }

            // 애니메이션
            RectTransform _rts = (RectTransform)ani_Item.transform;
            _rts.DOKill();
            _rts.DOAnchorPosY(350f, 0f);
            _rts.DOScale(1.4f, 0f);

            return;
        }

        ani_Box.SetTrigger("Open");

        if (crt_IconChange != null)
        {
            StopCoroutine(crt_IconChange);
        }
        ani_Item.gameObject.SetActive(true);

        // 보상내용 세팅
        switch ((ITEM_TYPE)tDataItemList.itemType)
        {
        case ITEM_TYPE.GOLD:
            image_ItemIcon.sprite = sprite_Gold;
            image_ItemIcon.SetNativeSize();
            iconChangeDelay = 0.6f;
            crt_IconChange  = StartCoroutine(IconChangeCoroutine(sprite_Gold));
            ani_Item.SetTrigger("Get");
            text_ItemName.text  = LocalizationManager.GetLangDesc(tDataItemList.itemName_langId);
            text_ItemCount.text = $"x{reward.Value}";
            obj_Guage.SetActive(false);
            SoundManager.instance.Play(Global.E_SOUND.SFX_UI_BOX_COMMON_GET_GOLD, 0.5f);
            break;

        case ITEM_TYPE.DIAMOND:
            image_ItemIcon.sprite = sprite_Diamond;
            image_ItemIcon.SetNativeSize();
            iconChangeDelay = 0.6f;
            crt_IconChange  = StartCoroutine(IconChangeCoroutine(sprite_Diamond));
            ani_Item.SetTrigger("Get");
            text_ItemName.text  = LocalizationManager.GetLangDesc(tDataItemList.itemName_langId);
            text_ItemCount.text = $"x{reward.Value}";
            obj_Guage.SetActive(false);
            SoundManager.instance.Play(Global.E_SOUND.SFX_UI_BOX_COMMON_GET_DIAMOND, 0.5f);
            break;

        case ITEM_TYPE.DICE:
        {
            obj_Guage.SetActive(true);
            for (int i = 0; i < arrPs_ItemNormal.Length; i++)
            {
                var module = arrPs_ItemNormal[i].main;
                module.startColor = UnityUtil.HexToColor(Global.g_gradeColor[0]);
            }

            image_ItemIcon.sprite = arrSprite_UnknownDiceIcon[0];

            TDataDiceInfo dataDiceInfo;
            if (TableManager.Get().DiceInfo.GetData(reward.ItemId, out dataDiceInfo) == false)
            {
                return;
            }


            if ((DICE_GRADE)dataDiceInfo.grade == DICE_GRADE.LEGEND)
            {
                _currentAudio = SoundManager.instance.Play(Global.E_SOUND.SFX_UI_BOX_COMMON_GET_DICE_LEGEND);
                ani_Item.SetTrigger("GetLegend");
                iconChangeDelay = 1.6f;
            }
            else
            {
                SoundManager.instance.Play(Global.E_SOUND.SFX_UI_BOX_COMMON_GET_DICE, 0.5f);
                ani_Item.SetTrigger("Get");
                iconChangeDelay = 0.6f;
            }

            crt_IconChange = StartCoroutine(IconChangeCoroutine(FileHelper.GetIcon(dataDiceInfo.iconName)));

            image_ItemIcon.SetNativeSize();
            text_ItemName.text  = LocalizationManager.GetLangDesc(tDataItemList.itemName_langId);
            text_ItemCount.text = $"x{reward.Value}";
            int level = 0;
            if (UserInfoManager.Get().GetUserInfo().dicGettedDice.ContainsKey(reward.ItemId))
            {
                level = UserInfoManager.Get().GetUserInfo().dicGettedDice[reward.ItemId][0];
            }

            TDataDiceUpgrade dataDiceUpgrade;
            if (TableManager.Get().DiceUpgrade.GetData(x => x.diceLv == level + 1 && x.diceGrade == dataDiceInfo.grade, out dataDiceUpgrade) == false)
            {
                return;
            }

            int needDiceCount = dataDiceUpgrade.needCard;
            crt_TextCount = StartCoroutine(TextCountCoroutine(
                                               UserInfoManager.Get().GetUserInfo().dicGettedDice[reward.ItemId][1],
                                               reward.Value, needDiceCount, 1.2f));
        }
        break;
        }

        // 애니메이션
        RectTransform rts = (RectTransform)ani_Item.transform;

        rts.DOKill();
        rts.anchoredPosition = new Vector2(0, -250);
        rts.DOAnchorPosY(350f, 0.5f);
        rts.localScale = Vector3.zero;
        rts.DOScale(1.4f, 0.5f);

        SoundManager.instance.Play(Global.E_SOUND.SFX_UI_BOX_COMMON_ITEM_APPEAR);

        openCount++;
    }
示例#20
0
        public override void BuildPacket()
        {
            int rankID = 0;

            this.PushIntoStack(userTaskList.Count);
            foreach (UserTask userTask in userTaskList)
            {
                SaveLog("任务ID:" + userTask.TaskID + ", 任务排行:" + MathUtils.Addition(rankID, 1));
                StoryTaskInfo taskInfo           = new ConfigCacheSet <StoryTaskInfo>().FindKey(userTask.TaskID);
                CityNpcInfo   reNpcInfo          = null;
                CityNpcInfo   deNpcInfo          = null;
                PlotInfo      plotInfo           = null;
                PlotNPCInfo   npcInfo            = null;
                ItemBaseInfo  itemInfo           = null;
                string[]      monsterList        = new string[0];
                string[]      monsterNumList     = new string[0];
                string[]      monsterCurrNumList = new string[0];
                if (taskInfo != null)
                {
                    reNpcInfo          = new ConfigCacheSet <CityNpcInfo>().FindKey(taskInfo.ReleaseNpcID);
                    deNpcInfo          = new ConfigCacheSet <CityNpcInfo>().FindKey(taskInfo.DeliveryNpcID);
                    plotInfo           = new ConfigCacheSet <PlotInfo>().FindKey(taskInfo.PlotID);
                    npcInfo            = new ConfigCacheSet <PlotNPCInfo>().FindKey(taskInfo.PlotNpcID);
                    itemInfo           = new ConfigCacheSet <ItemBaseInfo>().FindKey(taskInfo.TargetItemID);
                    monsterList        = taskInfo.TargetMonsterID.ToNotNullString().Split(new char[] { ',' });
                    monsterNumList     = taskInfo.TargetMonsterNum.ToNotNullString().Split(new char[] { ',' });
                    monsterCurrNumList = userTask.TaskTargetNum.ToNotNullString().Split(new char[] { ',' });
                }

                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.TaskID);
                dsItem.PushIntoStack(taskInfo == null ? string.Empty : taskInfo.TaskName.ToNotNullString());
                dsItem.PushIntoStack(taskInfo == null ? LanguageManager.GetLang().shortInt : taskInfo.TaskLv);
                dsItem.PushIntoStack((short)userTask.TaskState);
                dsItem.PushIntoStack(taskInfo == null ? string.Empty : taskInfo.TaskDescp.ToNotNullString());
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.ReleaseNpcID);
                dsItem.PushIntoStack(reNpcInfo == null ? string.Empty : reNpcInfo.NpcName.ToNotNullString());
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.DeliveryNpcID);
                dsItem.PushIntoStack(deNpcInfo == null ? string.Empty : deNpcInfo.NpcName.ToNotNullString());
                dsItem.PushIntoStack(taskInfo == null ? LanguageManager.GetLang().shortInt : (short)taskInfo.TermsType);

                dsItem.PushIntoStack(plotInfo != null ? plotInfo.CityID : 0);
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.PlotID);
                dsItem.PushIntoStack(plotInfo != null ? (short)plotInfo.PlotType : (short)0);
                dsItem.PushIntoStack(plotInfo != null ? plotInfo.PlotName.ToNotNullString() : string.Empty);
                dsItem.PushIntoStack(npcInfo == null ? string.Empty : npcInfo.NpcName.ToNotNullString());

                dsItem.PushIntoStack(monsterList.Length);
                for (int i = 0; i < monsterList.Length; i++)
                {
                    int         monsterID   = monsterList[i].ToInt();
                    int         monsterNum  = monsterNumList[i].ToInt();
                    int         currNum     = monsterCurrNumList.Length > i ? monsterCurrNumList[i].ToInt() : 0;
                    MonsterInfo monsterInfo = new ConfigCacheSet <MonsterInfo>().FindKey(monsterID);

                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(monsterInfo != null ? monsterInfo.GeneralName.ToNotNullString() : string.Empty);
                    dsItem1.PushIntoStack(monsterNum);
                    dsItem1.PushIntoStack(currNum);
                    dsItem.PushIntoStack(dsItem1);
                }

                dsItem.PushIntoStack(itemInfo != null ? itemInfo.ItemName.ToNotNullString() : string.Empty);
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.TargetItemNum);
                dsItem.PushIntoStack(UserItemHelper.CheckItemNum(ContextUser.UserID, taskInfo == null ? 0 : taskInfo.TargetItemID));
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.Experience);
                dsItem.PushIntoStack(taskInfo == null ? 0 : taskInfo.GameCoin);

                this.PushIntoStack(dsItem);
            }
        }
示例#21
0
    public bool OnReceiveSeasonPassStepAck(ERandomwarsSeasonErrorCode errorCode, int rewardId, ItemBaseInfo useItemInfo, ItemBaseInfo rewardInfo, QuestData[] arrayQuestData)
    {
        UI_Main.Get().obj_IndicatorPopup.SetActive(false);

        UI_Popup.AllClose();

        if (errorCode == ERandomwarsSeasonErrorCode.Success)
        {
            switch (useItemInfo.ItemId)
            {
            case 1:
                UserInfoManager.Get().GetUserInfo().gold += useItemInfo.Value;
                break;

            case 2:
                UserInfoManager.Get().GetUserInfo().diamond += useItemInfo.Value;
                break;
            }

            UserInfoManager.Get().GetUserInfo().seasonPassRewardStep = rewardId;
            UserInfoManager.Get().GetUserInfo().seasonTrophy        += rewardInfo.Value;

            UI_Main.Get().RefreshUserInfoUI();
            UI_Popup_Quest.QuestUpdate(arrayQuestData);
            SendMessageUpwards("RefreshSeasonInfo", SendMessageOptions.DontRequireReceiver);

            transform.parent.BroadcastMessage("SetButton");
        }
        else
        {
            UI_ErrorMessage.Get().ShowMessage("재화가 부족합니다.");
        }

        return(true);
    }
示例#22
0
 /// <summary>
 /// 상점 현금 결제 처리
 /// </summary>
 /// <param name="errorCode"></param>
 /// <param name="shopId"></param>
 /// <param name="shopProductInfo"></param>
 /// <param name="arrayItemBaseInfo"></param>
 /// <returns></returns>
 public bool ShowPurchaseResult(GameBaseShopErrorCode errorCode, int shopId, ShopProductInfo shopProductInfo, ShopProductInfo changeProductInfo, ItemBaseInfo payItemInfo, ItemBaseInfo[] arrayRewardItemInfo, QuestData[] arrayQuestData)
 {
     return(ShowBuyResult(errorCode, shopId, shopProductInfo, changeProductInfo, payItemInfo, arrayRewardItemInfo, arrayQuestData));
 }
示例#23
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);
        }
示例#24
0
        public override bool TakeAction()
        {
            if (!string.IsNullOrEmpty(_toUserID))
            {
                packUser = _toUserID;
            }
            else
            {
                packUser = ContextUser.UserID;
            }
            var package = UserItemPackage.Get(packUser);

            _useritem = package.ItemPackage.Find(m => string.Equals(m.UserItemID, _userItemID)) ?? new UserItemInfo();
            if (_useritem == null || _useritem.ItemID == 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                return(false);
            }

            _itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(_useritem.ItemID);
            if (_itemInfo == null)
            {
                ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }

            if (_useritem.ItemLv > _itemInfo.DemandLv)
            {
                demandLv = _useritem.ItemLv;
            }
            else
            {
                demandLv = _itemInfo.DemandLv;
            }
            if (_itemInfo.ItemType == ItemType.ZhuangBei)
            {
                _salePrice = UserHelper.StrongEquPayPrice(packUser, _userItemID);
            }
            else
            {
                if (isShow > 0)
                {
                    _salePrice = (_itemInfo.SalePrice / 4);
                }
                else
                {
                    _salePrice = ((_itemInfo.SalePrice / 4) * _useritem.Num);
                }
            }

            _itemEquArray = new ConfigCacheSet <ItemEquAttrInfo>().FindAll(m => m.ItemID == _useritem.ItemID);
            List <ItemSynthesisInfo> synthsisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(m => m.SynthesisID == _useritem.ItemID);

            if (synthsisArray.Count > 0)
            {
                var synthsis = synthsisArray[0];
                if (_itemInfo.ItemType == ItemType.TuZhi || _itemInfo.ItemType == ItemType.TuZhi)
                {
                    _itemSynthsisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(m => m.ItemID == synthsis.ItemID && m.SynthesisID != _useritem.ItemID);
                }
            }

            if (_itemInfo.CareerRange != null && _itemInfo.CareerRange.Trim() != "0")
            {
                _careerList = _itemInfo.CareerRange.Split(',');
            }
            PropertyArray = UserHelper.SparePartPropertyList(packUser, _userItemID); //灵件属性
            return(true);
        }
示例#25
0
        public override void BuildPacket()
        {
            PushIntoStack(enchantPackNum);
            PushIntoStack(moShiNum);
            PushIntoStack(goldNum);
            PushIntoStack(generalArray.Length);
            foreach (var general in generalArray)
            {
                UserEnchantInfo[] enchantGeneralArray = new UserEnchantInfo[0];
                UserItemInfo      useritem            = EnchantHelper.GetGeneralWeapon(general.UserID, general.GeneralID);
                ItemBaseInfo      itemInfo            = null;
                if (useritem != null)
                {
                    itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(useritem.ItemID);
                    openNum  = EnchantHelper.EnchantOpenGridNum(useritem.ItemLv);
                    if (package != null)
                    {
                        enchantGeneralArray = package.EnchantPackage.FindAll(m => m.UserItemID == useritem.UserItemID).ToArray();
                    }
                }
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(general.GeneralID);
                dsItem.PushIntoStack(general.GeneralName.ToNotNullString());
                dsItem.PushIntoStack((short)general.CareerID);
                dsItem.PushIntoStack(useritem == null ? string.Empty : useritem.UserItemID.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                dsItem.PushIntoStack((short)openNum);
                dsItem.PushIntoStack(enchantGeneralArray.Length);
                foreach (var enchant in enchantGeneralArray)
                {
                    EnchantInfo enchantInfo = new ConfigCacheSet <EnchantInfo>().FindKey(enchant.EnchantID);
                    DataStruct  dsItem1     = new DataStruct();
                    dsItem1.PushIntoStack((short)enchant.Position);
                    dsItem1.PushIntoStack(enchant.UserEnchantID.ToNotNullString());
                    dsItem1.PushIntoStack(enchantInfo == null ? string.Empty : enchantInfo.EnchantName.ToNotNullString());
                    dsItem1.PushIntoStack(enchantInfo == null ? string.Empty : enchantInfo.HeadID.ToNotNullString());
                    dsItem1.PushIntoStack((short)enchant.EnchantLv);
                    dsItem1.PushIntoStack(enchantInfo == null ? (short)0 : (short)enchantInfo.ColorType);
                    dsItem.PushIntoStack(dsItem1);
                }

                PushIntoStack(dsItem);
            }
            this.PushIntoStack(pageCount);
            this.PushIntoStack(enchantPackageArray.Length);
            foreach (var enchant in enchantPackageArray)
            {
                EnchantInfo enchantInfo = new ConfigCacheSet <EnchantInfo>().FindKey(enchant.EnchantID);
                DataStruct  dsItem      = new DataStruct();
                dsItem.PushIntoStack(enchant.UserEnchantID.ToNotNullString());
                dsItem.PushIntoStack(enchantInfo == null ? string.Empty : enchantInfo.EnchantName.ToNotNullString());
                dsItem.PushIntoStack(enchantInfo == null ? string.Empty : enchantInfo.HeadID.ToNotNullString());
                dsItem.PushIntoStack((short)enchant.EnchantLv);
                dsItem.PushIntoStack(enchantInfo == null ? (short)0 : (short)enchantInfo.ColorType);
                PushIntoStack(dsItem);
            }
            this.PushIntoStack(mosaicList.Length);
            foreach (var mosaic in mosaicList)
            {
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack((short)mosaic.Position);
                dsItem.PushIntoStack(mosaic.MosaicColor.ToNotNullString());
                dsItem.PushIntoStack((short)mosaic.DemandLv);

                this.PushIntoStack(dsItem);
            }
        }