public static void HandleGuildOperation(PacketReader packet) { int cid = packet.ReadInt(); int gid = packet.ReadInt(); string name = packet.ReadMapleString(); int point = packet.ReadInt(); int membercap = packet.ReadInt(); int emblemBG = packet.ReadShort(); int emblemBGC = packet.ReadShort(); int emblem = packet.ReadShort(); int emblemC = packet.ReadShort(); int membercount = packet.ReadInt(); List<GuildMember> mems = new List<GuildMember>(); for (int i = 0; i < membercount; ++i) { var member = new GuildMember(); member.CharacterID = packet.ReadInt(); member.Grade = packet.ReadInt(); member.GuildID = gid; mems.Add(member); } if (membercap == 0) ++membercap; var guild = new Guild(); guild.Name = name; guild.GuildID = gid; guild.Point = point; guild.MemberCap = membercap; guild.EmblemBG = emblemBG; guild.EmblemBGColour = emblemBGC; guild.Emblem = emblem; guild.EmblemColour = emblemC; guild.Members = mems.ToArray(); Program.mServer.GetClient(cid).mCharacter.mGuild = guild; }
public static Guild GetGuild(int GuildID) { var ret = new Guild(); MySqlDataReader reader = ExecuteDataQuery("SELECT * FROM guild_info WHERE id = {0};", GuildID); ret.GuildID = GuildID; while (reader.Read()) { ret.Name = Convert.ToString(reader["Name"]); ret.Point = Convert.ToInt32(reader["Point"]); ret.MemberCap = Convert.ToInt32(reader["MemberCap"]); ret.EmblemBG = Convert.ToInt32(reader["EmblemBG"]); ret.EmblemBGColour = Convert.ToInt32(reader["EmblemBGColour"]); ret.Emblem = Convert.ToInt32(reader["Emblem"]); ret.EmblemColour = Convert.ToInt32(reader["EmblemColour"]); ret.Created = Convert.ToInt64(reader["Created"]); } reader.Close(); reader = ExecuteDataQuery("SELECT * FROM guild_member WHERE GuildID = {0};", GuildID); List<GuildMember> members = new List<GuildMember>(); while (reader.Read()) { var member = new GuildMember(); member.GuildID = GuildID; member.CharacterID = Convert.ToInt32(reader["CharacterID"]); member.Grade = Convert.ToInt32(reader["Grade"]); members.Add(member); } reader.Close(); ret.Members = members.ToArray(); return ret; }