Пример #1
0
        private static void GetGroupBadges(Session Session, ClientMessage Message)
        {
            int groupid = 1;
            uint uId = Message.PopWiredUInt32();
            string badge = "b1101Xs21105s21103s211342d1e378ce1b2c021cc190f58003f484d";

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.AbsoluteRoomId);
                if (Instance == null)
                {
                   return;
                }
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    DataTable Table = MySqlClient.ExecuteQueryTable("SELECT * FROM groups_details");
                    foreach (DataRow Row in Table.Rows)
                    {
                        groupid = (int)Row["id"];
                        DataRow Description = MySqlClient.ExecuteQueryRow("SELECT * FROM groups_details where id = '" + groupid + "'");
                        badge = Description["badge"].ToString();

                        ServerMessage xMessage = new ServerMessage(309);
                        // count
                        // foreach => group id
                        //         => string/wb badge code
                        xMessage.AppendBoolean(true); // something
                        xMessage.AppendInt32(groupid); // group id
                        xMessage.AppendStringWithBreak(badge); //badge code
                        Session.SendData(xMessage);
                    }
                }
        }
Пример #2
0
        private static void SendMyGroup(Session Session, ClientMessage Message)
        {
            uint uId = Message.PopWiredUInt32();
            string badge;
            string desc;
            string name;
            string extra = "";
            string employer;
            int members;
            int roomid;
            int groupid;
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.AbsoluteRoomId);

            if (Instance == null)
            {
                return;
            }

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                DataRow Description = MySqlClient.ExecuteQueryRow("SELECT * FROM groups_details where id = '" + Session.CharacterInfo.GroupID + "'");
                badge = (string)Description["badge"];
                desc = (string)Description["description"];
                name = (string)Description["name"];
                roomid = (int)Description["roomid"];
                members = int.Parse(MySqlClient.ExecuteScalar("SELECT COUNT(*) FROM characters WHERE groupid = '" + Session.CharacterInfo.GroupID + "'").ToString());
                employer = (string)Description["employer"];
            }
            RoomInstance WorkRoom = RoomManager.GetInstanceByRoomId(uint.Parse(roomid.ToString()));
            ServerMessage xMessage = new ServerMessage(311);
            // count
            // foreach => group id
            //         => string/wb badge code
            groupid = Int32.Parse(uId.ToString());
            xMessage.AppendInt32(groupid); // Group ID
            xMessage.AppendStringWithBreak(name); // Group Name
            if (roomid >= 1)
            {
                extra = " at ";
            }
            if (WorkRoom == null || WorkRoom == RoomManager.GetInstanceByRoomId(0))
            {
                xMessage.AppendStringWithBreak("This user works for " + employer); // Group Desc
            }
            else
            {
                xMessage.AppendStringWithBreak("This user works for " + employer + extra + WorkRoom.Info.Name + "."); // Group Desc
            }
            xMessage.AppendStringWithBreak(badge); // Hash (badge) maybe lol?
            xMessage.AppendInt32(-1); // Room Id
            xMessage.AppendStringWithBreak(""); // Room Name
            xMessage.AppendBoolean(false);
            xMessage.AppendInt32(members); // Members
            xMessage.AppendBoolean(false);
            Session.SendData(xMessage);
        }