public RobData() { Rob = new StealRobTarget(); FriendRobList = new List <JPFriendRobData>(); EnemyRobList = new List <JPEnemyRobData>(); TodayRobList = new List <int>(); }
public UserLotteryCache() : base(AccessLevel.ReadWrite) { StealList = new CacheList <StealRobTarget>(); Rob = new StealRobTarget(); }
public override bool TakeAction() { receipt = new StealReceipt(); receipt.Result = false; if (GetLottery.StealTimes <= 0 || selectIndex >= 3) { return(true); } StealRobTarget target = GetLottery.StealList[selectIndex]; var rival = UserHelper.FindUserBasis(target.RivalUid); if (rival == null) { return(true); } var rivalEnemy = UserHelper.FindUserEnemy(rival.UserID); if (rivalEnemy == null) { return(true); } GetLottery.StealTimes--; receipt.Gold = target.Gold; UserHelper.RewardsGold(Current.UserId, target.Gold); BigInteger dummyGold = BigInteger.Parse(target.Gold); BigInteger realGold = rival.GoldNum <= dummyGold * 2 ? rival.GoldNum / 2 : dummyGold; UserHelper.ConsumeGold(rival.UserID, realGold); rivalEnemy.AddEnemy(new EnemyData() { UserId = Current.UserId }); EnemyLogData log = new EnemyLogData() { RivalUid = Current.UserId, RivalName = GetBasis.NickName, RivalAvatarUrl = GetBasis.AvatarUrl, LogTime = DateTime.Now, LossGold = realGold.ToString(), IsSteal = true, RivalProfession = GetBasis.Profession }; rivalEnemy.PushLog(log); PushMessageHelper.NewStealRobNotification(GameSession.Get(rival.UserID)); if (target.IsPrimary) { GetLottery.StealList.Clear(); UserHelper.RandomStealTarget(Current.UserId); } else { UserHelper.RandomStealTarget2(Current.UserId); } foreach (var v in GetLottery.StealList) { UserBasisCache basis = UserHelper.FindUserBasis(v.RivalUid); UserAttributeCache attribute = UserHelper.FindUserAttribute(v.RivalUid); UserEquipsCache equips = UserHelper.FindUserEquips(v.RivalUid); CombatMatchUserData data = new CombatMatchUserData() { UserId = basis.UserID, NickName = basis.NickName, Profession = basis.Profession, AvatarUrl = basis.AvatarUrl, RankId = basis.LevelRankID, UserLv = basis.UserLv, VipLv = basis.VipLv, FightingValue = attribute.FightValue, Equips = equips, // SkillCarryList = user.SkillCarryList }; receipt.StealList.Add(data); } receipt.Lottery = GetLottery; receipt.Result = true; return(true); }
protected override object this[string index] { get { #region switch (index) { case "UserID": return(UserID); case "LotteryTimes": return(LotteryTimes); case "StartRestoreLotteryTimesDate": return(StartRestoreLotteryTimesDate); case "StealList": return(StealList); case "Rob": return(Rob); case "StealTimes": return(StealTimes); case "RobTimes": return(RobTimes); case "TotalCount": return(TotalCount); default: throw new ArgumentException(string.Format("UserLotteryCache index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "UserID": _UserID = value.ToInt(); break; case "LotteryTimes": _LotteryTimes = value.ToInt(); break; case "StartRestoreLotteryTimesDate": _StartRestoreLotteryTimesDate = value.ToDateTime(); break; case "StealList": _StealList = ConvertCustomField <CacheList <StealRobTarget> >(value, index); break; case "Rob": _Rob = ConvertCustomField <StealRobTarget>(value, index); break; case "StealTimes": _StealTimes = value.ToInt(); break; case "RobTimes": _RobTimes = value.ToInt(); break; case "TotalCount": _TotalCount = value.ToInt(); break; default: throw new ArgumentException(string.Format("UserLotteryCache index[{0}] isn't exist.", index)); } #endregion } }