Esempio n. 1
0
        public override bool TakeAction()
        {
            var guild = new ShareCacheStruct <GuildsCache>().FindKey(GetGuild.GuildID);

            if (guild == null)
            {
                return(false);
            }
            var basis  = UserHelper.FindUserBasis(_userId);
            var member = guild.FindMember(_userId);

            receipt = new JPGuildMemberData()
            {
                UserID       = basis.UserID,
                NickName     = basis.NickName,
                Profession   = basis.Profession,
                UserLv       = basis.UserLv,
                AvatarUrl    = basis.AvatarUrl,
                CombatRankID = basis.CombatRankID,
                JobTitle     = member.JobTitle,
                Liveness     = member.Liveness,
            };
            var session = GameSession.Get(_userId);

            receipt.IsOnline = session != null && session.Connected;
            return(true);
        }
Esempio n. 2
0
        public override bool TakeAction()
        {
            receipt = new JPGuildData();
            var guildData = new ShareCacheStruct <GuildsCache>().FindKey(GetGuild.GuildID);

            if (guildData != null && guildData.FindMember(Current.UserId) != null)
            {
                UserHelper.BulidJPGuildData(GetGuild.GuildID, receipt);
            }
            return(true);
        }
Esempio n. 3
0
        public override bool TakeAction()
        {
            var guildData = new ShareCacheStruct <GuildsCache>().FindKey(GetGuild.GuildID);

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


            if (Current.UserId == _DestUid ||
                (guildData.FindAtevent().UserID != Current.UserId && guildData.FindVice(Current.UserId) == null))
            {
                receipt = RequestGuildResult.NoAuthority;
                return(true);
            }

            var basis  = UserHelper.FindUserBasis(_DestUid);
            var guild  = UserHelper.FindUserGuild(_DestUid);
            var member = guildData.FindMember(_DestUid);

            if (basis == null || member == null)
            {
                return(false);
            }


            GuildLogData log = new GuildLogData()
            {
                UserId   = basis.UserID,
                UserName = basis.NickName,
                LogTime  = DateTime.Now,
                Content  = string.Format("玩家 {0} 被移出公会。", basis.NickName),
            };

            guildData.NewLog(log);

            foreach (var v in guildData.MemberList)
            {
                PushMessageHelper.GuildMemberRemoveNotification(GameSession.Get(v.UserID), _DestUid);
                PushMessageHelper.NewGuildLogNotification(GameSession.Get(v.UserID));
            }

            guildData.RemoveMember(member);
            guild.GuildID = string.Empty;
            GlobalRemoteService.SendUserData(basis, guild.GuildID);

            receipt = RequestGuildResult.Successfully;
            return(true);
        }
Esempio n. 4
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);
        }