/// <summary> /// 晶币变化 /// </summary> /// <param name="note"></param> public static void ConsumeCoin(UserNote note) { PlayerEx ex = note.Player.Social; if (ex == null) return; Variant m = ex.Value.GetValueOrDefault<Variant>("Mentor"); if (m == null) return; IList master = m.GetValue<IList>("Master"); if (master == null || master.Count <= 0) return; Variant v = master[0] as Variant; if (v == null) return; PlayerBusiness pb = PlayersProxy.FindPlayerByID(v.GetStringOrDefault("PlayerID")); if (pb == null) return; int coin = note.GetInt32(0); FinanceType ft = note.GetValue<FinanceType>(1); int bond = 0;//得到 int owe = 0; if (coin < 0) { if (note.Player.Level > 39) { //高徒 bond = Convert.ToInt32(Math.Ceiling(-coin * 0.05)); } else { //学徒 bond = Convert.ToInt32(Math.Ceiling(-coin * 0.1)); } owe = Convert.ToInt32(Math.Ceiling(-coin * 0.5)); } int reTime = Convert.ToInt32(TipManager.GetMessage(EmailReturn.HameDay)); if (bond > 0) { if (pb.AddBond(bond, FinanceType.ConsumeCoin)) { string msg = string.Format(TipManager.GetMessage(SocialReturn.ConsumeCoin1), note.Player.Name, bond); //"你的徒弟【" + note.Player.Name + "】消费晶币,为感谢师傅的栽培,为师傅送上了【" + bond + "】点劵"; //徒弟消费奖励点劵 if (EmailAccess.Instance.SendEmail(TipManager.GetMessage(SocialReturn.ConsumeCoin2), TipManager.GetMessage(SocialReturn.FriendsBless8), pb.ID, pb.Name, msg, string.Empty, null, reTime)) { if (pb.Online) { pb.Call(EmailCommand.NewEmailTotalR, EmailAccess.Instance.NewTotal(pb.ID)); } } } } if (owe > 0) { if (pb.AddOwe(owe, FinanceType.ConsumeCoin)) { string msg = string.Format(TipManager.GetMessage(SocialReturn.ConsumeCoin3), owe); // "你获得了【" + owe + "】点感恩值"; //徒弟消费奖励感恩值 if (EmailAccess.Instance.SendEmail(TipManager.GetMessage(SocialReturn.ConsumeCoin4), TipManager.GetMessage(SocialReturn.FriendsBless8), pb.ID, pb.Name, msg, string.Empty, null, reTime)) { if (pb.Online) { pb.Call(EmailCommand.NewEmailTotalR, EmailAccess.Instance.NewTotal(pb.ID)); pb.Call(ClientCommand.SendActivtyR, new object[] { "T02", msg }); } } } } //晶币消费总量 //long gce = note.Player.GCE; }
/// <summary> /// 进入玩家和怪的战斗 /// </summary> /// <param name="note"></param> private void IntoBattle(UserNote note) { List<PlayerBusiness> players = FightBase.GetPlayers(note.Player); FightObject[] teamA = FightBase.CreateFightPlayers(players); FightType fType = (FightType)(note.GetInt32(0)); FightObject[] teamB = FightBase.CreateApcTeam(players, fType, note[1]); string npcID = note.GetString(2); if (players.Count == 0 || teamB.Length == 0) { foreach (var v in players) { v.SetActionState(ActionState.Standing); } return; } bool isEctype = (note.Player.Scene is SceneEctype || note.Player.Scene is SceneSubEctype); FightBusiness fb; if (fType == FightType.SceneAPC) { //打明怪 SceneApc sab = note.GetValue<SceneApc>(3); int subID = note.GetInt32(4); fb = new FightSceneApc(teamA, teamB, players, npcID, isEctype, sab, subID); } else if (fType == FightType.RobAPC) { SceneApc sab = note.GetValue<SceneApc>(3); int subID = note.GetInt32(4); RobBusiness rb = note.GetValue<RobBusiness>(5); fb = new FightBusinessRobApc(teamA, teamB, players, npcID, isEctype, sab, subID, rb); } else if (fType == FightType.ProAPC) { //守护战争明怪 SceneApc sab = note.GetValue<SceneApc>(3); int subID = note.GetInt32(4); PartBusiness pb = note.GetValue<PartBusiness>(5); fb = new FightBusinessProApc(teamA, teamB, players, npcID, isEctype, sab, subID, pb); } else { fb = new FightBusiness(teamA, teamB, players, npcID, isEctype); } foreach (var player in players) { player.Fight = fb; } fb.SendToClinet(FightCommand.StartFight, (int)fType, teamA, teamB); fb.Start(); }
/// <summary> /// 暴星分享 /// </summary> /// <param name="note"></param> public static void StartStarShared(UserNote note) { string share = note.PlayerID + "Share"; try { if (!m_dic.ContainsKey(share)) return; string m = ""; //暴星 IList o = note.GetValue<IList>(0); int power = note.GetInt32(1); if (m_dic.TryGetValue(share, out m)) { int n=0; if (int.TryParse(m, out n)) { if (power > n) { power = n; } } } power = power > 30000 ? 30000 : power; int exp = 10 * power + 1000; List<string> shareList = new List<string>(); foreach (string id in o) { PlayerBusiness pb = PlayersProxy.FindPlayerByID(id); if (pb.SceneID != note.Player.SceneID) continue; if (note.Player.AState == ActionState.Fight) continue; PlayerEx star = pb.Star; Variant v = star.Value; Variant tmp; if (v.TryGetValue("Share", out tmp)) { //分享总次数 string msg = ""; if (tmp.GetIntOrDefault("Total") >= PartAccess.Instance.MedConfig("Total")) { msg = TipManager.GetMessage(StarReturn.StartStarShared1); //"你已经达到星力爆发分享次数总上限,无法获得经验值!"; pb.Call(ClientCommand.SendActivtyR, new object[] { "T02", msg }); continue; } //如果是同一开 if (tmp.GetLocalTimeOrDefault("ShareTime").Date == DateTime.Now.Date) { //每天最多分享10次暴星经验 if (tmp.GetIntOrDefault("Count") >= PartAccess.Instance.MedConfig("EveryDay")) { msg = TipManager.GetMessage(StarReturn.StartStarShared2);// "你已经达到当天的星力爆发分享次数上限,无法获得经验"; pb.Call(ClientCommand.SendActivtyR, new object[] { "T02", msg }); continue; } tmp.SetOrInc("Count", 1); } else { tmp["Count"] = 1; } tmp.SetOrInc("Exp", exp); tmp["ShareTime"] = DateTime.UtcNow; tmp.SetOrInc("Total", 1); } else { tmp = new Variant(); tmp.SetOrInc("Exp", exp);//总共 tmp.SetOrInc("Count", 1);// tmp["ShareTime"] = DateTime.UtcNow;//上次分享时间 tmp.SetOrInc("Total", 1);//当前分享次数 v.Add("Share", tmp); } star.Save(); pb.AddExperience(exp, FinanceType.StartStarShared); pb.Call(ClientCommand.UpdateActorR, new PlayerExDetail(star)); shareList.Add(pb.ID); } PlayersProxy.CallAll(StarCommand.StartStarSharedR, new object[] { note.PlayerID, shareList }); } finally { m_dic.TryRemove(share, out share); } }