Beispiel #1
0
        /// <summary>
        /// 任务重置
        /// </summary>
        /// <param name="note"></param>
        public static object TaskReset(Notification note)
        {
            string connectionString = ConfigLoader.Config.DbPlayer;
            var db = MongoDatabase.Create(connectionString);
            //取得角色列表
            var mc = db.GetCollection("Player");

            IList nowtask = note.GetValue<IList>(0);
            if (nowtask == null || nowtask.Count == 0)
                return null;
            string nowactid = note.GetString(1);//新触发的任务
            var v = mc.FindAll();
            Dictionary<string, List<string>> dic = new Dictionary<string, List<string>>();
            List<string> tt = new List<string>()
            {
                "G_s120101","G_s120401","G_s120102","G_s120402","G_s120103","G_s120403"
            };
            dic.Add("1", tt);
            tt = new List<string>()
            {
                "G_s110101","G_s110401","G_s110102","G_s110402","G_s110103","G_s110403"
            };
            dic.Add("2", tt);
            tt = new List<string>()
            {
                "G_s130101","G_s130401","G_s130102","G_s130402","G_s130103","G_s130403"
            };
            dic.Add("3", tt);

            foreach (var item in v)
            {
                BsonValue o;
                if (item.TryGetValue("_id", out o))
                {
                    //将角色ID转换为十六进制
                    try
                    {
                        PlayerBusiness pb = PlayersProxy.FindPlayerByID(Convert.ToInt32(o));

                        if (pb == null)
                            continue;

                        int level = pb.Level;

                        List<Task> list = TaskAccess.Instance.GetTaskList(pb.ID);

                        bool isact = false;//是否需要触发新任务
                        string t = "";
                        foreach (Task task in list)
                        {
                            Variant tv = task.Value;
                            string taskid = tv.GetStringOrDefault("TaskID");
                            int tasktype = tv.GetIntOrDefault("TaskType");
                            if (tasktype != 0)
                                continue;
                            if (tv.GetIntOrDefault("Status") >= 3)
                                continue;
                            if (taskid == nowactid)
                                continue;
                            //表示存在这个新任务,则将这个移除
                            if (nowtask.Contains(taskid))
                            {
                                tv["Status"] = 3;
                                task.Save();
                                t = taskid;
                                isact = true;
                            }
                        }

                        if (isact)
                        {
                            GameConfig gc = GameConfigAccess.Instance.FindOneById(nowactid);
                            if (gc == null)
                                return null;
                            TaskManage.TaskBack(pb, gc);
                            LogWrapper.Warn(pb.UserID + "," + pb.Name + "," + t + "," + level);

                            List<Variant> goodsList = new List<Variant>();
                            List<string> g = dic[pb.RoleID];
                            for (int i = 0; i < g.Count; i++)
                            {
                                Variant gs = new Variant();
                                gs.Add("G", g[i]);
                                gs.Add("A", 1);
                                gs.Add("E", g[i]);
                                gs.Add("H", 1);
                                goodsList.Add(gs);
                            }

                            EmailAccess.Instance.SendEmail
                                (
                                "新手补偿",
                                TipManager.GetMessage(PetsReturn.StealPet12),
                                pb.ID,
                                pb.Name,
                                "因新手任务修改,可能会导致您的任务出错,请凉解!因此重置了您的任务,并且将您没有做的任务的道具通过邮件发送给您,因邮件存在过期时间,请尽快领取;特此申明!",
                                string.Empty,
                                goodsList, 15
                                );
                        }

                        if (pb.Level < 11)
                        {
                            pb.AddExperience(8200, FinanceType.GM, "2");
                        }
                        //移除任务内存
                        TaskAccess.Instance.Remove(pb.ID);
                    }
                    catch
                    {

                    }
                }
            }
            return "重置成功";
        }
Beispiel #2
0
 /// <summary>
 /// GM取得商城列表
 /// </summary>
 /// <param name="note"></param>
 /// <param name="strs"></param>
 public static object GMMallInfo(Notification note)
 {
     string type = note.GetString(0);
     if (type == "get")
     {
         HashSet<string> hs = MallAccess.HS;
         List<string> list = new List<string>();
         foreach (string k in hs)
         {
             list.Add(k);
         }
         return new object[] { type, list };
     }
     else
     {
         IList ms = note[1] as IList;
         return new object[] { type, MallAccess.UpdateMell(ms) };
     }
 }
Beispiel #3
0
        /// <summary>
        /// 家族设置
        /// </summary>
        /// <param name="note"></param>
        /// <returns></returns>
        public static object FamilySite(Notification note)
        {
            //家族名称
            string familyname = note.GetString(0);
            //角色名称
            string playername = note.GetString(1);
            //家族职业
            int roleid = note.GetInt32(2);

            //FamilyAccess.Instance.f

            PlayerBusiness player = PlayersProxy.FindPlayerByName(playername);
            if (player == null)
                return null;
            return null;
        }
Beispiel #4
0
        /// <summary>
        /// GM邮件发送
        /// </summary>
        /// <param name="note"></param>
        /// <returns></returns>
        public static object GMEmailSend(Notification note)
        {
            string title = note.GetString(0);
            string content = note.GetString(1);
            //int score = note.GetInt32(2);
            IList goods = note[2] as IList;
            if (goods.Count > 5)
            {
                return new object[] { false };
            }

            List<Variant> goodsList = new List<Variant>();
            foreach (Variant info in goods)
            {
                Variant v = new Variant();
                v["E"] = info.GetStringOrDefault("GoodsID");
                v["G"] = info.GetStringOrDefault("GoodsID");
                v["A"] = info.GetIntOrDefault("Number");
                v["H"] = info.GetStringOrDefault("IsBinding");
                goodsList.Add(v);
            }

            IList ms = note[3] as IList;
            foreach (Variant v in ms)
            {
                string playerid = v.GetStringOrDefault("_id");
                string name = v.GetStringOrDefault("Name");
                int reTime = Convert.ToInt32(TipManager.GetMessage(EmailReturn.HameDay));

                if (EmailAccess.Instance.SendEmail(title, TipManager.GetMessage(PetsReturn.StealPet12), playerid, name, content, string.Empty, goodsList, reTime))
                {
                    PlayerBusiness pb;
                    if (PlayersProxy.TryGetPlayerByID(Convert.ToInt32(playerid, 16), out pb))
                    {
                        if (pb != null && pb.Online)
                        {
                            pb.Call(EmailCommand.NewEmailTotalR, EmailAccess.Instance.NewTotal(pb.ID));
                        }
                    }
                }
            }
            return new object[] { true };
        }