public static string Build() { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { using (PlayerBussiness db = new PlayerBussiness()) { BestEquipInfo[] infos = db.GetCelebByDayBestEquip(); foreach (BestEquipInfo info in infos) { result.Add(FlashUtils.CreateBestEquipInfo(info)); } value = true; message = "Success!"; } } catch (Exception ex) { log.Error("Load CelebByDayBestEquip is fail!", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); return csFunction.CreateCompressXml(result, "CelebForBestEquip", false); }
public void ProcessRequest(HttpContext context) { XElement result = new XElement("Result"); bool registerResult=false; try { string username = HttpUtility.UrlDecode(context.Request["username"]); string password = HttpUtility.UrlDecode(context.Request["password"]); string nickName = HttpUtility.UrlDecode(context.Request["password"]); bool sex=false; int money=100; int giftoken=100; int gold = 100; using (PlayerBussiness db = new PlayerBussiness()) { registerResult=db.RegisterUser(username,password,nickName,sex,money,giftoken,gold);; } } catch (Exception ex) { log.Error("RegisterResult", ex); } finally { result.Add(new XAttribute("value", "vl")); result.Add(new XAttribute("message", registerResult)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); } }
public int HandlePacket(GameClient client, GSPacketIn packet) { GSPacketIn pkg = packet.Clone(); //pkg.ClearContext(); if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked")); return 0; } int id = packet.ReadInt(); int senderID; using (PlayerBussiness db = new PlayerBussiness()) { if (db.DeleteMail(client.Player.PlayerCharacter.ID, id, out senderID)) { client.Out.SendMailResponse(senderID,eMailRespose.Receiver); pkg.WriteBoolean(true); } else { pkg.WriteBoolean(false); } } client.Out.SendTCP(pkg); return 0; }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { int id = Convert.ToInt32(context.Request["userid"]); int selfid = Convert.ToInt32(context.Request["selfid"]); string key = context.Request["key"]; using (PlayerBussiness db = new PlayerBussiness()) { } value = true; message = "Success!"; } catch (Exception ex) { log.Error("IMListLoad", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(string.Format("0,{0},0",DateTime.Now)); //context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false))); }
/// <summary> /// 保存到数据库中 /// </summary> public void SaveToDatabase() { using (PlayerBussiness pb = new PlayerBussiness()) { lock (_lock) { for (int i = 0; i < _items.Length; i++) { ItemInfo item = _items[i]; if (item != null) { if (item.IsDirty) { if (item.ItemID > 0) { pb.UpdateGoods(item); } else { pb.AddGoods(item); } } } } foreach (ItemInfo item in _removedList) { pb.UpdateGoods(item); } _removedList.Clear(); } } }
public bool GetAnnex(string value, GamePlayer player, ref string msg, ref bool result, ref eMessageType eMsg) { int gid = int.Parse(value); using (PlayerBussiness db = new PlayerBussiness()) { ItemInfo goods = db.GetUserItemSingle(gid); if (goods != null) { if (goods.TemplateID == 11408) { player.AddMedal(goods.Count); return true; } else { if (player.AddItem(goods)) { eMsg = eMessageType.Normal; return true; } else { eMsg = eMessageType.ERROR; result = false; msg = LanguageMgr.GetTranslation(goods.GetBagName()) + LanguageMgr.GetTranslation("MailGetAttachHandler.NoPlace"); } } } } return false; }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { int userid = int.Parse(context.Request.Params["ID"]); using (PlayerBussiness db = new PlayerBussiness()) { ItemInfo[] items = db.GetUserItem(userid); foreach (ItemInfo item in items) { result.Add(Road.Flash.FlashUtils.CreateGoodsInfo(item)); } } value = true; message = "Success!"; } catch (Exception ex) { log.Error("LoadUserItems", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); }
protected void Page_Load(object sender, EventArgs e) { int result = 1; try { string username = HttpUtility.UrlDecode(Request["username"]); string site = Request["site"] == null ? "" : HttpUtility.UrlDecode(Request["site"]); if (!string.IsNullOrEmpty(username)) { username = BaseInterface.GetNameBySite(username, site); using (PlayerBussiness db = new PlayerBussiness()) { PlayerInfo info = db.GetUserSingleByUserName(username); if (info != null) { result = 0; } else { result = 2; } } } } catch (Exception ex) { log.Error("UserNameCheck:", ex); } Response.Write(result); }
//修改: Xiaov //时间: 2009-11-7 //描述: 获取用户装备<已测试> public int HandlePacket(GameClient client, GSPacketIn packet) { bool type = packet.ReadBoolean();//_loc_3.writeBoolean(true); int id = packet.ReadInt(); string nickname; if (!type) nickname = packet.ReadString(); GamePlayer player = Managers.WorldMgr.GetPlayerById(id); PlayerInfo info; List<ItemInfo> items; if (player != null) { info = player.PlayerCharacter; items = player.MainBag.GetItems(0, 31); } else { using (PlayerBussiness pb = new PlayerBussiness()) { info = pb.GetUserSingleByUserID(id); items = pb.GetUserEuqip(id); } } if (info != null && items != null) client.Out.SendUserEquip(info, items); return 0; }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { string UserName = context.Request["UserName"]; using (PlayerBussiness db = new PlayerBussiness()) { ArrayList friends = db.GetFriendsGood(UserName); for (int i = 0; i < friends.Count; i++) { XElement node = new XElement("Item", new XAttribute("UserName", friends[i].ToString())); result.Add(node); } } value = true; message = "Success!"; } catch (Exception ex) { log.Error("IMFriendsGood", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); }
/// <summary> /// 从数据库中加载 /// </summary> /// <param name="playerId"></param> public void LoadFromDatabase(int playerId) { lock (m_lock) { using (PlayerBussiness db = new PlayerBussiness()) { BufferInfo[] infos = db.GetUserBuffer(playerId); BeginChanges(); foreach (BufferInfo info in infos) { AbstractBuffer buffer = CreateBuffer(info); if (buffer != null) { buffer.Start(m_player); } } CommitChanges(); } //更新状态 Update(); } }
public int HandlePacket(ClientBase client, GamePacket packet) { int clientID = packet.ReadInt(); string account = packet.ReadUTF(); string nickName = packet.ReadUTF(); int playerID = 0; using (PlayerBussiness pb = new PlayerBussiness()) { playerID = pb.Registe(account, nickName); } if (playerID != 0) { ValidateLoginHandler.SendLoginPacket(client, clientID, account, playerID); } else { //TODO: 发送创建角色失败给客户端 RegisteResultPacket pkg = new RegisteResultPacket(); pkg.ClientID = clientID; client.SendTcp(pkg); } return 0; }
public override void OnTick(MarryRoom room) { try { if(room != null) { room.KickAllPlayer(); using(PlayerBussiness db = new PlayerBussiness()) { db.DisposeMarryRoomInfo(room.Info.ID); } GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.GroomID); GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.BrideID); GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.GroomID, false, room.Info); GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.BrideID, false, room.Info); MarryRoomMgr.RemoveMarryRoom(room); GSPacketIn pkg = new GSPacketIn((short)ePackageType.MARRY_ROOM_DISPOSE); pkg.WriteInt(room.Info.ID); WorldMgr.MarryScene.SendToALL(pkg); room.StopTimer(); } } catch(Exception ex) { if (log.IsErrorEnabled) log.Error("OnTick",ex); } }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { //int id = int.Parse(context.Request["id"]); using (PlayerBussiness db = new PlayerBussiness()) { } value = true; message = "Success!"; } catch (Exception ex) { log.Error("ActivePullDown", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); }
//修改: Xiaov //时间: 2009-11-4 //描述: 修改邮件的已读未读标志<已测试> public int HandlePacket(GameClient client, GSPacketIn packet) { GSPacketIn pkg = packet.Clone(); pkg.ClearContext(); int id = packet.ReadInt(); using (PlayerBussiness db = new PlayerBussiness()) { MailInfo mes = db.GetMailSingle(client.Player.PlayerCharacter.ID, id); if (mes != null && !mes.IsRead) { mes.IsRead = true; if (mes.Type < 100) { mes.ValidDate = 3 * 24; mes.SendTime = DateTime.Now; } db.UpdateMail(mes, mes.Money); pkg.WriteBoolean(true); } else { pkg.WriteBoolean(false); } } client.Out.SendTCP(pkg); return 0; }
/// <summary> /// 从数据库中加载当前玩家的的任务列表 /// </summary> /// <param name="playerId">传入玩家编号</param> public void LoadFromDatabase(int playerId) { lock (_lock) { using (PlayerBussiness db = new PlayerBussiness()) { QuestDataInfo[] infos = db.GetUserQuest(playerId); foreach (QuestDataInfo info in infos) { if (!_currentQuest.ContainsKey(info.QuestID)) { //未开始 //if (info.IsExist && info.QuestInfo.TimeLimit && DateTime.Now.CompareTo(info.QuestInfo.EndDate) > 0) //{ // info.IsExist = false; //} _currentQuest.Add(info.QuestID, info); } } } } ClearConsortiaQuest(); /*清除非工会任务*/ ClearMarryQuest(); /*清除非结婚任务*/ }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { int userID = int.Parse(context.Request["ID"]); using (PlayerBussiness db = new PlayerBussiness()) { QuestDataInfo[] quests = db.GetUserQuest(userID); foreach (QuestDataInfo quest in quests) { result.Add(FlashUtils.CreateQuestDataInfo(quest)); } value = true; message = "Success!"; } } catch (Exception ex) { log.Error("UserQuestList", ex); } result.Add(new XAttribute("vaule", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); //context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false))); }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.CurrentMarryRoom != null && client.Player.PlayerCharacter.ID == client.Player.CurrentMarryRoom.Info.PlayerID) { string roomName = packet.ReadString(); bool isPwdChanged = packet.ReadBoolean(); string pwd = packet.ReadString(); string introduction = packet.ReadString(); MarryRoom room = client.Player.CurrentMarryRoom; room.Info.RoomIntroduction = introduction; room.Info.Name = roomName; if (isPwdChanged) { room.Info.Pwd = pwd; } using (PlayerBussiness db = new PlayerBussiness()) { db.UpdateMarryRoomInfo(room.Info); } room.SendMarryRoomInfoUpdateToScenePlayers(room); client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryRoomInfoUpdateHandler.Successed")); return 0; } return 1; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { //param格式://int templateID, int count, int validDate, int StrengthenLevel, int AttackCompose, int DefendCompose, int AgilityCompose, int LuckCompose, bool isBinds //result:0:成功 1:失败 2:没有该账号 3:ip无效 4:param不合法 5:key错误 6:content内参数列不正确 7:超时 int result=1; //判断IP是否合法 if (ValidSentRewardIP(context.Request.UserHostAddress)) { string content = HttpUtility.UrlDecode(context.Request["content"]); string key = GetSentRewardKey; BaseInterface inter = BaseInterface.CreateInterface(); string[] str_param = inter.UnEncryptSentReward(content, ref result, key); if (str_param.Length == 8 && result != 5 && result != 6 && result != 7) { string mailTitle = str_param[0]; string mailContent = str_param[1]; string username = str_param[2]; int gold = Int32.Parse(str_param[3]); int money = Int32.Parse(str_param[4]); string param = str_param[5]; //判断para是否合法,并将不合法的数值设为默认合法值 if (checkParam(ref param)) { PlayerBussiness pb = new PlayerBussiness(); result = pb.SendMailAndItemByUserName(mailTitle, mailContent, username, gold, money, param); } else { result = 4; } } } else { result = 3; } context.Response.Write(result); } catch(Exception ex) { log.Error("SentReward", ex); } }
public void ProcessRequest(HttpContext context) { bool value = false; string message = LanguageMgr.GetTranslation("Tank.Request.RenameNick.Fail1");// "Login Fail!"; XElement result = new XElement("Result"); try { BaseInterface inter = BaseInterface.CreateInterface(); string p = context.Request["p"]; string site = context.Request["site"] == null ? "" : HttpUtility.UrlDecode(context.Request["site"]); //string nickname = context.Request["nickname"] == null ? "" : HttpUtility.UrlDecode(context.Request["nickname"]); //string newNickname = context.Request["newNickname"] == null ? "" : HttpUtility.UrlDecode(context.Request["newNickname"]); string IP = context.Request.UserHostAddress; if (!string.IsNullOrEmpty(p)) { //解密 byte[] src = CryptoHelper.RsaDecryt2(StaticFunction.RsaCryptor, p); string[] strList = Encoding.UTF8.GetString(src, 7, src.Length - 7).Split(','); if (strList.Length == 5) { string name = strList[0]; string pwd = strList[1]; string newPwd = strList[2]; string nickname = strList[3]; string newNickname = strList[4]; if (PlayerManager.Login(name, pwd)) { using (PlayerBussiness db = new PlayerBussiness()) { if (db.RenameNick(name, nickname, newNickname, ref message)) { PlayerManager.Update(name, newPwd); value = true; message = LanguageMgr.GetTranslation("Tank.Request.RenameNick.Success"); } } } } } } catch (Exception ex) { log.Error("RenameNick", ex); value = false; message = LanguageMgr.GetTranslation("Tank.Request.RenameNick.Fail2"); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); }
public static string BuildCelebConsortia(string file, int order, string fileNotCompress) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); int total = 0; try { int page = 1; int size = 50; //int order = 10; int consortiaID = -1; string name = ""; int level = -1; using (ConsortiaBussiness db = new ConsortiaBussiness()) { ConsortiaInfo[] infos = db.GetConsortiaPage(page, size, ref total, order, name, consortiaID, level,-1); foreach (ConsortiaInfo info in infos) { XElement node = FlashUtils.CreateConsortiaInfo(info); if (info.ChairmanID != 0) { using (PlayerBussiness pb = new PlayerBussiness()) { PlayerInfo player = pb.GetUserSingleByUserID(info.ChairmanID); if (player != null) { node.Add(FlashUtils.CreateCelebInfo(player)); } } } result.Add(node); } value = true; message = "Success!"; } } catch (Exception ex) { log.Error(file + " is fail!", ex); } result.Add(new XAttribute("total", total)); result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); result.Add(new XAttribute("date", System.DateTime.Today.ToString("yyyy-MM-dd"))); if (!string.IsNullOrEmpty(fileNotCompress)) { csFunction.CreateCompressXml(result, fileNotCompress, false); } return csFunction.CreateCompressXml(result, file, true); }
public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet) { if (player.CurrentHotSpringRoom != null) { int num = packet.ReadInt(); if (num <= 0) { return false; } if (player.PlayerCharacter.Money >= num) { player.RemoveMoney(num); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Gift, player.PlayerCharacter.ID, num, player.PlayerCharacter.Money, 0, 0, 0, "", "", ""); using (PlayerBussiness bussiness = new PlayerBussiness()) { string translation = LanguageMgr.GetTranslation("LargessCommand.Content", new object[] { player.PlayerCharacter.NickName, num / 2 }); string str2 = LanguageMgr.GetTranslation("LargessCommand.Title", new object[] { player.PlayerCharacter.NickName }); MailInfo mail = new MailInfo { Annex1 = "", Content = translation, Gold = 0, IsExist = true, Money = num / 2, Receiver = player.CurrentHotSpringRoom.Info.playerName, ReceiverID = player.CurrentHotSpringRoom.Info.playerID, Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]), SenderID = 0, Title = str2, Type = 14 }; bussiness.SendMail(mail); player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver); MailInfo info2 = new MailInfo { Annex1 = "", Content = translation, Gold = 0, IsExist = true, Money = num / 2, Receiver = player.CurrentHotSpringRoom.Info.GroomName, ReceiverID = player.CurrentHotSpringRoom.Info.GroomID, Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]), SenderID = 0, Title = str2, Type = 14 }; bussiness.SendMail(info2); player.Out.SendMailResponse(info2.ReceiverID, eMailRespose.Receiver); } player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("LargessCommand.Succeed", new object[0])); GSPacketIn @in = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("LargessCommand.Notice", new object[] { player.PlayerCharacter.NickName, num })); player.CurrentHotSpringRoom.SendToPlayerExceptSelf(@in, player); return true; } player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0])); } return false; }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; int total = 0; XElement result = new XElement("Result"); try { int page = int.Parse(context.Request["page"]); string name = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["name"])); int type = int.Parse(context.Request["type"]); int pay = int.Parse(context.Request["pay"]); int userID = int.Parse(context.Request["userID"]); int buyID = int.Parse(context.Request["buyID"]); int order = int.Parse(context.Request["order"]); bool sort = bool.Parse(context.Request["sort"]); string AuctionIDs = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["Auctions"])); AuctionIDs = string.IsNullOrEmpty(AuctionIDs) ? "0" : AuctionIDs; int size = 50;//int.Parse(context.Request["size"]); using (PlayerBussiness db = new PlayerBussiness()) { AuctionInfo[] infos = db.GetAuctionPage(page, name, type, pay, ref total, userID, buyID, order, sort, size, AuctionIDs); foreach (AuctionInfo info in infos) { XElement temp = FlashUtils.CreateAuctionInfo(info); using (PlayerBussiness pb = new PlayerBussiness()) { ItemInfo item = pb.GetUserItemSingle(info.ItemID); if (item != null) { temp.Add(Road.Flash.FlashUtils.CreateGoodsInfo(item)); } result.Add(temp); } } value = true; message = "Success!"; } } catch (Exception ex) { log.Error("AuctionPageList", ex); } result.Add(new XAttribute("total", total)); result.Add(new XAttribute("vaule", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); //context.Response.BinaryWrite(StaticFunction.Compress(result.ToString())); }
public void TestMethod2() { PlayerBussiness pb = new PlayerBussiness(); for (int i = 2000; i < 3000; i++) { PlayerInfo info = pb.GetUserSingleByUserID(i); Assert.IsNotNull(info); } }
/// <summary> /// 从数据库中加载 /// </summary> /// <param name="playerId"></param> public void LoadFromDatabase(int playerId) { using (PlayerBussiness pb = new PlayerBussiness()) { ItemInfo[] list = pb.GetUserBagByType(playerId, _bagType); foreach (ItemInfo item in list) { _items[item.Place] = item; } } }
public int HandlePacket(GameClient client, GSPacketIn packet) { bool result = packet.ReadBoolean(); int UserID = packet.ReadInt(); int AnswerId = packet.ReadInt(); //答复对话框ID //先判断自已有没有结婚 if (result && client.Player.PlayerCharacter.IsMarried) { client.Player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg2")); } using (PlayerBussiness db = new PlayerBussiness()) { PlayerInfo tempSpouse = db.GetUserSingleByUserID(UserID); //发送好人卡 if (!result) { SendGoodManCard(tempSpouse.NickName, tempSpouse.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ID, db); GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID); } //判断对方有没有结婚 if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex) { return 1; } if (tempSpouse.IsMarried) { client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg3")); } MarryApplyInfo info = new MarryApplyInfo(); info.UserID = UserID; info.ApplyUserID = client.Player.PlayerCharacter.ID; info.ApplyUserName = client.Player.PlayerCharacter.NickName; info.ApplyType = 2; info.LoveProclamation = ""; info.ApplyResult = result; int id = 0; if (db.SavePlayerMarryNotice(info, AnswerId, ref id)) { if (result) { client.Player.Out.SendMarryApplyReply(client.Player, tempSpouse.ID, tempSpouse.NickName, result, false, id); client.Player.LoadMarryProp(); SendSYSMessages(client.Player, tempSpouse); } GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID); return 0; } } return 1; }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { int id = int.Parse(context.Request["id"]); using (PlayerBussiness db = new PlayerBussiness()) { FriendInfo[] infos = db.GetFriendsAll(id); foreach (FriendInfo g in infos) { XElement node = new XElement("Item", new XAttribute("ID", g.FriendID), //new XAttribute("ID",g.ID), new XAttribute("NickName", g.NickName), new XAttribute("LoginName", g.UserName), new XAttribute("Style", g.Style), new XAttribute("Sex", g.Sex == 1 ? true : false), new XAttribute("Colors", g.Colors), new XAttribute("Grade", g.Grade), new XAttribute("Hide", g.Hide), new XAttribute("ConsortiaName", g.ConsortiaName), new XAttribute("TotalCount", g.Total), new XAttribute("EscapeCount", g.Escape), new XAttribute("WinCount", g.Win), new XAttribute("Offer", g.Offer), new XAttribute("Relation", g.Relation), new XAttribute("Repute", g.Repute), new XAttribute("State", g.State == 1 ? 1 : 0), new XAttribute("Nimbus",g.Nimbus), new XAttribute("DutyName", g.DutyName)); result.Add(node); } } value = true; message = "Success!"; } catch (Exception ex) { log.Error("IMListLoad", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); //context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false))); }
//修改: Xiaov //时间: 2009-11-7 //描述: 用户与用户之间私聊<已测试> public int HandlePacket(GameClient client, GSPacketIn packet) { int receiverID = packet.ReadInt(); //int senderID = packet.ReadInt(); string receiver = packet.ReadString(); string sender = packet.ReadString(); string msg = packet.ReadString(); bool isAutoReply = packet.ReadBoolean(); if (receiverID == 0) { using (PlayerBussiness db = new PlayerBussiness()) { PlayerInfo info = db.GetUserSingleByNickName(receiver); if (info != null) receiverID = info.ID; } } if (receiverID != 0) { GSPacketIn pkg = packet.Clone(); pkg.ClearContext(); pkg.WriteInt(receiverID); pkg.ClientID = (client.Player.PlayerCharacter.ID); //pkg.WriteInt(senderID); pkg.WriteString(receiver); pkg.WriteString(sender); pkg.WriteString(msg); pkg.WriteBoolean(false); GamePlayer player = Managers.WorldMgr.GetPlayerById(receiverID); if (player != null) { if (player.IsBlackFriend(client.Player.PlayerCharacter.ID)) return 1; player.Out.SendTCP(pkg); } else { GameServer.Instance.LoginServer.SendPacket(pkg); } client.Out.SendTCP(pkg); } else { client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserPrivateChatHandler.NoUser")); } return 1; }
public int HandlePacket(GameClient client, GSPacketIn packet) { //已经开始游戏则不处理 if (client.Player.CurrentRoom != null && client.Player.CurrentRoom.IsPlaying) return 0; int bagType = packet.ReadByte(); int index = packet.ReadInt(); PlayerInventory bag = client.Player.GetInventory((eBageType)bagType); ItemInfo item = bag.GetItemAt(index); if (item != null && !item.IsValidItem()) { if (bagType == 0 && index < 11) { int place = bag.FindFirstEmptySlot(31); if (place != -1) { bag.RemoveItem(item); //bag.MoveItem(item.Place, place); } else { using (PlayerBussiness pb = new PlayerBussiness()) { MailInfo mail = new MailInfo(); mail.Annex1 = item.ItemID.ToString(); mail.Content = LanguageMgr.GetTranslation("ItemOverdueHandler.Content"); mail.Gold = 0; mail.IsExist = true; mail.Money = 0; mail.Receiver = client.Player.PlayerCharacter.NickName; mail.ReceiverID = item.UserID; mail.Sender = client.Player.PlayerCharacter.NickName; mail.SenderID = item.UserID; mail.Title = LanguageMgr.GetTranslation("ItemOverdueHandler.Title"); mail.Type = (int)eMailType.ItemOverdue; if (pb.SendMail(mail)) { //item.UserID = 0; bag.RemoveItem(item); } } } } else { bag.UpdateItem(item); } } return 0; }
public int KitoffUserByNickName(string name, string msg) { int result = 1; using (PlayerBussiness db = new PlayerBussiness()) { PlayerInfo player = db.GetUserSingleByNickName(name); if (player == null) return 2; result = KitoffUser(player.ID, msg); } return result; }
public int KitoffUserByNickName(string name, string msg) { int num = 1; using (PlayerBussiness playerBussiness = new PlayerBussiness()) { PlayerInfo singleByNickName = playerBussiness.GetUserSingleByNickName(name); if (singleByNickName == null) { return(2); } num = this.KitoffUser(singleByNickName.ID, msg); } return(num); }
public int KitoffUserByUserName(string name, string msg) { int result = 1; using (PlayerBussiness playerBussiness = new PlayerBussiness()) { PlayerInfo userSingleByUserName = playerBussiness.GetUserSingleByUserName(name); if (userSingleByUserName == null) { return(2); } result = this.KitoffUser(userSingleByUserName.ID, msg); } return(result); }
public int KitoffUserByNickName(string name, string msg) { int result = 1; using (PlayerBussiness db = new PlayerBussiness()) { PlayerInfo player = db.GetUserSingleByNickName(name); if (player == null) { return(2); } result = KitoffUser(player.ID, msg); } return(result); }