public static FriendGroupManage ( string type, string groupname, short groupid, int targetid ) : byte[] | ||
type | string | |
groupname | string | |
groupid | short | |
targetid | int | |
리턴 | byte[] |
///////////////////////////////////////////////////////////////////////////////// // Friend groups ///////////////////////////////////////////////////////////////////////////////// void FriendGroup(string type) { try { //We use string type for switch statement. switch (type) { //Add new group case "ADD": //First check if the user has friends int friendcount = MsSQL.GetRowsCount("SELECT * FROM FRIENDS WHERE owner='" + Character.Information.CharacterID + "'"); //If the user has no friends return if (friendcount == 0) { return; } //Create our packet reader PacketReader reader = new PacketReader(PacketInformation.buffer); //Start reading information string groupname = reader.Text(); //Close the reader reader.Close(); //Update database information MsSQL.InsertData("INSERT INTO friends_groups (playerid,groupname) VALUES ('" + Character.Information.CharacterID + "','" + groupname + "')"); //Get group id from count short groupid = GetGroupId(Character.Information.CharacterID); //Send packet to client client.Send(Packet.FriendGroupManage("ADD", groupname, groupid, 0)); break; //Remove group case "REMOVE": //Create our packet reader reader = new PacketReader(PacketInformation.buffer); //Start reading information groupid = reader.Int16(); //Close the reader reader.Close(); //Get group name string groupnameinfo = GetGroupName(Character.Information.CharacterID, groupid); //Update database information MsSQL.InsertData("DELETE FROM friends_groups WHERE groupname='" + groupnameinfo + "'"); //Send packet to client client.Send(Packet.FriendGroupManage("REMOVE", groupnameinfo, groupid, 0)); break; //Move to group case "MOVE": //Create our packet reader reader = new PacketReader(PacketInformation.buffer); //Start reading information int targetid = reader.Int32(); groupid = reader.Int16(); //Close the reader reader.Close(); //Get groupname groupnameinfo = GetGroupName(Character.Information.CharacterID, groupid); //Update database information MsSQL.UpdateData("UPDATE friends SET group_name='" + groupnameinfo + "' WHERE owner='" + Character.Information.CharacterID + "' AND friend_name='" + targetid + "'"); //Send packet to client client.Send(Packet.FriendGroupManage("MOVE", groupnameinfo, groupid, targetid)); break; } } catch (Exception ex) { Systems.Debugger.Write(ex); } }