Exemplo n.º 1
0
        /// <summary>
        /// GM取得拍卖行数据
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void GMAuctionList(GMNote note, string[] strs)
        {
            if (strs.Length < 3)
                return;
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
                return;
            int pageIndex = 0;

            if (!int.TryParse(strs[1].Trim(), out pageIndex))
                return;
            int pageSize = 6;

            int total = 0;
            int curIndex = 0;
            List<Auction> auctionList = AuctionAccess.Instance.AuctionSellerList(player.ID, pageSize, pageIndex, out total, out curIndex);
            List<Variant> list = new List<Variant>();
            foreach (Auction model in auctionList)
            {
                Variant mv = model.Value;
                Variant v = new Variant();
                foreach (var item in mv)
                {
                    v.Add(item.Key, item.Value);
                }
                v.Add("ID", model.ID);
                v.Add("Name", model.Name);
                list.Add(v);
            }
            note.Call(GMCommand.GMAuctionListR, list, total, curIndex);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 开启多倍经验活动
 /// </summary>
 /// <param name="note"></param>
 /// <param name="strs"></param>
 public static void DoubleExp(GMNote note, string[] strs)
 {
     if (strs.Length != 4) return;
     DateTime start;
     if (DateTime.TryParse(strs[0], out start))
     {
         start = start.ToUniversalTime();
     }
     else
     {
         return;
     }
     DateTime end;
     if (DateTime.TryParse(strs[1], out end))
     {
         end = end.ToUniversalTime();
     }
     else
     {
         return;
     }
     double x;
     if (!double.TryParse(strs[2], out x))
     {
         return;
     }
     ExperienceControl.Instance.SetExp(start, end, x, strs[3]);
     note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.DoubleExp), ExperienceControl.ExpCoe));
     //("设置成功,当前经验:" + ExperienceControl.ExpCoe));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 断开所有用户
 /// </summary>
 /// <param name="note"></param>
 public static void ExitAll(GMNote note)
 {
     x++;
     if (x == 1)
     {
         dt = DateTime.UtcNow;
     }
     TimeSpan ts = DateTime.UtcNow - dt;
     if (ts.TotalSeconds > 10)
     {
         x = 1;
         dt = DateTime.UtcNow;
     }
     else
     {
         if (x >= 2)
         {
             FrontApplication.Instance.Stop();
             string str = string.Format("服务已停止");
             note.Call(GMCommand.GMR, str);
             //Environment.Exit(0);
             return;
         }
     }
     string str2 = string.Format("确定要停止应用程序,请在10秒内重新发该指令");
     note.Call(GMCommand.GMR, (str2));
 }
Exemplo n.º 4
0
 /// <summary>
 /// GM删除拍卖行记当
 /// </summary>
 /// <param name="note"></param>
 /// <param name="strs"></param>
 public static void GMAuctionDel(GMNote note, string[] strs)
 {
     if (strs.Length != 2)
         return;
     PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
     if (player == null)
         return;
     string[] s = strs[1].Split('|');
     if (AuctionAccess.Instance.GMAuctionDel(player.ID, s))
     {
         note.Call(GMCommand.GMAuctionDelR, true);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 充值
 /// </summary>
 /// <param name="note"></param>
 /// <param name="strs"></param>
 public static void AddScore(GMNote note, string[] strs)
 {
     if (strs.Length < 2) return;
     PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
     if (player == null)
     {
         note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
         return;
     }
     int score = Convert.ToInt32(strs[1]);
     player.AddScore(score, FinanceType.GM);
     note.Call(GMCommand.GMR, "为【" + player.Name + "】充值游戏币:" + score);
 }
Exemplo n.º 6
0
        /// <summary>
        /// 充值
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void AddCoin(GMNote note, string[] strs)
        {
            if (strs.Length < 2) return;
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
            {
                note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
                return;
            }
            int coin = Convert.ToInt32(strs[1]);
            player.AddCoin(coin, FinanceType.GM);

            UserNote note1 = new UserNote(player, PartCommand.Recharge, new object[] { coin });
            Notifier.Instance.Publish(note1);
            note.Call(GMCommand.GMR, "为【" + player.Name + "】充值晶币:" + coin);
        }
Exemplo n.º 7
0
 /// <summary>
 /// 踢出玩家
 /// </summary>
 /// <param name="note"></param>
 public static void KickUser(GMNote note, string[] strs)
 {
     if (strs.Length < 2) return;
     string key = strs[0].Trim();
     PlayerBusiness player = PlayersProxy.FindPlayerByName(key);
     if (player == null)
     {
         //检查是否是IP地址
         IPAddress ip;
         if (!System.Net.IPAddress.TryParse(key, out ip))
         {
             note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
             return;
         }
     }
     else
     {
         key = player.UserID;
     }
     int t; //禁止登录的时间
     if (!Int32.TryParse(strs[1], out t))
     {
         t = 60;
     }
     //解除黑名单
     if (t < 0)
     {
         BlackListManager.Instance.Remove(key);
         note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.KickUser), strs[0]));
         //"解除成功:" + strs[0]);
         return;
     }
     if (t > 0)
     {
         BlackListManager.Instance.AddBlack(key, DateTime.UtcNow.AddMinutes(t));
     }
     if (player != null && player.Session != null)
     {
         player.Session.Close();
     }
     string str = string.Format(TipManager.GetMessage(GMReturn.Exit), player == null ? key : player.Name);
     note.Call(GMCommand.GMR, str);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 查看在线人数
 /// </summary>
 /// <param name="note"></param>
 public static void Online(GMNote note, string[] strs)
 {
     if (strs == null || strs.Length == 0)
     {
         note.Call(GMCommand.OnlineR, new List<int> { UsersProxy.UserCount, PlayersProxy.OnlineCount });
         return;
     }
     if (strs.Length == 1)
     {
         if (string.IsNullOrEmpty(strs[0]))
         {
             Process process = Process.GetCurrentProcess();
             //查看所有场景人数
             var v = ScenesProxy.OnlineCount();
             v["User"] = UsersProxy.UserCount;
             v["Player"] = PlayersProxy.OnlineCount;
             v["Memory"] = (int)(process.WorkingSet64 >> 20);
             note.Call(GMCommand.OnlineR, v);
         }
         else
         {
             SceneBusiness scene;
             if (ScenesProxy.TryGetScene(strs[0], out scene))
             {
                 Dictionary<string, int> dic = new Dictionary<string, int>(1);
                 dic.Add(strs[0], scene.Players.Count);
                 note.Call(GMCommand.OnlineR, dic);
                 return;
             }
             note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.Online), strs[0]));
             //"场景信息不正确:" + strs[0]);
         }
     }
 }
Exemplo n.º 9
0
        public static void OpenPart(GMNote note, string[] strs)
        {
            if (strs.Length != 4) return;
            DateTime start;
            if (!DateTime.TryParse(strs[0], out start))
            {
                return;
            }

            DateTime end;
            if (!DateTime.TryParse(strs[1], out end))
            {
                return;
            }
            if (end < DateTime.Now)
            {
                return;
            }

            string name = strs[2];
            Part part = null;
            if (name == Part.Pro)
            {
                part = PartManager.Instance.FindOne(Part.Pro);
            }
            else if (name == Part.Rob)
            {
                part = PartManager.Instance.FindOne(Part.Rob);
            }
            if (part == null)
            {
                return;
            }

            Period p = new Period(start, end);
            part.Periods.Add(p);
            //("活动开启成功:" + name)
            note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.OpenPart), name));
        }
Exemplo n.º 10
0
        /// <summary>
        /// 公告
        /// </summary>
        /// <param name="note"></param>
        public static void Notice(GMNote note)
        {
            Variant v = note.GetVariant(1);
            if (v == null)
            {
                return;
            }

            Notice model = new Entity.Notice();
            model.ID = ObjectId.GenerateNewId().ToString();
            model.Name = v.GetStringOrDefault("Name");
            model.StartTime = v.GetUtcTimeOrDefault("StartTime");
            model.EndTime = v.GetUtcTimeOrDefault("EndTime");
            model.Sort = v.GetIntOrDefault("Sort");
            model.Content = v.GetStringOrDefault("Content");
            model.Count = v.GetIntOrDefault("Count");
            model.Rate = v.GetIntOrDefault("Rate");
            model.Status = v.GetIntOrDefault("Status");
            model.Place = v.GetStringOrDefault("Place");
            if (model.Save())
            {
                NoticeAccess.Instance.AddNotice(model);
                note.Call(GMCommand.GMR, TipManager.GetMessage(GMReturn.Notice1));
            }
            else
            {
                note.Call(GMCommand.GMR, "");
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// 取得公告列表
 /// </summary>
 /// <param name="note"></param>
 public static void NoticeList(GMNote note)
 {
     List<Notice> list = NoticeAccess.Instance.GetNotices();
     List<Variant> tmp = new List<Variant>();
     foreach (Notice model in list)
     {
         Variant t = new Variant();
         t.Add("ID", model.ID);
         t.Add("Sort", model.Sort);
         t.Add("Name", model.Name);
         t.Add("StartTime", model.StartTime);
         t.Add("EndTime", model.EndTime);
         t.Add("Content", model.Content);
         t.Add("Rate", model.Rate);
         t.Add("Count", model.Count);
         t.Add("Status", model.Status);
         t.Add("Place", model.Place);
         tmp.Add(t);
     }
     note.Call(GMCommand.NoticeListR, tmp);
 }
Exemplo n.º 12
0
        /// <summary>
        /// 添加宠物经验
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void PetExp(GMNote note, string[] strs)
        {
            if (strs.Length < 2) return;
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
            {
                note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
                return;
            }
            if (player.Pet == null)
            {
                note.Call(GMCommand.GMR, ("没有出征宠物!"));
                return;
            }

            int number = 0;
            if (!int.TryParse(strs[1], out number))
                return;

            player.AddPetExp(player.Pet, number, true, (int)FinanceType.GM);
            string str = string.Format("成功给【{0}】的宠物添加{1}点经验", player.Name, number);
            note.Call(GMCommand.GMR, str);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 清理包袱,仓库,家园,兽栏
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void GMBurdenClear(GMNote note, string[] strs)
        {
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
                return;
            string b = strs[1].Trim();
            List<string> list = new List<string>()
            {
                "B0",
                "B1",
                "B2",
                "B3",
                "Home",
                "Star"
            };

            if (!list.Contains(b))
                return;

            PlayerEx burden = player.Value[b] as PlayerEx;
            if (burden == null)
                return;
            Variant v = burden.Value;
            if (b.IndexOf("B") == 0)
            {
                IList c = v.GetValue<IList>("C");
                foreach (Variant k in c)
                {

                    string soleid = k.GetStringOrDefault("E");

                    if (string.IsNullOrEmpty(soleid))
                        continue;
                    string goodsid = k.GetStringOrDefault("G");
                    GameConfig gc = GameConfigAccess.Instance.FindOneById(goodsid);
                    if (gc == null)
                    {
                        BurdenManager.BurdenClear(k);
                        continue;
                    }
                    //道具类型
                    string goodsType = gc.Value.GetStringOrDefault("GoodsType");
                    if (goodsType == "")
                        continue;
                    BurdenManager.BurdenClear(k);
                    if (b == "B0" || b == "B1")
                    {
                        if (soleid != goodsid)
                        {
                            GoodsAccess.Instance.Remove(soleid, player.ID);
                        }
                    }
                    else
                    {
                        Pet p = PetAccess.Instance.FindOneById(soleid);
                        if (p != null)
                        {
                            int level = p.Value.GetIntOrDefault("PetsLevel");
                            string petsid = p.Value.GetStringOrDefault("PetsID");

                            PetAccess.Instance.RemoveOneById(p.ID, SafeMode.False);
                            int pl = (b == "B2") ? 2 : 3;
                            player.AddLog(Log.Actiontype.PetRemove, p.ID, level, GoodsSource.GM, petsid, pl);
                        }
                    }

                }
            }
            else if (b == "Home")
            {
                Variant pk = v.GetValueOrDefault<Variant>("PetKeep");
                string id = pk.GetStringOrDefault("ID");
                string petid = "";
                if (!string.IsNullOrEmpty(id))
                {
                    Pet p = PetAccess.Instance.FindOneById(id);
                    if (p != null)
                    {
                        petid = p.Value.GetStringOrDefault("PetsID");
                        int level = p.Value.GetIntOrDefault("PetsLevel");
                        PetAccess.Instance.RemoveOneById(id, SafeMode.False);
                        pk["EndTime"] = "";
                        pk["ID"] = "";
                        pk["PetID"] = "";
                        pk["PetName"] = "";
                        pk["PetsWild"] = 0;
                        pk["StartTime"] = "";

                        player.AddLog(Log.Actiontype.PetRemove, petid, level, GoodsSource.GM, p.ID, 1);
                    }
                }

                Variant pd = v.GetValueOrDefault<Variant>("Produces");
                if (pd != null)
                {
                    foreach (var item in pd)
                    {
                        Variant info = item.Value as Variant;
                        IList petlist = info.GetValue<IList>("PetList");
                        if (petlist != null && petlist.Count > 0)
                        {
                            foreach (Variant k in petlist)
                            {
                                id = k.GetStringOrDefault("E");
                                Pet p = PetAccess.Instance.FindOneById(id);
                                if (p != null)
                                {
                                    petid = p.Value.GetStringOrDefault("PetsID");
                                    int level = p.Value.GetIntOrDefault("PetsLevel");
                                    PetAccess.Instance.RemoveOneById(p.ID, SafeMode.False);
                                    player.AddLog(Log.Actiontype.PetRemove, petid, level, GoodsSource.GM, p.ID, 1);
                                }
                            }
                            //宠物回收
                            petlist.Clear();
                        }
                    }
                }
            }
            else
            {
                Variant pl = v.GetVariantOrDefault("PetsList");
                if (pl != null)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        Variant pv = pl.GetVariantOrDefault(i.ToString());
                        if (pv == null)
                            continue;
                        //移除星阵中宠物
                        string id = pv.GetStringOrDefault("ID");
                        Pet p = PetAccess.Instance.FindOneById(id);
                        if (p != null)
                        {
                            string petid = p.Value.GetStringOrDefault("PetsID");
                            int level = p.Value.GetIntOrDefault("PetsLevel");
                            PetAccess.Instance.RemoveOneById(p.ID, SafeMode.False);
                            //星阵中宠物
                            player.AddLog(Log.Actiontype.PetRemove, p.ID, level, GoodsSource.GM, petid, 4);
                        }
                    }
                }
                //星座清理
                burden.Value.Clear();
            }
            if (burden.Save())
            {
                if (player.Online)
                {
                    player.UpdateBurden(b);
                }
                note.Call("", true);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 公告更新
        /// </summary>
        /// <param name="note"></param>
        public static void UpdateNotice(GMNote note)
        {
            Variant v = note.GetVariant(1);
            if (v == null)
            {
                return;
            }
            string id = v.GetStringOrDefault("ID");
            Notice model;
            if (NoticeAccess.Instance.GetNotice(id, out model))
            {
                bool ischange = false;
                if (v.ContainsKey("Name") && model.Name != v.GetStringOrDefault("Name"))
                {
                    model.Name = v.GetStringOrDefault("Name");
                    ischange = true;
                }

                if (v.ContainsKey("StartTime") && model.StartTime != v.GetUtcTimeOrDefault("StartTime"))
                {
                    model.StartTime = v.GetUtcTimeOrDefault("StartTime");
                    ischange = true;
                }

                if (v.ContainsKey("EndTime") && model.EndTime != v.GetUtcTimeOrDefault("EndTime"))
                {
                    model.EndTime = v.GetUtcTimeOrDefault("EndTime");
                    ischange = true;
                }

                if (v.ContainsKey("Sort") && model.Sort != v.GetIntOrDefault("Sort"))
                {
                    model.Sort = v.GetIntOrDefault("Sort");
                    ischange = true;
                }
                if (v.ContainsKey("Content") && model.Content != v.GetStringOrDefault("Content"))
                {
                    model.Content = v.GetStringOrDefault("Content");
                    ischange = true;
                }
                if (v.ContainsKey("Count") && model.Count != v.GetIntOrDefault("Count"))
                {
                    model.Count = v.GetIntOrDefault("Count");
                    ischange = true;
                }
                if (v.ContainsKey("Rate") && model.Rate != v.GetIntOrDefault("Rate"))
                {
                    model.Rate = v.GetIntOrDefault("Rate");
                    ischange = true;
                }
                if (v.ContainsKey("Status") && model.Status != v.GetIntOrDefault("Status"))
                {
                    model.Status = v.GetIntOrDefault("Status");
                    ischange = true;
                }
                if (v.ContainsKey("Place") && model.Place != v.GetStringOrDefault("Place"))
                {
                    model.Place = v.GetStringOrDefault("Place");
                    ischange = true;
                }
                if (v.ContainsKey("Cur") && model.Cur != v.GetIntOrDefault("Cur"))
                {
                    model.Cur = v.GetIntOrDefault("Cur");
                    ischange = true;
                }
                if (ischange)
                {
                    model.Save();
                    note.Call(GMCommand.UpdateNoticeR, true);
                    return;
                }
            }
            note.Call(GMCommand.UpdateNoticeR, false);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 触发某个任务
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void TaskAct(GMNote note, string[] strs)
        {
            if (strs.Length < 2) return;
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
            {
                note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
                return;
            }
            GameConfig gc = GameConfigAccess.Instance.FindOneById(strs[1]);
            if (gc == null) return;

            TaskManage.TaskBack(player, gc);
            string str = string.Format("任务【{0}】触发成功", gc.Name);
            note.Call(GMCommand.GMR, str);
        }
Exemplo n.º 16
0
 internal static void ReStart(GMNote note, string[] comm)
 {
     string str;
     if (FrontApplication.Instance.Restart())
     {
         str = "服务重启成功";
     }
     else
     {
         str = "服务运行中..";
     }
     note.Call(GMCommand.GMR, str);
 }
Exemplo n.º 17
0
 internal static void SetTalk(GMNote note, string[] strs)
 {
     if (strs.Length != 2) return;
     PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
     if (player == null)
     {
         note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
         return;
     }
     int min;
     Int32.TryParse(strs[1], out min);
     if (min > 0)
     {
         player.Danned = DateTime.UtcNow.AddMinutes(min);
         note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.SetTalk1), strs[0]));
     }
     else
     {
         player.Danned = DateTime.MinValue;
         note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.SetTalk2), strs[0]));
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// 邮件查询
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void SelectEmail(GMNote note, string[] strs)
        {
            try
            {
                if (runing) return;
                runing = true;
                if (strs.Length < 3)
                    return;

                PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
                if (player == null)
                    return;
                int type = 0;
                if (!int.TryParse(strs[1].Trim(), out type))
                    return;
                int pageSize = 0;
                if (!int.TryParse(strs[2].Trim(), out pageSize))
                    return;
                int pageIndex = 0;
                if (!int.TryParse(strs[3].Trim(), out pageIndex))
                    return;
                int status = 0;
                if (!int.TryParse(strs[4].Trim(), out status))
                    return;

                int total = 0;
                List<Email> emailList = EmailAccess.Instance.GMEmailList(player.ID, type, pageSize, pageIndex, status, out total);
                List<Variant> list = new List<Variant>();
                foreach (Email model in emailList)
                {
                    Variant mv = model.Value;
                    if (mv == null)
                        continue;
                    Variant v = new Variant();
                    foreach (var item in mv)
                    {
                        v.Add(item.Key, item.Value);
                    }
                    v.Add("ID", model.ID);
                    v.Add("Name", model.Name);
                    v.Add("MainType", model.MainType);
                    v.Add("Status", model.Status);
                    list.Add(v);
                }

                note.Call(GMCommand.SelectEmailR, total, list);
            }
            finally
            {
                runing = false;
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 任务重置
        /// </summary>
        /// <param name="note"></param>
        public static void TaskReset(GMNote note)
        {
            string connectionString = ConfigLoader.Config.DbPlayer;
            var db = MongoDatabase.Create(connectionString);
            //取得角色列表
            var mc = db.GetCollection("Player");

            IList nowtask = note.GetValue<IList>(1);
            if (nowtask == null || nowtask.Count == 0)
                return;
            string nowactid = note.GetString(2);//新触发的任务
            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;
                            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
                    {

                    }
                }
            }
            Console.WriteLine("任务重置处理完成...");
            note.Call(GMCommand.GMR, "重置成功");
        }
Exemplo n.º 20
0
 /// <summary>
 /// 移除某角色某个任务
 /// </summary>
 /// <param name="note"></param>
 /// <param name="strs"></param>
 public static void TaskRemove(GMNote note, string[] strs)
 {
     if (strs.Length < 2) return;
     PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
     if (player == null)
     {
         note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
         return;
     }
     List<string> list = new List<string>();
     list.Add(strs[1].Trim());
     List<Task> tasks = TaskAccess.Instance.FindConfigList(player.ID, list);
     foreach (Task k in tasks)
     {
         TaskAccess.Instance.Remove(player.ID, new List<string> { k.Value.GetStringOrDefault("TaskID") });
         TaskManage.TaskGiveup(player, k, false);
         note.Call(GMCommand.GMR, ("移除任务【" + k.Value.GetStringOrDefault("TaskID") + "】成功"));
     }
 }
Exemplo n.º 21
0
 /// <summary>
 /// 设置玩家状态
 /// </summary>
 /// <param name="note"></param>
 /// <param name="strs"></param>
 public static void SetPlayerState(GMNote note, string[] strs)
 {
     if (strs.Length != 2) return;
     PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
     if (player == null)
     {
         note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
         return;
     }
     int state;
     Int32.TryParse(strs[1], out state);
     if (state < 0 || state > 4)
     {
         return;
     }
     if (player.State != state)
     {
         if (state == 3)
         {
             //删除玩家
             PlayersProxy.DeletePlayer(player.PID, false);
         }
         if (PlayerAccess.Instance.ChangeState(player.PID, state))
         {
             player.State = state;
             if (state != 1)
             {
                 UserSession us = player.Session;
                 if (us != null) us.Close();
             }
         }
     }
     note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.SetPlayerState), player.Name, player.State));
 }
Exemplo n.º 22
0
        /// <summary>
        /// 添加宠物技能
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void PSkill(GMNote note, string[] strs)
        {
            if (strs.Length < 3) return;
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
            {
                note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
                return;
            }
            string skillid = strs[1].Trim();
            int level = Convert.ToInt32(strs[2]);//等级
            GameConfig gc = GameConfigAccess.Instance.FindOneById(skillid);

            if (gc == null || gc.Value == null)
                return;

            if (!gc.Value.ContainsKey(level.ToString()))
                return;

            PlayerEx petBook = player.PetBook;
            Variant v = petBook.Value;
            object o;
            if (v.TryGetValueT(skillid, out o))
            {
                IList list = o as IList;
                if (list.Contains(level))
                {
                    note.Call(GMCommand.GMR, ("该技能已经成存!"));
                    return;
                }
                list.Add(level);
            }
            else
            {
                v.Add(skillid, new List<int> { level });
            }
            petBook.Save();
            player.Call(ClientCommand.UpdateActorR, new PlayerExDetail(petBook));
            string str = string.Format("【{0}】学习宠物技能【{1}】成功", player.Name, gc.Name);
            note.Call(GMCommand.GMR, str);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 道具移除
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void GoodRemove(GMNote note, string[] strs)
        {
            if (strs.Length < 3) return;
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
            {
                note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
                return;
            }
            string goodsid = strs[1];
            int number = 0;
            if (!int.TryParse(strs[2], out number))
                return;

            PlayerEx b0 = player.B0;
            PlayerEx b1 = player.B1;
            PlayerEx eq = player.Equips;
            IList c = null;
            if (number == 0)
            {
                c = b0.Value.GetValue<IList>("C");
                foreach (Variant v in c)
                {
                    if (v.GetStringOrDefault("G") == goodsid)
                    {
                        BurdenManager.BurdenClear(v);
                    }
                }

                c = b1.Value.GetValue<IList>("C");
                foreach (Variant v in c)
                {
                    if (v.GetStringOrDefault("G") == goodsid)
                    {
                        BurdenManager.BurdenClear(v);
                    }
                }

                foreach (Variant v in eq.Value.Values)
                {
                    if (v.GetStringOrDefault("G") == goodsid)
                    {
                        GMUninstall(player, v);
                        BurdenManager.BurdenClear(v);
                    }
                }
            }
            else
            {
                int total = 0;
                c = b0.Value.GetValue<IList>("C");
                foreach (Variant v in c)
                {
                    if (v.GetStringOrDefault("G") == goodsid)
                    {
                        int m = number - total;
                        int n = v.GetIntOrDefault("A");
                        if (m >= n)
                        {
                            BurdenManager.BurdenClear(v);
                            total += n;
                        }
                        else
                        {
                            v["A"] = n - m;
                            total += m;
                        }

                        if (total >= number)
                            break;
                    }
                }

                if (total < number)
                {
                    c = b1.Value.GetValue<IList>("C");
                    foreach (Variant v in c)
                    {
                        if (v.GetStringOrDefault("G") == goodsid)
                        {
                            int m = number - total;
                            int n = v.GetIntOrDefault("A");
                            if (m >= n)
                            {
                                BurdenManager.BurdenClear(v);
                                total += n;
                            }
                            else
                            {
                                v["A"] = n - m;
                                total += m;
                            }

                            if (total >= number)
                                break;
                        }
                    }
                }

                if (total < number)
                {
                    foreach (Variant v in eq.Value.Values)
                    {
                        if (v.GetStringOrDefault("G") == goodsid)
                        {
                            GMUninstall(player, v);
                            total++;
                            BurdenManager.BurdenClear(v);
                            if (total >= number)
                                break;
                        }
                    }
                }
            }
            b0.Save();
            b1.Save();
            eq.Save();

            if (player.Online)
            {
                player.UpdateBurden("B0", "B1");
                player.Call(GoodsCommand.GetEquipPanelR, true, eq);
            }
            note.Call(GMCommand.GMR, ("道具移除成功"));
        }
Exemplo n.º 24
0
        /// <summary>
        /// 添加角色技能
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void Skill(GMNote note, string[] strs)
        {
            if (strs.Length < 3) return;
            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
            {
                note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
                return;
            }
            string skillid = strs[1].Trim();
            int level = Convert.ToInt32(strs[2]);//等级
            GameConfig gc = GameConfigAccess.Instance.FindOneById(skillid);
            if (gc == null || gc.Value == null)
                return;
            PlayerEx sk = player.Skill;
            if (sk == null)
                return;
            Variant v = sk.Value;
            if (v == null)
                return;
            object o;
            if (v.TryGetValueT(skillid, out o))
            {

            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 添加点券
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        internal static void AddBond(GMNote note, string[] strs)
        {
            if (strs.Length < 2) return;

            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
            {
                note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
                return;
            }
            int bond = Convert.ToInt32(strs[1]);
            if (player.AddBond(bond, FinanceType.GM, "GM"))
            {
                string name = player.Name;
                //note.Call(GMCommand.GMR, ("为【" + name + "】充入点券:" + bond));
                note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.AddBond), name, bond));
            }
        }
Exemplo n.º 26
0
 /// <summary>
 /// 得到道具ID
 /// </summary>
 /// <param name="note"></param>
 /// <param name="strs"></param>
 public static void GoodID(GMNote note, string[] strs)
 {
     if (strs.Length < 2) return;
     GameConfig gc = GameConfigAccess.Instance.Find(MainType.Goods, null, strs[0].Trim());
     if (gc == null)
         return;
     string str = "道具【" + gc.Name + "】配置ID为【" + gc.ID + "】";
     note.Call(GMCommand.GMR, str);
 }
Exemplo n.º 27
0
 /// <summary>
 /// 查看玩家信息
 /// </summary>
 /// <param name="note"></param>
 /// <param name="comm"></param>
 internal static void ViewPlayer(GMNote note, string[] strs)
 {
     if (strs.Length != 1) return;
     PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
     if (player == null)
     {
         note.Call(GMCommand.GMR, string.Format(TipManager.GetMessage(GMReturn.NoName), strs[0]));
         return;
     }
     note.Call(GMCommand.ViewPlayerR, player.Online, new PlayerDetail(player, 2));
 }
Exemplo n.º 28
0
 /// <summary>
 /// GM取得商城列表
 /// </summary>
 /// <param name="note"></param>
 /// <param name="strs"></param>
 public static void GMMallInfo(GMNote note)
 {
     string type = note.GetString(1);
     if (type == "get")
     {
         HashSet<string> hs = MallAccess.HS;
         List<string> list = new List<string>();
         foreach (string k in hs)
         {
             list.Add(k);
         }
         note.Call(GMCommand.GMMallInfoR, new object[] { type, list });
     }
     else
     {
         IList ms = note[2] as IList;
         note.Call(GMCommand.GMMallInfoR, new object[] { type, MallAccess.UpdateMell(ms) });
     }
 }
Exemplo n.º 29
0
 /// <summary>
 /// GM基本指令
 /// </summary>
 /// <param name="note"></param>
 private void GMInstruction(GMNote note, string[] comm)
 {
     switch (note.Name)
     {
         case GMCommand.Exitall:
             ManageBusiness.ExitAll(note);
             break;
         case GMCommand.Coin:
             //充值
             ManageBusiness.AddCoin(note, comm);
             break;
         case GMCommand.Score:
             ManageBusiness.AddScore(note, comm);
             break;
         //case GMCommand.Bond:
         //    ManageBusiness.AddBond(note, comm);
         //    break;
         case GMCommand.Exp:
             //添加经验
             ManageBusiness.Exp(note, comm);
             break;
         case GMCommand.TaskRemove:
             //删除某个任务
             ManageBusiness.TaskRemove(note, comm);
             break;
         case GMCommand.TaskAct:
             //重新触发某个任务
             ManageBusiness.TaskAct(note, comm);
             break;
         case GMCommand.TaskId:
             //得到任务ID
             ManageBusiness.GetTaskID(note, comm);
             break;
         case GMCommand.Goodsid:
             //道具ID
             ManageBusiness.GoodID(note, comm);
             break;
         case GMCommand.Getgood:
             //道具赠送
             ManageBusiness.GetGood(note, comm);
             break;
         case GMCommand.GoodRemove:
             //道具移除
             ManageBusiness.GoodRemove(note, comm);
             break;
         case GMCommand.PetExp:
             //添加宠物经验
             ManageBusiness.PetExp(note, comm);
             break;
         case GMCommand.Skill:
             ManageBusiness.Skill(note, comm);
             break;
         case GMCommand.Pskill:
             ManageBusiness.PSkill(note, comm);
             break;
         case GMCommand.Restart:
             ManageBusiness.ReStart(note, comm);
             break;
         case GMCommand.SelectEmail:
             ManageBusiness.SelectEmail(note, comm);
             break;
         case GMCommand.GMDelEmail:
             ManageBusiness.GMDelEmail(note, comm);
             break;
         case GMCommand.GMAuctionList:
             ManageAuction.GMAuctionList(note, comm);
             break;
         case GMCommand.GMAuctionDel:
             ManageAuction.GMAuctionDel(note, comm);
             break;
         case GMCommand.GMBurdenClear:
             ManageAuction.GMBurdenClear(note, comm);
             break;
         case GMCommand.GMMallInfo:
             ManageAuction.GMMallInfo(note);
             break;
         case GMCommand.TaskReset:
             ManageBusiness.TaskReset(note);
             break;
     }
 }
Exemplo n.º 30
0
        /// <summary>
        /// GM删除邮件
        /// </summary>
        /// <param name="note"></param>
        /// <param name="strs"></param>
        public static void GMDelEmail(GMNote note, string[] strs)
        {
            if (strs.Length < 2)
                return;

            PlayerBusiness player = PlayersProxy.FindPlayerByName(strs[0].Trim());
            if (player == null)
                return;
            string[] de = strs[1].Trim().Split('|');

            EmailAccess.Instance.GMRemoveEmail(de, player.ID);
        }