Ejemplo n.º 1
0
        public bool Judge(GameClient client, string arg, out string failedMsg)
        {
            failedMsg = "";

            bool bOK = false;

            if (client != null && !string.IsNullOrEmpty(arg))
            {
                GoodsData usingHuFu = client.UsingEquipMgr.GetGoodsDataByCategoriy(client, (int)ItemCategories.HuFu);
                if (usingHuFu != null)
                {
                    int iNeedSuit = -1;
                    if (int.TryParse(arg, out iNeedSuit) && Global.GetEquipGoodsSuitID(usingHuFu.GoodsID) >= iNeedSuit)
                    {
                        bOK = true;
                    }
                }
            }

            if (!bOK)
            {
                failedMsg = string.Format(Global.GetLang(CondMultiLang.Wrapper),
                                          string.Format(Global.GetLang(CondMultiLang.HuShenFu), arg));
            }

            return(bOK);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 将物品字符串列表解析成物品数据列表
        /// </summary>
        /// <param name="goodsStr"></param>
        /// <returns></returns>
        private static List <GoodsData> ParseGoodsDataList(string goodsIDs)
        {
            List <GoodsData> goodsDataList = new List <GoodsData>();

            if (string.IsNullOrEmpty(goodsIDs))
            {
                return(goodsDataList);
            }

            // 物品参数改造 [5/11/2014 LiaoWei]
            string[] fields = goodsIDs.Split('|');
            for (int i = 0; i < fields.Length; i++)
            {
                string[] sa = fields[i].Split(',');
                if (sa.Length != 7)
                {
                    continue;
                }

                int[] goodsFields = Global.StringArray2IntArray(sa);

                //获取物品数据
                GoodsData goodsData = Global.GetNewGoodsData(goodsFields[0], goodsFields[1], 0, goodsFields[3], goodsFields[2], 0, goodsFields[5], 0, goodsFields[6], goodsFields[4], 0);
                goodsDataList.Add(goodsData);
            }

            return(goodsDataList);
        }
Ejemplo n.º 3
0
        public void ReloadGiveAwardsGoodsDataList(SystemXmlItem systemBattle = null)
        {
            if (null == systemBattle)
            {
                if (!GameManager.SystemArenaBattle.SystemXmlItemDict.TryGetValue(1, out systemBattle))
                {
                    return;
                }
            }
            List <GoodsData> goodsDataList = new List <GoodsData>();
            string           giveGoodsIDs  = systemBattle.GetStringValue("GiveGoodsIDs").Trim();

            string[] fields = giveGoodsIDs.Split(new char[]
            {
                ','
            });
            if (fields != null && fields.Length > 0)
            {
                for (int i = 0; i < fields.Length; i++)
                {
                    if (!string.IsNullOrEmpty(fields[i].Trim()))
                    {
                        int           goodsID     = Convert.ToInt32(fields[i].Trim());
                        SystemXmlItem systemGoods = null;
                        if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsID, out systemGoods))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("PK之王配置文件中,配置的固定物品奖励中的物品不存在, GoodsID={0}", goodsID), null, true);
                        }
                        else
                        {
                            GoodsData goodsData = new GoodsData
                            {
                                Id                    = -1,
                                GoodsID               = goodsID,
                                Using                 = 0,
                                Forge_level           = 0,
                                Starttime             = "1900-01-01 12:00:00",
                                Endtime               = "1900-01-01 12:00:00",
                                Site                  = 0,
                                Quality               = 0,
                                Props                 = "",
                                GCount                = 1,
                                Binding               = 0,
                                Jewellist             = "",
                                BagIndex              = 0,
                                AddPropIndex          = 0,
                                BornIndex             = 0,
                                Lucky                 = 0,
                                Strong                = 0,
                                ExcellenceInfo        = 0,
                                AppendPropLev         = 0,
                                ChangeLifeLevForEquip = 0
                            };
                            goodsDataList.Add(goodsData);
                        }
                    }
                }
            }
            this.GiveAwardsGoodsDataList = goodsDataList;
        }
Ejemplo n.º 4
0
    public void SetUIGoods(GoodsData goodsData, int goodsId, int runeId, int salesId, bool isSoldOut)
    {
        var runeDataSheet = DataBase.Instance.runeDataSheet;

        if (runeDataSheet.TryGetRuneData(runeId, out var runeData))
        {
            runeOnSalesId = salesId;
            SetLocked();

            if (!isLocked)
            {
                SetGoodsName(runeData.Name);
                SetGoodsImage(runeData.Image);
                SetGoodsGrade(runeData.Grade);
                SetGoodsPrice(goodsData.PurchasePrice, runeData.Grade);
                SetPurchaseCurrencyImage(goodsData.PurchaseCurrency);

                if (isSoldOut)
                {
                    SetIsSoldOut();
                }
                else
                {
                    SoldOut.SetActive(false);
                    showAskPurchaseButton.onClick.RemoveAllListeners();
                    showAskPurchaseButton.onClick.AddListener(() =>
                    {
                        var uiAskPurchaseForRuneGoods = MainManager.instance.backCanvas.uiMainMenu.uiStore.uiAskPurchaseForRuneGoods;
                        uiAskPurchaseForRuneGoods.SetUIAskPurchase(goodsData, goodsId, runeData, runeOnSalesId);
                        UIManager.Instance.ShowNew(uiAskPurchaseForRuneGoods);
                    });
                }
            }
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 关闭
    /// </summary>
    public void Close()
    {
        _currData = null;
        if (transform == null)
        {
            return;
        }
        if (_iconImage != null)
        {
            _iconImage.sprite = null;
        }
        if (_gradeText != null)
        {
            _gradeText.text = "";
        }

        if (_numberText != null)
        {
            _numberText.text = "";
        }

        if (_desText != null)
        {
            _desText.text = "";
        }
        if (gameObject != null)
        {
            gameObject.SetActive(false);
        }
        WarehouseController.Instance.RefreshData();
    }
Ejemplo n.º 6
0
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client, int id)
        {
            JieriVIPYouHuiActivityConfig configData = null;
            bool result;

            if (!this.VIPYouHuiCofigDict.TryGetValue(id, out configData))
            {
                result = false;
            }
            else
            {
                int nOccu = Global.CalcOriginalOccupationID(client);
                List <GoodsData> lData = new List <GoodsData>();
                foreach (GoodsData item in configData.GoodsDataListOne)
                {
                    lData.Add(item);
                }
                int count = configData.GoodsDataListTwo.Count;
                for (int i = 0; i < count; i++)
                {
                    GoodsData data = configData.GoodsDataListTwo[i];
                    if (Global.IsCanGiveRewardByOccupation(client, data.GoodsID))
                    {
                        lData.Add(data);
                    }
                }
                AwardItem tmpAwardItem = configData.GoodsDataListThr.ToAwardItem();
                foreach (GoodsData item in tmpAwardItem.GoodsDataList)
                {
                    lData.Add(item);
                }
                result = Global.CanAddGoodsDataList(client, lData);
            }
            return(result);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 攻击某人时减少装备耐久度
        /// </summary>
        /// <param name="client"></param>
        public void AttackSomebody(GameClient client)
        {
            // 耐久改造 [4/14/2014 LiaoWei]

            /*if (null == WeaponEquip)
             * {
             *  return;
             * }
             *
             * GoodsData goodsData = WeaponEquip;*/

            if (WeaponEquipList.Count <= 0)
            {
                return;
            }

            GoodsData goodsData = null;

            lock (WeaponEquipList)
            {
                goodsData = WeaponEquipList[Global.GetRandomNumber(0, WeaponEquipList.Count)];
            }

            //减少指定装备的耐久度(反向的, 增加后,最大值减去这个值,就是减少)
            GameManager.ClientMgr.AddEquipStrong(client, goodsData, 1);
        }
Ejemplo n.º 8
0
    /// <summary>
    /// 获取当前仓库总价
    /// </summary>
    /// <returns></returns>
    public static string GetCurrWareHouseTotalPrices(List <GoodsData> currGoodsDatas)
    {
        string str = "";

        long totalPrices = 0;

        for (int i = 0; i < currGoodsDatas.Count; i++)
        {
            GoodsData data = currGoodsDatas[i];
            if (!data._isLock && data._data.PriceSell != null && data._data.PriceSell.Count != 0)
            {
                int prices = 0;

                for (int e = 0; e < data._data.PriceSell.Count; e++)
                {
                    if (data._data.PriceSell[e].IdGameItem == StaticData.configExcel.GetVertical().GoldGoodsId)
                    {
                        prices = data._data.PriceSell[0].Price;
                    }
                }
                totalPrices = totalPrices + (prices * data._number);
            }
        }
        str = str + totalPrices.ToString();

        return(str);
    }
Ejemplo n.º 9
0
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client, int nOcc)
        {
            bool result;

            if (this.AwardDict.GoodsDataList.Count <= 0 && this.AwardDict2.GoodsDataList.Count <= 0)
            {
                result = true;
            }
            else if (Global.CanAddGoodsDataList(client, this.AwardDict.GoodsDataList))
            {
                int nOccu = Global.CalcOriginalOccupationID(client);
                List <GoodsData> lData = new List <GoodsData>();
                foreach (GoodsData item in this.AwardDict.GoodsDataList)
                {
                    lData.Add(item);
                }
                int count = this.AwardDict2.GoodsDataList.Count;
                for (int i = 0; i < count; i++)
                {
                    GoodsData data = this.AwardDict2.GoodsDataList[i];
                    if (Global.IsRoleOccupationMatchGoods(nOccu, data.GoodsID))
                    {
                        lData.Add(this.AwardDict2.GoodsDataList[i]);
                    }
                }
                result = Global.CanAddGoodsDataList(client, lData);
            }
            else
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 10
0
 public static void InitForTestMode(GameClient client)
 {
     if (GameManager.TestGamePerformanceMode && (GameManager.TestGamePerformanceForAllUser || client.strUserID == null || client.strUserID.StartsWith("mu")))
     {
         if (GameManager.TestGamePerformanceAllPK)
         {
             client.ClientData.PKMode = 1;
         }
         if (client.ClientData.LoginNum <= 0)
         {
             int              occu           = Global.CalcOriginalOccupationID(client);
             int[]            nArray         = GameManager.TestRoleEquipsArrays[occu];
             List <GoodsData> usingGoodsList = Global.GetUsingGoodsList(client.ClientData);
             if (usingGoodsList == null || usingGoodsList.Count == 0)
             {
                 client.ClientData.Level           = 95;
                 client.ClientData.ChangeLifeCount = 7;
                 for (int i = 0; i < nArray.Length; i++)
                 {
                     GoodsData goodsData = new GoodsData
                     {
                         Id                    = -1,
                         GoodsID               = nArray[i],
                         Using                 = 0,
                         Forge_level           = 10,
                         Starttime             = "1900-01-01 12:00:00",
                         Endtime               = "1900-01-01 12:00:00",
                         Site                  = 0,
                         Quality               = 0,
                         Props                 = "",
                         GCount                = 1,
                         Binding               = 1,
                         Jewellist             = "",
                         BagIndex              = i,
                         AddPropIndex          = 0,
                         BornIndex             = 0,
                         Lucky                 = 1,
                         Strong                = 0,
                         ExcellenceInfo        = 63,
                         AppendPropLev         = 40,
                         ChangeLifeLevForEquip = 0
                     };
                     int      nDBid  = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, GLang.GetLang(515, new object[0]), false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true);
                     string   format = "{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}";
                     object[] array  = new object[9];
                     array[0] = client.ClientData.RoleID;
                     array[1] = 1;
                     array[2] = nDBid;
                     array[3] = goodsData.GoodsID;
                     array[4] = 1;
                     array[5] = 0;
                     array[6] = 1;
                     array[7] = goodsData.BagIndex;
                     string strCmd = string.Format(format, array);
                     Global.ModifyGoodsByCmdParams(client, strCmd, "客户端修改", null);
                 }
             }
         }
     }
 }
Ejemplo n.º 11
0
        public void CopyPropsTo(GoodsData gd)
        {
            lock (this.ChangedIndexes)
            {
                foreach (UpdatePropIndexes idx in this.ChangedIndexes)
                {
                    UpdatePropIndexes updatePropIndexes = idx;
                    if (updatePropIndexes != UpdatePropIndexes.binding)
                    {
                        switch (updatePropIndexes)
                        {
                        case UpdatePropIndexes.WashProps:
                            gd.WashProps = this.WashProps;
                            break;

                        case UpdatePropIndexes.ElementhrtsProps:
                            gd.ElementhrtsProps = this.ElementhrtsProps;
                            break;
                        }
                    }
                    else
                    {
                        gd.Binding = this.Binding;
                    }
                }
            }
        }
Ejemplo n.º 12
0
    /// <summary>
    /// 消耗掉一个对应宝箱
    /// </summary>
    /// <param name="id"></param>
    public void ConsumeTreasureChest(int id)
    {
        GoodsData goodsData = new GoodsData();
        int       key       = 0;
        int       index     = 0;

        foreach (var item in _treasureChestDic)
        {
            for (int i = 0; i < item.Value.Count; i++)
            {
                if (item.Value[i]._id == id)
                {
                    key       = item.Key;
                    index     = i;
                    goodsData = item.Value[i];
                }
            }
        }
        if (goodsData != null)
        {
            goodsData._number = goodsData._number - 1;
            StaticData.UpdateWareHouseItems(goodsData._id, (int)goodsData._number);
            if (goodsData._number <= 0)
            {
                _treasureChestDic[key].RemoveAt(index);
                StaticData.UpdateWareHouseItems(goodsData._id, 0);
            }
            WarehouseTool.ChangeUnlockTreasureChestID(goodsData._id, 0);
        }
    }
Ejemplo n.º 13
0
    /// <summary>
    /// 获取可以卖出的商品
    /// </summary>
    /// <returns></returns>
    public List <GoodsData> GetYouCanSell()
    {
        //筛选出没有锁定的数据
        List <GoodsData> sales = new List <GoodsData>();

        for (int i = 0; i < _currGoodsDatas.Count; i++)
        {
            //没有锁定才能卖
            if (!_currGoodsDatas[i]._isLock && WarehouseTool.IsGoodsSell(_currGoodsDatas[i]))
            {
                sales.Add(_currGoodsDatas[i]);
            }
        }
        //获取锁定信息有变化的数据
        List <GoodsData> lockDatas = new List <GoodsData>();

        for (int i = 0; i < _currGoodsDatas.Count; i++)
        {
            GoodsData data = _currGoodsDatas[i];
            //判断是否是有效数据
            if (_totaDataDic.ContainsKey(data._id))
            {
                //判断锁定信息是否有变化
                if (_totaDataDic[data._id]._isLock != data._isLock)
                {
                    lockDatas.Add(data);
                }
            }
        }

        return(sales);
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 数据排序
    /// </summary>
    /// <param name="goodsDatas"></param>
    public static void DataSort(List <GoodsData> goodsDatas, Action <List <GoodsData>, Dictionary <int, GoodsData> > AcceptCurrTotalDataAction)
    {
        List <GoodsData> datas = new List <GoodsData>();

        datas = goodsDatas;
        for (int i = 0; i < datas.Count; i++)
        {
            GoodsData data  = datas[i];
            int       index = i;

            //找出权值最大的物品
            for (int j = i + 1; j < datas.Count; j++)
            {
                //比较权值
                if (datas[i]._rarityValue < datas[j]._rarityValue)
                {
                    index = j;
                }
            }
            //交换
            if (index != i)
            {
                GoodsData ephemeral = datas[i];
                datas[i]     = datas[index];
                datas[index] = ephemeral;
            }
        }
        //分辨新物品
        GetDistinguishDatas(datas, AcceptCurrTotalDataAction);
    }
        /// <summary>
        /// 获取物品通关的物品奖励
        /// </summary>
        /// <param name="client"></param>
        public static void AddRewardToClient(GameClient client, List <GoodsData> goodNormal, int nExp, int nMoney, int nXinHun, string strTitle)
        {
            if (null != goodNormal)
            {
                // 如果背包格子不够 就发邮件-附件带物品给玩家
                if (!Global.CanAddGoodsNum(client, goodNormal.Count))
                {
                    Global.UseMailGivePlayerAward2(client, goodNormal, strTitle, strTitle);
                }
                else
                {
                    foreach (var item in goodNormal)
                    {
                        GoodsData goodsData = new GoodsData(item);

                        //向DBServer请求加入某个新的物品到背包中
                        //添加物品
                        goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality,
                                                                     goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, strTitle,
                                                                     true, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true);    // 卓越信息 [12/13/2013 LiaoWei]
                    }
                }
            }

            GameManager.ClientMgr.ModifyStarSoulValue(client, nXinHun, strTitle, true, true);
            GameManager.ClientMgr.ProcessRoleExperience(client, nExp, true, true);
            GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nMoney, "万魔塔", false);
        }
Ejemplo n.º 16
0
    /// <summary>
    /// 删除对应商品id的物品
    /// </summary>
    /// <param name="ids"></param>
    void RemoveData(int type, int id)
    {
        GoodsData tageData = null;

        for (int i = 0; i < _currGoodsDatas.Count; i++)
        {
            if (_currGoodsDatas[i]._id == id)
            {
                tageData         = _currGoodsDatas[i];
                tageData._number = 0;
            }
        }
        if (tageData != null)
        {
            _currGoodsDatas.Remove(tageData);
            switch (type)
            {
            case 0:
                _seeds.Remove(tageData);
                break;

            case 1:
                _fruits.Remove(tageData);
                break;

            case 2:
                _gameItems.Remove(tageData);
                break;

            case 3:
                _decorates.Remove(tageData);
                break;
            }
        }
    }
Ejemplo n.º 17
0
    /// <summary>
    /// 卖出
    /// </summary>
    public static void OnSale(GoodsData goodsData, int number, Action <bool> saleAction)
    {
        //创建上传数据
        CSGoodSellData goodSellData = new CSGoodSellData();
        CSGoodStruct   cSGoodStruct = new CSGoodStruct();

        //获取当前点击数据
        cSGoodStruct.GoodId  = goodsData._id;
        cSGoodStruct.GoodNum = number;
        goodSellData.GoodSellInfo.Add(cSGoodStruct);

        ProtocalManager.Instance().SendCSGoodSellData(goodSellData, (SCGoodSellData data) =>
        {
            //更新玩家的金币和钻石数据
            for (int i = 0; i < data.GoodSellInfo.Count; i++)
            {
                int id = data.GoodSellInfo[i].GoodId;
                StaticData.UpdateWareHouseItems(id, data.GoodSellInfo[i].GoodNum);
                Debug.Log("刷新金币:" + id + "   Number:" + data.GoodSellInfo[i].GoodNum);
            }
            saleAction(true);
            //修改本地数据
            StaticData.UpdateWareHouseItem(goodsData._id, -number);
            Debug.Log("卖出物品成功ID:" + goodsData._id + "   Number:" + number);
        }, (ErrorInfo er) =>
        {
            saleAction(false);
            Debug.Log("卖出物品失败ID:" + goodsData._id + "   Number:" + number + "  ErrorMessage:" + er.ErrorMessage);
        });
    }
Ejemplo n.º 18
0
 /// <summary>
 /// 关闭
 /// </summary>
 private void Close()
 {
     _data             = null;
     _iconImage.sprite = null;
     _uISetAmountComponent._minValue = 0;
     gameObject.SetActive(false);
 }
Ejemplo n.º 19
0
        /// <summary>
        /// 将物品字符串列表解析成物品数据列表
        /// </summary>
        /// <param name="goodsStr"></param>
        /// <returns></returns>
        private static List <GoodsData> ParseGoodsDataList(string[] fields)
        {
            List <GoodsData> goodsDataList = new List <GoodsData>();

            for (int i = 0; i < fields.Length; i++)
            {
                string[] sa = fields[i].Split(',');
                if (fields[i] == "1" || fields[i] == "")
                {
                    continue;
                }
                else if (sa.Length != 7)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("解析FuBenMap.xml文件中的奖励项时失败, 物品配置项个数错误"));
                    continue;
                }

                int[] goodsFields = Global.StringArray2IntArray(sa);

                //获取物品数据            // 物品通用奖励改造 [1/8/2014 LiaoWei]
                GoodsData goodsData = Global.GetNewGoodsData(goodsFields[0], goodsFields[1], 0, goodsFields[3], goodsFields[2], 0, goodsFields[5], 0, goodsFields[6], goodsFields[4]);
                goodsDataList.Add(goodsData);
            }

            return(goodsDataList);
        }
Ejemplo n.º 20
0
        private static List <GoodsData> ParseGoodsDataList(string[] fields)
        {
            List <GoodsData> goodsDataList = new List <GoodsData>();

            for (int i = 0; i < fields.Length; i++)
            {
                string[] sa = fields[i].Split(new char[]
                {
                    ','
                });
                if (!(fields[i] == "1") && !(fields[i] == ""))
                {
                    if (sa.Length != 7)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("解析FuBenMap.xml文件中的奖励项时失败, 物品配置项个数错误", new object[0]), null, true);
                    }
                    else
                    {
                        int[]     goodsFields = Global.StringArray2IntArray(sa);
                        GoodsData goodsData   = Global.GetNewGoodsData(goodsFields[0], goodsFields[1], 0, goodsFields[3], goodsFields[2], 0, goodsFields[5], 0, goodsFields[6], goodsFields[4], 0);
                        goodsDataList.Add(goodsData);
                    }
                }
            }
            return(goodsDataList);
        }
Ejemplo n.º 21
0
    public override void SetData(object data)
    {
        goodsData = data as GoodsData;
        if (goodsData.type != "money" && goodsData.type != "energy")
        {
            //countText.fontSize = 25;
            countText.text = "+" + goodsData.name;
        }
        else
        {
            //countText.fontSize = 25;
            countText.text = "+" + GameUtils.GetCurrencyString(goodsData.quantity);
        }
        //priceText.text = "¥" + ((float)goodsData.price / 100).ToString();
        Product product = GameMainManager.instance.iap.GetProductWithID(goodsData.GetPurchaseID());

        if (product != null)
        {
            priceText.text = product.metadata.localizedPriceString;
            int index = Mathf.Min(sprites.Length - 1, Mathf.Max(0, int.Parse(goodsData.goodsId) % 10 - 1));
            image.sprite = sprites[index];
        }
        else
        {
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 22
0
        protected bool GiveAwardByOccupation(GameClient client, AwardItem myAwardItem, int occupation)
        {
            bool result;

            if (client == null || null == myAwardItem)
            {
                result = false;
            }
            else
            {
                if (myAwardItem.GoodsDataList != null && myAwardItem.GoodsDataList.Count > 0)
                {
                    int count = myAwardItem.GoodsDataList.Count;
                    for (int i = 0; i < count; i++)
                    {
                        GoodsData data = myAwardItem.GoodsDataList[i];
                        if (Global.IsCanGiveRewardByOccupation(client, data.GoodsID))
                        {
                            Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, data.GoodsID, data.GCount, data.Quality, "", data.Forge_level, data.Binding, 0, "", true, 1, Activity.GetActivityChineseName((ActivityTypes)this.ActivityType), "1900-01-01 12:00:00", data.AddPropIndex, data.BornIndex, data.Lucky, data.Strong, data.ExcellenceInfo, data.AppendPropLev, data.ChangeLifeLevForEquip, null, null, 0, true);
                        }
                    }
                }
                if (myAwardItem.AwardYuanBao > 0)
                {
                    GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType), ActivityTypes.None, "");
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(386, new object[0]), new object[]
                    {
                        myAwardItem.AwardYuanBao
                    }), GameInfoTypeIndexes.Normal, ShowGameInfoTypes.OnlyErr, 0);
                    GameManager.DBCmdMgr.AddDBCmd(10113, string.Format("{0}:{1}:{2}", client.ClientData.RoleID, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType)), null, client.ServerId);
                }
                result = true;
            }
            return(result);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Trades the goods.
        /// </summary>
        /// <returns><c>true</c>, if goods was traded, <c>false</c> otherwise.</returns>
        /// <param name="user">User.</param>
        /// <param name="goods">Goods.</param>
        /// <param name="goodsNum">Goods number.</param>
        /// <param name="errorCode">Error code.</param>
        public bool TradeGoods(BaseUser user, GoodsData goods, int goodsNum, out TradeErrorCode errorCode)
        {
            bool result = false;

            if (_tradeStrategy.TryEnterTraded(goods))
            {
                try
                {
                    double payAmount;
                    if (HasTraded(user, goods, goodsNum, out payAmount, out errorCode))
                    {
                        var items = ProduceGoods(goods, goodsNum);
                        if (SendGoods(user, items) && PayAmount(user, goods.TradeType, payAmount))
                        {
                            TradeSuccess(user, goods, goodsNum, payAmount, items);
                            errorCode = TradeErrorCode.Sucess;
                            result    = true;
                        }
                        else
                        {
                            errorCode = TradeErrorCode.Fail;
                        }
                    }
                }
                finally
                {
                    _tradeStrategy.ExitTraded();
                }
            }
            else
            {
                errorCode = TradeErrorCode.TradeTimeout;
            }
            return(result);
        }
Ejemplo n.º 24
0
        private static List <GoodsData> ParseGoodsDataList(string goodsIDs)
        {
            List <GoodsData> goodsDataList = new List <GoodsData>();
            List <GoodsData> result;

            if (string.IsNullOrEmpty(goodsIDs))
            {
                result = goodsDataList;
            }
            else
            {
                string[] fields = goodsIDs.Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < fields.Length; i++)
                {
                    string[] sa = fields[i].Split(new char[]
                    {
                        ','
                    });
                    if (sa.Length == 7)
                    {
                        int[]     goodsFields = Global.StringArray2IntArray(sa);
                        GoodsData goodsData   = Global.GetNewGoodsData(goodsFields[0], goodsFields[1], 0, goodsFields[3], goodsFields[2], 0, goodsFields[5], 0, goodsFields[6], goodsFields[4], 0);
                        goodsDataList.Add(goodsData);
                    }
                }
                result = goodsDataList;
            }
            return(result);
        }
Ejemplo n.º 25
0
        public static GoodsData AddDamonGoodsData(GameClient client, int id, int goodsID, int forgeLevel, int quality, int goodsNum, int binding, int site, string jewelList, string endTime, int addPropIndex, int bornIndex, int lucky, int strong, int ExcellenceProperty, int nAppendPropLev, int nEquipChangeLife)
        {
            GoodsData gd = new GoodsData
            {
                Id                    = id,
                GoodsID               = goodsID,
                Using                 = 0,
                Forge_level           = forgeLevel,
                Starttime             = "1900-01-01 12:00:00",
                Endtime               = endTime,
                Site                  = site,
                Quality               = quality,
                Props                 = "",
                GCount                = goodsNum,
                Binding               = binding,
                Jewellist             = jewelList,
                BagIndex              = 0,
                AddPropIndex          = addPropIndex,
                BornIndex             = bornIndex,
                Lucky                 = lucky,
                Strong                = strong,
                ExcellenceInfo        = ExcellenceProperty,
                AppendPropLev         = nAppendPropLev,
                ChangeLifeLevForEquip = nEquipChangeLife
            };

            DamonMgr.AddDamonGoodsData(client, gd, true);
            return(gd);
        }
Ejemplo n.º 26
0
        public static long DelGoodsReturnLingJing(GoodsData goodsData)
        {
            long sum = 0L;
            List <PetSkillInfo>        petSkillList = PetSkillManager.GetPetSkillInfo(goodsData);
            IEnumerable <PetSkillInfo> temp         = from info in petSkillList
                                                      where info.PitIsOpen && info.Level > 0
                                                      select info;
            long result;

            if (!temp.Any <PetSkillInfo>())
            {
                result = sum;
            }
            else
            {
                using (IEnumerator <PetSkillInfo> enumerator = temp.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        PetSkillInfo info = enumerator.Current;
                        sum += (from levelInfo in PetSkillManager._psLevelUpDic
                                where levelInfo.Key <= info.Level
                                select levelInfo.Value).Sum();
                    }
                }
                result = sum;
            }
            return(result);
        }
Ejemplo n.º 27
0
 public static void DoEquipRestoreBlood(GameClient client, int categoriy)
 {
     if (client.ClientData.CurrentLifeV <= 0)
     {
         GoodsData goodData = client.UsingEquipMgr.GetGoodsDataByCategoriy(client, categoriy);
         if (null != goodData)
         {
             List <MagicActionItem> magicActionItemList = UsingGoods.GetMagicActionListByGoodsID(goodData.GoodsID);
             if (magicActionItemList != null && magicActionItemList.Count > 0)
             {
                 MagicActionItem item = magicActionItemList[0];
                 if (MagicActionIDs.EXT_RESTORE_BLOOD == item.MagicActionID)
                 {
                     double cooldown = item.MagicActionParams[0];
                     if (cooldown * 1000.0 + (double)client.ClientData.SpecialEquipLastUseTicks < (double)TimeUtil.NOW())
                     {
                         client.ClientData.CurrentLifeV             = client.ClientData.LifeV;
                         client.ClientData.SpecialEquipLastUseTicks = TimeUtil.NOW();
                         GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, GLang.GetLang(531, new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        /// 把Tuple信息转化为GoodsData
        /// </summary>
        /// <param name="detail"></param>
        /// <returns></returns>
        private GoodsData _ParseGoodsFromDetail(Tuple <int, int, int, int, int, int, int> detail)
        {
            GoodsData goods = new GoodsData()
            {
                Id                    = -1,
                GoodsID               = detail.Item1,
                Using                 = 0,
                Forge_level           = detail.Item4,
                Starttime             = "1900-01-01 12:00:00",
                Endtime               = Global.ConstGoodsEndTime,
                Site                  = 0,
                Quality               = 0,
                Props                 = "",
                GCount                = detail.Item2,
                Binding               = detail.Item3,
                Jewellist             = "",
                BagIndex              = 0,
                AddPropIndex          = 0,
                BornIndex             = 0,
                Lucky                 = detail.Item6,
                Strong                = 0,
                ExcellenceInfo        = detail.Item7,
                AppendPropLev         = detail.Item5,
                ChangeLifeLevForEquip = 0,
            };

            return(goods);
        }
Ejemplo n.º 29
0
        public void RebornRightAnelIndex(ref int index, int Categoriy)
        {
            List <GoodsData> listGood = null;
            GoodsData        Good     = null;
            int Count = 0;

            lock (this.EquipDict)
            {
                if (this.EquipDict.TryGetValue(Categoriy, out listGood))
                {
                    Count += listGood.Count;
                    if (Count >= 2)
                    {
                        return;
                    }
                    if (Count == 1 && listGood.Count > 0)
                    {
                        Good = listGood[0];
                    }
                }
            }
            if (Count == 1 && Good != null)
            {
                if (Good.BagIndex == index && Good.BagIndex == 1)
                {
                    index = 0;
                }
                else if (Good.BagIndex == index && Good.BagIndex == 0)
                {
                    index = 1;
                }
            }
        }
Ejemplo n.º 30
0
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client)
        {
            bool result;

            if (null == this.OneDollarChongZhiData)
            {
                result = false;
            }
            else
            {
                int nOccu = Global.CalcOriginalOccupationID(client);
                List <GoodsData> lData = new List <GoodsData>();
                foreach (GoodsData item in this.OneDollarChongZhiData.GoodsDataListOne)
                {
                    lData.Add(item);
                }
                int count = this.OneDollarChongZhiData.GoodsDataListTwo.Count;
                for (int i = 0; i < count; i++)
                {
                    GoodsData data = this.OneDollarChongZhiData.GoodsDataListTwo[i];
                    if (Global.IsCanGiveRewardByOccupation(client, data.GoodsID))
                    {
                        lData.Add(data);
                    }
                }
                result = Global.CanAddGoodsDataList(client, lData);
            }
            return(result);
        }
Ejemplo n.º 31
0
 public void AddSellGoodsData(GoodsData data)
 {
     this.sellList.Add(data);
 }
Ejemplo n.º 32
0
 public void AddBuyGoodsData(GoodsData data)
 {
     this.buyList.Add(data);
 }
Ejemplo n.º 33
0
            public object Clone()
            {
                GoodsData data = new GoodsData(Price, OrderAmount);

                return data;
            }