Exemplo n.º 1
0
        public override bool TakeAction()
        {
            PlayerFoundryLogic pf = new PlayerFoundryLogic();

            pf.SetUser(m_UserId);

            int[]                      drops    = GameConsts.Foundry.FoundryRewardDropPackageId[m_RequestPacket.Level];
            RandomDropLogic            random   = RandomDropLogic.GetInstance();
            CacheDictionary <int, int> dropDict = new CacheDictionary <int, int>();

            foreach (int dropId in drops)
            {
                DTDrop dataRow = CacheSet.DropTable.GetData(dropId);
                random.GetDropDict(dataRow, dropDict);
            }
            PlayerPackageLogic pp = new PlayerPackageLogic();

            pp.SetUser(m_UserId);
            if (!pp.CheckPackageSlot(dropDict))
            {
                ErrorCode = (int)ErrorType.PackageSlotFull;
                ErrorInfo = "package is full";
                return(false);
            }
            if (!pf.GetReward(m_RequestPacket.Level))
            {
                ErrorCode = (int)ErrorType.RequireNotMet;
                ErrorInfo = "You can not get this reward";
                return(false);
            }
            PBReceivedItems receivedItems;

            pp.GetItems(dropDict, ReceiveItemMethodType.GearFoundry, out receivedItems);
            m_ResponsePacket.ReceivedItems = receivedItems;
            m_ResponsePacket.RewardFlags.AddRange(pf.MyFoundry.CanReceiveRewards);
            return(true);
        }