public static void Process(IHttpRequest Request, IHttpResponse Response) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); int total = 0; try { int page = int.Parse(Request.Uri.QueryString["page"]); int size = int.Parse(Request.Uri.QueryString["size"]); int order = int.Parse(Request.Uri.QueryString["order"]); int consortiaID = int.Parse(Request.Uri.QueryString["consortiaID"]); int dutyID = int.Parse(Request.Uri.QueryString["dutyID"]); using (ConsortiaBussiness db = new ConsortiaBussiness()) { ConsortiaDutyInfo[] infos = db.GetConsortiaDutyPage(page, size, ref total, order, consortiaID, dutyID); ConsortiaDutyInfo[] array = infos; for (int i = 0; i < array.Length; i++) { ConsortiaDutyInfo info = array[i]; result.Add(FlashUtils.CreateConsortiaDutyInfo(info)); } value = true; message = "Success!"; } } catch (Exception ex) { } result.Add(new XAttribute("total", total)); result.Add(new XAttribute("vaule", value)); result.Add(new XAttribute("message", message)); Response.Write(result.ToString(false)); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { int result2; if (player.PlayerCharacter.ConsortiaID == 0) { result2 = 0; } else { int id = packet.ReadInt(); bool upGrade = packet.ReadBoolean(); bool result = false; string msg = "ConsortiaUserGradeUpdateHandler.Failed"; using (ConsortiaBussiness db = new ConsortiaBussiness()) { string tempUserName = ""; ConsortiaDutyInfo info = new ConsortiaDutyInfo(); if (db.UpdateConsortiaUserGrade(id, player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, upGrade, ref msg, ref info, ref tempUserName)) { msg = "ConsortiaUserGradeUpdateHandler.Success"; result = true; GameServer.Instance.LoginServer.SendConsortiaDuty(info, upGrade ? 6 : 7, player.PlayerCharacter.ConsortiaID, id, tempUserName, player.PlayerCharacter.ID, player.PlayerCharacter.NickName); } } packet.WriteBoolean(result); packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0])); player.Out.SendTCP(packet); result2 = 0; } return(result2); }
public static XElement CreateConsortiaDutyInfo(ConsortiaDutyInfo info) { return(new XElement("Item", new XAttribute("DutyID", info.DutyID), new XAttribute("ConsortiaID", info.ConsortiaID), new XAttribute("DutyName", info.DutyName == null ? "" : info.DutyName), new XAttribute("Right", info.Right), new XAttribute("Level", info.Level))); }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.PlayerCharacter.ConsortiaID == 0) { return(0); } int dutyID = packet.ReadInt(); int updateType = packet.ReadByte(); //int level = packet.ReadInt(); bool result = false; string msg = "ConsortiaDutyUpdateHandler.Failed"; using (ConsortiaBussiness db = new ConsortiaBussiness()) { ConsortiaDutyInfo info = new ConsortiaDutyInfo(); info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID; info.DutyID = dutyID; info.IsExist = true; info.DutyName = ""; switch (updateType) { case 1: return(1); case 2: info.DutyName = packet.ReadString(); if (string.IsNullOrEmpty(info.DutyName) || System.Text.Encoding.Default.GetByteCount(info.DutyName) > 10) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaDutyUpdateHandler.Long")); return(1); } info.Right = packet.ReadInt(); break; case 3: break; case 4: break; } if (db.UpdateConsortiaDuty(info, client.Player.PlayerCharacter.ID, updateType, ref msg)) { dutyID = info.DutyID; msg = "ConsortiaDutyUpdateHandler.Success"; result = true; GameServer.Instance.LoginServer.SendConsortiaDuty(info, updateType, client.Player.PlayerCharacter.ConsortiaID); } } packet.WriteBoolean(result); packet.WriteInt(dutyID); packet.WriteString(LanguageMgr.GetTranslation(msg)); client.Out.SendTCP(packet); return(0); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { int result2; if (player.PlayerCharacter.ConsortiaID == 0) { result2 = 0; } else { int dutyID = packet.ReadInt(); int updateType = (int)packet.ReadByte(); bool result = false; string msg = "ConsortiaDutyUpdateHandler.Failed"; using (ConsortiaBussiness db = new ConsortiaBussiness()) { ConsortiaDutyInfo info = new ConsortiaDutyInfo(); info.ConsortiaID = player.PlayerCharacter.ConsortiaID; info.DutyID = dutyID; info.IsExist = true; info.DutyName = ""; switch (updateType) { case 1: result2 = 1; return(result2); case 2: info.DutyName = packet.ReadString(); if (string.IsNullOrEmpty(info.DutyName) || Encoding.Default.GetByteCount(info.DutyName) > 10) { player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaDutyUpdateHandler.Long", new object[0])); result2 = 1; return(result2); } info.Right = packet.ReadInt(); break; } if (db.UpdateConsortiaDuty(info, player.PlayerCharacter.ID, updateType, ref msg)) { dutyID = info.DutyID; msg = "ConsortiaDutyUpdateHandler.Success"; result = true; GameServer.Instance.LoginServer.SendConsortiaDuty(info, updateType, player.PlayerCharacter.ConsortiaID); } } packet.WriteBoolean(result); packet.WriteInt(dutyID); packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0])); player.Out.SendTCP(packet); result2 = 0; } return(result2); }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.PlayerCharacter.ConsortiaID == 0) { return(0); } //int id = packet.ReadInt(); string nickName = packet.ReadString(); bool result = false; string msg = "ConsortiaChangeChairmanHandler.Failed"; if (string.IsNullOrEmpty(nickName)) { msg = "ConsortiaChangeChairmanHandler.NoName"; } else if (nickName == client.Player.PlayerCharacter.NickName) { msg = "ConsortiaChangeChairmanHandler.Self"; } else { using (ConsortiaBussiness db = new ConsortiaBussiness()) { string tempUserName = ""; int tempUserID = 0; ConsortiaDutyInfo info = new ConsortiaDutyInfo(); if (db.UpdateConsortiaChairman(nickName, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg, ref info, ref tempUserID, ref tempUserName)) { ConsortiaDutyInfo orderInfo = new ConsortiaDutyInfo(); orderInfo.Level = client.Player.PlayerCharacter.DutyLevel; orderInfo.DutyName = client.Player.PlayerCharacter.DutyName; orderInfo.Right = client.Player.PlayerCharacter.Right; msg = "ConsortiaChangeChairmanHandler.Success1"; result = true; GameServer.Instance.LoginServer.SendConsortiaDuty(orderInfo, 9, client.Player.PlayerCharacter.ConsortiaID, tempUserID, tempUserName, 0, ""); GameServer.Instance.LoginServer.SendConsortiaDuty(info, 8, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, 0, ""); } } } string temp = LanguageMgr.GetTranslation(msg); if (msg == "ConsortiaChangeChairmanHandler.Success1") { temp += nickName + LanguageMgr.GetTranslation("ConsortiaChangeChairmanHandler.Success2"); } packet.WriteBoolean(result); packet.WriteString(temp); client.Out.SendTCP(packet); return(0); }
public void SendConsortiaDuty(ConsortiaDutyInfo info, int updateType, int consortiaID, int playerID, string playerName, int handleID, string handleName) { GSPacketIn pkg = new GSPacketIn(128); pkg.WriteByte(8); pkg.WriteByte((byte)updateType); pkg.WriteInt(consortiaID); pkg.WriteInt(playerID); pkg.WriteString(playerName); pkg.WriteInt(info.Level); pkg.WriteString(info.DutyName); pkg.WriteInt(info.Right); pkg.WriteInt(handleID); pkg.WriteString(handleName); this.SendTCP(pkg); }
//updateType:1.添加责务,2.更改责务,3.职务升级,4.职务降级,5.个人改变,6.个人升级,7.个人降级,8.会长转让,9.升会长。 public void SendConsortiaDuty(ConsortiaDutyInfo info, int updateType, int consortiaID, int playerID, string playerName, int handleID, string handleName) { GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.CONSORTIA_RESPONSE); pkg.WriteByte(8); pkg.WriteByte((byte)updateType); pkg.WriteInt(consortiaID); pkg.WriteInt(playerID); pkg.WriteString(playerName); pkg.WriteInt(info.Level); pkg.WriteString(info.DutyName); pkg.WriteInt(info.Right); pkg.WriteInt(handleID); pkg.WriteString(handleName); SendTCP(pkg); }
public void SendConsortiaDuty(ConsortiaDutyInfo info, int updateType, int consortiaID) { SendConsortiaDuty(info, updateType, consortiaID, 0, "", 0, ""); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { int result2; if (player.PlayerCharacter.ConsortiaID == 0) { result2 = 0; } else { string nickName = packet.ReadString(); bool result = false; string msg = "ConsortiaChangeChairmanHandler.Failed"; if (string.IsNullOrEmpty(nickName)) { msg = "ConsortiaChangeChairmanHandler.NoName"; } else { if (nickName == player.PlayerCharacter.NickName) { msg = "ConsortiaChangeChairmanHandler.Self"; } else { using (ConsortiaBussiness db = new ConsortiaBussiness()) { string tempUserName = ""; int tempUserID = 0; ConsortiaDutyInfo info = new ConsortiaDutyInfo(); if (db.UpdateConsortiaChairman(nickName, player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, ref msg, ref info, ref tempUserID, ref tempUserName)) { ConsortiaDutyInfo orderInfo = new ConsortiaDutyInfo(); orderInfo.Level = player.PlayerCharacter.DutyLevel; orderInfo.DutyName = player.PlayerCharacter.DutyName; orderInfo.Right = player.PlayerCharacter.Right; msg = "ConsortiaChangeChairmanHandler.Success1"; result = true; GameServer.Instance.LoginServer.SendConsortiaDuty(orderInfo, 9, player.PlayerCharacter.ConsortiaID, tempUserID, tempUserName, 0, ""); GameServer.Instance.LoginServer.SendConsortiaDuty(info, 8, player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, player.PlayerCharacter.NickName, 0, ""); ConsortiaMgr.ConsortiaChangChairman(player.PlayerCharacter.ConsortiaID, nickName); } if (db.UpdateConsortiaIsBanChat(tempUserID, player.PlayerCharacter.ConsortiaID, tempUserID, false, ref tempUserID, ref tempUserName, ref msg)) { GameServer.Instance.LoginServer.SendConsortiaBanChat(tempUserID, tempUserName, player.PlayerCharacter.ID, player.PlayerCharacter.NickName, false); } } } } string temp = LanguageMgr.GetTranslation(msg, new object[0]); if (msg == "ConsortiaChangeChairmanHandler.Success1") { temp = temp + nickName + LanguageMgr.GetTranslation("ConsortiaChangeChairmanHandler.Success2", new object[0]); } packet.WriteBoolean(result); packet.WriteString(temp); player.Out.SendTCP(packet); result2 = 0; } return(result2); }
public int HandlePacket(GameClient client, GSPacketIn packet) { var consortiaCmd = packet.ReadInt(); bool result = false; string msg = "Packet Error!"; ConsortiaLevelInfo levelInfo = null; GamePlayer[] players = WorldMgr.GetAllPlayers(); switch (consortiaCmd) { case (int)ConsortiaPackageType.CONSORTIA_TRYIN: HandleCONSORTIA_TRYIN(packet); break; case (int)ConsortiaPackageType.CONSORTIA_CREATE: //Create Guild { if (client.Player.PlayerCharacter.ConsortiaID != 0) return 0; levelInfo = ConsortiaLevelMgr.FindConsortiaLevelInfo(1); string name = packet.ReadString(); //if (string.IsNullOrEmpty(name) || System.Text.Encoding.Default.GetByteCount(name) > 12) //{ // client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaCreateHandler.Long")); // return 1; //} //result = false; int id = 0; int mustGold = levelInfo.NeedGold; int mustLevel = 5; msg = "ConsortiaCreateHandler.Failed"; ConsortiaDutyInfo dutyInfo = new ConsortiaDutyInfo(); if (!string.IsNullOrEmpty(name) && client.Player.PlayerCharacter.Gold >= mustGold && client.Player.PlayerCharacter.Grade >= mustLevel) { using (ConsortiaBussiness db = new ConsortiaBussiness()) { ConsortiaInfo info = new ConsortiaInfo(); info.BuildDate = DateTime.Now; info.CelebCount = 0; info.ChairmanID = client.Player.PlayerCharacter.ID; info.ChairmanName = client.Player.PlayerCharacter.NickName; info.ConsortiaName = name; info.CreatorID = info.ChairmanID; info.CreatorName = info.ChairmanName; info.Description = ""; info.Honor = 0; info.IP = ""; info.IsExist = true; info.Level = levelInfo.Level; info.MaxCount = levelInfo.Count; info.Riches = levelInfo.Riches; info.Placard = ""; info.Port = 0; info.Repute = 0; info.Count = 1; if (db.AddConsortia(info, ref msg, ref dutyInfo)) { client.Player.PlayerCharacter.ConsortiaID = info.ConsortiaID; client.Player.PlayerCharacter.ConsortiaName = info.ConsortiaName; client.Player.PlayerCharacter.DutyLevel = dutyInfo.Level; client.Player.PlayerCharacter.DutyName = dutyInfo.DutyName; client.Player.PlayerCharacter.Right = dutyInfo.Right; client.Player.PlayerCharacter.ConsortiaLevel = levelInfo.Level; client.Player.RemoveGold(mustGold); msg = "ConsortiaCreateHandler.Success"; result = true; id = info.ConsortiaID; GameServer.Instance.LoginServer.SendConsortiaCreate(id, client.Player.PlayerCharacter.Offer, info.ConsortiaName); } else { client.Player.SendMessage("db.AddConsortia Error "); } } } //Send package create Guild client.Out.SendConsortiaCreate(name, result, id, name, LanguageMgr.GetTranslation(msg), dutyInfo.Level, dutyInfo.DutyName, dutyInfo.Right, client.Player.PlayerCharacter.ID); } break; case (int)ConsortiaPackageType.CONSORTIA_DISBAND: HandleCONSORTIA_DISBAND(packet); break; case (int)ConsortiaPackageType.CONSORTIA_RENEGADE: HandleCONSORTIA_RENEGADE(packet); break; case (int)ConsortiaPackageType.CONSORTIA_TRYIN_PASS: HandleCONSORTIA_TRYIN_PASS(packet); break; case (int)ConsortiaPackageType.CONSORTIA_TRYIN_DEL: HandleCONSORTIA_TRYIN_DEL(packet); break; case (int)ConsortiaPackageType.CONSORTIA_RICHES_OFFER: break; case (int)ConsortiaPackageType.CONSORTIA_APPLY_STATE: break; case (int)ConsortiaPackageType.CONSORTIA_DUTY_DELETE: break; case (int)ConsortiaPackageType.CONSORTIA_DUTY_UPDATE: break; case (int)ConsortiaPackageType.CONSORTIA_INVITE: break; case (int)ConsortiaPackageType.CONSORTIA_INVITE_PASS: break; case (int)ConsortiaPackageType.CONSORTIA_INVITE_DELETE: break; case (int)ConsortiaPackageType.CONSORTIA_DESCRIPTION_UPDATE: break; case (int)ConsortiaPackageType.CONSORTIA_PLACARD_UPDATE: break; case (int)ConsortiaPackageType.CONSORTIA_BANCHAT_UPDATE: break; case (int)ConsortiaPackageType.CONSORTIA_USER_REMARK_UPDATE: break; case (int)ConsortiaPackageType.CONSORTIA_USER_GRADE_UPDATE: break; case (int)ConsortiaPackageType.CONSORTIA_CHAIRMAN_CHAHGE: break; case (int)ConsortiaPackageType.CONSORTIA_CHAT: break; case (int)ConsortiaPackageType.CONSORTIA_LEVEL_UP: break; case (int)ConsortiaPackageType.CONSORTIA_TASK_RELEASE: break; case (int)ConsortiaPackageType.DONATE: break; case (int)ConsortiaPackageType.CONSORTIA_EQUIP_CONTROL: break; case (int)ConsortiaPackageType.POLL_CANDIDATE: break; case (int)ConsortiaPackageType.SKILL_SOCKET: break; case (int)ConsortiaPackageType.CONSORTION_MAIL: break; case (int)ConsortiaPackageType.BUY_BADGE: break; } return 0; }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.PlayerCharacter.ConsortiaID != 0) { return(0); } ConsortiaLevelInfo levelInfo = ConsortiaLevelMgr.FindConsortiaLevelInfo(1); string name = packet.ReadString(); if (string.IsNullOrEmpty(name) || System.Text.Encoding.Default.GetByteCount(name) > 12) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaCreateHandler.Long")); return(1); } bool result = false; int id = 0; int mustGold = levelInfo.NeedGold; int mustLevel = 5; string msg = "ConsortiaCreateHandler.Failed"; ConsortiaDutyInfo dutyInfo = new ConsortiaDutyInfo(); if (!string.IsNullOrEmpty(name) && client.Player.PlayerCharacter.Gold >= mustGold && client.Player.PlayerCharacter.Grade >= mustLevel) { using (ConsortiaBussiness db = new ConsortiaBussiness()) { ConsortiaInfo info = new ConsortiaInfo(); info.BuildDate = DateTime.Now; info.CelebCount = 0; info.ChairmanID = client.Player.PlayerCharacter.ID; info.ChairmanName = client.Player.PlayerCharacter.NickName; info.ConsortiaName = name; info.CreatorID = info.ChairmanID; info.CreatorName = info.ChairmanName; info.Description = ""; info.Honor = 0; info.IP = ""; info.IsExist = true; info.Level = levelInfo.Level; info.MaxCount = levelInfo.Count; info.Riches = levelInfo.Riches; info.Placard = ""; info.Port = 0; info.Repute = 0; info.Count = 1; if (db.AddConsortia(info, ref msg, ref dutyInfo)) { client.Player.PlayerCharacter.ConsortiaID = info.ConsortiaID; client.Player.PlayerCharacter.ConsortiaName = info.ConsortiaName; client.Player.PlayerCharacter.DutyLevel = dutyInfo.Level; client.Player.PlayerCharacter.DutyName = dutyInfo.DutyName; client.Player.PlayerCharacter.Right = dutyInfo.Right; client.Player.PlayerCharacter.ConsortiaLevel = levelInfo.Level; client.Player.RemoveGold(mustGold); msg = "ConsortiaCreateHandler.Success"; result = true; id = info.ConsortiaID; GameServer.Instance.LoginServer.SendConsortiaCreate(id, client.Player.PlayerCharacter.Offer, info.ConsortiaName); } } } packet.WriteBoolean(result); packet.WriteInt(id); packet.WriteString(name); packet.WriteString(LanguageMgr.GetTranslation(msg)); packet.WriteInt(dutyInfo.Level); packet.WriteString(dutyInfo.DutyName == null ? "" : dutyInfo.DutyName); packet.WriteInt(dutyInfo.Right); client.Out.SendTCP(packet); //client.Out.SendMessage(eMessageType.Normal, msg); return(0); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { int result2; if (player.PlayerCharacter.ConsortiaID != 0) { result2 = 0; } else { ConsortiaLevelInfo levelInfo = ConsortiaLevelMgr.FindConsortiaLevelInfo(1); string name = packet.ReadString(); if (string.IsNullOrEmpty(name) || Encoding.Default.GetByteCount(name) > 12) { player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaCreateHandler.Long", new object[0])); result2 = 1; } else { bool result = false; int id = 0; //int mustGold = levelInfo.NeedGold; //int mustLevel = 5; string msg = "ConsortiaCreateHandler.Failed"; ConsortiaDutyInfo dutyInfo = new ConsortiaDutyInfo(); if (!string.IsNullOrEmpty(name) && player.PlayerCharacter.Money >= 1000) { using (ConsortiaBussiness db = new ConsortiaBussiness()) { ConsortiaInfo info = new ConsortiaInfo(); info.BuildDate = DateTime.Now; info.CelebCount = 0; info.ChairmanID = player.PlayerCharacter.ID; info.ChairmanName = player.PlayerCharacter.NickName; info.ConsortiaName = name; info.CreatorID = info.ChairmanID; info.CreatorName = info.ChairmanName; info.Description = ""; info.Honor = 0; info.IP = ""; info.IsExist = true; info.Level = levelInfo.Level; info.MaxCount = levelInfo.Count; info.Riches = levelInfo.Riches; info.Placard = ""; info.Port = 0; info.Repute = 0; info.Count = 1; if (db.AddConsortia(info, ref msg, ref dutyInfo)) { player.PlayerCharacter.ConsortiaID = info.ConsortiaID; player.PlayerCharacter.ConsortiaName = info.ConsortiaName; player.PlayerCharacter.DutyLevel = dutyInfo.Level; player.PlayerCharacter.DutyName = dutyInfo.DutyName; player.PlayerCharacter.Right = dutyInfo.Right; player.PlayerCharacter.ConsortiaLevel = levelInfo.Level; player.RemoveGold(1000); msg = "ConsortiaCreateHandler.Success"; result = true; id = info.ConsortiaID; GameServer.Instance.LoginServer.SendConsortiaCreate(id, player.PlayerCharacter.Offer, info.ChairmanName); } } } packet.WriteBoolean(result); packet.WriteInt(id); packet.WriteString("cName");//UnKnown packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0])); packet.WriteInt(dutyInfo.Level); packet.WriteString((dutyInfo.DutyName == null) ? "" : dutyInfo.DutyName); packet.WriteInt(dutyInfo.Right); player.Out.SendTCP(packet); result2 = 0; } } return(result2); }