Exemplo n.º 1
0
        public override bool TakeAction()
        {
            List <string> list = new List <string>();

            if (isall)
            {
                foreach (var m in GetMailBox.MailList)
                {
                    list.Add(m.ID);
                }
            }
            else
            {
                list.Add(mailid);
            }

            for (int i = 0; i < list.Count; ++i)
            {
                MailData mail = GetMailBox.findMail(list[i]);
                if (mail == null)
                {
                    continue;
                }

                UserHelper.RewardsItems(Current.UserId, mail.AppendItem.ToList());
                mail.AppendItem.Clear();
                if (!string.IsNullOrEmpty(mail.ApppendCoinNum))
                {
                    BigInteger bigint = BigInteger.Parse(mail.ApppendCoinNum);
                    if (bigint > 0)
                    {
                        switch (mail.ApppendCoinType)
                        {
                        case CoinType.Gold:
                            UserHelper.RewardsGold(Current.UserId, bigint);
                            break;

                        case CoinType.Diamond:
                            UserHelper.RewardsDiamond(Current.UserId, mail.ApppendCoinNum.ToInt());
                            break;
                            //case CoinType.CombatCoin:
                            //    UserHelper.RewardsDiamond(Current.UserId, mail.ApppendDiamond, UpdateDiamondType.Other);
                            //    break;
                            //case CoinType.GuildCoin:
                            //    UserHelper.RewardsDiamond(Current.UserId, mail.ApppendDiamond, UpdateDiamondType.Other);
                            //    break;
                        }

                        mail.ApppendCoinNum = "0";
                    }
                }
            }

            receipt = true;
            return(true);
        }
Exemplo n.º 2
0
        public override bool TakeAction()
        {
            receipt = GetMailBox.findMail(newid);
            if (receipt == null)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public override bool TakeAction()
        {
            MailData mail = GetMailBox.findMail(mailid);

            if (mail == null)
            {
                return(false);
            }

            if (!mail.IsRead)
            {
                mail.IsRead = true;
            }


            return(true);
        }
Exemplo n.º 4
0
        public override bool TakeAction()
        {
            receipt        = new RequestDeleteMailData();
            receipt.IsAll  = isall;
            receipt.Result = EventStatus.Good;
            if (isall)
            {
                foreach (var m in GetMailBox.MailList)
                {
                    if (string.IsNullOrEmpty(m.ApppendCoinNum))
                    {
                        m.ApppendCoinNum = "0";
                    }
                    BigInteger bigint = BigInteger.Parse(m.ApppendCoinNum);
                    if (bigint != 0 || m.AppendItem.Count > 0)
                    {
                        MailData tm = new MailData()
                        {
                            ID              = m.ID,
                            Title           = m.Title,
                            Sender          = m.Sender,
                            Date            = m.Date,
                            Context         = m.Context,
                            IsRead          = m.IsRead,
                            AppendItem      = m.AppendItem,
                            ApppendCoinType = m.ApppendCoinType,
                            ApppendCoinNum  = m.ApppendCoinNum,
                        };
                        receipt.MailList.Add(tm);
                    }
                }
                if (receipt.MailList.Count > 0)
                {
                    receipt.Result = EventStatus.Bad;
                }

                GetMailBox.MailList = receipt.MailList;
            }
            else
            {
                MailData mail = GetMailBox.findMail(mailid);
                if (mail == null)
                {
                    return(false);
                }
                if (string.IsNullOrEmpty(mail.ApppendCoinNum))
                {
                    mail.ApppendCoinNum = "0";
                }
                BigInteger bigint = BigInteger.Parse(mail.ApppendCoinNum);
                if (bigint != 0 || mail.AppendItem.Count > 0)
                {
                    receipt.Result = EventStatus.Bad;
                }
                else
                {
                    GetMailBox.MailList.Remove(mail);
                }

                receipt.MailList = GetMailBox.MailList;
            }


            return(true);
        }