예제 #1
0
        public override bool TakeAction()
        {
            UserBasisCache dest = UserHelper.FindUserBasis(Uid);

            if (dest == null)
            {
                return(true);
            }
            FriendApplyData apply = GetFriends.FindFriendApply(Uid);

            if (apply == null)
            {
                return(true);
            }

            receipt            = new JPFriendApplyData();
            receipt.UserId     = Uid;
            receipt.NickName   = dest.NickName;
            receipt.Profession = dest.Profession;
            receipt.AvatarUrl  = dest.AvatarUrl;
            receipt.UserLv     = dest.UserLv;
            //receipt.FightValue = dest.FightingValue;
            receipt.VipLv     = dest.VipLv;
            receipt.ApplyTime = apply.ApplyDate;

            GameSession fsession = GameSession.Get(dest.UserID);

            receipt.IsOnline = fsession != null && fsession.Connected;
            return(true);
        }
예제 #2
0
        public override bool TakeAction()
        {
            if (GetBasis.BackLevelNum > 0)
            {
                int levelDown = GetBasis.BackLevelNum;
                GetBasis.UserLv = Math.Max(GetBasis.UserLv - levelDown, 10);
                UserHelper.UserLvChange(Current.UserId);
                GetBasis.BackLevelNum = 0;
            }


            receipt = new JPUserDetailsData()
            {
                UserId                   = Current.UserId,
                NickName                 = GetBasis.NickName,
                Profession               = GetBasis.Profession,
                UserLv                   = GetBasis.UserLv,
                Diamond                  = GetBasis.DiamondNum,
                BuyDiamond               = GetBasis.BuyDiamond,
                UsedDiamond              = GetBasis.UsedDiamond,
                VipLv                    = GetBasis.VipLv,
                AvatarUrl                = GetBasis.AvatarUrl,
                Gold                     = GetBasis.Gold,
                CombatRankID             = GetBasis.CombatRankID,
                LevelRankID              = GetBasis.LevelRankID,
                LotteryTimes             = GetLottery.LotteryTimes,
                SignStartID              = DataHelper.SignStartID,
                ShareCount               = GetBasis.ShareCount,
                ShareDate                = GetBasis.ShareDate,
                InviteCount              = GetBasis.InviteCount,
                ReceiveInviteList        = GetBasis.ReceiveInviteList.ToList(),
                ReceiveLevelAwardList    = GetBasis.ReceiveLevelAwardList.ToList(),
                ReceiveRankingAwardList  = GetBasis.ReceiveRankingAwardList.ToList(),
                LastMatchFightFailedDate = Util.ConvertDateTimeStamp(GetCombat.LastMatchFightFailedDate),
                ComboNum                 = GetBasis.ComboNum,
                OpenServiceDateSec       = Util.ConvertDateTimeStamp(DataHelper.OpenServiceDate)
            };
            receipt.Attribute   = GetAttribute;
            receipt.Equips      = GetEquips;
            receipt.Package     = GetPackage;
            receipt.Soul        = GetSoul;
            receipt.Skill       = GetSkill;
            receipt.Task        = GetTask;
            receipt.Achievement = GetAchievement;
            receipt.Guild       = GetGuild;
            receipt.MailBox     = GetMailBox;
            receipt.EventAward  = GetEventAward;
            UserHelper.FundCfgCheck(Current.UserId);
            receipt.Pay     = GetPay;
            receipt.Combat  = GetCombat;
            receipt.Lottery = GetLottery;
            receipt.VitData.RemainTimeSec = GetBasis.RestoreVitRemainTimeSec();
            receipt.VitData.Vit           = GetBasis.Vit;

            UserHelper.ElfExperienceExpireCheck(Current.UserId);
            receipt.Elf = GetElf;

            UserHelper.TransferExpireCheck(Current.UserId);
            receipt.Transfer = GetTransfer;

            /// 好友/仇人
            {
                receipt.Friends.GiveAwayCount = GetFriends.GiveAwayCount;
                //receipt.Friends.TodayRobList = GetFriends.TodayRobList.ToList();
                foreach (var v in GetFriends.FriendsList)
                {
                    var          basis  = UserHelper.FindUserBasis(v.UserId);
                    JPFriendData friend = new JPFriendData()
                    {
                        UserId            = v.UserId,
                        NickName          = basis.NickName,
                        Profession        = basis.Profession,
                        AvatarUrl         = basis.AvatarUrl,
                        UserLv            = basis.UserLv,
                        VipLv             = basis.VipLv,
                        IsGiveAway        = v.IsGiveAway,
                        IsByGiveAway      = v.IsByGiveAway,
                        IsReceiveGiveAway = v.IsReceiveGiveAway,
                        RobGold           = v.RobGold,
                    };
                    var gameSession = GameSession.Get(v.UserId);
                    friend.IsOnline = gameSession != null && gameSession.Connected;
                    receipt.Friends.FriendsList.Add(friend);
                }
                foreach (var v in GetFriends.ApplyList)
                {
                    var basis = UserHelper.FindUserBasis(v.UserId);
                    JPFriendApplyData apply = new JPFriendApplyData()
                    {
                        UserId     = v.UserId,
                        NickName   = basis.NickName,
                        Profession = basis.Profession,
                        AvatarUrl  = basis.AvatarUrl,
                        UserLv     = basis.UserLv,
                        VipLv      = basis.VipLv,
                        ApplyTime  = v.ApplyDate
                    };
                    var gameSession = GameSession.Get(v.UserId);
                    apply.IsOnline = gameSession != null && gameSession.Connected;
                    receipt.Friends.ApplyList.Add(apply);
                }
                foreach (var v in GetEnemys.EnemyList)
                {
                    var         basis = UserHelper.FindUserBasis(v.UserId);
                    JPEnemyData enemy = new JPEnemyData()
                    {
                        UserId     = v.UserId,
                        NickName   = basis.NickName,
                        Profession = basis.Profession,
                        AvatarUrl  = basis.AvatarUrl,
                        UserLv     = basis.UserLv,
                        RobGold    = v.RobGold,
                    };
                    receipt.Enemys.EnemysList.Add(enemy);
                }
                receipt.Enemys.LogList      = GetEnemys.LogList.ToList();
                receipt.Enemys.IsHaveNewLog = GetEnemys.IsHaveNewLog;
            }

            /// 公会
            if (!receipt.Guild.GuildID.IsEmpty())
            {
                var guildData = new ShareCacheStruct <GuildsCache>().FindKey(receipt.Guild.GuildID);
                if (guildData != null && guildData.FindMember(Current.UserId) != null)
                {
                    UserHelper.BulidJPGuildData(GetGuild.GuildID, receipt.GuildData);
                }
            }


            if (GetBasis.IsReceiveOfflineEarnings)
            {
                receipt.OfflineEarnings = "0";
                receipt.OfflineTimeSec  = 0;
            }
            else
            {
                // 离线收益

                BigInteger transscriptEarnings = 0;
                var        monster             = new ShareCacheStruct <Config_Monster>().Find(t => t.Grade == GetBasis.UserLv);

                BigInteger bi = BigInteger.Parse(monster.DropoutGold) * 30;
                transscriptEarnings += bi;

                double rate = Convert.ToDouble(GetBasis.OfflineTimeSec / 300.0);
                int    tmp  = Convert.ToInt32(rate * 100);

                //var vipcfg = new ShareCacheStruct<Config_Vip>().FindKey(GetBasis.VipLv);
                //if (vipcfg != null)
                {
                    int skillAddition = 0;
                    var elfcfg        = new ShareCacheStruct <Config_Elves>().Find(t => t.ElvesID == GetElf.SelectID);
                    if (elfcfg != null && elfcfg.ElvesType == ElfSkillType.OffineGold)
                    {
                        skillAddition = elfcfg.ElvesNum;
                    }
                    BigInteger sum = transscriptEarnings * tmp / 100;
                    //BigInteger earning = sum + sum / 100 * (vipcfg.Multiple);
                    //BigInteger earning2 = earning + earning / 1000 * skillAddition;
                    BigInteger earning2 = sum + sum / 1000 * skillAddition;
                    if (GetPay.QuarterCardDays >= 0)
                    {
                        earning2 = earning2 * 2;
                    }

                    GetBasis.OfflineEarnings = earning2.ToNotNullString("0");
                }
            }
            receipt.OfflineTimeSec  = GetBasis.OfflineTimeSec;
            receipt.OfflineEarnings = GetBasis.OfflineEarnings;


            // 排行榜奖励数据
            UserRankAward rankAward = DataHelper.LevelRankingAwardCacheList.Find(t => t.UserID == Current.UserId);

            if (rankAward != null)
            {
                receipt.RankAwardData.LevelRankID     = rankAward.RankId;
                receipt.RankAwardData.IsReceivedLevel = rankAward.IsReceived;
            }
            rankAward = DataHelper.FightValueRankingAwardCacheList.Find(t => t.UserID == Current.UserId);
            if (rankAward != null)
            {
                receipt.RankAwardData.FightValueRankID     = rankAward.RankId;
                receipt.RankAwardData.IsReceivedFightValue = rankAward.IsReceived;
            }
            rankAward = DataHelper.ComboRankingAwardCacheList.Find(t => t.UserID == Current.UserId);
            if (rankAward != null)
            {
                receipt.RankAwardData.ComboRankID     = rankAward.RankId;
                receipt.RankAwardData.IsReceivedCombo = rankAward.IsReceived;
            }

            UserHelper.AchievementProcess(Current.UserId, AchievementType.CombatRandID, "0", 0, false);



            return(true);
        }