Esempio n. 1
0
        public void DoEvents()
        {
            while (true)
            {
                StringBuilder sendText = new StringBuilder();
                foreach (ConnectedUser user in _Users.Values)
                {
                    if (user._Room_X != user._Room_X_Target || user._Room_Y != user._Room_Y_Target)
                    {
                        int[] nextCoords;
                        bool walkDoor = false;

                        if (user._Room_X == door_x && user._Room_Y == door_y)
                        {
                            // first walk out of the door, then check if you can walk after that!
                            walkDoor = true;
                            if (user._Room_X_Target == doorstep_x && user._Room_Y_Target == doorstep_y)
                            {
                                // just come out of the door
                                squareState[,] stateMap = avatarStateMap(doorstep_x, doorstep_y);
                                if (stateMap[doorstep_x, doorstep_y] == squareState.Open && (!_sqUnit[doorstep_x, doorstep_y]))
                                {
                                    // doorstep is free
                                    nextCoords = new int[2];
                                    nextCoords[0] = doorstep_x;
                                    nextCoords[1] = doorstep_y;
                                }
                                else
                                {
                                    nextCoords = null;
                                }
                            }
                            else
                            {
                                PathFinderFast Pathfinder = new PathFinderFast(GenerateGrid(user._Room_X_Target, user._Room_Y_Target));
                                List<PathFinderNode> Path = Pathfinder.FindPath(new Point(doorstep_x, doorstep_y), new Point(user._Room_X_Target, user._Room_Y_Target));
                                if (Path == null || Path.Count == 0)
                                {
                                    nextCoords = null;
                                }
                                else
                                {
                                    // after coming out of your door you'll be able to walk
                                    squareState[,] stateMap = avatarStateMap(doorstep_x, doorstep_y);
                                    if (stateMap[doorstep_x, doorstep_y] == squareState.Open && (!_sqUnit[doorstep_x, doorstep_y]))
                                    {
                                        // doorstep is free
                                        nextCoords = new int[2];
                                        nextCoords[0] = doorstep_x;
                                        nextCoords[1] = doorstep_y;
                                    }
                                    else
                                    {
                                        nextCoords = null;
                                    }
                                }
                            }
                        }
                        else
                        {
                            PathFinderFast Pathfinder = new PathFinderFast(GenerateGrid(user._Room_X_Target, user._Room_Y_Target));
                            List<PathFinderNode> Path = Pathfinder.FindPath(new Point(user._Room_X, user._Room_Y), new Point(user._Room_X_Target, user._Room_Y_Target));
                            if (Path == null || Path.Count == 0)
                            {
                                nextCoords = null;
                            }
                            else
                            {
                                PathFinderNode NextPosition = Path[Path.Count - 2];
                                nextCoords = new int[2];
                                nextCoords[0] = NextPosition.X;
                                nextCoords[1] = NextPosition.Y;
                            }
                        }

                        if (nextCoords == null)
                        {
                            user._Room_Sit = "";
                            user._Room_X_Target = user._Room_X;
                            user._Room_Y_Target = user._Room_Y;
                            StopAvatarPacket stopMove = new StopAvatarPacket();
                            stopMove.I = user._UserID;
                            string stopMovePacket = JsonConvert.SerializeObject(stopMove);
                            sendText.Append("064");
                            sendText.Append(stopMovePacket);
                            sendText.Append("#");
                        }
                        else
                        {
                            int nextX = nextCoords[0];
                            int nextY = nextCoords[1];
                            squareState nextState = _sqState[nextX, nextY];

                            if (!walkDoor)
                            {
                                _sqUnit[user._Room_X, user._Room_Y] = false;
                            }
                            _sqUnit[nextX, nextY] = true;

                            double nextHeight = 0;
                            nextHeight = (double)_sqHeight[nextX, nextY];

                            // dir eerst!
                            user._Room_Dir = getNewDir(user._Room_X, user._Room_Y, nextX, nextY);
                            user._Room_X = nextX;
                            user._Room_Y = nextY;
                            user._Room_Z = (int)nextHeight;

                            if (nextState == squareState.Seat)
                            {
                                // Do Sit
                                MoveAvatarPacket mvpack = new MoveAvatarPacket();
                                mvpack.I = user._UserID;
                                mvpack.X = nextX;
                                mvpack.Y = nextY;
                                mvpack.H = user._Room_Dir;
                                string stringmvpack = JsonConvert.SerializeObject(mvpack);
                                sendText.Append("057");
                                sendText.Append(stringmvpack);
                                sendText.Append("#");

                                if (user._Room_X == user._Room_X_Target && user._Room_Y == user._Room_Y_Target)
                                {
                                    user._Room_Dir = _sqRot[user._Room_X, user._Room_Y] * 2;
                                    user._Room_Sit = user._Room_Dir.ToString() + "|" + _sqTile[user._Room_X, user._Room_Y];
                                    StopAvatarPacket stopMove = new StopAvatarPacket();
                                    stopMove.I = user._UserID;
                                    string stopMovePacket = JsonConvert.SerializeObject(stopMove);
                                    sendText.Append("064");
                                    sendText.Append(stopMovePacket);
                                    sendText.Append("#");

                                    SetSitPacket setSit = new SetSitPacket();
                                    setSit.I = user._UserID;
                                    setSit.S = user._Room_Sit;
                                    string SetSitPacket = JsonConvert.SerializeObject(setSit);
                                    sendText.Append("081");
                                    sendText.Append(SetSitPacket);
                                    sendText.Append("#");
                                }
                            }
                            else
                            {
                                user._Room_Sit = "";

                                MoveAvatarPacket mvpack = new MoveAvatarPacket();
                                mvpack.I = user._UserID;
                                mvpack.X = nextX;
                                mvpack.Y = nextY;
                                mvpack.H = user._Room_Dir;
                                string stringmvpack = JsonConvert.SerializeObject(mvpack);
                                sendText.Append("057");
                                sendText.Append(stringmvpack);
                                sendText.Append("#");

                                if (user._Room_X == user._Room_X_Target && user._Room_Y == user._Room_Y_Target)
                                {
                                    StopAvatarPacket stopMove = new StopAvatarPacket();
                                    stopMove.I = user._UserID;
                                    string stopMovePacket = JsonConvert.SerializeObject(stopMove);
                                    sendText.Append("064");
                                    sendText.Append(stopMovePacket);
                                    sendText.Append("#");
                                }
                            }
                        }
                    }
                }

                // BOTS
                try
                {
                    foreach (RoomBot bot in _Bots.Values)
                    {
                        if (bot._MyX != bot.targetX || bot._MyY != bot.targetY)
                        {
                            int[] nextCoords;
                            bool walkDoor = false;

                            if (bot._MyX == door_x && bot._MyY == door_y)
                            {
                                // first walk out of the door, then check if you can walk after that!
                                walkDoor = true;
                                if (bot.targetX == doorstep_x && bot.targetY == doorstep_y)
                                {
                                    // just come out of the door
                                    squareState[,] stateMap = avatarStateMap(doorstep_x, doorstep_y);
                                    if (stateMap[doorstep_x, doorstep_y] == squareState.Open && (!_sqUnit[doorstep_x, doorstep_y]))
                                    {
                                        // doorstep is free
                                        nextCoords = new int[2];
                                        nextCoords[0] = doorstep_x;
                                        nextCoords[1] = doorstep_y;
                                    }
                                    else
                                    {
                                        nextCoords = null;
                                    }
                                }
                                else
                                {
                                    PathFinderFast Pathfinder = new PathFinderFast(GenerateGrid(bot.targetX, bot.targetY));
                                    List<PathFinderNode> Path = Pathfinder.FindPath(new Point(doorstep_x, doorstep_y), new Point(bot.targetX, bot.targetY));
                                    if (Path == null || Path.Count == 0)
                                    {
                                        nextCoords = null;
                                    }
                                    else
                                    {
                                        // after coming out of your door you'll be able to walk
                                        squareState[,] stateMap = avatarStateMap(doorstep_x, doorstep_y);
                                        if (stateMap[doorstep_x, doorstep_y] == squareState.Open && (!_sqUnit[doorstep_x, doorstep_y]))
                                        {
                                            // doorstep is free
                                            nextCoords = new int[2];
                                            nextCoords[0] = doorstep_x;
                                            nextCoords[1] = doorstep_y;
                                        }
                                        else
                                        {
                                            nextCoords = null;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                PathFinderFast Pathfinder = new PathFinderFast(GenerateGrid(bot.targetX, bot.targetY));
                                List<PathFinderNode> Path = Pathfinder.FindPath(new Point(bot._MyX, bot._MyY), new Point(bot.targetX, bot.targetY));
                                if (Path == null || Path.Count == 0)
                                {
                                    nextCoords = null;
                                }
                                else
                                {
                                    PathFinderNode NextPosition = Path[Path.Count - 2];
                                    nextCoords = new int[2];
                                    nextCoords[0] = NextPosition.X;
                                    nextCoords[1] = NextPosition.Y;
                                }
                            }
                            if (nextCoords == null)
                            {
                                if (bot.walking)
                                {
                                    bot._Sit = "";
                                    bot.targetX = bot._MyX;
                                    bot.targetY = bot._MyY;
                                    StopAvatarPacket stopMove = new StopAvatarPacket();
                                    stopMove.I = bot._MyAvatarID;
                                    string stopMovePacket = JsonConvert.SerializeObject(stopMove);
                                    sendText.Append("064");
                                    sendText.Append(stopMovePacket);
                                    sendText.Append("#");
                                    bot.walking = false;
                                }
                            }
                            else
                            {
                                bot.walking = true;
                                int nextX = nextCoords[0];
                                int nextY = nextCoords[1];
                                squareState nextState = _sqState[nextX, nextY];

                                if (!walkDoor)
                                {
                                    _sqUnit[bot._MyX, bot._MyY] = false;
                                }
                                _sqUnit[nextX, nextY] = true;

                                double nextHeight = 0;
                                nextHeight = (double)_sqHeight[nextX, nextY];

                                bot._MyZ = getNewDir(bot._MyX, bot._MyY, nextX, nextY);
                                bot._MyX = nextX;
                                bot._MyY = nextY;
                                //bot._MyZ = (int)nextHeight;

                                if (nextState == squareState.Seat)
                                {
                                    // Do Sit
                                    MoveAvatarPacket mvpack = new MoveAvatarPacket();
                                    mvpack.I = bot._MyAvatarID;
                                    mvpack.X = nextX;
                                    mvpack.Y = nextY;
                                    mvpack.H = bot._MyZ;
                                    string stringmvpack = JsonConvert.SerializeObject(mvpack);
                                    sendText.Append("057");
                                    sendText.Append(stringmvpack);
                                    sendText.Append("#");

                                    if (bot._MyX == bot.targetX && bot._MyY == bot.targetY)
                                    {
                                        bot._MyZ = _sqRot[bot._MyX, bot._MyY] * 2;
                                        bot._Sit = bot._MyZ.ToString() + "|" + _sqTile[bot._MyX, bot._MyY];
                                        StopAvatarPacket stopMove = new StopAvatarPacket();
                                        stopMove.I = bot._MyAvatarID;
                                        string stopMovePacket = JsonConvert.SerializeObject(stopMove);
                                        sendText.Append("064");
                                        sendText.Append(stopMovePacket);
                                        sendText.Append("#");

                                        SetSitPacket setSit = new SetSitPacket();
                                        setSit.I = bot._MyAvatarID;
                                        setSit.S = bot._Sit;
                                        string SetSitPacket = JsonConvert.SerializeObject(setSit);
                                        sendText.Append("081");
                                        sendText.Append(SetSitPacket);
                                        sendText.Append("#");
                                    }
                                }
                                else
                                {
                                    bot._Sit = "";
                                    MoveAvatarPacket mvpack = new MoveAvatarPacket();
                                    mvpack.I = bot._MyAvatarID;
                                    mvpack.X = nextX;
                                    mvpack.Y = nextY;
                                    mvpack.H = bot._MyZ;
                                    string stringmvpack = JsonConvert.SerializeObject(mvpack);
                                    sendText.Append("057");
                                    sendText.Append(stringmvpack);
                                    sendText.Append("#");

                                    if (bot._MyX == bot.targetX && bot._MyY == bot.targetY)
                                    {
                                        StopAvatarPacket stopMove = new StopAvatarPacket();
                                        stopMove.I = bot._MyAvatarID;
                                        string stopMovePacket = JsonConvert.SerializeObject(stopMove);
                                        sendText.Append("064");
                                        sendText.Append(stopMovePacket);
                                        sendText.Append("#");
                                        bot.walking = false;
                                    }
                                }
                            }
                        }
                    }

                }
                catch (Exception e)
                {
                    Console.WriteLine("BOTWALK ERROR: {0}", e);
                }
                string sendTextString = sendText.ToString();
                if (sendTextString != "")
                {
                    foreach (ConnectedUser usr in _Users.Values)
                    {
                        usr.sendData(sendTextString);
                    }
                }
                Thread.Sleep(480); // 480 milliseconds
            }
        }
Esempio n. 2
0
        public override void doFurni(ConnectedUser user, int id, string tile)
        {
            bool inRoom = false;
            bool donating = false;
            Item furniData;
            if (furniture.ContainsKey(id))
            {
                furniData = getItem(id);
                inRoom = true;
            }
            else
            {
                 string[] data = MySQL.runReadRow("SELECT owner, room, tile, stacknr, stackheight, turn, action, furni, tradeable FROM items WHERE id = '" + id + "'");
                 furniData = new Item(id, int.Parse(data[0]), int.Parse(data[1]), data[2], int.Parse(data[3]), int.Parse(data[4]), int.Parse(data[5]), int.Parse(data[6]), data[7], int.Parse(data[8]));
            }
            CatalogueManager.ItemTemplate furniTemplate = CatalogueManager.getTemplate(furniData.furni);
            if (user._HasRights)
            {
                List<Point> currentTiles;
                if (furniTemplate.soort != "poster")
                {
                    currentTiles = getCurrentTiles(furniData, inRoom);
                }
                else
                {
                    currentTiles = new List<Point>();
                }
                if (tile == "inv")
                {
                    if (RoomOwner == user._UserID || RankManager.containsRight(user._Rank, "always_pickup"))
                    {
                        // check if it's the room, otherwise: remove from hashtable!
                        if (inRoom)
                        {
                            // remove from room
                            furniture.Remove(id);
                            MySQL.runQuery("UPDATE items SET owner='" + user._UserID + "', room='0', tile='" + tile + "', stacknr='1', stackheight='0', turn='1', action='0' WHERE id='" + id + "'");
                            if (RoomOwner != user._UserID)
                            {
                                MySQL.runQuery("INSERT INTO furni_history SET id='" + id + "', `date`='" + timestamp.get + "', `type`='take', `from`='" + RoomOwner + "', `to`='" + user._UserID + "', credits='0';");
                            }
                            updateHeightmapping();

                            FurniturePacket movePacket = new FurniturePacket();
                            movePacket.I = furniData.id;
                            movePacket.T = tile;
                            movePacket.S = 1;
                            movePacket.SH = 0;
                            movePacket.H = 1;
                            movePacket.A = 0;
                            movePacket.F = furniData.furni;
                            string movePacketString = JsonConvert.SerializeObject(movePacket);
                            user.sendData("047" + movePacketString + "#");

                            FurnitureRemovePacket removePacket = new FurnitureRemovePacket();
                            removePacket.I = furniData.id;
                            string removePacketString = JsonConvert.SerializeObject(removePacket);
                            sendDataButNotTo(user, "048" + removePacketString + "#");

                            // chair stuff
                            if (furniTemplate.soort == "stoel")
                            {
                                StringBuilder sendText = new StringBuilder();
                                for (int i = 0; i < currentTiles.Count; i++)
                                {
                                    Point thisTile = currentTiles[i];
                                    if (_sqUnit[thisTile.X, thisTile.Y] == true)
                                    {
                                        foreach (ConnectedUser seatUser in _Users.Values)
                                        {
                                            if (seatUser._Room_X == thisTile.X && seatUser._Room_Y == thisTile.Y)
                                            {
                                                seatUser._Room_Sit = "";
                                                SetSitPacket setSit = new SetSitPacket();
                                                setSit.I = seatUser._UserID;
                                                setSit.S = seatUser._Room_Sit;
                                                string SetSitPacket = JsonConvert.SerializeObject(setSit);
                                                sendText.Append("080");
                                                sendText.Append(SetSitPacket);
                                                sendText.Append("#");
                                            }
                                        }
                                    }
                                }
                                string sendTextString = sendText.ToString();
                                if (sendTextString != "")
                                {
                                    foreach (ConnectedUser usr in _Users.Values)
                                    {
                                        usr.sendData(sendTextString);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (inRoom || furniData.owner == user._UserID)
                    {
                        // moving or placing in room, not putting in inventory
                        if (!inRoom && furniData.owner == user._UserID && RoomOwner != user._UserID)
                        {
                            donating = true;
                        }
                        if (donating && furniData.tradeable == 0)
                        {
                            // not tradeable
                            user.sendData(user.notify(TextsManager.get("untradeable"), TextsManager.get("notify_default")));
                        }
                        else
                        {
                            if (furniTemplate.soort != "poster")
                            {
                                int X = int.Parse(tile.Split('_')[0]) - 1;
                                int Y = int.Parse(tile.Split('_')[1]) - 1;
                                string check = furniPlaceable(furniData, new int[] { X, Y }, furniData.turn, furniTemplate.lang, furniTemplate.breed, inRoom, currentTiles);
                                if (check == "free")
                                {
                                    furniData.tile = tile;
                                    if (!inRoom)
                                    {
                                        furniture.Add(id, furniData);
                                    }
                                    else
                                    {
                                        furniture[id] = furniData; // update hashtable
                                    }
                                    MySQL.runQuery("UPDATE items SET owner='" + RoomOwner + "', room='" + RoomID + "', tile='" + tile + "' WHERE id='" + id + "'");
                                    if (donating)
                                    {
                                        MySQL.runQuery("INSERT INTO furni_history SET id='" + id + "', `date`='" + timestamp.get + "', `type`='don', `from`='" + user._UserID + "', `to`='" + RoomOwner + "', credits='0';");
                                    }

                                    updateHeightmapping();

                                    FurniturePacket movepacket = new FurniturePacket();
                                    movepacket.I = furniData.id;
                                    movepacket.T = furniData.tile;
                                    movepacket.S = furniData.stacknr;
                                    movepacket.SH = furniData.stackheight;
                                    movepacket.H = furniData.turn;
                                    movepacket.A = furniData.action;
                                    movepacket.F = furniData.furni;
                                    string movepacketstring = JsonConvert.SerializeObject(movepacket);
                                    foreach (ConnectedUser usr in _Users.Values)
                                    {
                                        usr.sendData("047" + movepacketstring + "#");
                                    }

                                    // chair stuff
                                    if (furniTemplate.soort == "stoel" && inRoom)
                                    {
                                        StringBuilder sendText = new StringBuilder();
                                        for (int i = 0; i < currentTiles.Count; i++)
                                        {
                                            Point thisTile = currentTiles[i];
                                            if (_sqUnit[thisTile.X, thisTile.Y] == true)
                                            {
                                                foreach (ConnectedUser seatUser in _Users.Values)
                                                {
                                                    if (seatUser._Room_X == thisTile.X && seatUser._Room_Y == thisTile.Y)
                                                    {
                                                        if (_sqState[seatUser._Room_X, seatUser._Room_Y] == squareState.Seat)
                                                        {
                                                            seatUser._Room_Dir = _sqRot[seatUser._Room_X, seatUser._Room_Y] * 2;
                                                            seatUser._Room_Sit = seatUser._Room_Dir.ToString() + "|" + _sqTile[seatUser._Room_X, seatUser._Room_Y];
                                                        }
                                                        else
                                                        {
                                                            seatUser._Room_Sit = "";
                                                        }
                                                        SetSitPacket setSit = new SetSitPacket();
                                                        setSit.I = seatUser._UserID;
                                                        setSit.S = seatUser._Room_Sit;
                                                        string SetSitPacket = JsonConvert.SerializeObject(setSit);
                                                        sendText.Append("080");
                                                        sendText.Append(SetSitPacket);
                                                        sendText.Append("#");
                                                    }
                                                }
                                            }
                                        }
                                        string sendTextString = sendText.ToString();
                                        if (sendTextString != "")
                                        {
                                            foreach (ConnectedUser usr in _Users.Values)
                                            {
                                                usr.sendData(sendTextString);
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (!inRoom) // only place and pickup poster, don't move them
                                {
                                    string coords = tile.Split('@')[0];
                                    int X = int.Parse(coords.Split('|')[0]);
                                    int Y = int.Parse(coords.Split('|')[1]);
                                    int H = int.Parse(tile.Split('@')[1]);

                                    furniData.tile = coords;
                                    furniData.turn = H;
                                    furniture.Add(id, furniData);

                                    MySQL.runQuery("UPDATE items SET owner='" + RoomOwner + "', room='" + RoomID + "', tile='" + coords + "', turn='" + H + "' WHERE id='" + id + "'");
                                    if (donating)
                                    {
                                        MySQL.runQuery("INSERT INTO furni_history SET id='" + id + "', `date`='" + timestamp.get + "', `type`='don', `from`='" + user._UserID + "', `to`='" + RoomOwner + "', credits='0';");
                                    }

                                    FurniturePacket movepacket = new FurniturePacket();
                                    movepacket.I = furniData.id;
                                    movepacket.T = furniData.tile;
                                    movepacket.S = furniData.stacknr;
                                    movepacket.SH = furniData.stackheight;
                                    movepacket.H = furniData.turn;
                                    movepacket.A = furniData.action;
                                    movepacket.F = furniData.furni;
                                    string movepacketstring = JsonConvert.SerializeObject(movepacket);
                                    foreach (ConnectedUser usr in _Users.Values)
                                    {
                                        usr.sendData("047" + movepacketstring + "#");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public override void turnFurni(ConnectedUser user, int id)
        {
            if (furniture.ContainsKey(id) && user._HasRights)
            {
                Item furniData = getItem(id);
                CatalogueManager.ItemTemplate furniTemplate = CatalogueManager.getTemplate(furniData.furni);
                if (furniData.tile != "inv" && furniTemplate.soort != "poster")
                {
                    int turns = furniTemplate.afb;
                    int turnNow = furniData.turn;
                    int turnNext = turnNow;
                    if (furniTemplate.soort == "stoel" && turns == 1)
                    {
                        turns = 4;
                    }
                    if (turnNow == turns)
                    {
                        turnNext = 1;
                    }
                    else
                    {
                        turnNext = turnNow + 1;
                    }
                    int X = int.Parse(furniData.tile.Split('_')[0]) - 1;
                    int Y = int.Parse(furniData.tile.Split('_')[1]) - 1;
                    List<Point> currentTiles = getCurrentTiles(furniData, true);
                    string check = furniPlaceable(furniData, new int[] { X, Y }, turnNext, furniTemplate.lang, furniTemplate.breed, true, currentTiles);
                    if (check == "free")
                    {
                        furniData.turn = turnNext;
                        furniture[id] = furniData; // update hashtable
                        MySQL.runQuery("UPDATE items SET turn='" + turnNext + "' WHERE id='" + id + "'");
                        updateHeightmapping();

                        FurniturePacket movepacket = new FurniturePacket();
                        movepacket.I = furniData.id;
                        movepacket.T = furniData.tile;
                        movepacket.S = furniData.stacknr;
                        movepacket.SH = furniData.stackheight;
                        movepacket.H = furniData.turn;
                        movepacket.A = furniData.action;
                        movepacket.F = furniData.furni;
                        string movepacketstring = JsonConvert.SerializeObject(movepacket);
                        foreach (ConnectedUser usr in _Users.Values)
                        {
                            usr.sendData("047" + movepacketstring + "#");
                        }
                    }
                    // chair stuff
                    if (furniTemplate.soort == "stoel")
                    {
                        StringBuilder sendText = new StringBuilder();
                        for (int i = 0; i < currentTiles.Count; i++)
                        {
                            Point thisTile = currentTiles[i];
                            if (_sqUnit[thisTile.X, thisTile.Y] == true)
                            {
                                foreach (ConnectedUser seatUser in _Users.Values)
                                {
                                    if (seatUser._Room_X == thisTile.X && seatUser._Room_Y == thisTile.Y)
                                    {
                                        if (_sqState[seatUser._Room_X, seatUser._Room_Y] == squareState.Seat)
                                        {
                                            seatUser._Room_Dir = _sqRot[seatUser._Room_X, seatUser._Room_Y] * 2;
                                            seatUser._Room_Sit = seatUser._Room_Dir.ToString() + "|" + _sqTile[seatUser._Room_X, seatUser._Room_Y];
                                        }
                                        else
                                        {
                                            seatUser._Room_Sit = "";
                                        }
                                        SetSitPacket setSit = new SetSitPacket();
                                        setSit.I = seatUser._UserID;
                                        setSit.S = seatUser._Room_Sit;
                                        string SetSitPacket = JsonConvert.SerializeObject(setSit);
                                        sendText.Append("080");
                                        sendText.Append(SetSitPacket);
                                        sendText.Append("#");
                                    }
                                }
                            }
                        }
                        string sendTextString = sendText.ToString();
                        if (sendTextString != "")
                        {
                            foreach (ConnectedUser usr in _Users.Values)
                            {
                                usr.sendData(sendTextString);
                            }
                        }
                    }
                }
            }
        }