예제 #1
0
        public void RemoveTileStatus(RoomUser user, int X, int Y)
        {
            mRoomInstance.RemoveUniqueStatus(user.SessionID, "sit");
            mRoomInstance.RemoveUniqueStatus(user.SessionID, "lay");

            List<FurniInfo> objects = GetFurniObjects(X, Y);
            if (objects != null)
            {
                foreach (FurniInfo info in objects)
                {
                    if (info.Flags.PoolChange)
                    {
                        ClientMessage message = new ClientMessage();
                        message.Init(71); //AG
                        message.appendString(info.FurniVar);
                        message.appendString(" ");
                        message.appendString("open");
                        mRoomInstance.RoomBroadcast(message);

                        //Unblock the curtain position
                        int tmpX = int.Parse(info.WallLocation.Split(',')[0]);
                        int tmpY = int.Parse(info.WallLocation.Split(',')[1]);
                        mPlayerMap[tmpX, tmpY] = false;

                    }

                    if (info.Flags.CanSit || info.Flags.CanLay)
                    {
                        user.CurrentZ = mHeightMap[info.PosX, info.PosY];
                    }
                }

            }
        }
예제 #2
0
 public void ModeratorAlert(RoomUser userInfo, long sessionTo, long sessionFrom, string message, string extraInfo)
 {
     if (ModHasRight(sessionFrom, "fuse_alert"))
     {
         ExecuteAlert(sessionTo, message);
         WhisperResponse("Alert sent to " + userInfo.UserInfo.sUsername, sessionFrom);
         LogCommand(InstanceManager.Sessions.GetSession(sessionFrom).mUserInfo.userId, userInfo.UserInfo.userId, "alert", message, extraInfo);
     }
 }
예제 #3
0
 public void ModeratorUnmute(RoomUser user, long sessionTo, long sessionFrom, string message)
 {
     if (ModHasRight(sessionFrom, "fuse_mute"))
     {
         ExecuteUnmute(sessionTo);
         if (user != null) WhisperResponse("Unmuted user " + user.UserInfo.sUsername, sessionFrom);
         LogCommand(InstanceManager.Sessions.GetSession(sessionFrom).mUserInfo.userId, user.UserInfo.userId, "unmute", message, "Text Command");
     }
 }
예제 #4
0
        public void ModeratorBan(RoomUser user, int userToBan, int userBanner, string message, int numHours, long sessionTo, long sessionFrom, bool banMachine, bool banIp, string extraInfo)
        {
            if (ModHasRight(sessionFrom, "fuse_ban"))
            {
                int roomId = InstanceManager.Sessions.GetSession(sessionTo).mRoomID;

                ExecuteBan(sessionTo, message, roomId, userToBan, userBanner, numHours, banIp);
                if (user != null)
                {
                    WhisperResponse("Ban issued to " + user.UserInfo.sUsername, sessionFrom);
                    LogCommand(InstanceManager.Sessions.GetSession(sessionFrom).mUserInfo.userId, user.UserInfo.userId, "ban", "Length:" + numHours.ToString() + "\r\nMessage:" + message, extraInfo);
                }
            }
        }
        public void CallForHelp(RoomUser user, RoomInfo room, string callBody)
        {
            CallForHelpInfo cfh = new CallForHelpInfo();
            cfh.CallId = callCurrentID++;
            cfh.Caller = user.UserInfo.sUsername;
            cfh.CallerId = user.UserInfo.userId;
            cfh.Message = callBody;
            cfh.PickedUpBy = "";
            cfh.Priority = 2;
            cfh.RoomId = room.RoomID;
            cfh.RoomName = room.RoomName;

            mCalls.Add(cfh.CallId, cfh);

            SendCFH(cfh);
        }
예제 #6
0
        private void SendTradeInfo(RoomUser currentUser, RoomUser otherUser)
        {
            mMessage.Init(108); //Al
            mMessage.appendString(currentUser.UserInfo.sUsername);
            mMessage.appendChar(9);
            mMessage.appendString(currentUser.TradeAccepted.ToString().ToLower());
            mMessage.appendChar(9);

            if (currentUser.TradeOffer.Count > 0)
            {
                mMessage.appendString(BuildTradeList(currentUser.TradeOffer));
            }

            mMessage.appendChar(13);

            mMessage.appendString(otherUser.UserInfo.sUsername);
            mMessage.appendChar(9);
            mMessage.appendString(otherUser.TradeAccepted.ToString().ToLower());
            mMessage.appendChar(9);

            if (otherUser.TradeOffer.Count > 0)
            {
                mMessage.appendString(BuildTradeList(otherUser.TradeOffer));
            }

            InstanceManager.Sessions.GetSession(currentUser.SessionID).SendMessage(mMessage);
        }
예제 #7
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;
                    }

                }
            }
        }
예제 #8
0
        public void TeleporterGoIn(int itemId, RoomUser user)
        {
            FurniInfo item = GetFurniObject(itemId);

            if (item != null)
            {
                if (item.Flags.IsTeleport)
                {
                    if (TilesTouching(item.PosX, item.PosY, user.CurrentX, user.CurrentY) && PlayerCheck(item.PosX, item.PosY) == false)
                    {
                        user.IsMoving = true;
                        user.TargetX = item.PosX;
                        user.TargetY = item.PosY;
                        user.AllowOveride = true;
                        user.Path.Clear();
                        PathFinderNode node = new PathFinderNode();
                        node.X = item.PosX;
                        node.Y = item.PosY;
                        user.Path.Add(node);
                    }
                }
            }
        }
예제 #9
0
        public void TeleporterActivate(int itemId, RoomUser user)
        {
            FurniInfo item = GetFurniObject(itemId);

            if (item != null)
            {
                new ProcessTeleporterDelegate(ProcessTeleporter).BeginInvoke(item, user, null, null);
            }
        }
예제 #10
0
        public void RequestSetStuffDataFloorItem(int itemId, string data, RoomUser user, FurniInfo.VarTypes overrideType)
        {
            FurniInfo item = GetFurniObject(itemId);
            ClientMessage mMessage = new ClientMessage();

            if (item != null)
            {
                if (overrideType != 0) item.VarType = overrideType;

                switch (item.VarType)
                {
                    case FurniInfo.VarTypes.TempOpen:
                        if (TilesTouching(item.PosX, item.PosY, user.CurrentX, user.CurrentY))
                        {
                            InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, "FALSE");
                            if (data == "TRUE") NotifyClientSetStuffTempOpen(itemId);

                        }
                        break;

                    case FurniInfo.VarTypes.TrueFalse:
                        if (TilesTouching(item.PosX, item.PosY, user.CurrentX, user.CurrentY))
                        {
                            if ((data == "TRUE" || data == "FALSE"))
                            {
                                InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data);
                                NotifyClientSetStuffChange(itemId, data);
                            }

                        }
                        break;

                    case FurniInfo.VarTypes.DoorDivider:
                        if (user.HasAdmin || user.HasRights)
                        {
                            if (data == "O" || data == "C")
                            {
                                if (!PlayerCheck(item.PosX, item.PosY))
                                {
                                    InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data);
                                    NotifyClientSetStuffChange(itemId, data);
                                    mFloorFurni = InstanceManager.Game.Furni.GetRoomFloorFurni(mRoomInstance.RoomInfo.RoomID);
                                    GenerateMaps();
                                }

                            }
                        }
                        break;

                    case FurniInfo.VarTypes.Dice:
                        if (TilesTouching(item.PosX, item.PosY, user.CurrentX, user.CurrentY))
                        {
                            if (data == "dice_roll" || data == "dice_off")
                            {
                                int newVal = 0;
                                if (data == "dice_roll") newVal = SpecialMath.RandomNumber(1, 6);
                                bool isRoll = newVal > 0;
                                int rollVal = (item.FurniID * 38) + newVal;
                                InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, newVal.ToString());
                                NotifyClientDiceRoll(item.FurniID, rollVal, isRoll);
                            }
                        }
                        break;

                    case FurniInfo.VarTypes.Bottle:
                        if (data == "dice_roll")
                        {
                            int newVal = SpecialMath.RandomNumber(0, 7);
                            bool isRoll = newVal > 0;
                            int rollVal = (item.FurniID * 38) + newVal;
                            InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, newVal.ToString());
                            NotifyClientDiceRoll(item.FurniID, rollVal, isRoll);
                        }
                        break;

                    case FurniInfo.VarTypes.OnOff:
                        if (data == "ON" || data == "OFF")
                        {
                            InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data);
                            NotifyClientSetStuffChange(itemId, data);
                        }
                        break;

                    case FurniInfo.VarTypes.OpenOrClosed:
                        if (data == "O" || data == "C")
                        {
                            InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data);
                            NotifyClientSetStuffChange(itemId, data);
                        }
                        break;

                    case FurniInfo.VarTypes.NumericalOff:
                        int tmpNum = -1;

                        if (int.TryParse(data, out tmpNum) || data == "OFF")
                        {
                            if (tmpNum >= -1 && tmpNum < 10 && !(tmpNum == -1 && data == "-1"))
                            {
                                InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data);
                                NotifyClientSetStuffChange(itemId, data);
                            }
                        }
                        break;

                }

            }
        }
예제 #11
0
        public void CalculateRights(ref RoomUser newUser, long sessionID)
        {
            newUser.HasAdmin = false;
            newUser.HasRights = false;

            if (newUser.SpecialStates.ContainsKey("flatctrl"))
            {
                newUser.SpecialStates.Remove("flatctrl");
            }

            if (newUser.UserInfo.userId == RoomInfo.RoomOwner)
            {
                newUser.HasAdmin = true;
                newUser.HasRights = true;
            }

            if (InstanceManager.Game.Roles.HasRight(newUser.UserInfo.iRole, "fuse_any_room_controller")) { newUser.HasAdmin = true; newUser.HasRights = true; }
            if (InstanceManager.Game.Roles.HasRight(newUser.UserInfo.iRole, "fuse_any_room_rights")) newUser.HasRights = true;

            if (InstanceManager.Game.Rooms.HasRights(mRoomInfo.RoomID, newUser.UserInfo.userId)) newUser.HasRights = true;

            //Owner Check
            if (newUser.HasAdmin || newUser.HasRights)
            {
                mMessage.Init(42); //@j
                SendMessage(mMessage, sessionID);
                if (newUser.HasAdmin)
                {
                    mMessage.Init(47); //@o
                    SendMessage(mMessage, sessionID);
                }
                newUser.SpecialStates.Add("flatctrl", new RoomUser.RoomUserStatus("flatctrl", true, "useradmin", 0, 0, 0, null, true));
            }

            if (!newUser.HasRights)
            {
                if (mRoomInfo.SuperUsers > 0) newUser.HasRights = true;

                // Superusers
                if (newUser.HasRights && !newUser.HasAdmin)
                {
                    mMessage.Init(42); //@j
                    SendMessage(mMessage, sessionID);
                    newUser.SpecialStates.Add("flatctrl", new RoomUser.RoomUserStatus("flatctrl", true, "onlyfurniture", 0, 0, 0, null, true));
                }
            }

            newUser.MustUpdate = true;
        }
예제 #12
0
        public void ActivateUser(long sessionID)
        {
            RoomUser newUser = new RoomUser();
            newUser.RoomUserID = AllocateID();
            newUser.SessionID = sessionID;

            if (!mDoorEntries.ContainsKey(sessionID))
            {
                newUser.CurrentX = mRoomInfo.StartX;
                newUser.CurrentY = mRoomInfo.StartY;
                newUser.CurrentZ = mRoomInfo.StartZ;
            }
            else
            {
                Furni.FurniInfo teleporter = InstanceManager.Game.Furni.GetFurni(mDoorEntries[sessionID]);
                newUser.CurrentX = teleporter.PosX;
                newUser.CurrentY = teleporter.PosY;
                newUser.CurrentZ = teleporter.PosZ;

            }

            mRoomUsers.Add(sessionID, newUser);

            AnnounceUser(sessionID);

            if (mDoorEntries.ContainsKey(sessionID))
            {
                Furni.FurniInfo teleporter = InstanceManager.Game.Furni.GetFurni(mDoorEntries[sessionID]);
                mMessage.Init(92); //A\
                mMessage.appendInt(teleporter.FurniID);
                mMessage.appendString("/");
                mMessage.appendString(newUser.UserInfo.sUsername);
                mMessage.appendString("/");
                mMessage.appendString(teleporter.FurniSprite);
                RoomBroadcast(mMessage);
                mDoorEntries.Remove(sessionID);
            }

            CalculateRights(ref newUser, sessionID);

            //Send all the user statuses
            foreach (RoomUser roomUser in mRoomUsers.Values)
            {
                SendUserStatus(roomUser.SessionID, true, newUser.SessionID);
            }

            InstanceManager.Game.Rooms.UpdateUsers(mRoomInfo.RoomID, mRoomUsers.Count);
        }
예제 #13
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);
            }
        }
예제 #14
0
        private void WorkBestTile(RoomUser user)
        {
            if (user.Path.Count > 1)
            {
                PathFinderNode skipNode = user.Path[1];

                if (TilesTouching(user.CurrentX, user.CurrentY, skipNode.X, skipNode.Y))
                {
                    if (TileCheck(skipNode.X, skipNode.Y, mMatrix))
                    {
                        int checkX1 = 0;
                        int checkX2 = 0;
                        if (skipNode.X > user.CurrentX)
                        {
                            checkX1 = -1;
                            checkX2 = 1;
                        }
                        else
                        {
                            checkX1 = 1;
                            checkX2 = -1;
                        }

                        if (TileCheck(skipNode.X + checkX1, skipNode.Y, mMatrix) && TileCheck(user.CurrentX + checkX2, user.CurrentY, mMatrix))
                        {
                            PathFinderNode nextNode = user.Path[0];
                            user.Path.Remove(nextNode);
                        }
                    }
                }
            }
        }
예제 #15
0
 private void doPlayerUpdate(RoomUser user, PathFinderNode nextNode)
 {
     user.NextX = nextNode.X;
     user.NextY = nextNode.Y;
     user.NextZ = mHeightMap[user.NextX, user.NextY];
     user.Path.Remove(nextNode);
     mPlayerMap[user.CurrentX, user.CurrentY] = false;
     mPlayerMap[user.NextX, user.NextY] = true;
     int newDirection = SpecialMath.WorkDirection(user.CurrentX, user.CurrentY, user.NextX, user.NextY);
     user.HeadDirection = newDirection;
     user.BodyDirection = newDirection;
     mRoomInstance.AnnounceUserStatus(user.SessionID, true);
     user.CurrentX = user.NextX;
     user.CurrentY = user.NextY;
     user.CurrentZ = user.NextZ;
 }
예제 #16
0
        private void CalculateTileStatusForUser(int X, int Y, RoomUser user, bool isRoller)
        {
            mRoomInstance.RemoveUniqueStatus(user.SessionID, "sit");
            mRoomInstance.RemoveUniqueStatus(user.SessionID, "lay");

            List<FurniInfo> objects = GetFurniObjects(X, Y);
            if (objects != null)
            {
                foreach (FurniInfo info in objects)
                {

                    if (info.Flags.NeverBlocked)
                    {
                        mPlayerMap[X, Y] = false;
                    }

                    if (info.Flags.CanSit)
                    {
                        user.HeadDirection = info.PosRotation;
                        user.BodyDirection = info.PosRotation;
                        user.CurrentZ = info.PosZ;
                        if (!user.SpecialStates.ContainsKey("sit"))
                        {
                            user.SpecialStates.Add("sit", new RoomUser.RoomUserStatus("sit", false, info.ActionHeight.ToString().Replace(',', '.'), 0, 0, 0, null, true));
                        }
                        mRoomInstance.RemoveUniqueStatuses(user.SessionID, "carryd");
                    }
                    else if (info.Flags.CanLay)
                    {
                        user.CurrentZ = info.PosZ;
                        user.HeadDirection = info.PosRotation;
                        user.BodyDirection = info.PosRotation;
                        if (isRoller) user.CurrentZ = mHeightMap[user.CurrentX, user.CurrentY];
                        if (!user.SpecialStates.ContainsKey("lay"))
                        {
                            user.SpecialStates.Add("lay", new RoomUser.RoomUserStatus("lay", false, info.ActionHeight.ToString().Replace(',', '.'), 0, 0, 0, "", true));
                        }
                        mRoomInstance.RemoveUniqueStatuses(user.SessionID, "");
                    }
                    else if (info.Flags.PoolChange)
                    {
                        user.UserLocked = true;

                        ClientMessage message = new ClientMessage();
                        message.Init(96); //A`
                        mRoomInstance.SendMessage(message, user.SessionID);

                        message.Init(71); //AG
                        message.appendString(info.FurniVar);
                        message.appendString(" ");
                        message.appendString("close");
                        mRoomInstance.RoomBroadcast(message);

                        //Block the curtain position
                        int tmpX = int.Parse(info.WallLocation.Split(',')[0]);
                        int tmpY = int.Parse(info.WallLocation.Split(',')[1]);
                        mPlayerMap[tmpX, tmpY] = true;
                    }
                    else if (info.Flags.PoolEnter)
                    {
                        if (user.UserInfo.sPoolFigure != "")
                        {
                            mRoomInstance.RemoveUniqueStatuses(user.SessionID, "");
                            int tmpX = int.Parse(info.WallLocation.Split(',')[0]);
                            int tmpY = int.Parse(info.WallLocation.Split(',')[1]);
                            user.CurrentX = tmpX;
                            user.CurrentY = tmpY;
                            user.CurrentZ = mHeightMap[tmpX, tmpY];
                            user.IsMoving = false;
                            if (!user.SpecialStates.ContainsKey("swim"))
                            {
                                user.SpecialStates.Add("swim", new RoomUser.RoomUserStatus("swim", true, "", 0, 0, 0, null, true));
                            }

                            ClientMessage message = new ClientMessage();
                            message.Init(71); //AG
                            message.appendString(info.FurniVar);
                            message.appendString(" ");
                            message.appendString("enter");
                            mRoomInstance.RoomBroadcast(message);

                            mRoomInstance.AnnounceUserStatus(user.SessionID, true);

                        }
                    }
                    else if (info.Flags.PoolExit)
                    {
                        mRoomInstance.RemoveUniqueStatuses(user.SessionID, "");
                        int tmpX = int.Parse(info.WallLocation.Split(',')[0]);
                        int tmpY = int.Parse(info.WallLocation.Split(',')[1]);
                        user.CurrentX = tmpX;
                        user.CurrentY = tmpY;
                        user.CurrentZ = mHeightMap[tmpX, tmpY];
                        user.IsMoving = false;

                        ClientMessage message = new ClientMessage();
                        message.Init(71); //AG
                        message.appendString(info.FurniVar);
                        message.appendString(" ");
                        message.appendString("exit");
                        mRoomInstance.RoomBroadcast(message);

                        mRoomInstance.AnnounceUserStatus(user.SessionID, true);
                    }

                }
            }
            else
            {
                mRoomInstance.RemoveUniqueStatuses(user.SessionID, "carryd,dance,swim");
            }
        }