当前位置: 首页>>代码示例>>C#>>正文


C# GameClient.SendMessage方法代码示例

本文整理汇总了C#中Firewind.HabboHotel.GameClients.GameClient.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.SendMessage方法的具体用法?C# GameClient.SendMessage怎么用?C# GameClient.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Firewind.HabboHotel.GameClients.GameClient的用法示例。


在下文中一共展示了GameClient.SendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryRedeemVoucher

        internal static void TryRedeemVoucher(GameClient Session, string Code)
        {
            if (!IsValidCode(Code))
            {
                ServerMessage Error = new ServerMessage(Outgoing.VoucherRedeemError);
                Error.AppendRawInt32(0); // 0=invalid code,1=technical issue,3=redeem at webpage
                Session.SendMessage(Error);
                return;
            }

            int Value = GetVoucherValue(Code);

            TryDeleteVoucher(Code);

            Session.GetHabbo().Credits += Value;
            Session.GetHabbo().UpdateCreditsBalance();

            ServerMessage message = new ServerMessage(Outgoing.VoucherRedeemOk);
            message.AppendString("Credits"); // productName
            message.AppendString("Awesome"); // productDescription
            Session.SendMessage(message);
        }
开发者ID:Kristopher-RZ,项目名称:Firewind,代码行数:22,代码来源:VoucherHandler.cs

示例2: GetSongData

        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));
        }
开发者ID:TheNaked,项目名称:Firewind,代码行数:17,代码来源:SongManager.cs

示例3: GetPlaylist

        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()));
        }
开发者ID:TheNaked,项目名称:Firewind,代码行数:12,代码来源:SongManager.cs

示例4: GetDisks

 private static void GetDisks(GameClient Session, ClientMessage Message)
 {
     Session.SendMessage(JukeboxComposer.Compose(Session));
 }
开发者ID:TheNaked,项目名称:Firewind,代码行数:4,代码来源:SongManager.cs

示例5: ProgressUserAchievement

        internal bool ProgressUserAchievement(GameClient Session, string AchievementGroup, int ProgressAmount)
        {
            if (!Achievements.ContainsKey(AchievementGroup))
            {
                return false;
            }

            Achievement AchievementData = null;

            AchievementData = Achievements[AchievementGroup];

            UserAchievement UserData = Session.GetHabbo().GetAchievementData(AchievementGroup);

            if (UserData == null)
            {
                UserData = new UserAchievement(AchievementGroup, 0, 0);
                Session.GetHabbo().Achievements.Add(AchievementGroup, UserData);
            }

            int TotalLevels = AchievementData.Levels.Count;

            if (UserData != null && UserData.Level == TotalLevels)
            {
                return false; // done, no more.
            }

            int TargetLevel = (UserData != null ? UserData.Level + 1 : 1);

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

            AchievementLevel TargetLevelData = AchievementData.Levels[TargetLevel];

            int NewProgress = (UserData != null ? UserData.Progress + ProgressAmount : ProgressAmount);
            int NewLevel = (UserData != null ? UserData.Level : 0);
            int NewTarget = NewLevel + 1;

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

            if (NewProgress >= TargetLevelData.Requirement)
            {
                NewLevel++;
                NewTarget++;

                int ProgressRemainder = NewProgress - TargetLevelData.Requirement;
                NewProgress = 0;

                Session.GetHabbo().GetBadgeComponent().GiveBadge(AchievementGroup + TargetLevel, true);

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

                Session.GetHabbo().ActivityPoints += TargetLevelData.RewardPixels;
                Session.GetHabbo().UpdateActivityPointsBalance(false);

                Session.SendMessage(AchievementUnlockedComposer.Compose(AchievementData, TargetLevel, TargetLevelData.RewardPoints,
                    TargetLevelData.RewardPixels));

                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("REPLACE INTO user_achievement VALUES (" + Session.GetHabbo().Id + ", @group, " + NewLevel + ", " + NewProgress + ")");
                    dbClient.addParameter("group", AchievementGroup);
                    dbClient.runQuery();
                }

                UserData.Level = NewLevel;
                UserData.Progress = NewProgress;

                Session.GetHabbo().AchievementPoints += TargetLevelData.RewardPoints;
                Session.GetHabbo().ActivityPoints += TargetLevelData.RewardPixels;
                Session.GetHabbo().UpdateActivityPointsBalance(false);
                Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints));

                AchievementLevel NewLevelData = AchievementData.Levels[NewTarget];
                Session.SendMessage(AchievementProgressComposer.Compose(AchievementData, NewTarget, NewLevelData,
                    TotalLevels, Session.GetHabbo().GetAchievementData(AchievementGroup)));

                return true;
            }
            else
            {
                UserData.Level = NewLevel;
                UserData.Progress = NewProgress;
                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("REPLACE INTO user_achievement VALUES (" + Session.GetHabbo().Id + ", @group, " + NewLevel + ", " + NewProgress + ")");
                    dbClient.addParameter("group", AchievementGroup);
                    dbClient.runQuery();
                }

                Session.SendMessage(AchievementProgressComposer.Compose(AchievementData, TargetLevel, TargetLevelData,
                TotalLevels, Session.GetHabbo().GetAchievementData(AchievementGroup)));
            }
//.........这里部分代码省略.........
开发者ID:TheNaked,项目名称:Firewind,代码行数:101,代码来源:AchievementManager.cs

示例6: GetList

 internal void GetList(GameClient Session, ClientMessage Message)
 {
     Session.SendMessage(AchievementListComposer.Compose(Session, Achievements.Values.ToList()));
 }
开发者ID:TheNaked,项目名称:Firewind,代码行数:4,代码来源:AchievementManager.cs

示例7: OnTrigger

        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);
//.........这里部分代码省略.........
开发者ID:TheNaked,项目名称:Firewind,代码行数:101,代码来源:FurniInteractor.cs

示例8: GetCurrentQuest

        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));
        }
开发者ID:TheNaked,项目名称:Firewind,代码行数:27,代码来源:QuestManager.cs

示例9: HandleSave


//.........这里部分代码省略.........
                        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:
开发者ID:TheNaked,项目名称:Firewind,代码行数:67,代码来源:WiredSaver.cs

示例10: CancelQuest

        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);
        }
开发者ID:TheNaked,项目名称:Firewind,代码行数:17,代码来源:QuestManager.cs

示例11: ActivateQuest

        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));
        }
开发者ID:TheNaked,项目名称:Firewind,代码行数:20,代码来源:QuestManager.cs

示例12: ProgressUserQuest

        internal void ProgressUserQuest(GameClient Session, QuestType QuestType, uint EventData = 0)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentQuestId <= 0)
            {
                return;
            }

            Quest UserQuest = GetQuest(Session.GetHabbo().CurrentQuestId);

            if (UserQuest == null || UserQuest.GoalType != QuestType)
            {
                return;
            }

            int CurrentProgress = Session.GetHabbo().GetQuestProgress(UserQuest.Id);
            int NewProgress = CurrentProgress;
            bool PassQuest = false;

            switch (QuestType)
            {
                default:

                    NewProgress++;

                    if (NewProgress >= UserQuest.GoalData)
                    {
                        PassQuest = true;
                    }

                    break;

                case QuestType.EXPLORE_FIND_ITEM:

                    if (EventData != UserQuest.GoalData)
                        return;

                    NewProgress = (int)UserQuest.GoalData;
                    PassQuest = true;
                    break;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("UPDATE user_quests SET progress = " + NewProgress +  " WHERE user_id = " + Session.GetHabbo().Id + " AND quest_id =  " + UserQuest.Id);

                if (PassQuest)
                {
                    dbClient.runFastQuery("UPDATE users SET currentquestid = 0 WHERE id = " + Session.GetHabbo().Id);
                    //Quest NextQuest = GetNextQuestInSeries(UserQuest.Category, UserQuest.Number + 1);

                    //if (NextQuest != null)
                    //    dbClient.runFastQuery("INSERT INTO user_quests (user_id, quest_id, progress) VALUES (" + Session.GetHabbo().Id + ", " + NextQuest.Id + ", 0)");
                }
            }

            Session.GetHabbo().quests[Session.GetHabbo().CurrentQuestId] = NewProgress;
            Session.SendMessage(QuestStartedComposer.Compose(Session, UserQuest));

            if (PassQuest)
            {
                Session.GetHabbo().CurrentQuestId = 0;
                Session.GetHabbo().LastCompleted = UserQuest.Id;
                Session.SendMessage(QuestCompletedComposer.Compose(Session, UserQuest));
                Session.GetHabbo().ActivityPoints += UserQuest.Reward;
                Session.GetHabbo().UpdateActivityPointsBalance(false);
                GetList(Session, null);
            }
        }
开发者ID:TheNaked,项目名称:Firewind,代码行数:68,代码来源:QuestManager.cs

示例13: GetList

 internal void GetList(GameClient Session, ClientMessage Message)
 {
     Session.SendMessage(QuestListComposer.Compose(Session, quests.Values.ToList(), (Message != null)));
 }
开发者ID:TheNaked,项目名称:Firewind,代码行数:4,代码来源:QuestManager.cs

示例14: RemoveFromPlaylist

        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()));
        }
开发者ID:TheNaked,项目名称:Firewind,代码行数:23,代码来源:SongManager.cs

示例15: HandlePurchase

        internal void HandlePurchase(GameClient Session, int PageId, uint ItemId, string extraParameter, int buyAmount, Boolean IsGift, string GiftUser, string GiftMessage, int GiftSpriteId, int GiftLazo, int GiftColor, bool giftShowIdentity)
        {
            int finalAmount = buyAmount;
            if (buyAmount > 5) // Possible discount!
            {
                // Nearest number that increases the amount of free items
                int nearestDiscount = ((int)Math.Floor(buyAmount / 6.0) * 6);

                // How many free ones we get
                int freeItemsCount = (nearestDiscount - 3) / 3;

                // Add 1 free if more than 42
                if (buyAmount >= 42)
                    freeItemsCount++;

                // Doesn't follow rules as it isn't dividable by 6, but still increases free items
                if (buyAmount >= 99)
                {
                    freeItemsCount = 33;
                }

                // This is how many we pay for in the end
                finalAmount = buyAmount - freeItemsCount;
            }

            //Logging.WriteLine("Amount: " + priceAmount + "; withOffer= " + finalAmount);
            CatalogPage Page;
            if (!Pages.TryGetValue(PageId, out Page))
                return;
            if (Page == null || !Page.Enabled || !Page.Visible || Session == null || Session.GetHabbo() == null)
            {
                Session.SendMessage(new ServerMessage(Outgoing.PurchaseError));
                return;
            }
            if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
            {
                Session.SendMessage(new ServerMessage(Outgoing.PurchaseError));
                return;
            }
            if (Page.MinRank > Session.GetHabbo().Rank)
            {
                Session.SendMessage(new ServerMessage(Outgoing.PurchaseError));
                return;
            }
            CatalogItem Item = Page.GetItem(ItemId);

            if (Item == null) // TODO: Check item minimum club rank
            {
                Session.SendMessage(new ServerMessage(Outgoing.PurchaseError));
                return;
            }
            if (!Item.HaveOffer && buyAmount > 1) // Check if somebody is bulk-buying when not allowed
            {
                Session.SendMessage(new ServerMessage(Outgoing.PurchaseError));
                return;
            }
            if (Item.IsLimited && Item.LimitedStack <= Item.LimitedSelled)
            {
                Session.SendMessage(new ServerMessage(Outgoing.PurchaseError));
                return;
            }

            uint GiftUserId = 0;
            //int giftWrappingCost = 0;
            if (IsGift)
            {
                if(!Item.AllowGift)
                {
                    Session.SendMessage(new ServerMessage(Outgoing.PurchaseError));
                    return;
                }
                if(Item.Items.Count > 1 || Item.Amount > 1) // Gifts can only have 1 item?
                {
                    Session.SendMessage(new ServerMessage(Outgoing.PurchaseError));
                    return;
                }

                DataRow dRow;
                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT id FROM users WHERE username = @gift_user");
                    dbClient.addParameter("gift_user", GiftUser);

                    dRow = dbClient.getRow();
                }

                if (dRow == null)
                {
                    Session.GetMessageHandler().GetResponse().Init(Outgoing.GiftError);
                    Session.GetMessageHandler().GetResponse().AppendString(GiftUser);
                    Session.GetMessageHandler().SendResponse();

                    return;
                }

                GiftUserId = Convert.ToUInt32(dRow[0]);

                if (GiftUserId == 0)
                {
                    Session.GetMessageHandler().GetResponse().Init(Outgoing.GiftError);
//.........这里部分代码省略.........
开发者ID:TheNaked,项目名称:Firewind,代码行数:101,代码来源:Catalog.cs


注:本文中的Firewind.HabboHotel.GameClients.GameClient.SendMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。