コード例 #1
0
ファイル: SongManager.cs プロジェクト: TheNaked/Firewind
        private static void AddToPlaylist(GameClient Session, ClientMessage Message)
        {
            Room Instance = Session.GetHabbo().CurrentRoom;

            if (Instance == null || !Instance.CheckRights(Session, true) || !Instance.GotMusicController() ||
                Instance.GetRoomMusicController().PlaylistSize >= Instance.GetRoomMusicController().PlaylistCapacity)
            {
                return;
            }

            UserItem DiskUserItem = Session.GetHabbo().GetInventoryComponent().GetItem(Message.ReadUInt32());

            if (DiskUserItem == null || DiskUserItem.GetBaseItem().InteractionType != InteractionType.musicdisc)
            {
                return;
            }

            SongItem item = new SongItem(DiskUserItem);

            int NewOrder = Instance.GetRoomMusicController().AddDisk(item);

            if (NewOrder < 0)
            {
                return;
            }

            Session.GetHabbo().GetInventoryComponent().RemoveItem(item.itemID, true);

            Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity,
                Instance.GetRoomMusicController().Playlist.Values.ToList()));
        }
コード例 #2
0
        internal void HandleRequest(ClientMessage request)
        {
            if (isDestroyed)
                return;
            //if (Session.GetHabbo() != null && Session.GetHabbo().Username == "Leon")
            //{
            //    Logging.WriteLine("Received request " + request.Id + " [LEON]");
            //}

            if (FirewindEnvironment.diagPackets)
            {
                DateTime start = DateTime.Now;
                this.Request = request;
                StaticClientMessageHandler.HandlePacket(this, request);

                TimeSpan spent = DateTime.Now - start;
                if (spent.TotalMilliseconds > FirewindEnvironment.timeout)
                {
                    Logging.WriteLine("Packet " + request.Id + " took " + spent.Milliseconds + "ms to run. Packetdata: " + request.ToString());
                }
            }
            else
            {
                this.Request = request;

                StaticClientMessageHandler.HandlePacket(this, request);
            }
            //RequestHandler handler;

            //if (RequestHandlers.TryGetValue(pRequest.Id, out handler))
            //{
            //    //Console.ForegroundColor = ConsoleColor.Green;
            //    //Logging.WriteLine(string.Format("Processing packetID => [{0}]", pRequest.Id));
            //    //DateTime start = DateTime.Now;
            //    handler.Invoke();

            //    //TimeSpan spent = DateTime.Now - start;

            //    //int msSpent = (int)spent.TotalMilliseconds;

            //    //if (msSpent > timeOut)
            //    //{
            //    //    Logging.LogCriticalException(start.ToString() +  " PacketID: " + pRequest.Id + ", total time: " + msSpent);
            //    //}

            //    //Logging.WriteLine(string.Format("[{0}] => Invoked [{1} ticks]", pRequest.Id, spent.Ticks));

            //}
            //else
            //{
            //    //Console.ForegroundColor = ConsoleColor.Red;
            //Logging.WriteLine(string.Format("Unknown packetID => [{0}] data: [{1}]", pRequest.Id, pRequest.Header));
            //}

            //TimeSpan TimeUsed = DateTime.Now - start;
            //if (TimeUsed.Milliseconds > 0 || TimeUsed.Seconds > 0)
            //    Logging.WriteLine("Total used time: " + TimeUsed.Seconds + "s, " + TimeUsed.Milliseconds + "ms");
        }
コード例 #3
0
ファイル: QuestManager.cs プロジェクト: TheNaked/Firewind
        internal void ActivateQuest(GameClient Session, ClientMessage Message)
        {
            Quest Quest = GetQuest(Message.ReadUInt32());

            if (Quest == null)
            {
                return;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {

                dbClient.runFastQuery("REPLACE INTO user_quests VALUES (" + Session.GetHabbo().Id + ", " + Quest.Id + ", 0)");
                dbClient.runFastQuery("UPDATE users SET currentquestid = " + Quest.Id + " WHERE id = " + Session.GetHabbo().Id);
            }

            Session.GetHabbo().CurrentQuestId = Quest.Id;
            GetList(Session, null);
            Session.SendMessage(QuestStartedComposer.Compose(Session, Quest));
        }
コード例 #4
0
ファイル: SongManager.cs プロジェクト: TheNaked/Firewind
        private static void RemoveFromPlaylist(GameClient Session, ClientMessage Message)
        {
            Room Instance = Session.GetHabbo().CurrentRoom;

            if (Instance == null ||  !Instance.GotMusicController() || !Instance.CheckRights(Session, true))
            {
                return;
            }

            SongItem TakenItem = Instance.GetRoomMusicController().RemoveDisk(Message.ReadInt32());
            // playlist will skip to the next item automatically if it has to

            if (TakenItem == null)
            {
                return;
            }

            Session.GetHabbo().GetInventoryComponent().AddNewItem(TakenItem.itemID, TakenItem.baseItem.ItemId, new StringData(TakenItem.songID.ToString()), 0, true, true);

            Session.SendMessage(JukeboxComposer.Compose(Session));
            Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity,
                Instance.GetRoomMusicController().Playlist.Values.ToList()));
        }
コード例 #5
0
ファイル: SongManager.cs プロジェクト: TheNaked/Firewind
        private static void GetSongData(GameClient Session, ClientMessage Message)
        {
            int Amount = Message.ReadInt32();
            List<SongData> Songs = new List<SongData>();

            for (int i = 0; i < Amount; i++)
            {
                SongData Song = GetSong(Message.ReadUInt32());

                if (Song == null)
                    continue;

                Songs.Add(Song);
            }

            Session.SendMessage(JukeboxComposer.Compose(Songs));
        }
コード例 #6
0
ファイル: SongManager.cs プロジェクト: TheNaked/Firewind
        private static void GetPlaylist(GameClient Session, ClientMessage Message)
        {
            Room Instance = Session.GetHabbo().CurrentRoom;

            if (Instance == null || !Instance.CheckRights(Session, true))
            {
                return;
            }

            Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity,
                Instance.GetRoomMusicController().Playlist.Values.ToList()));
        }
コード例 #7
0
ファイル: SongManager.cs プロジェクト: TheNaked/Firewind
 private static void GetDisks(GameClient Session, ClientMessage Message)
 {
     Session.SendMessage(JukeboxComposer.Compose(Session));
 }
コード例 #8
0
 internal void GetList(GameClient Session, ClientMessage Message)
 {
     Session.SendMessage(AchievementListComposer.Compose(Session, Achievements.Values.ToList()));
 }
コード例 #9
0
        internal void HandleRequest(ClientMessage request)
        {
            if (isDestroyed)
            {
                return;
            }
            //if (Session.GetHabbo() != null && Session.GetHabbo().Username == "Leon")
            //{
            //    Logging.WriteLine("Received request " + request.Id + " [LEON]");
            //}

            if (FirewindEnvironment.diagPackets)
            {
                DateTime start = DateTime.Now;
                this.Request = request;
                StaticClientMessageHandler.HandlePacket(this, request);

                TimeSpan spent = DateTime.Now - start;
                if (spent.TotalMilliseconds > FirewindEnvironment.timeout)
                {
                    Logging.WriteLine("Packet " + request.Id + " took " + spent.Milliseconds + "ms to run. Packetdata: " + request.ToString());
                }
            }
            else
            {
                this.Request = request;

                StaticClientMessageHandler.HandlePacket(this, request);
            }
            //RequestHandler handler;

            //if (RequestHandlers.TryGetValue(pRequest.Id, out handler))
            //{
            //    //Console.ForegroundColor = ConsoleColor.Green;
            //    //Logging.WriteLine(string.Format("Processing packetID => [{0}]", pRequest.Id));
            //    //DateTime start = DateTime.Now;
            //    handler.Invoke();

            //    //TimeSpan spent = DateTime.Now - start;

            //    //int msSpent = (int)spent.TotalMilliseconds;

            //    //if (msSpent > timeOut)
            //    //{
            //    //    Logging.LogCriticalException(start.ToString() +  " PacketID: " + pRequest.Id + ", total time: " + msSpent);
            //    //}

            //    //Logging.WriteLine(string.Format("[{0}] => Invoked [{1} ticks]", pRequest.Id, spent.Ticks));


            //}
            //else
            //{
            //    //Console.ForegroundColor = ConsoleColor.Red;
            //Logging.WriteLine(string.Format("Unknown packetID => [{0}] data: [{1}]", pRequest.Id, pRequest.Header));
            //}

            //TimeSpan TimeUsed = DateTime.Now - start;
            //if (TimeUsed.Milliseconds > 0 || TimeUsed.Seconds > 0)
            //    Logging.WriteLine("Total used time: " + TimeUsed.Seconds + "s, " + TimeUsed.Milliseconds + "ms");
        }
コード例 #10
0
ファイル: WiredSaver.cs プロジェクト: TheNaked/Firewind
        internal static void HandleSave(GameClient Session, uint itemID, Room room, ClientMessage clientMessage)
        {
            RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
            if (item == null)
                return;

            if (item.wiredHandler != null)
            {
                item.wiredHandler.Dispose();
                item.wiredHandler = null;
            }
            //Logging.WriteLine("handle wired!");
            InteractionType type = item.GetBaseItem().InteractionType;
            switch (type)
            {
                case InteractionType.triggeronusersay:
                    {
                        int junk = clientMessage.ReadInt32();
                        bool isOnlyOwner = (clientMessage.ReadInt32() == 1);
                        string message = clientMessage.ReadString();
                        //Logging.WriteLine("Handle 'onusersay' itemid(" + item.Id + ") junk(" + junk + ") wired: isOnlyOwner(" + isOnlyOwner + ") message = " + message);

                        IWiredTrigger handler = new UserSays(item, room.GetWiredHandler(), isOnlyOwner, message, room);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }
                case InteractionType.triggerwalkonfurni:
                    {
                        int junk = clientMessage.ReadInt32();
                        string message = clientMessage.ReadString();
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.ReadInt32();

                        IWiredTrigger handler = new WalksOnFurni(item, room.GetWiredHandler(), items, delay);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }
                case InteractionType.triggerwalkofffurni:
                    {
                        int junk = clientMessage.ReadInt32();
                        string message = clientMessage.ReadString();
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.ReadInt32();

                        IWiredTrigger handler = new WalksOnFurni(item, room.GetWiredHandler(), items, delay);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }
                case InteractionType.actionshowmessage:
                    {
                        int junk = clientMessage.ReadInt32();
                        string message = clientMessage.ReadString();

                        IWiredTrigger action = new ShowMessage(message, room.GetWiredHandler(), itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
                        break;
                    }
                case InteractionType.actionteleportto:
                    {
                        int junk = clientMessage.ReadInt32();
                        string junk2 = clientMessage.ReadString();
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.ReadInt32();

                        IWiredTrigger action = new TeleportToItem(room.GetGameMap(), room.GetWiredHandler(), items, delay, itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
                        break;
                    }
                case InteractionType.actiontogglestate:
                    {
                        int junk = clientMessage.ReadInt32();
                        string message = clientMessage.ReadString();
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.ReadInt32();
                        //Logging.WriteLine("Save action toogle wired with " + items.Count + " item(s) and " + delay + " second(s) of delay!");

                        IWiredTrigger action = new ToggleItemState(room.GetGameMap(), room.GetWiredHandler(), items, delay, item);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
                        break;
                    }
                case InteractionType.actionmoverotate:
                    {
                        int junk = clientMessage.ReadInt32();
                        MovementState movement = (MovementState)clientMessage.ReadInt32();
                        RotationState rotation = (RotationState)clientMessage.ReadInt32();

                        bool junk3 = clientMessage.ReadBoolean();
                        bool junk2 = clientMessage.ReadBoolean();
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.ReadInt32();

                        IWiredTrigger handler = new MoveRotate(movement, rotation, items, delay, room, room.GetWiredHandler(), itemID);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }
                case InteractionType.actionposreset:
                    {

                        int junk = clientMessage.ReadInt32();
                        bool junk3 = clientMessage.ReadBoolean();
                        bool junk2 = clientMessage.ReadBoolean();

                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.ReadInt32();

                        IWiredTrigger action = new PositionReset(items, delay, room.GetRoomItemHandler(), room.GetWiredHandler(), itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.actionresettimer:
                    {

                        int junk = clientMessage.ReadInt32();
                        bool junk3 = clientMessage.ReadBoolean();
                        bool junk2 = clientMessage.ReadBoolean();
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.ReadInt32();

                        IWiredTrigger action = new TimerReset(room, room.GetWiredHandler(), items, delay, itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }
                case InteractionType.actiongivescore:
                    {
                        int junk = clientMessage.ReadInt32();
                        int points = clientMessage.ReadInt32();
                        int games = clientMessage.ReadInt32();

                        IWiredTrigger action = new GiveScore(games, points, room.GetGameManager(), itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }
                case InteractionType.triggergameend:
                    {
                        IWiredTrigger handler = new GameEnds(item, room.GetWiredHandler(), room.GetGameManager());
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }

                case InteractionType.triggergamestart:
                    {
                        IWiredTrigger handler = new GameStarts(item, room.GetWiredHandler(), room.GetGameManager());
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }
                case InteractionType.triggerrepeater:
                    {
                        int junk = clientMessage.ReadInt32();
                        int cycleTimes = clientMessage.ReadInt32();

                        IWiredTrigger handler = new Repeater(room.GetWiredHandler(), item, cycleTimes);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.triggerroomenter:
                    {
                        int junk = clientMessage.ReadInt32();
                        string users = clientMessage.ReadString();

                        IWiredTrigger handler = new EntersRoom(item, room.GetWiredHandler(), room.GetRoomUserManager(), !string.IsNullOrEmpty(users), users);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }

                case InteractionType.triggerscoreachieved:
                    {
                        int junk = clientMessage.ReadInt32();
                        int score = clientMessage.ReadInt32();

                        IWiredTrigger handler = new ScoreAchieved(item, room.GetWiredHandler(), score, room.GetGameManager());
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.triggertimer:
                    {
                        int junk = clientMessage.ReadInt32();
                        int cycles = clientMessage.ReadInt32();

                        IWiredTrigger handler = new Timer(item, room.GetWiredHandler(), cycles, room.GetGameManager());
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.triggerstatechanged:
                    {
                        int junk = clientMessage.ReadInt32();
                        bool junk3 = clientMessage.ReadBoolean();
                        bool junk2 = clientMessage.ReadBoolean();

                        int furniAmount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniAmount);
                        int delay = clientMessage.ReadInt32();

                        IWiredTrigger handler = new SateChanged(room.GetWiredHandler(), item, items, delay);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }
            }
            Session.SendMessage(new ServerMessage(Outgoing.SaveWired));
            /*switch (type)
            {
                case InteractionType.actiongivescore:
                    {
                        clientMessage.AdvancePointer(1);
                        int points = clientMessage.PopWiredInt32();
                        int games = clientMessage.PopWiredInt32();

                        IWiredTrigger action = new GiveScore(games, points, room.GetGameManager(), itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.actionmoverotate:
                    {
                        clientMessage.AdvancePointer(1);
                        MovementState movement = (MovementState)clientMessage.PopWiredInt32();
                        RotationState rotation = (RotationState)clientMessage.PopWiredInt32();

                        clientMessage.AdvancePointer(2);
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.PopWiredInt32();

                        IWiredTrigger action = new MoveRotate(movement, rotation, items, delay, room, room.GetWiredHandler(), itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.actionposreset:
                    {

                        clientMessage.AdvancePointer(3);
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.PopWiredInt32();

                        IWiredTrigger action = new PositionReset(items, delay, room.GetRoomItemHandler(), room.GetWiredHandler(), itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.actionresettimer:
                    {

                        clientMessage.AdvancePointer(3);
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.PopWiredInt32();

                        IWiredTrigger action = new TimerReset(room, room.GetWiredHandler(), items, delay, itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.actionshowmessage:
                    {
                        clientMessage.AdvancePointer(1);
                        string message = clientMessage.PopFixedString();

                        IWiredTrigger action = new ShowMessage(message, room.GetWiredHandler(), itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
                        break;
                    }

                case InteractionType.actionteleportto:
                    {
                        clientMessage.AdvancePointer(3);
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.PopWiredInt32();

                        IWiredTrigger action = new TeleportToItem(room.GetGameMap(), room.GetWiredHandler(), items, delay, itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.actiontogglestate:
                    {
                        clientMessage.AdvancePointer(3);
                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
                        int delay = clientMessage.PopWiredInt32();

                        IWiredTrigger action = new ToggleItemState(room.GetGameMap(), room.GetWiredHandler(), items, delay, itemID);
                        HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.conditionfurnishaveusers:
                    {
                        clientMessage.AdvancePointer(1);
                        bool a = clientMessage.PopWiredBoolean();
                        bool b = clientMessage.PopWiredBoolean();
                        bool c = clientMessage.PopWiredBoolean();
                        clientMessage.AdvancePointer(2);

                        int furniCount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniCount);

                        if (a)
                        {
                            int a1 = 2;
                        }

                        break;
                    }

                case InteractionType.conditionstatepos:
                    {

                        break;
                    }

                case InteractionType.conditiontimelessthan:
                    {

                        break;
                    }

                case InteractionType.conditiontimemorethan:
                    {

                        break;
                    }

                case InteractionType.conditiontriggeronfurni:
                    {

                        break;
                    }

                case InteractionType.specialrandom:
                    {

                        break;
                    }

                case InteractionType.specialunseen:
                    {

                        break;
                    }

                case InteractionType.triggergameend:
                    {
                        IWiredTrigger handler = new GameEnds(item, room.GetWiredHandler(), room.GetGameManager());
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }

                case InteractionType.triggergamestart:
                    {
                        IWiredTrigger handler = new GameStarts(item, room.GetWiredHandler(), room.GetGameManager());
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }

                case InteractionType.triggeronusersay:
                    {
                        clientMessage.AdvancePointer(1);
                        bool isOnlyOwner = clientMessage.PopWiredBoolean();
                        clientMessage.AdvancePointer(0);
                        string message = clientMessage.PopFixedString();
                        string stuff = clientMessage.ToString();

                        IWiredTrigger handler = new UserSays(item, room.GetWiredHandler(), isOnlyOwner, message, room);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.triggerrepeater:
                    {
                        clientMessage.AdvancePointer(1);
                        int cycleTimes = clientMessage.PopWiredInt32();

                        IWiredTrigger handler = new Repeater(room.GetWiredHandler(), item, cycleTimes);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.triggerroomenter:
                    {
                        clientMessage.AdvancePointer(1);
                        string users = clientMessage.PopFixedString();

                        IWiredTrigger handler = new EntersRoom(item, room.GetWiredHandler(), room.GetRoomUserManager(), !string.IsNullOrEmpty(users), users);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }

                case InteractionType.triggerscoreachieved:
                    {
                        clientMessage.AdvancePointer(1);
                        int score = clientMessage.PopWiredInt32();

                        IWiredTrigger handler = new ScoreAchieved(item, room.GetWiredHandler(), score, room.GetGameManager());
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.triggertimer:
                    {
                        clientMessage.AdvancePointer(1);
                        int cycles = clientMessage.PopWiredInt32();

                        IWiredTrigger handler = new Timer(item, room.GetWiredHandler(), cycles, room.GetGameManager());
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.triggerstatechanged:
                    {
                        clientMessage.AdvancePointer(3);

                        int furniAmount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniAmount);
                        int delay = clientMessage.PopWiredInt32();

                        IWiredTrigger handler = new SateChanged(room.GetWiredHandler(), item, items, delay);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }

                case InteractionType.triggerwalkofffurni:
                    {
                        clientMessage.AdvancePointer(3);

                        int furniAmount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniAmount);

                        int delay = clientMessage.PopWiredInt32();

                        IWiredTrigger handler = new WalksOffFurni(item, room.GetWiredHandler(), items, delay);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);
                        break;
                    }

                case InteractionType.triggerwalkonfurni:
                    {
                        clientMessage.AdvancePointer(3);
                        int furniAmount;
                        List<RoomItem> items = GetItems(clientMessage, room, out furniAmount);

                        int delay = clientMessage.PopWiredInt32();

                        IWiredTrigger handler = new WalksOnFurni(item, room.GetWiredHandler(), items, delay);
                        HandleTriggerSave(handler, room.GetWiredHandler(), room, itemID);

                        break;
                    }
            }*/
        }
コード例 #11
0
ファイル: WiredSaver.cs プロジェクト: TheNaked/Firewind
        internal static void HandleConditionSave(uint itemID, Room room, ClientMessage clientMessage)
        {
            RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
            if (item == null)
                return;

            if (item.wiredHandler != null)
            {
                item.wiredHandler.Dispose();
                item.wiredHandler = null;
            }

            InteractionType type = item.GetBaseItem().InteractionType;

            if (type != InteractionType.conditionfurnishaveusers && type != InteractionType.conditionstatepos &&
                type != InteractionType.conditiontimelessthan && type != InteractionType.conditiontimemorethan &&
                type != InteractionType.conditiontriggeronfurni)
                return;

            clientMessage.AdvancePointer(1);
            bool a = clientMessage.ReadBoolean();
            bool b = clientMessage.ReadBoolean();
            bool c = clientMessage.ReadBoolean();
            clientMessage.AdvancePointer(2);

            int furniCount;
            List<RoomItem> items = GetItems(clientMessage, room, out furniCount);

            IWiredCondition handler = null;

            switch (type)
            {
                case InteractionType.conditionfurnishaveusers:
                    {
                        handler = new FurniHasUser(item, items);
                        break;
                    }
                case InteractionType.conditionstatepos:
                    {
                        handler = new FurniStatePosMatch(item, items);
                        break;
                    }

                case InteractionType.conditiontimelessthan:
                    {
                        handler = new LessThanTimer(500, room, item);
                        break;
                    }

                case InteractionType.conditiontimemorethan:
                    {
                        handler = new MoreThanTimer(500, room, item);
                        break;
                    }

                case InteractionType.conditiontriggeronfurni:
                    {
                        handler = new TriggerUserIsOnFurni(item, items);
                        break;
                    }

                default:
                    return;
            }

            item.wiredCondition = handler;
            room.GetWiredHandler().conditionHandler.AddOrIgnoreRefferance(item);

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                handler.SaveToDatabase(dbClient);
            }
        }
コード例 #12
0
ファイル: QuestManager.cs プロジェクト: TheNaked/Firewind
        internal void CancelQuest(GameClient Session, ClientMessage Message)
        {
            Quest Quest = GetQuest(Session.GetHabbo().CurrentQuestId);

            if (Quest == null)
            {
                return;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("DELETE FROM user_quests WHERE user_id = " + Session.GetHabbo().Id + " AND quest_id = " + Quest.Id);
            }

            Session.SendMessage(QuestAbortedComposer.Compose());
            GetList(Session, null);
        }
コード例 #13
0
ファイル: QuestManager.cs プロジェクト: TheNaked/Firewind
 internal void GetList(GameClient Session, ClientMessage Message)
 {
     Session.SendMessage(QuestListComposer.Compose(Session, quests.Values.ToList(), (Message != null)));
 }
コード例 #14
0
ファイル: QuestManager.cs プロジェクト: TheNaked/Firewind
        internal void GetCurrentQuest(GameClient Session, ClientMessage Message)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Quest UserQuest = GetQuest(Session.GetHabbo().LastCompleted);
            Quest NextQuest = GetNextQuestInSeries(UserQuest.Category, UserQuest.Number + 1);

            if (NextQuest == null)
            {
                return;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("REPLACE INTO user_quests VALUES (" + Session.GetHabbo().Id + ", " + NextQuest.Id + ", 0)");
                dbClient.runFastQuery("UPDATE users SET currentquestid = " + NextQuest.Id + " WHERE id = " + Session.GetHabbo().Id);
            }

            Session.GetHabbo().CurrentQuestId = NextQuest.Id;
            GetList(Session, null);
            Session.SendMessage(QuestStartedComposer.Compose(Session, NextQuest));

            //Session.SendMessage(QuestStartedComposer.Compose(Session, NextQuest));
        }
コード例 #15
0
ファイル: WiredSaver.cs プロジェクト: TheNaked/Firewind
        private static List<RoomItem> GetItems(ClientMessage message, Room room, out int itemCount)
        {
            List<RoomItem> items = new List<RoomItem>();
            itemCount = message.ReadInt32();

            uint itemID;
            RoomItem item;
            for (int i = 0; i < itemCount; i++)
            {
                itemID = message.ReadUInt32();
                item = room.GetRoomItemHandler().GetItem(itemID);

                if (item != null && !WiredUtillity.TypeIsWired(item.GetBaseItem().InteractionType))
                    items.Add(item);
            }

            return items;
        }
コード例 #16
0
ファイル: GameClient.cs プロジェクト: TheNaked/Firewind
 void parser_onNewPacket(ClientMessage Message)
 {
     try
     {
         MessageHandler.HandleRequest(Message);
     }
     catch (Exception e) { Logging.LogPacketException(Message.ToString(), e.ToString()); }
 }
コード例 #17
0
ファイル: WiredSaver.cs プロジェクト: Kristopher-RZ/Firewind
        internal static void HandleConditionSave(GameClient Session, uint itemID, Room room, ClientMessage clientMessage)
        {
            // // id, resolveIntParams, resolveStringParam, getStuffIds, resolveStuffSelectionType
            RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
            if (item == null)
                return;

            if (item.wiredCondition != null)
            {
                item.wiredCondition.Dispose();
                item.wiredCondition = null;
            }

            InteractionType type = item.GetBaseItem().InteractionType;

            if (type != InteractionType.conditionfurnishaveusers && type != InteractionType.conditionstatepos &&
                type != InteractionType.conditiontimelessthan && type != InteractionType.conditiontimemorethan &&
                type != InteractionType.conditiontriggeronfurni)
                return;

            // Parse data
            int[] intParams = new int[clientMessage.ReadInt32()];
            for (int i = 0; i < intParams.Length; i++)
                intParams[i] = clientMessage.ReadInt32();

            string stringParam = clientMessage.ReadString();

            int furniCount;
            List<RoomItem> items = GetItems(clientMessage, room, out furniCount);

            int stuffSelectionType = clientMessage.ReadInt32();

            IWiredCondition handler = null;

            switch (type)
            {
                case InteractionType.conditionfurnishaveusers:
                    {
                        handler = new FurniHasUser(item, items);
                        break;
                    }
                case InteractionType.conditionstatepos:
                    {
                        handler = new FurniStatePosMatch(item, items);
                        break;
                    }

                case InteractionType.conditiontimelessthan:
                    {
                        handler = new LessThanTimer(500, room, item);
                        break;
                    }

                case InteractionType.conditiontimemorethan:
                    {
                        handler = new MoreThanTimer(500, room, item);
                        break;
                    }

                case InteractionType.conditiontriggeronfurni:
                    {
                        handler = new TriggerUserIsOnFurni(item, items);
                        break;
                    }

                default:
                    return;
            }

            item.wiredCondition = handler;
            room.GetWiredHandler().conditionHandler.AddOrIgnoreRefferance(item);

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                handler.SaveToDatabase(dbClient);
            }
            Session.SendMessage(new ServerMessage(Outgoing.SaveWired));
        }