示例#1
0
        public override void BuildPacket()
        {
            var cacheSetItem = new ConfigCacheSet <ItemBaseInfo>();

            PushIntoStack(_cityInfoList.Count);
            foreach (var city in _cityInfoList)
            {
                List <PlotInfo> plotList = _cacheSetPlot.FindAll(s => s.CityID == city.CityID && s.PlotType == plotType);

                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(plotList.Count);
                foreach (PlotInfo item in plotList)
                {
                    UserPlotInfo userPlot   = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, item.PlotID);
                    int          isKill     = PlotHelper.IsKill(ContextUser.UserID, item.PlotID, cityID) ? 1 : 0;
                    DataStruct   dsItemPlot = new DataStruct();
                    dsItemPlot.PushIntoStack(item.PlotID);
                    dsItemPlot.PushIntoStack(item.PlotSeqNo.ToShort());
                    dsItemPlot.PushIntoStack(item.PlotName.ToNotNullString());
                    dsItemPlot.PushIntoStack(item.BossHeadID.ToNotNullString());
                    dsItemPlot.PushIntoStack(GetPlotStatus(userPlot, plotType));
                    dsItemPlot.PushIntoStack(userPlot == null ? 1 : (int)userPlot.StarScore);
                    dsItemPlot.PushIntoStack(isKill);
                    dsItemPlot.PushIntoStack(item.HonourNum);
                    dsItemPlot.PushIntoStack(item.GameCoin);
                    dsItemPlot.PushIntoStack(item.PlotDesc);
                    dsItemPlot.PushIntoStack(item.PlotLv);
                    dsItemPlot.PushIntoStack(ConfigEnvSet.GetInt("Plot.BattleEnergyNum"));
                    dsItemPlot.PushIntoStack(PlotHelper.GetPlotChallengeNum(UserId.ToString(), item.PlotID));
                    dsItemPlot.PushIntoStack(item.ChallengeNum);
                    dsItemPlot.PushIntoStack(userPlot == null ? 0 : userPlot.PlotNum);
                    dsItem.PushIntoStack(dsItemPlot);
                    var itemArray = item.ItemRank.Split(',');
                    dsItemPlot.PushIntoStack(itemArray.Length);
                    foreach (var s in itemArray)
                    {
                        var        sArray     = s.Split('=');
                        var        itemInfo   = cacheSetItem.FindKey(sArray.Length > 0 ? sArray[0].ToInt() : 0);
                        DataStruct dsItemInfo = new DataStruct();
                        dsItemInfo.PushIntoStack(itemInfo != null ? itemInfo.ItemName : string.Empty);
                        dsItemInfo.PushIntoStack(sArray.Length > 1 ? sArray[1].ToInt() : 0);
                        dsItemPlot.PushIntoStack(dsItemInfo);
                    }
                }

                dsItem.PushIntoStack(city.CityID);
                dsItem.PushIntoStack(city.CityName.ToNotNullString());

                PushIntoStack(dsItem);
            }
            PushIntoStack(resetNum);
            PushIntoStack(_backpackType);
        }