コード例 #1
0
ファイル: Trade.cs プロジェクト: TheNaked/Firewind
        internal Trade(UInt32 UserOneId, UInt32 UserTwoId, UInt32 RoomId)
        {
            this.oneId = UserOneId;
            this.twoId = UserTwoId;

            this.Users = new TradeUser[2];
            this.Users[0] = new TradeUser(UserOneId, RoomId);
            this.Users[1] = new TradeUser(UserTwoId, RoomId);
            this.TradeStage = 1;
            this.RoomId = RoomId;

            foreach (TradeUser User in Users)
            {
                if (!User.GetRoomUser().Statusses.ContainsKey("trd"))
                {
                    User.GetRoomUser().AddStatus("trd", "");
                    User.GetRoomUser().UpdateNeeded = true;
                }
            }

            ServerMessage Message = new ServerMessage(Outgoing.TradeStart);
            Message.AppendUInt(UserOneId);
            Message.AppendInt32(1); // ready
            Message.AppendUInt(UserTwoId);
            Message.AppendInt32(1); // ready
            SendMessageToUsers(Message);
        }
コード例 #2
0
        internal static ServerMessage Compose(int PlaylistCapacity, List<SongInstance> Playlist)
        {
            ServerMessage Message = new ServerMessage(334);
            Message.AppendInt32(PlaylistCapacity);
            Message.AppendInt32(Playlist.Count);

            foreach (SongInstance Song in Playlist)
            {
                Message.AppendUInt(Song.DiskItem.itemID);
                Message.AppendUInt(Song.SongData.Id);
            }

            return Message;
        }
コード例 #3
0
ファイル: ChatMessage.cs プロジェクト: TheNaked/Firewind
 internal void Serialize(ref ServerMessage packet)
 {
     packet.AppendInt32(timeSpoken.Hour);
     packet.AppendInt32(timeSpoken.Minute);
     packet.AppendUInt(userID);
     packet.AppendString(username);
     packet.AppendString(message);
 }
コード例 #4
0
ファイル: MessengerRequest.cs プロジェクト: TheNaked/Firewind
        internal void Serialize(ServerMessage Request)
        {
            // BDhqu@UMeth0d1322033860

            Request.AppendUInt(FromUser);
            Request.AppendString(mUsername);
            Habbo user = FirewindEnvironment.getHabboForName(mUsername);
            Request.AppendString((user != null) ? user.Look : "");
        }
コード例 #5
0
ファイル: UserItem.cs プロジェクト: TheNaked/Firewind
        internal void SerializeFloor(ServerMessage Message, Boolean Inventory)
        {
            Message.AppendUInt(Id);
            Message.AppendString(mBaseItem.Type.ToString().ToUpper());
            Message.AppendUInt(Id);
            Message.AppendInt32(GetBaseItem().SpriteId);
            Message.AppendInt32(Extra); // extra

            Message.AppendInt32(Data.GetTypeID());
            Data.AppendToMessage(Message);

            Message.AppendBoolean(GetBaseItem().AllowRecycle);
            Message.AppendBoolean(GetBaseItem().AllowTrade);
            Message.AppendBoolean(GetBaseItem().AllowInventoryStack);
            Message.AppendBoolean(Marketplace.CanSellItem(this));
            Message.AppendInt32(-1);
            Message.AppendString("");
            Message.AppendInt32(0);
        }
コード例 #6
0
        public static ServerMessage ComposePlayingComposer(uint SongId, int PlaylistItemNumber, int SyncTimestampMs)
        {
            ServerMessage Message = new ServerMessage(327);

            if (SongId == 0)
            {
                Message.AppendInt32(-1);
                Message.AppendInt32(-1);
                Message.AppendInt32(-1);
                Message.AppendInt32(-1);
                Message.AppendInt32(0);
            }
            else
            {
                Message.AppendUInt(SongId);
                Message.AppendInt32(PlaylistItemNumber);
                Message.AppendUInt(SongId);
                Message.AppendInt32(0);
                Message.AppendInt32(SyncTimestampMs);
            }

            return Message;
        }
コード例 #7
0
        public static ServerMessage Compose(List<SongData> Songs)
        {
            ServerMessage Message = new ServerMessage(300);
            Message.AppendInt32(Songs.Count);

            foreach (SongData Song in Songs)
            {
                Message.AppendUInt(Song.Id);
                Message.AppendString(Song.Name);
                Message.AppendString(Song.Data);
                Message.AppendInt32(Song.LengthMiliseconds);
                Message.AppendString(Song.Artist);
            }

            return Message;
        }
コード例 #8
0
ファイル: SearchResult.cs プロジェクト: TheNaked/Firewind
        internal void Searialize(ServerMessage reply)
        {
            reply.AppendUInt(userID);
            reply.AppendString(username);
            reply.AppendString(motto);

            bool Online = (FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(userID) != null);

            reply.AppendBoolean(Online);

            reply.AppendBoolean(false);

            reply.AppendString(string.Empty);
            reply.AppendInt32(0);
            reply.AppendString(look);
            reply.AppendString(last_online);
        }
コード例 #9
0
 internal static ServerMessage Compose(Achievement Achievement, int Level, int PointReward, int PixelReward)
 {
     ServerMessage Message = new ServerMessage(Outgoing.UnlockAchievement);
     Message.AppendUInt(Achievement.Id);                                           // Achievement ID
     Message.AppendInt32(Level);                                                     // Achieved level
     Message.AppendInt32(144);                                                         // Unknown. Random useless number.
     Message.AppendString(Achievement.GroupName + Level);                   // Achieved name
     Message.AppendInt32(PointReward);                                               // Point reward
     Message.AppendInt32(PixelReward);                                               // Pixel reward
     Message.AppendInt32(0);                                                         // Unknown.
     Message.AppendInt32(10);                                                         // Unknown.
     Message.AppendInt32(21);                                                         // Unknown. (Extra reward?)
     Message.AppendString(Level > 1 ? Achievement.GroupName + (Level - 1) : string.Empty);
     Message.AppendString(Achievement.Category);
     Message.AppendString(String.Empty);
     Message.AppendInt32(0);
     Message.AppendInt32(0);
     return Message;
 }
コード例 #10
0
 internal static ServerMessage Compose(Achievement Achievement, int TargetLevel, AchievementLevel TargetLevelData,
     int TotalLevels, UserAchievement UserData)
 {
     ServerMessage Message = new ServerMessage(Outgoing.AchievementProgress);
     Message.AppendUInt(Achievement.Id);                                               // Unknown (ID?)
     Message.AppendInt32(TargetLevel);                                                   // Target level
     Message.AppendString(Achievement.GroupName + TargetLevel);                 // Target name/desc/badge
     Message.AppendInt32(TargetLevelData.Requirement);                                   // Progress req/target
     Message.AppendInt32(TargetLevelData.RewardPixels);                                   // Pixel reward
     Message.AppendInt32(TargetLevelData.RewardPoints);                                  // Unknown(??)
     Message.AppendInt32(0); // ?
     Message.AppendInt32(UserData != null ? UserData.Progress : 0);                      // Current progress
     Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false);  // Set 100% completed(??)
     Message.AppendString(Achievement.Category);                               // Category
     Message.AppendString(String.Empty);
     Message.AppendInt32(TotalLevels);                                                   // Total amount of levels
     Message.AppendInt32(0);
     return Message;
 }
コード例 #11
0
        internal static ServerMessage Compose(GameClient Session, List<Achievement> Achievements)
        {
            ServerMessage Message = new ServerMessage(Outgoing.AchievementList); //436
            Message.AppendInt32(Achievements.Count);

            foreach (Achievement Achievement in Achievements)
            {
                UserAchievement UserData = Session.GetHabbo().GetAchievementData(Achievement.GroupName);
                int TargetLevel = (UserData != null ? UserData.Level + 1 : 1);
                int TotalLevels = Achievement.Levels.Count;

                if (TargetLevel > TotalLevels)
                {
                    TargetLevel = TotalLevels;
                }

                AchievementLevel TargetLevelData = Achievement.Levels[TargetLevel];

                Message.AppendUInt(Achievement.Id);                                                           // Unknown (ID?)
                Message.AppendInt32(TargetLevel);                                                   // Target level
                Message.AppendString(Achievement.GroupName + TargetLevel);                 // Target name/desc/badge
                Message.AppendInt32(TargetLevelData.Requirement);                                   // Progress req/target
                Message.AppendInt32(TargetLevelData.RewardPixels);                                   // Pixel reward
                Message.AppendInt32(TargetLevelData.RewardPoints);                                  // Unknown(??)
                Message.AppendInt32(0);
                Message.AppendInt32(UserData != null ? UserData.Progress : 0);                      // Current progress
                Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false);  // Set 100% completed(??)
                Message.AppendString(Achievement.Category);                                // Category
                Message.AppendString(String.Empty);
                Message.AppendInt32(TotalLevels);                                                   // Total amount of levels
                Message.AppendInt32(0);
            }
            Message.AppendBoolean(false);
            Message.AppendBoolean(false);
            return Message;
        }
コード例 #12
0
ファイル: Marketplace.cs プロジェクト: Kristopher-RZ/Firewind
        internal static ServerMessage SerializeOffers(int MinCost, int MaxCost, String SearchQuery, int FilterMode)
        {
            // IgI`UJUIIY~JX]gXoAJISA

            DataTable Data = new DataTable();
            StringBuilder WhereClause = new StringBuilder();
            string OrderMode = "";

            WhereClause.Append("WHERE state = '1' AND timestamp >= " + FormatTimestampString());

            if (MinCost >= 0)
            {
                WhereClause.Append(" AND total_price > " + MinCost);
            }

            if (MaxCost >= 0)
            {
                WhereClause.Append(" AND total_price < " + MaxCost);
            }

            switch (FilterMode)
            {
                case 1:
                default:

                    OrderMode = "ORDER BY asking_price DESC";
                    break;

                case 2:

                    OrderMode = "ORDER BY asking_price ASC";
                    break;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (SearchQuery.Length >= 1)
                    WhereClause.Append(" AND public_name LIKE @search_query");

                dbClient.setQuery("SELECT offer_id, item_type, sprite_id, total_price FROM catalog_marketplace_offers " + WhereClause.ToString() + " " + OrderMode + " LIMIT 100");
                dbClient.addParameter("search_query", SearchQuery + "%");

                Data = dbClient.getTable();
            }

            ServerMessage Message = new ServerMessage(615);

            if (Data != null)
            {
                Message.AppendInt32(Data.Rows.Count);

                foreach (DataRow Row in Data.Rows)
                {
                    Message.AppendUInt(Convert.ToUInt32(Row["offer_id"]));
                    Message.AppendInt32(1);
                    Message.AppendInt32(int.Parse(Row["item_type"].ToString()));
                    Message.AppendInt32((int)Row["sprite_id"]); // Sprite ID
                    Message.AppendString(""); // Extra Chr (R52)
                    Message.AppendInt32((int)Row["total_price"]); // Price
                    Message.AppendInt32((int)Row["sprite_id"]); // ??
                    Message.AppendInt32((int)Row["total_price"]); // Avg
                    Message.AppendInt32(0); // Offers
                }
            }
            else
            {
                Message.AppendInt32(0);
            }

            return Message;
        }
コード例 #13
0
ファイル: Marketplace.cs プロジェクト: Kristopher-RZ/Firewind
        internal static ServerMessage SerializeOwnOffers(int HabboId)
        {
            int Profits = 0;
            DataTable Data;
            String RawProfit;

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT timestamp, state, offer_id, item_type, sprite_id, total_price FROM catalog_marketplace_offers WHERE user_id = " + HabboId);
                Data = dbClient.getTable();

                dbClient.setQuery("SELECT SUM(asking_price) FROM catalog_marketplace_offers WHERE state = '2' AND user_id = " + HabboId);
                RawProfit = dbClient.getRow()[0].ToString();
            }

            if (RawProfit.Length > 0)
                Profits = int.Parse(RawProfit);

            ServerMessage Message = new ServerMessage(616);
            Message.AppendInt32(Profits);

            if (Data != null)
            {
                Message.AppendInt32(Data.Rows.Count);

                foreach (DataRow Row in Data.Rows)
                {
                    int MinutesLeft = (int)Math.Floor((((Double)Row["timestamp"] + 172800) - FirewindEnvironment.GetUnixTimestamp()) / 60);
                    int state = int.Parse(Row["state"].ToString());

                    if (MinutesLeft <= 0)
                    {
                        state = 3;
                        MinutesLeft = 0;
                    }

                    Message.AppendUInt(Convert.ToUInt32(Row["offer_id"]));
                    Message.AppendInt32(state); // 1 = active, 2 = sold, 3 = expired
                    Message.AppendInt32(int.Parse(Row["item_type"].ToString())); // always 1 (??)
                    Message.AppendInt32((int)Row["sprite_id"]);
                    Message.AppendString(""); // Extra Chr (R52)
                    Message.AppendInt32((int)Row["total_price"]); // ??
                    Message.AppendInt32(MinutesLeft);
                    Message.AppendInt32((int)Row["sprite_id"]);
                }
            }
            else
                Message.AppendInt32(0);

            return Message;
        }
コード例 #14
0
        internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category)
        {
            int AmountInCat = FirewindEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category);
            int Number = Quest == null ? AmountInCat : Quest.Number - 1;
            int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);

            if (Quest != null && Quest.IsCompleted(UserProgress))
            {
                Number++;
            }

            Message.AppendString(Category);
            Message.AppendInt32(Number); // Quest progress in this cat
            Message.AppendInt32(AmountInCat); // Total quests in this cat
            Message.AppendInt32((int)QuestRewardType.Pixels); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
            Message.AppendUInt(Quest == null ? 0 : Quest.Id); // Quest id
            Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started
            Message.AppendString(Quest == null ? string.Empty : Quest.ActionName);
            Message.AppendString(Quest == null ? string.Empty : Quest.DataBit);
            Message.AppendInt32(Quest == null ? 0 : Quest.Reward);
            Message.AppendString(Quest == null ? string.Empty : Quest.Name);
            Message.AppendInt32(UserProgress); // Current progress
            Message.AppendUInt(Quest == null ? 0 : Quest.GoalData); // Target progress
            Message.AppendInt32(0); // "Next quest available countdown" in seconds
        }
コード例 #15
0
        internal void UpdateBadges()
        {
            Session.GetHabbo().GetBadgeComponent().ResetSlots();

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("UPDATE user_badges SET badge_slot = 0 WHERE user_id = " + Session.GetHabbo().Id);
            }

            for (int i = 0; i < 5; i++)
            {
                int    Slot  = Request.ReadInt32();
                string Badge = Request.ReadString();

                if (Badge.Length == 0)
                {
                    continue;
                }

                if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Badge) || Slot < 1 || Slot > 5)
                {
                    return;
                }

                Session.GetHabbo().GetBadgeComponent().GetBadge(Badge).Slot = Slot;

                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("UPDATE user_badges SET badge_slot = " + Slot + " WHERE badge_id = @badge AND user_id = " + Session.GetHabbo().Id + "");
                    dbClient.addParameter("badge", Badge);
                    dbClient.runQuery();
                }
            }

            FirewindEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.PROFILE_BADGE);

            ServerMessage Message = new ServerMessage(Outgoing.UpdateBadges);

            Message.AppendUInt(Session.GetHabbo().Id);
            Message.AppendInt32(Session.GetHabbo().GetBadgeComponent().EquippedCount);

            foreach (Badge Badge in Session.GetHabbo().GetBadgeComponent().BadgeList.Values)
            {
                if (Badge.Slot <= 0)
                {
                    continue;
                }

                Message.AppendInt32(Badge.Slot);
                Message.AppendString(Badge.Code);
            }

            if (Session.GetHabbo().InRoom&& FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null)
            {
                FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(Message);
            }
            else
            {
                Session.SendMessage(Message);
            }
        }
コード例 #16
0
        internal ServerMessage SerializeMusicDiscs()
        {
            ServerMessage Message = new ServerMessage(333);
            Message.AppendInt32(discs.Count);

            foreach (UserItem SongDisk in discs.Values)
            {
                uint SongId = 0;
                uint.TryParse(SongDisk.Data.ToString(), out SongId);

                Message.AppendUInt(SongDisk.Id);
                Message.AppendUInt(SongId);
            }

            return Message;
        }
コード例 #17
0
ファイル: RConListener.cs プロジェクト: TheNaked/Firewind
        internal void processCommand(String data)
        {
            String header = data.Split(Convert.ToChar(1))[0];
            String param = data.Split(Convert.ToChar(1))[1];

            //Logging.WriteLine("[MUSConnection.ProcessCommand]: " + data);

            GameClient Client = null;
            switch (header.ToLower())
            {
                case "updatecredits":
                    {
                        if (param == "ALL")
                        {
                         //   FirewindEnvironment.GetGame().GetClientManager().GetClient()
                        }
                        else
                        {
                            Client = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(uint.Parse(param));

                            if (Client == null)
                            {
                                return;
                            }

                            DataRow newCredits;

                            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                            {
                                dbClient.setQuery("SELECT credits FROM users WHERE id = @userid");
                                dbClient.addParameter("userid", (int)Client.GetHabbo().Id);
                                newCredits = dbClient.getRow();
                            }

                            Client.GetHabbo().Credits = (int)newCredits["credits"];
                            Client.GetHabbo().UpdateCreditsBalance();
                        }

                        break;
                    }
                case "signout":
                    {
                        GameClient client = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(uint.Parse(param));
                        if (client == null)
                            return;

                        ServerMessage message = new ServerMessage(Outgoing.DisconnectReason);
                        message.AppendInt32(0); // reason
                        client.SendMessage(message);

                        // Wait 5 seconds and disconnect if not already done by client itself
                        new Task(async delegate { await Task.Delay(5000); client.Disconnect(); }).Start();
                        break;
                    }

                case "ha":
                    {
                        //String extradata = data.Split(Convert.ToChar(1))[2];

                        ServerMessage HotelAlert = new ServerMessage(810);
                        HotelAlert.AppendUInt(1);
                        HotelAlert.AppendString(LanguageLocale.GetValue("hotelallert.notice") + "\r\n" +
                        param + "\r\n");

                        /*if (extradata.Contains("://"))
                        {
                            Logging.WriteLine("TEST");
                            HotelAlert.AppendString(extradata);
                        }*/

                        FirewindEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(HotelAlert);
                        break;
                    }
                case "useralert":
                    {
                        String extradata = data.Split(Convert.ToChar(1))[2];
                        String url = extradata.Split(Convert.ToChar(1))[0];
                        GameClient TargetClient = null;
                        TargetClient = FirewindEnvironment.GetGame().GetClientManager().GetClientByUsername(param);

                        if (TargetClient == null)
                        {
                            return;
                        }
                        if (url.Contains("://"))
                        {
                            extradata = extradata + Convert.ToChar(2) + url;
                        }
                        TargetClient.SendNotif(extradata);
                        break;
                    }

                default:
                    {
                        Logging.WriteLine("Unrecognized MUS packet: " + header + "//" + data);
                        break;
                    }
            }
        }
コード例 #18
0
ファイル: Messenger.cs プロジェクト: TheNaked/Firewind
        internal void SendInstantInvite()
        {
            int count = Request.ReadInt32();

            List<UInt32> UserIds = new List<uint>();

            for (int i = 0; i < count; i++)
            {
                UserIds.Add(Request.ReadUInt32());
            }

            string message = FirewindEnvironment.FilterInjectionChars(Request.ReadString(), true);

            ServerMessage Message = new ServerMessage(Outgoing.InstantInvite);
            Message.AppendUInt(Session.GetHabbo().Id);
            Message.AppendString(message);

            foreach (UInt32 Id in UserIds)
            {
                if (!Session.GetHabbo().GetMessenger().FriendshipExists(Id))
                    continue;

                GameClient Client = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(Id);

                if (Client == null)
                {
                    return;
                }

                Client.SendMessage(Message);
            }
        }
コード例 #19
0
        internal static ServerMessage SerializeSongInventory(Hashtable songs)
        {
            ServerMessage message = new ServerMessage(333);
            message.AppendInt32(songs.Count);

            foreach (UserItem userItem in songs.Values)
            {
                uint songID = (uint)TextHandling.Parse(userItem.Data.ToString());

                message.AppendUInt(userItem.Id);
                message.AppendUInt(songID);
            }

            return message;
        }
コード例 #20
0
ファイル: HabboMessenger.cs プロジェクト: TheNaked/Firewind
 internal void DeliverInstantMessage(string message, uint convoID)
 {
     ServerMessage InstantMessage = new ServerMessage(Outgoing.InstantChat);
     InstantMessage.AppendUInt(convoID);
     InstantMessage.AppendString(message);
     InstantMessage.AppendString(FirewindEnvironment.GetUnixTimestamp() + string.Empty);
     GetClient().SendMessage(InstantMessage);
 }
コード例 #21
0
ファイル: FurniInteractor.cs プロジェクト: TheNaked/Firewind
        internal override bool OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            Point ItemCoordx1 = new Point(Item.Coordinate.X + 1, Item.Coordinate.Y);
            Point ItemCoordx2 = new Point(Item.Coordinate.X - 1, Item.Coordinate.Y);
            Point ItemCoordy1 = new Point(Item.Coordinate.X, Item.Coordinate.Y + 1);
            Point ItemCoordy2 = new Point(Item.Coordinate.X, Item.Coordinate.Y - 1);

            if (User == null)
            {
                return false;
            }

            if (User.Coordinate != ItemCoordx1 && User.Coordinate != ItemCoordx2 && User.Coordinate != ItemCoordy1 && User.Coordinate != ItemCoordy2)
            {
                if (User.CanWalk)
                {
                    User.MoveTo(Item.SquareInFront);
                    return false;
                }
            }
            else
            {
                int NewX = Item.Coordinate.X;
                int NewY = Item.Coordinate.Y;

                if (User.Coordinate == ItemCoordx1)
                {
                    NewX = Item.Coordinate.X - 1;
                    NewY = Item.Coordinate.Y;
                }
                else if (User.Coordinate == ItemCoordx2)
                {
                    NewX = Item.Coordinate.X + 1;
                    NewY = Item.Coordinate.Y;
                }
                else if (User.Coordinate == ItemCoordy1)
                {
                    NewX = Item.Coordinate.X;
                    NewY = Item.Coordinate.Y - 1;
                }
                else if (User.Coordinate == ItemCoordy2)
                {
                    NewX = Item.Coordinate.X;
                    NewY = Item.Coordinate.Y + 1;
                }

                if (Item.GetRoom().GetGameMap().itemCanBePlacedHere(NewX, NewY))
                {
                    Double NewZ = Item.GetRoom().GetGameMap().SqAbsoluteHeight(NewX, NewY);

                    ServerMessage Message = new ServerMessage();
                    Message.Init(Outgoing.ObjectOnRoller); // Cf
                    Message.AppendInt32(Item.Coordinate.X);
                    Message.AppendInt32(Item.Coordinate.Y);
                    Message.AppendInt32(NewX);
                    Message.AppendInt32(NewY);
                    Message.AppendInt32(1);
                    Message.AppendUInt(Item.Id);
                    Message.AppendString(Item.GetZ.ToString().Replace(',', '.'));
                    Message.AppendString(NewZ.ToString().Replace(',', '.'));
                    Message.AppendUInt(0);
                    Item.GetRoom().SendMessage(Message);

                    Item.GetRoom().GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, NewX, NewY, Item.Rot, false, false, false);
                }
            }
            return true;
        }
コード例 #22
0
ファイル: HabboMessenger.cs プロジェクト: TheNaked/Firewind
        internal void DeliverInstantMessageError(int ErrorId, UInt32 ConversationId)
        {
            /*
            3                =     Your friend is muted and cannot reply.
            4                =     Your message was not sent because you are muted.
            5                =     Your friend is not online.
            6                =     Receiver is not your friend anymore.
            7                =     Your friend is busy.
            8                =     Your friend is wanking*/

            ServerMessage reply = new ServerMessage(Outgoing.InstantChatError);
            reply.AppendInt32(ErrorId);
            reply.AppendUInt(ConversationId);
            GetClient().SendMessage(reply);
        }
コード例 #23
0
ファイル: Trade.cs プロジェクト: Kristopher-RZ/Firewind
        internal void UpdateTradeWindow()
        {
            ServerMessage Message = new ServerMessage(Outgoing.TradeUpdate);

            for (int i = 0; i < Users.Length; i++)
            {
                TradeUser User = Users[i];
                if (User == null)
                    continue;

                lock (User.OfferedItems)
                {
                    Message.AppendInt32(User.UserId);
                    Message.AppendInt32(User.OfferedItems.Count);

                    foreach (UserItem Item in User.OfferedItems)
                    {
                        Message.AppendUInt(Item.Id);
                        Message.AppendString(Item.GetBaseItem().Type.ToString().ToLower());
                        Message.AppendUInt(Item.Id);
                        Message.AppendInt32(Item.GetBaseItem().SpriteId);
                        Message.AppendInt32(0); // undef
                        Message.AppendBoolean(true);
                        Message.AppendInt32(0);
                        Message.AppendString("");
                        Message.AppendInt32(0); // xmas 09 furni had a special furni tag here, with wired day (wat?)
                        Message.AppendInt32(0); // xmas 09 furni had a special furni tag here, wired month (wat?)
                        Message.AppendInt32(0); // xmas 09 furni had a special furni tag here, wired year (wat?)

                        if (Item.GetBaseItem().Type == 's')
                        {
                            Message.AppendInt32(0);
                        }
                    }
                }
            }

            SendMessageToUsers(Message);
        }
コード例 #24
0
ファイル: GameClient.cs プロジェクト: TheNaked/Firewind
        internal bool tryLogin(string AuthTicket)
        {
            int loginProgress = 0;
            try
            {
                string ip = GetConnection().getIp();
                byte errorCode = 0;
                UserData userData = UserDataFactory.GetUserData(AuthTicket, ip, out errorCode);
                if (errorCode == 1)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso"));
                    return false;
                }
                else if (errorCode == 2)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.loggedin"));
                    return false;
                }
                loginProgress++;

                FirewindEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                this.Habbo = userData.user;
                userData.user.LoadData(userData);
                loginProgress++;

                if (userData.user.Username == null)
                {
                    SendBanMessage("You have no username.");
                    return false;
                }
                string banReason = FirewindEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip);
                loginProgress++;
                if (!string.IsNullOrEmpty(banReason))
                {
                    SendBanMessage(banReason);
                    return false;
                }

                userData.user.Init(this, userData);

                QueuedServerMessage response = new QueuedServerMessage(Connection);

                ServerMessage UniqueId = new ServerMessage(Outgoing.UniqueID);
                UniqueId.AppendString(this.MachineId);
                response.appendResponse(UniqueId);

                ServerMessage authok = new ServerMessage(Outgoing.AuthenticationOK);
                response.appendResponse(authok);

                ServerMessage HomeRoom = new ServerMessage(Outgoing.HomeRoom);
                HomeRoom.AppendUInt(this.GetHabbo().HomeRoom); // first home
                HomeRoom.AppendUInt(this.GetHabbo().HomeRoom); // first home
                SendMessage(HomeRoom);

                loginProgress++;

                ServerMessage FavouriteRooms = new ServerMessage(Outgoing.FavouriteRooms);
                FavouriteRooms.AppendInt32(30); // max rooms
                FavouriteRooms.AppendInt32(userData.user.FavoriteRooms.Count);
                foreach (uint Id in userData.user.FavoriteRooms.ToArray())
                {
                    FavouriteRooms.AppendUInt(Id);
                }
                response.appendResponse(FavouriteRooms);

                loginProgress++;

                ServerMessage fuserights = new ServerMessage(Outgoing.Fuserights);
                if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) // VIP
                    fuserights.AppendInt32(2);
                else if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) // HC
                    fuserights.AppendInt32(1);
                else
                    fuserights.AppendInt32(0);
                fuserights.AppendUInt(this.GetHabbo().Rank);
                response.appendResponse(fuserights);

                loginProgress++;

                ServerMessage bools1 = new ServerMessage(Outgoing.AvailabilityStatus);
                bools1.AppendBoolean(true);
                bools1.AppendBoolean(false);
                response.appendResponse(bools1);

                ServerMessage bools2 = new ServerMessage(Outgoing.InfoFeedEnable);
                bools2.AppendBoolean(false);
                response.appendResponse(bools2);

                loginProgress++;

                ServerMessage setRanking = new ServerMessage(Outgoing.SerializeCompetitionWinners);
                setRanking.AppendString("hlatCompetitions"); // competition type
                setRanking.AppendInt32(Ranking.getCompetitionForInfo("hlatCompetitions").Count);

                loginProgress++;
                int i = 0;
                foreach (Ranking r in Ranking.getCompetitionForInfo("hlatCompetitions"))
                {
                    i++;
                    setRanking.AppendUInt(r.UserId);
                    Habbo data = FirewindEnvironment.getHabboForId(r.UserId);
                    setRanking.AppendString((data != null) ? data.Username : "******");
                    setRanking.AppendString((data != null) ? data.Look : "sh-907-96.hd-3096-3.he-3082-91.lg-3018-81.ch-660-95.hr-9534-34");
                    setRanking.AppendInt32(i); // position
                    setRanking.AppendInt32(r.Score);
                }
                response.appendResponse(setRanking);

                loginProgress++;

                if (userData.user.HasFuse("fuse_mod"))
                {
                    this.SendMessage(FirewindEnvironment.GetGame().GetModerationTool().SerializeTool());
                    FirewindEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(ref response, userData.userID);
                }

                if (LanguageLocale.welcomeAlertEnabled)
                {
                    this.SendMOTD(LanguageLocale.welcomeAlert);
                }

                loginProgress++;
                using (IQueryAdapter db = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    db.setQuery("UPDATE users SET online = '1' WHERE id = @id");
                    db.addParameter("id", this.GetHabbo().Id);
                    db.runQuery();
                }

                loginProgress++;

                // Send the big chunk
                response.sendResponse();

                // fire the event!
                FirewindEnvironment.GetGame().GetClientManager().ClientLoggedIn(this);
                return true;

            }
            catch (UserDataNotFoundException e)
            {
                SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e.ToString());
            }
            catch (Exception e)
            {
                Logging.LogCriticalException(String.Format("Invalid Dario bug duing user login (progress = {0}): ", loginProgress) + e.ToString());
                SendNotifWithScroll("Login error: " + e.ToString());
            }
            return false;
        }
コード例 #25
0
ファイル: Users.cs プロジェクト: TheNaked/Firewind
        internal void UpdateBadges()
        {
            Session.GetHabbo().GetBadgeComponent().ResetSlots();

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("UPDATE user_badges SET badge_slot = 0 WHERE user_id = " + Session.GetHabbo().Id);
            }

            for(int i = 0; i < 5; i++)
            {
                int Slot = Request.ReadInt32();
                string Badge = Request.ReadString();

                if(Badge.Length == 0)
                    continue;

                if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Badge) || Slot < 1 || Slot > 5)
                    return;

                Session.GetHabbo().GetBadgeComponent().GetBadge(Badge).Slot = Slot;

                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("UPDATE user_badges SET badge_slot = " + Slot + " WHERE badge_id = @badge AND user_id = " + Session.GetHabbo().Id + "");
                    dbClient.addParameter("badge", Badge);
                    dbClient.runQuery();
                }
            }

            FirewindEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.PROFILE_BADGE);

            ServerMessage Message = new ServerMessage(Outgoing.UpdateBadges);
            Message.AppendUInt(Session.GetHabbo().Id);
            Message.AppendInt32(Session.GetHabbo().GetBadgeComponent().EquippedCount);

            foreach (Badge Badge in Session.GetHabbo().GetBadgeComponent().BadgeList.Values)
            {
                if (Badge.Slot <= 0)
                {
                    continue;
                }

                Message.AppendInt32(Badge.Slot);
                Message.AppendString(Badge.Code);
            }

            if (Session.GetHabbo().InRoom && FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null)
            {
                FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(Message);
            }
            else
            {
                Session.SendMessage(Message);
            }
        }
コード例 #26
0
ファイル: Soccer.cs プロジェクト: Kristopher-RZ/Firewind
        internal void MoveBall(RoomItem item, GameClient mover, int newX, int newY)
        {
            if (item == null || mover == null)
                return;

            if (!room.GetGameMap().itemCanBePlacedHere(newX, newY))
            {
                return;
            }

            Point oldRoomCoord = item.Coordinate;
            bool itemIsOnGameItem = GameItemOverlaps(item);

            Double NewZ = room.GetGameMap().Model.SqFloorHeight[newX, newY];

            /*ServerMessage Message = new ServerMessage(Outgoing.UpdateItemOnRoom);
            Message.AppendUInt(item.Id);
            Message.AppendInt32(item.GetBaseItem().SpriteId);
            Message.AppendInt32(item.CoordinateX);
            Message.AppendInt32(item.CoordinateY);
            Message.AppendInt32(Rot);
            Message.AppendString(String.Format("{0:0.00}", TextHandling.GetString(mZ)));
            Message.AppendInt32(0);
            Message.AppendInt32(0);
            if (GetBaseItem().InteractionType != InteractionType.fbgate)
                Message.AppendString(ExtraData);
            else
                Message.AppendString(string.Empty);
            Message.AppendInt32(-1);
            Message.AppendInt32(1); // Type New R63 ('use bottom')
            Message.AppendInt32(UserId);
            Message.AppendUInt(item.Id);
            Message.AppendUInt(3508);
            Message.AppendInt32(item.Coordinate.X);
            Message.AppendInt32(item.Coordinate.Y);
            Message.AppendInt32(newX);
            Message.AppendInt32(newY);
            Message.AppendUInt(4);
            Message.AppendString(NewZ.ToString());
            Message.AppendString("H11");
            Message.AppendInt32(-1);
            Message.AppendInt32(0);
            room.SendMessage(Message);*/

            ServerMessage mMessage = new ServerMessage();
            mMessage.Init(Outgoing.ObjectOnRoller); // Cf
            mMessage.AppendInt32(item.Coordinate.X);
            mMessage.AppendInt32(item.Coordinate.Y);
            mMessage.AppendInt32(newX);
            mMessage.AppendInt32(newY);
            mMessage.AppendInt32(1);
            mMessage.AppendUInt(item.Id);
            mMessage.AppendString(item.GetZ.ToString().Replace(',', '.'));
            mMessage.AppendString(NewZ.ToString().Replace(',', '.'));
            mMessage.AppendUInt(0);
            room.SendMessage(mMessage);

            if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
                return;

            room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rot, false, false, false, false);

            if (!itemIsOnGameItem)
                HandleFootballGameItems(new Point(newX, newY), room.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id));
        }
コード例 #27
0
ファイル: Habbo.cs プロジェクト: TheNaked/Firewind
        internal void SerializeClub()
        {
            GameClient Client = GetClient();
            ServerMessage club = new ServerMessage(Outgoing.SerializeClub);
            club.AppendString("club_habbo");

            if (GetSubscriptionManager().HasSubscription("habbo_vip"))
            {
                Double Expire = GetSubscriptionManager().GetSubscription("habbo_vip").ExpireTime;
                Double TimeLeft = Expire - FirewindEnvironment.GetUnixTimestamp();
                int TotalDaysLeft = (int)Math.Ceiling(TimeLeft / 86400);
                int MonthsLeft = TotalDaysLeft / 31;

                if (MonthsLeft >= 1) MonthsLeft--;

                club.AppendInt32(TotalDaysLeft - (MonthsLeft * 31));
                club.AppendInt32(2); // ??
                club.AppendInt32(MonthsLeft);
                club.AppendInt32(1); // type
                club.AppendBoolean(true);
                club.AppendBoolean(true);
                club.AppendInt32(0);
                club.AppendInt32(0); // days i have on hc
                club.AppendInt32(0); // days i have on vip
            }
            else
            {
                club.AppendInt32(0);
                club.AppendInt32(0); // ??
                club.AppendInt32(0);
                club.AppendInt32(0); // type
                club.AppendBoolean(false);
                club.AppendBoolean(true);
                club.AppendInt32(0);
                club.AppendInt32(0); // days i have on hc
                club.AppendInt32(0); // days i have on vip
            }

            Client.SendMessage(club);

            ServerMessage fuserights = new ServerMessage(Outgoing.Fuserights);
            if (GetSubscriptionManager().HasSubscription("habbo_vip")) // VIP
                fuserights.AppendInt32(2);
            else if (GetSubscriptionManager().HasSubscription("habbo_club")) // HC
                fuserights.AppendInt32(1);
            else
                fuserights.AppendInt32(0);
            fuserights.AppendUInt(Rank);

            Client.SendMessage(fuserights);
        }
コード例 #28
0
ファイル: FurniInteractor.cs プロジェクト: TheNaked/Firewind
        internal override bool OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            if (Session == null || Item == null)
                return false;

            if (!UserHasRights)
                return false;

            String ExtraInfo = "";
            List<RoomItem> items = new List<RoomItem>();
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                try
                {
                    dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id ");
                    dbClient.addParameter("id", (int)Item.Id);
                    ExtraInfo = dbClient.getString();
                }
                catch { }
                try
                {
                    dbClient.setQuery("SELECT triggers_item FROM trigger_in_place WHERE original_trigger = @id");
                    dbClient.addParameter("id", (int)Item.Id);
                    DataTable dTable = dbClient.getTable();
                    RoomItem targetItem;
                    foreach (DataRow dRows in dTable.Rows)
                    {
                        targetItem = Item.GetRoom().GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
                        if (targetItem == null || items.Contains(targetItem))
                            continue;
                        items.Add(targetItem);
                    }
                }
                catch { }
            }
            switch (Item.GetBaseItem().InteractionType)
            {
                #region Triggers

                case InteractionType.triggerwalkonfurni:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false); // stuffTypeSelectionEnabled
                        message.AppendInt32(5); // furniLimit

                        message.AppendInt32(items.Count); //stuffIds
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);

                        message.AppendInt32(Item.GetBaseItem().SpriteId); // stuffTypeId
                        message.AppendUInt(Item.Id); // id
                        message.AppendString(ExtraInfo); // stringParam

                        message.AppendInt32(0); // intParams

                        message.AppendInt32(8); // type
                        message.AppendInt32(0); // delayInPulses
                        message.AppendInt32(0); // conflictingTriggers
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggergamestart:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(0);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggerroomenter:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(0);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(7);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggergameend:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(0);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggertimer:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);

                        message.AppendString(ExtraInfo);
                        message.AppendInt32(1);
                        message.AppendInt32(1);
                        message.AppendInt32(1);
                        message.AppendInt32(3);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggerwalkofffurni:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);

                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggeronusersay:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(0);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggerscoreachieved:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(1);
                        message.AppendInt32(100);
                        message.AppendInt32(0);
                        message.AppendInt32(10);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggerrepeater:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(1);
                        message.AppendInt32(10);
                        message.AppendInt32(0);
                        message.AppendInt32(6);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.triggerstatechanged:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }
                #endregion

                #region Effects
                case InteractionType.actionposreset:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actiongivescore:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(2);
                        message.AppendInt32(5);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(6);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actionresettimer:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actiontogglestate:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actionshowmessage:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(0);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(7);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actionteleportto:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendByte(2);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actionmoverotate:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(2);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(4);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                #endregion

                #region Add-ons
                case InteractionType.specialrandom:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.specialunseen:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }
                #endregion

                #region Conditions
                case InteractionType.conditiontimelessthan:
                case InteractionType.conditiontimemorethan:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredCondition);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        //message.AppendBoolean(false);
                        //message.AppendBoolean(false);
                        //message.AppendInt32(7);
                        //message.AppendBoolean(false);
                        //message.AppendBoolean(false);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.conditionfurnishaveusers:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredCondition);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);

                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(1);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.conditionstatepos:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredCondition);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);

                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(1);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.conditiontriggeronfurni:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredCondition);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);

                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                //Unknown:
                //2 radio + 5 selct
                #endregion

            }
            return true;
        }
コード例 #29
0
        internal bool RemovePet(uint PetId)
        {
            isUpdated = false;
            ServerMessage RemoveMessage = new ServerMessage(Outgoing.PetRemovedFromInventory);
            RemoveMessage.AppendUInt(PetId);
            GetClient().SendMessage(RemoveMessage);

            InventoryPets.Remove(PetId);
            return true;
        }
コード例 #30
0
ファイル: RoomData.cs プロジェクト: Kristopher-RZ/Firewind
        internal void Serialize(ServerMessage Message, Boolean ShowEvents)
        {
            Message.AppendUInt(Id);

            if (Event == null || !ShowEvents)
            {
                Message.AppendBoolean(false);
                Message.AppendString(Name);
                Message.AppendBoolean(Owner != "");
                Message.AppendInt32(OwnerId);
                Message.AppendString(Owner);
                Message.AppendInt32(State); // room state
                Message.AppendInt32(UsersNow);
                Message.AppendInt32(UsersMax);
                Message.AppendString(Description);
                Message.AppendInt32(0); // dunno!
                Message.AppendInt32(2); // can trade?
                Message.AppendInt32(Score);
                Message.AppendInt32(Category);
                Message.AppendInt32(Group != null ? Group.ID : 0); // group id
                Message.AppendString(Group != null ? Group.Name : ""); // group name
                Message.AppendString(Group != null ? Group.BadgeCode : ""); // group image
                //Message.AppendInt32(1);
                //Message.AppendString("GRP");
                //Message.AppendString("");
                Message.AppendString(""); // ???
                Message.AppendInt32(TagCount);

                foreach (string Tag in Tags)
                {
                    Message.AppendString(Tag);
                }
            }
            else
            {
                Message.AppendBoolean(true);
                Message.AppendString(Event.Name);
                Message.AppendString(Owner);
                Message.AppendInt32(State);
                Message.AppendInt32(UsersNow);
                Message.AppendInt32(UsersMax);
                Message.AppendString(Event.Description);
                Message.AppendBoolean(true);
                Message.AppendBoolean(true);
                Message.AppendInt32(Score);
                Message.AppendInt32(Event.Category);
                Message.AppendString(Event.StartTime);
                Message.AppendInt32(Event.Tags.Count);

                foreach (string Tag in Event.Tags.ToArray())
                {
                    Message.AppendString(Tag);
                }
            }
            Message.AppendInt32(0);
            Message.AppendInt32(0);
            Message.AppendInt32(0);
            Message.AppendBoolean(true);
            Message.AppendBoolean(true);
        }
コード例 #31
0
ファイル: FurniInteractor.cs プロジェクト: TheNaked/Firewind
        internal override bool OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            if (Session == null)
                return false;
            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return false;
            }

            if (User.Coordinate != Item.SquareInFront && User.CanWalk)
            {
                User.MoveTo(Item.SquareInFront);
                return false;
            }

            // This check works for some reason
            if (!Item.GetRoom().GetGameMap().itemCanBePlacedHere(Item.SquareBehind.X, Item.SquareBehind.Y))
            {
                return false;
            }

            if (Item.InteractingUser == 0)
            {
                Item.InteractingUser = User.HabboId;

                User.CanWalk = false;

                if (User.IsWalking && (User.GoalX != Item.SquareInFront.X || User.GoalY != Item.SquareInFront.Y))
                {
                    User.ClearMovement(true);
                }

                ServerMessage update = new ServerMessage(Outgoing.OneWayDoorStatus);
                update.AppendUInt(Item.Id); // id
                update.AppendInt32(1); // status
                Item.GetRoom().SendMessage(update);

                User.AllowOverride = true;
                User.MoveTo(Item.SquareBehind);

                Item.ReqUpdate(4, true);
                return true;
            }
            return false;
        }