Ejemplo n.º 1
0
        public static void ClanInfo(Client client, string clanName)
        {
            var player = client.ClientPlayer;
            var info = new ClanInfo();
            var clanId = Globals.GunzDatabase.GetClanId(clanName);

            Globals.GunzDatabase.GetClanInfo(clanId, ref info);

            if (info == null)
                return;

            info.ConnectedMembers = Convert.ToInt16(TcpServer.GetClanMembers(clanId).Count);

            using (var packet = new PacketWriter(Operation.MatchClanResponseClanInfo, CryptFlags.Encrypt))
            {
                packet.Write(1, 78);

                packet.Write(info.Name, 16);
                packet.Write(info.Level);
                packet.Write(info.Points);
                packet.Write(info.TotalPoints);
                packet.Write(info.Ranking);
                packet.Write(info.Master, 32);
                packet.Write(info.Wins);
                packet.Write(info.Losses);
                packet.Write(info.MemberCount);
                packet.Write(info.ConnectedMembers);
                packet.Write(info.ClanId);
                packet.Write(info.EmblemChecksum);

                client.Send(packet);
            }
        }
Ejemplo n.º 2
0
        public void GetClanInfo(Int32 clanId, ref ClanInfo clanInfo)
        {
            lock (_sqlConnection)
            {
                using (
                    var command = new MySqlCommand("SELECT * FROM clan WHERE CLID=@clid",
                                                   _sqlConnection))
                {
                    command.Parameters.AddWithValue("@clid", clanId);
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader == null || !reader.Read())
                        {
                            clanInfo = null;
                            return;
                        }

                        clanInfo.ClanId = clanId;
                        clanInfo.Name = Convert.ToString(reader["name"]);
                        clanInfo.Points = (Int32)reader["exp"];
                        clanInfo.Level = Convert.ToInt16(reader["level"]);
                        clanInfo.TotalPoints = (Int32)reader["point"];
                        clanInfo.Wins = Convert.ToInt16(reader["wins"]);
                        clanInfo.Losses = Convert.ToInt16(reader["losses"]);
                        clanInfo.Ranking = (Int32)reader["ranking"];
                        clanInfo.EmblemChecksum = reader["emblemurl"] == null ? 0 : 1;
                        var cid = (Int32)reader["mastercid"];

                        reader.Close();

                        clanInfo.Master = GetCharacterName(cid);
                        clanInfo.MemberCount = Convert.ToInt16(GetQuery("SELECT COUNT(CID) FROM clanmember WHERE CLID=" + clanId));
                    }

                }
            }
        }