public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.PlayerCharacter.ConsortiaID == 0) return 0; int id = packet.ReadInt(); bool result = false; string msg = "ConsortiaApplyLoginPassHandler.Failed"; using (ConsortiaBussiness db = new ConsortiaBussiness()) { int consortiaRepute = 0; ConsortiaUserInfo info = new ConsortiaUserInfo(); if (db.PassConsortiaApplyUsers(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ConsortiaID, ref msg, info, ref consortiaRepute)) { msg = "ConsortiaApplyLoginPassHandler.Success"; result = true; if (info.UserID != 0) { info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID; info.ConsortiaName = client.Player.PlayerCharacter.ConsortiaName; GameServer.Instance.LoginServer.SendConsortiaUserPass(client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, info, false, consortiaRepute, info.LoginName, client.Player.PlayerCharacter.FightPower); } } } packet.WriteBoolean(result); packet.WriteString(LanguageMgr.GetTranslation(msg)); client.Out.SendTCP(packet); return 0; }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.PlayerCharacter.ConsortiaID != 0) return 0; int id = packet.ReadInt(); bool result = false; int consortiaID = 0; string consortiaName = ""; string msg = "ConsortiaInvitePassHandler.Failed"; int tempID = 0; string tempName = ""; using (ConsortiaBussiness db = new ConsortiaBussiness()) { int consortiaRepute = 0; ConsortiaUserInfo info = new ConsortiaUserInfo(); if (db.PassConsortiaInviteUsers(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, ref consortiaID, ref consortiaName, ref msg, info, ref tempID, ref tempName, ref consortiaRepute)) { client.Player.PlayerCharacter.ConsortiaID = consortiaID; client.Player.PlayerCharacter.ConsortiaName = consortiaName; client.Player.PlayerCharacter.DutyLevel = info.Level; client.Player.PlayerCharacter.DutyName = info.DutyName; client.Player.PlayerCharacter.Right = info.Right; ConsortiaInfo consotia = ConsortiaMgr.FindConsortiaInfo(consortiaID); if (consotia != null) client.Player.PlayerCharacter.ConsortiaLevel = consotia.Level; msg = "ConsortiaInvitePassHandler.Success"; result = true; info.UserID = client.Player.PlayerCharacter.ID; info.UserName = client.Player.PlayerCharacter.NickName; info.Grade = client.Player.PlayerCharacter.Grade; info.Offer = client.Player.PlayerCharacter.Offer; info.RichesOffer = client.Player.PlayerCharacter.RichesOffer; info.RichesRob = client.Player.PlayerCharacter.RichesRob; info.Win = client.Player.PlayerCharacter.Win; info.Total = client.Player.PlayerCharacter.Total; info.Escape = client.Player.PlayerCharacter.Escape; info.ConsortiaID = consortiaID; info.ConsortiaName = consortiaName; GameServer.Instance.LoginServer.SendConsortiaUserPass(tempID, tempName, info, true, consortiaRepute, client.Player.PlayerCharacter.UserName, client.Player.PlayerCharacter.FightPower); } } packet.WriteBoolean(result); packet.WriteInt(consortiaID); packet.WriteString(consortiaName); packet.WriteString(LanguageMgr.GetTranslation(msg)); client.Out.SendTCP(packet); return 0; }
public bool PassConsortiaInviteUsers(int inviteID, int userID, string userName, ref int consortiaID, ref string consortiaName, ref string msg, ConsortiaUserInfo info, ref int tempID, ref string tempName, ref int consortiaRepute) { bool result = false; try { SqlParameter[] para = new SqlParameter[24]; para[0] = new SqlParameter("@ID", inviteID); para[1] = new SqlParameter("@UserID", userID); para[2] = new SqlParameter("@UserName", userName); para[3] = new SqlParameter("@ConsortiaID", consortiaID); para[3].Direction = ParameterDirection.InputOutput; para[4] = new SqlParameter("@ConsortiaName", System.Data.SqlDbType.NVarChar, 100); para[4].Value = consortiaName; para[4].Direction = ParameterDirection.InputOutput; para[5] = new SqlParameter("@Result", System.Data.SqlDbType.Int); para[5].Direction = ParameterDirection.ReturnValue; para[6] = new SqlParameter("@tempName", System.Data.SqlDbType.NVarChar, 100); para[6].Direction = ParameterDirection.InputOutput; para[6].Value = tempName; para[7] = new SqlParameter("@tempDutyID", System.Data.SqlDbType.Int); para[7].Direction = ParameterDirection.InputOutput; para[7].Value = info.DutyID; para[8] = new SqlParameter("@tempDutyName", System.Data.SqlDbType.NVarChar, 100); para[8].Direction = ParameterDirection.InputOutput; para[8].Value = ""; para[9] = new SqlParameter("@tempOffer", System.Data.SqlDbType.Int); para[9].Direction = ParameterDirection.InputOutput; para[9].Value = info.Offer; para[10] = new SqlParameter("@tempRichesOffer", System.Data.SqlDbType.Int); para[10].Direction = ParameterDirection.InputOutput; para[10].Value = info.RichesOffer; para[11] = new SqlParameter("@tempRichesRob", System.Data.SqlDbType.Int); para[11].Direction = ParameterDirection.InputOutput; para[11].Value = info.RichesRob; para[12] = new SqlParameter("@tempLastDate", System.Data.SqlDbType.DateTime); para[12].Direction = ParameterDirection.InputOutput; para[12].Value = DateTime.Now; para[13] = new SqlParameter("@tempWin", System.Data.SqlDbType.Int); para[13].Direction = ParameterDirection.InputOutput; para[13].Value = info.Win; para[14] = new SqlParameter("@tempTotal", System.Data.SqlDbType.Int); para[14].Direction = ParameterDirection.InputOutput; para[14].Value = info.Total; para[15] = new SqlParameter("@tempEscape", System.Data.SqlDbType.Int); para[15].Direction = ParameterDirection.InputOutput; para[15].Value = info.Escape; para[16] = new SqlParameter("@tempID", System.Data.SqlDbType.Int); para[16].Direction = ParameterDirection.InputOutput; para[16].Value = tempID; para[17] = new SqlParameter("@tempGrade", System.Data.SqlDbType.Int); para[17].Direction = ParameterDirection.InputOutput; para[17].Value = info.Level; para[18] = new SqlParameter("@tempLevel", System.Data.SqlDbType.Int); para[18].Direction = ParameterDirection.InputOutput; para[18].Value = info.Level; para[19] = new SqlParameter("@tempCUID", System.Data.SqlDbType.Int); para[19].Direction = ParameterDirection.InputOutput; para[19].Value = info.ID; para[20] = new SqlParameter("@tempState", System.Data.SqlDbType.Int); para[20].Direction = ParameterDirection.InputOutput; para[20].Value = info.State; para[21] = new SqlParameter("@tempSex", System.Data.SqlDbType.Bit); para[21].Direction = ParameterDirection.InputOutput; para[21].Value = info.Sex; para[22] = new SqlParameter("@tempRight", System.Data.SqlDbType.Int); para[22].Direction = ParameterDirection.InputOutput; para[22].Value = info.Right; para[23] = new SqlParameter("@tempConsortiaRepute", System.Data.SqlDbType.Int); para[23].Direction = ParameterDirection.InputOutput; para[23].Value = consortiaRepute; db.RunProcedure("SP_ConsortiaInviteUser_Pass", para); int returnValue = (int)para[5].Value; result = returnValue == 0; if (result) { consortiaID = (int)para[3].Value; consortiaName = para[4].Value.ToString(); tempName = para[6].Value.ToString(); info.DutyID = (int)para[7].Value; info.DutyName = para[8].Value.ToString(); info.Offer = (int)para[9].Value; info.RichesOffer = (int)para[10].Value; info.RichesRob = (int)para[11].Value; info.LastDate = (DateTime)para[12].Value; info.Win = (int)para[13].Value; info.Total = (int)para[14].Value; info.Escape = (int)para[15].Value; tempID = (int)para[16].Value; info.Grade = (int)para[17].Value; info.Level = (int)para[18].Value; info.ID = (int)para[19].Value; info.State = (int)para[20].Value; info.Sex = (bool)para[21].Value; info.Right = (int)para[22].Value; consortiaRepute = (int)para[23].Value; } switch (returnValue) { case 3: msg = "ConsortiaBussiness.PassConsortiaInviteUsers.Msg3"; break; case 6: msg = "ConsortiaBussiness.PassConsortiaInviteUsers.Msg6"; break; } } catch (Exception e) { if (log.IsErrorEnabled) log.Error("Init", e); } return result; }
public ConsortiaUserInfo[] GetConsortiaUsersPage(int page, int size, ref int total, int order, int consortiaID, int userID, int state) { List<ConsortiaUserInfo> infos = new List<ConsortiaUserInfo>(); try { string sWhere = " IsExist=1 "; if (consortiaID != -1) { sWhere += " and ConsortiaID =" + consortiaID + " "; } if (userID != -1) { sWhere += " and UserID =" + userID + " "; } if (state != -1) { sWhere += " and state =" + state + " "; } string sOrder = "UserName"; switch (order) { case 1: sOrder = "DutyID"; break; case 2: sOrder = "Grade"; break; case 3: sOrder = "Repute"; break; case 4: sOrder = "GP"; break; case 5: sOrder = "State"; break; case 6: sOrder = "Offer"; break; } sOrder += ",ID "; DataTable dt = GetPage("V_Consortia_Users", sWhere, page, size, "*", sOrder, "ID", ref total); foreach (DataRow dr in dt.Rows) { ConsortiaUserInfo info = new ConsortiaUserInfo(); info.ID = (int)dr["ID"]; info.ConsortiaID = (int)dr["ConsortiaID"]; info.DutyID = (int)dr["DutyID"]; info.DutyName = dr["DutyName"].ToString(); info.IsExist = (bool)dr["IsExist"]; info.RatifierID = (int)dr["RatifierID"]; info.RatifierName = dr["RatifierName"].ToString(); info.Remark = dr["Remark"].ToString(); info.UserID = (int)dr["UserID"]; info.UserName = dr["UserName"].ToString(); info.Grade = (int)dr["Grade"]; info.GP = (int)dr["GP"]; info.Repute = (int)dr["Repute"]; info.State = (int)dr["State"]; info.Right = (int)dr["Right"]; info.Offer = (int)dr["Offer"]; info.Colors = dr["Colors"].ToString(); info.Style = dr["Style"].ToString(); info.Hide = (int)dr["Hide"]; info.Skin = dr["Skin"] == null ? "" : info.Skin; info.Level = (int)dr["Level"]; info.LastDate = (DateTime)dr["LastDate"]; info.Sex = (bool)dr["Sex"]; info.IsBanChat = (bool)dr["IsBanChat"]; info.Win = (int)dr["Win"]; info.Total = (int)dr["Total"]; info.Escape = (int)dr["Escape"]; info.RichesOffer = (int)dr["RichesOffer"]; info.RichesRob = (int)dr["RichesRob"]; info.LoginName = dr["LoginName"] == null ? "" : dr["LoginName"].ToString(); info.Nimbus = (int)dr["Nimbus"]; info.FightPower = (int)dr["FightPower"]; info.typeVIP = Convert.ToByte(dr["typeVIP"]); info.VIPLevel = (int)dr["VIPLevel"]; infos.Add(info); } } catch (Exception e) { if (log.IsErrorEnabled) log.Error("Init", e); } finally { } return infos.ToArray(); }
public void SendConsortiaUserPass(int playerid, string playerName, ConsortiaUserInfo info, bool isInvite, int consortiaRepute, string loginName,int fightpower) { GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.CONSORTIA_RESPONSE, playerid); pkg.WriteByte(1); pkg.WriteInt(info.ID); pkg.WriteBoolean(isInvite); pkg.WriteInt(info.ConsortiaID); pkg.WriteString(info.ConsortiaName); pkg.WriteInt(info.UserID); pkg.WriteString(info.UserName); pkg.WriteInt(playerid); pkg.WriteString(playerName); pkg.WriteInt(info.DutyID); pkg.WriteString(info.DutyName); pkg.WriteInt(info.Offer); pkg.WriteInt(info.RichesOffer); pkg.WriteInt(info.RichesRob); pkg.WriteDateTime(info.LastDate); pkg.WriteInt(info.Grade); pkg.WriteInt(info.Level); pkg.WriteInt(info.State); pkg.WriteBoolean(info.Sex); pkg.WriteInt(info.Right); pkg.WriteInt(info.Win); pkg.WriteInt(info.Total); pkg.WriteInt(info.Escape); pkg.WriteInt(consortiaRepute); pkg.WriteString(loginName); pkg.WriteInt(fightpower); pkg.WriteInt(500); //New pkg.WriteString("Honor"); SendTCP(pkg); }
public ConsortiaUserInfo InitConsortiaUserInfo(SqlDataReader dr) { ConsortiaUserInfo consortiaUserInfo = new ConsortiaUserInfo(); consortiaUserInfo.ID = (int)dr["ID"]; consortiaUserInfo.ConsortiaID = (int)dr["ConsortiaID"]; consortiaUserInfo.DutyID = (int)dr["DutyID"]; consortiaUserInfo.DutyName = dr["DutyName"].ToString(); consortiaUserInfo.IsExist = (bool)dr["IsExist"]; consortiaUserInfo.RatifierID = (int)dr["RatifierID"]; consortiaUserInfo.RatifierName = dr["RatifierName"].ToString(); consortiaUserInfo.Remark = dr["Remark"].ToString(); consortiaUserInfo.UserID = (int)dr["UserID"]; consortiaUserInfo.UserName = dr["UserName"].ToString(); consortiaUserInfo.Grade = (int)dr["Grade"]; consortiaUserInfo.GP = (int)dr["GP"]; consortiaUserInfo.Repute = (int)dr["Repute"]; consortiaUserInfo.State = (int)dr["State"]; consortiaUserInfo.Right = (int)dr["Right"]; consortiaUserInfo.Offer = (int)dr["Offer"]; consortiaUserInfo.Colors = dr["Colors"].ToString(); consortiaUserInfo.Style = dr["Style"].ToString(); consortiaUserInfo.Hide = (int)dr["Hide"]; consortiaUserInfo.Skin = dr["Skin"] == null ? "" : consortiaUserInfo.Skin; consortiaUserInfo.Level = (int)dr["Level"]; consortiaUserInfo.LastDate = (DateTime)dr["LastDate"]; consortiaUserInfo.Sex = (bool)dr["Sex"]; consortiaUserInfo.IsBanChat = (bool)dr["IsBanChat"]; consortiaUserInfo.Win = (int)dr["Win"]; consortiaUserInfo.Total = (int)dr["Total"]; consortiaUserInfo.Escape = (int)dr["Escape"]; consortiaUserInfo.RichesOffer = (int)dr["RichesOffer"]; consortiaUserInfo.RichesRob = (int)dr["RichesRob"]; consortiaUserInfo.LoginName = dr["LoginName"] == null ? "" : dr["LoginName"].ToString(); consortiaUserInfo.Nimbus = (int)dr["Nimbus"]; consortiaUserInfo.FightPower = (int)dr["FightPower"]; consortiaUserInfo.typeVIP = Convert.ToByte(dr["typeVIP"]); consortiaUserInfo.VIPLevel = (int)dr["VIPLevel"]; return consortiaUserInfo; }
public static XElement CreateConsortiaUserInfo(ConsortiaUserInfo info) { return new XElement("Item", new XAttribute("ID", info.ID), new XAttribute("ConsortiaID", info.ConsortiaID), new XAttribute("DutyID", info.DutyID), new XAttribute("DutyName", info.DutyName == null ? "" : info.DutyName), new XAttribute("GP", info.GP), new XAttribute("Grade", info.Grade), new XAttribute("Right", info.Right), new XAttribute("DutyLevel", info.Level), new XAttribute("Offer", info.Offer), new XAttribute("RatifierID", info.RatifierID), new XAttribute("RatifierName", info.RatifierName == null ? "" : info.RatifierName), new XAttribute("Remark", info.Remark == null ? "" : info.Remark), new XAttribute("Repute", info.Repute), new XAttribute("State", info.State == 1 ? 1 : 0), new XAttribute("UserID", info.UserID), new XAttribute("Hide", info.Hide), new XAttribute("Colors", info.Colors == null ? "" : info.Colors), new XAttribute("Skin", info.Skin == null ? "" : info.Skin), new XAttribute("Style", info.Style), new XAttribute("LastDate", info.LastDate.ToString("yyyy-MM-dd HH:mm:ss")), new XAttribute("Sex", info.Sex), new XAttribute("IsBanChat", info.IsBanChat), new XAttribute("WinCount", info.Win), new XAttribute("TotalCount", info.Total), new XAttribute("EscapeCount", info.Escape), new XAttribute("RichesOffer", info.RichesOffer), new XAttribute("RichesRob", info.RichesRob), new XAttribute("Nimbus", info.Nimbus), new XAttribute("LoginName", info.LoginName == null ? "" : info.LoginName), new XAttribute("UserName", info.UserName == null ? "" : info.UserName), new XAttribute("typeVIP", info.typeVIP), new XAttribute("VIPLevel", info.VIPLevel), new XAttribute("AchievementPoint", 1), new XAttribute("Rank", "honor"), new XAttribute("FightPower", info.FightPower), new XAttribute("IsCandidate", false), //new XAttribute("IsDownGrade", true), //new XAttribute("IsEditorPlacard", true), //new XAttribute("IsEditorDescription", true), //new XAttribute("IsExpel", true), //new XAttribute("IsEditorUser", true), new XAttribute("IsVote", false), new XAttribute("TotalRichesOffer", 106), new XAttribute("LastWeekRichesOffer", 0)); //new XAttribute("IsRatify", true), //new XAttribute("IsChat", true)); }
public static XElement CreateConsortiaIMInfo(ConsortiaUserInfo info) { return new XElement("Item", new XAttribute("ID", info.ID), new XAttribute("ConsortiaID", info.ConsortiaID), new XAttribute("DutyID", info.DutyID), new XAttribute("DutyName", info.DutyName == null ? "" : info.DutyName), new XAttribute("GP", info.GP), new XAttribute("Grade", info.Grade), new XAttribute("Level", info.Level), new XAttribute("Offer", info.Offer), new XAttribute("Remark", info.Remark == null ? "" : info.Remark), new XAttribute("Repute", info.Repute), new XAttribute("State", info.State == 1 ? 1 : 0), new XAttribute("UserID", info.UserID), new XAttribute("Hide", info.Hide), new XAttribute("Colors", info.Colors == null ? "" : info.Colors), new XAttribute("Skin", info.Skin == null ? "" : info.Skin), new XAttribute("Style", info.Style), new XAttribute("LastDate", info.LastDate.ToString("yyyy-MM-dd HH:mm:ss")), new XAttribute("Sex", info.Sex), new XAttribute("LoginName", info.LoginName), new XAttribute("NickName", info.UserName == null ? "" : info.UserName)); }