Exemple #1
0
        private void UpdateRollerUser(RoomUser user, int newX, int newY, float newZ, bool isLastRoller, int rollerId)
        {
            user.NextX = newX;
            user.NextY = newY;
            user.NextZ = newZ;

            ClientMessage mMessage = new ClientMessage();
            mMessage.Init(230); // Cf
            mMessage.appendArgumentInt(user.CurrentX);
            mMessage.appendArgumentInt(user.CurrentY);

            mMessage.appendArgumentInt(user.NextX);
            mMessage.appendArgumentInt(user.NextY);

            mMessage.appendArgumentInt(0);

            mMessage.appendArgumentInt(rollerId);

            mMessage.appendString("J");

            mMessage.appendArgumentInt(user.RoomUserID);

            mMessage.appendString(user.CurrentZ.ToString().Replace(',', '.'));
            mMessage.appendChar(2);
            mMessage.appendString(user.NextZ.ToString().Replace(',', '.'));
            mMessage.appendChar(2);

            mRollerBroadcast.Append(mMessage.ToString());

            mPlayerMap[user.CurrentX, user.CurrentY] = false;
            user.CurrentX = user.NextX;
            user.CurrentY = user.NextY;
            user.CurrentZ = user.NextZ;
            user.MustUpdate = true;
            mPlayerMap[user.CurrentX, user.CurrentY] = true;

            if (isLastRoller)
            {
                CalculateTileStatusForUser(user.CurrentX, user.CurrentY, user, true);
            }
        }
Exemple #2
0
        private void ProcessTeleporter(FurniInfo Teleporter1, RoomUser user)
        {
            FurniInfo Teleporter2 = null;

            Point invalidPoint = new Point(Teleporter1.PosX, Teleporter1.PosY);

            if (Teleporter1.PosRotation == 0 || Teleporter1.PosRotation == 2) invalidPoint.X++;
            if (Teleporter1.PosRotation == 4) invalidPoint.Y++;

            if (InstanceManager.Game.Furni.FurniExists(Teleporter1.TeleportId))
            {
                Teleporter2 = InstanceManager.Game.Furni.GetFurni(Teleporter1.TeleportId);
            }

            if (!user.UserLocked)
            {

                user.UserLocked = true;
                Thread.Sleep(1000);

                if (Teleporter1.PosX == user.CurrentX && Teleporter1.PosY == user.CurrentY)
                {

                    ClientMessage message = new ClientMessage();

                    if (Teleporter2 != null && Teleporter2.RoomID > 0 && Teleporter1.Flags.IsTeleport && Teleporter2.Flags.IsTeleport)
                    {
                        message.Init(89); //AY
                        message.appendInt(Teleporter1.FurniID);
                        message.appendString("/");
                        message.appendString(user.UserInfo.sUsername);
                        message.appendString("/");
                        message.appendString(Teleporter1.FurniSprite);
                        mRoomInstance.RoomBroadcast(message);

                        if (Teleporter2.RoomID == Teleporter1.RoomID) //Same room
                        {
                            Thread.Sleep(2000);
                            Teleporter2 = InstanceManager.Game.Furni.GetFurni(Teleporter1.TeleportId);
                            Teleporter1 = InstanceManager.Game.Furni.GetFurni(Teleporter1.FurniID);
                            if (Teleporter2.RoomID == Teleporter1.RoomID && Teleporter1.PosX == user.CurrentX && Teleporter1.PosY == user.CurrentY)
                            {
                                message.Init(92); //A\
                                message.appendInt(Teleporter2.FurniID);
                                message.appendString("/");
                                message.appendString(user.UserInfo.sUsername);
                                message.appendString("/");
                                message.appendString(Teleporter2.FurniSprite);
                                mRoomInstance.RoomBroadcast(message);
                                mPlayerMap[user.CurrentX, user.CurrentY] = false;
                                user.CurrentX = Teleporter2.PosX;
                                user.CurrentY = Teleporter2.PosY;
                                user.CurrentZ = Teleporter2.PosZ;
                                mRoomInstance.AnnounceUserStatus(user.SessionID, true);
                                mPlayerMap[user.CurrentX, user.CurrentY] = true;
                                user.UserLocked = false;
                            }
                            else
                            {
                                if (Teleporter1.PosX == user.CurrentX && Teleporter1.PosY == user.CurrentY)
                                {
                                    RequestSetStuffDataFloorItem(Teleporter1.FurniID, "TRUE", user, FurniInfo.VarTypes.TempOpen);
                                    RequestMovePlayer(user.SessionID, invalidPoint.X, invalidPoint.Y, null, true);
                                }
                                user.UserLocked = false;
                            }
                        }
                        else //In another room
                        {

                            InstanceManager.Sessions.GetSession(user.SessionID).authenticatedDoor = Teleporter2.FurniID;
                            InstanceManager.Sessions.GetSession(user.SessionID).authenticatedFlat = Teleporter2.RoomID;

                            message.Init(62); //@~
                            message.appendArgumentInt(Teleporter2.FurniID);
                            message.appendArgumentInt(Teleporter2.RoomID);
                            mRoomInstance.SendMessage(message, user.SessionID);
                        }

                    }
                    else //No linked teleporter exists
                    {
                        Thread.Sleep(700);
                        RequestSetStuffDataFloorItem(Teleporter1.FurniID, "TRUE", user, FurniInfo.VarTypes.TempOpen);
                        RequestMovePlayer(user.SessionID, invalidPoint.X, invalidPoint.Y, null, true);
                        user.UserLocked = false;
                    }

                }
            }
        }
Exemple #3
0
        private void UpdateRollerFurni(FurniInfo info, int nextX, int nextY, float nextZ, bool isLastRoller, int rollerId)
        {
            ClientMessage mMessage = new ClientMessage();
            mMessage.Init(230); // Cf
            mMessage.appendArgumentInt(info.PosX);
            mMessage.appendArgumentInt(info.PosY);

            mMessage.appendArgumentInt(nextX);
            mMessage.appendArgumentInt(nextY);

            mMessage.appendArgumentInt(1);

            mMessage.appendArgumentInt(info.FurniID);

            mMessage.appendString(info.PosZ.ToString().Replace(',', '.'));
            mMessage.appendChar(2);
            mMessage.appendString(nextZ.ToString().Replace(',', '.'));
            mMessage.appendChar(2);

            mMessage.appendArgumentInt(rollerId);

            mRollerBroadcast.Append(mMessage.ToString());

            info.PosX = nextX;
            info.PosY = nextY;
            info.PosZ = nextZ;
            InstanceManager.Game.Furni.MoveFloorItem(info.FurniID, info.PosX, info.PosY, info.PosZ, info.PosRotation, mRoomInstance.RoomInfo);
        }