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


C# GameClient.SendMessage方法代码示例

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


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

示例1: MatchingPollResults

        internal static void MatchingPollResults(GameClient client, Poll poll)
        {
            var room = client.GetHabbo().CurrentRoom;
            if (poll == null || poll.Type != PollType.Matching || room == null)
                return;

            var users = room.GetRoomUserManager().GetRoomUsers();

            for (var i = 0; i < 10; i++)
            {
                Thread.Sleep(1000);
                foreach (var roomUser in users)
                {
                    var user = Azure.GetHabboById(roomUser.UserId);
                    if (user.AnsweredPool)
                    {
                        var result =
                            new ServerMessage(LibraryParser.OutgoingRequest("MatchingPollResultMessageComposer"));
                        result.AppendInteger(poll.Id);
                        result.AppendInteger(2);
                        result.AppendString("0");
                        result.AppendInteger(poll.AnswersNegative);
                        result.AppendString("1");
                        result.AppendInteger(poll.AnswersPositive);
                        client.SendMessage(result);
                    }
                }
            }

            foreach (var roomUser in users)
                Azure.GetHabboById(roomUser.UserId).AnsweredPool = false;
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:32,代码来源:StartQuestion.cs

示例2: GiveBadge

        /// <summary>
        ///     Gives the badge.
        /// </summary>
        /// <param name="badge">The badge.</param>
        /// <param name="inDatabase">if set to <c>true</c> [in database].</param>
        /// <param name="session">The session.</param>
        /// <param name="wiredReward">if set to <c>true</c> [wired reward].</param>
        internal void GiveBadge(string badge, bool inDatabase, GameClient session, bool wiredReward = false)
        {
            if (wiredReward)
                session.SendMessage(SerializeBadgeReward(!HasBadge(badge)));

            if (HasBadge(badge))
                return;

            if (inDatabase)
            {
                using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
                {
                    queryReactor.SetQuery(
                        string.Concat("INSERT INTO users_badges (user_id,badge_id,badge_slot) VALUES (", _userId,
                            ",@badge,", 0, ")"));
                    queryReactor.AddParameter("badge", badge);
                    queryReactor.RunQuery();
                }
            }

            BadgeList.Add(badge, new Badge(badge, 0));

            session.SendMessage(SerializeBadge(badge));
            session.SendMessage(Update(badge));
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:32,代码来源:BadgeComponent.cs

示例3: Execute

        public override bool Execute(GameClient client, string[] pms)
        {
            var message =
                new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));

            message.AppendString("Azure");
            message.AppendInteger(4);
            message.AppendString("title");
            message.AppendString("ManiaEVO 1.2");
            message.AppendString("message");
            var info = new StringBuilder();
            info.Append("<h5><b>ManiaEVO 1.2 - Base: Azure</b><h5></br></br>");
            info.Append("<br />");
            info.AppendFormat(
                "<b><br />Desenvolvedores:</b> <br />iPlezier <br />Claudi0<br />Kessiler <br /><br /> ");
            info.AppendFormat(
                "<b>Créditos:</b> <br />Jamal, Claudio, Boris, Lucca, Antoine, IhToN<br /> <br /> ");
            info.AppendFormat("<b>Estatisticas:</b> <br />");
            var userCount = Azure.GetGame().GetClientManager().Clients.Count;
            var roomsCount = Azure.GetGame().GetRoomManager().LoadedRooms.Count;
            info.AppendFormat("<b>Usuários:</b> {0} em {1}{2}.<br /><br /><br />", userCount, roomsCount,
                (roomsCount == 1) ? " Quarto" : " Quartos");
            message.AppendString(info.ToString());
            message.AppendString("linkUrl");
            message.AppendString("event:");
            message.AppendString("linkTitle");
            message.AppendString("ok");
            client.SendMessage(message);

            return true;
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:31,代码来源:About.cs

示例4: Execute

 public override bool Execute(GameClient session, string[] pms)
 {
     var room = session.GetHabbo().CurrentRoom;
     foreach (
         var pet in
             room.GetRoomUserManager().GetPets().Where(pet => pet.OwnerId == session.GetHabbo().Id))
     {
         session.GetHabbo().GetInventoryComponent().AddPet(pet);
         room.GetRoomUserManager().RemoveBot(pet.VirtualId, false);
     }
     session.SendMessage(session.GetHabbo().GetInventoryComponent().SerializePetInventory());
     return true;
 }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:13,代码来源:PickPets.cs

示例5: Execute

        public override bool Execute(GameClient session, string[] pms)
        {
            if (ExtraSettings.NewPageCommands)
            {
                session.SendMessage(StaticMessage.NewWayToOpenCommandsList);
                return true;
            }

            string commandList;
            if (pms.Length == 0)
            {
                commandList =
                    CommandsManager.CommandsDictionary.Where(
                        command => CommandsManager.CanUse(command.Value.MinRank, session))
                        .Aggregate(string.Empty,
                            (current, command) =>
                                current + (command.Value.Usage + " - " + command.Value.Description + "\n"));
            }
            else
            {
                if (pms[0].Length == 1)
                {
                    commandList =
                        CommandsManager.CommandsDictionary.Where(
                            command =>
                                command.Key.StartsWith(pms[0]) && CommandsManager.CanUse(command.Value.MinRank, session))
                            .Aggregate(string.Empty,
                                (current, command) =>
                                    current + (command.Value.Usage + " - " + command.Value.Description + "\n"));
                }
                else
                {
                    commandList =
                        CommandsManager.CommandsDictionary.Where(
                            command =>
                                command.Key.Contains(pms[0]) && CommandsManager.CanUse(command.Value.MinRank, session))
                            .Aggregate(string.Empty,
                                (current, command) =>
                                    current + (command.Value.Usage + " - " + command.Value.Description + "\n"));
                }
            }
            session.SendNotifWithScroll(commandList);

            return true;
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:45,代码来源:CommandList.cs

示例6: Execute

        public override bool Execute(GameClient session, string[] pms)
        {
            var client = Azure.GetGame().GetClientManager().GetClientByUserName(pms[0]);
            if (client == null || client.GetHabbo() == null)
            {
                session.SendWhisper(Azure.GetLanguage().GetVar("user_not_found"));
                return true;
            }
            if (client.GetHabbo().CurrentRoom == null ||
                client.GetHabbo().CurrentRoom == session.GetHabbo().CurrentRoom)
                return false;
            var roomFwd =
                new ServerMessage(LibraryParser.OutgoingRequest("RoomForwardMessageComposer"));
            roomFwd.AppendInteger(client.GetHabbo().CurrentRoom.RoomId);
            session.SendMessage(roomFwd);

            return true;
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:18,代码来源:FollowUser.cs

示例7: OnTrigger

        public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
        {
            var user = session.GetHabbo();
            var ishc = user.Vip;

            if (!ishc)
            {
                var message = new ServerMessage(LibraryParser.OutgoingRequest("CustomUserNotificationMessageComposer"));
                message.AppendInteger(3);
                session.SendMessage(message);
                return;
            }

            if (item?.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.HcGate)
                return;

            var modes = item.GetBaseItem().Modes - 1;

            if (modes <= 0)
                item.UpdateState(false, true);

            int currentMode;
            int.TryParse(item.ExtraData, out currentMode);
            int newMode;

            if (currentMode <= 0)
                newMode = 1;
            else if (currentMode >= modes)
                newMode = 0;
            else
                newMode = currentMode + 1;

            if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y))
                return;

            item.ExtraData = newMode.ToString();
            item.UpdateState();
            item.GetRoom().GetGameMap().UpdateMapForItem(item);
            item.GetRoom()
                .GetWiredHandler()
                .ExecuteWired(Interaction.TriggerStateChanged,
                    item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item);
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:43,代码来源:InteractorHCGate.cs

示例8: CompleteUserTalent

        /// <summary>
        ///     Completes the user talent.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="talent">The talent.</param>
        internal void CompleteUserTalent(GameClient session, Talent talent)
        {
            if (session?.GetHabbo() == null || session.GetHabbo().CurrentTalentLevel < talent.Level || session.GetHabbo().Talents.ContainsKey(talent.Id))
                return;

            if (!LevelIsCompleted(session, talent.Type, talent.Level))
                return;

            if (!string.IsNullOrEmpty(talent.Prize) && talent.PrizeBaseItem > 0u)
                Azure.GetGame().GetCatalog().DeliverItems(session, Azure.GetGame().GetItemManager().GetItem(talent.PrizeBaseItem), 1, string.Empty, 0, 0, string.Empty);

            session.GetHabbo().Talents.Add(talent.Id, new UserTalent(talent.Id, 1));

            using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery($"REPLACE INTO users_talents VALUES ('{session.GetHabbo().Id}', '{talent.Id}', '1');");

            var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("TalentLevelUpMessageComposer"));

            serverMessage.AppendString(talent.Type);
            serverMessage.AppendInteger(talent.Level);
            serverMessage.AppendInteger(0);

            if (talent.Type == "citizenship" && talent.Level == 4)
            {
                serverMessage.AppendInteger(2);
                serverMessage.AppendString("HABBO_CLUB_VIP_7_DAYS");
                serverMessage.AppendInteger(7);
                serverMessage.AppendString(talent.Prize);
                serverMessage.AppendInteger(0);
            }
            else
            {
                serverMessage.AppendInteger(1);
                serverMessage.AppendString(talent.Prize);
                serverMessage.AppendInteger(0);
            }

            session.SendMessage(serverMessage);

            if (talent.Type == "citizenship" && talent.Level == 3)
                Azure.GetGame().GetAchievementManager().ProgressUserAchievement(session, "ACH_Citizenship", 1);
            else if (talent.Type == "citizenship" && talent.Level == 4)
            {
                session.GetHabbo().GetSubscriptionManager().AddSubscription(7);

                using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
                    queryReactor.RunFastQuery($"UPDATE users SET talent_status = 'helper' WHERE id = '{session.GetHabbo().Id}'");
            }
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:54,代码来源:TalentManager.cs

示例9: GetList

 /// <summary>
 ///     Gets the list.
 /// </summary>
 /// <param name="session">The session.</param>
 /// <param name="message">The message.</param>
 internal void GetList(GameClient session, ClientMessage message)
 {
     session.SendMessage(AchievementListComposer.Compose(session, Achievements.Values.ToList()));
 }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:9,代码来源:AchievementManager.cs

示例10: OnTrigger

        public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
        {
            if (session == null || item?.GetRoom() == null || !hasRights)
                return;

            var wired = item.GetRoom().GetWiredHandler().GetWired(item);

            if (wired == null)
                return;

            var extraInfo = wired.OtherString;
            var flag = wired.OtherBool;
            var delay = wired.Delay / 500;
            var list = wired.Items.Where(roomItem => roomItem != null).ToList();
            var extraString = wired.OtherExtraString;
            var extraString2 = wired.OtherExtraString2;

            switch (item.GetBaseItem().InteractionType)
            {
                case Interaction.TriggerTimer:
                    {
                        var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
                        serverMessage.AppendBool(false);
                        serverMessage.AppendInteger(5);
                        serverMessage.AppendInteger(list.Count);
                        foreach (var current in list) serverMessage.AppendInteger(current.Id);
                        serverMessage.AppendInteger(item.GetBaseItem().SpriteId);
                        serverMessage.AppendInteger(item.Id);
                        serverMessage.AppendString(extraInfo);
                        serverMessage.AppendInteger(1);
                        serverMessage.AppendInteger(delay);
                        serverMessage.AppendInteger(1);
                        serverMessage.AppendInteger(3);
                        serverMessage.AppendInteger(0);
                        serverMessage.AppendInteger(0);
                        session.SendMessage(serverMessage);
                        return;
                    }
                case Interaction.TriggerRoomEnter:
                    {
                        var serverMessage2 = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
                        serverMessage2.AppendBool(false);
                        serverMessage2.AppendInteger(0);
                        serverMessage2.AppendInteger(list.Count);
                        foreach (var current2 in list) serverMessage2.AppendInteger(current2.Id);
                        serverMessage2.AppendInteger(item.GetBaseItem().SpriteId);
                        serverMessage2.AppendInteger(item.Id);
                        serverMessage2.AppendString(extraInfo);
                        serverMessage2.AppendInteger(0);
                        serverMessage2.AppendInteger(0);
                        serverMessage2.AppendInteger(7);
                        serverMessage2.AppendInteger(0);
                        serverMessage2.AppendInteger(0);
                        serverMessage2.AppendInteger(0);
                        session.SendMessage(serverMessage2);
                        return;
                    }
                case Interaction.TriggerGameEnd:
                    {
                        var serverMessage3 = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
                        serverMessage3.AppendBool(false);
                        serverMessage3.AppendInteger(0);
                        serverMessage3.AppendInteger(list.Count);
                        foreach (var current3 in list) serverMessage3.AppendInteger(current3.Id);
                        serverMessage3.AppendInteger(item.GetBaseItem().SpriteId);
                        serverMessage3.AppendInteger(item.Id);
                        serverMessage3.AppendString(extraInfo);
                        serverMessage3.AppendInteger(0);
                        serverMessage3.AppendInteger(0);
                        serverMessage3.AppendInteger(8);
                        serverMessage3.AppendInteger(0);
                        serverMessage3.AppendInteger(0);
                        serverMessage3.AppendInteger(0);
                        session.SendMessage(serverMessage3);
                        return;
                    }
                case Interaction.TriggerGameStart:
                    {
                        var serverMessage4 = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
                        serverMessage4.AppendBool(false);
                        serverMessage4.AppendInteger(0);
                        serverMessage4.AppendInteger(list.Count);
                        foreach (var current4 in list) serverMessage4.AppendInteger(current4.Id);
                        serverMessage4.AppendInteger(item.GetBaseItem().SpriteId);
                        serverMessage4.AppendInteger(item.Id);
                        serverMessage4.AppendString(extraInfo);
                        serverMessage4.AppendInteger(0);
                        serverMessage4.AppendInteger(0);
                        serverMessage4.AppendInteger(8);
                        serverMessage4.AppendInteger(0);
                        serverMessage4.AppendInteger(0);
                        serverMessage4.AppendInteger(0);
                        session.SendMessage(serverMessage4);
                        return;
                    }
                case Interaction.TriggerLongRepeater:
                    {
                        var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
                        serverMessage.AppendBool(false);
                        serverMessage.AppendInteger(5);
//.........这里部分代码省略.........
开发者ID:kessiler,项目名称:azureEmulator,代码行数:101,代码来源:InteractorWired.cs

示例11: SerializeGroupInfo

        /// <summary>
        ///     Serializes the theGroup information.
        /// </summary>
        /// <param name="group">The theGroup.</param>
        /// <param name="response">The response.</param>
        /// <param name="session">The session.</param>
        /// <param name="newWindow">if set to <c>true</c> [new window].</param>
        internal void SerializeGroupInfo(Guild group, ServerMessage response, GameClient session, bool newWindow = false)
        {
            if (group == null || session == null)
                return;

            var dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
            var dateTime2 = dateTime.AddSeconds(group.CreateTime);

            response.Init(LibraryParser.OutgoingRequest("GroupDataMessageComposer"));

            response.AppendInteger(group.Id);
            response.AppendBool(true);
            response.AppendInteger(group.State);
            response.AppendString(group.Name);
            response.AppendString(group.Description);
            response.AppendString(group.Badge);
            response.AppendInteger(group.RoomId);
            response.AppendString((Azure.GetGame().GetRoomManager().GenerateRoomData(group.RoomId) == null) ? "No room found.." : Azure.GetGame().GetRoomManager().GenerateRoomData(@group.RoomId).Name);
            response.AppendInteger((group.CreatorId == session.GetHabbo().Id) ? 3 : (group.Requests.ContainsKey(session.GetHabbo().Id) ? 2 : (group.Members.ContainsKey(session.GetHabbo().Id) ? 1 : 0)));
            response.AppendInteger(group.Members.Count);
            response.AppendBool(session.GetHabbo().FavouriteGroup == group.Id);
            response.AppendString($"{dateTime2.Day.ToString("00")}-{dateTime2.Month.ToString("00")}-{dateTime2.Year}");
            response.AppendBool(group.CreatorId == session.GetHabbo().Id);
            response.AppendBool(group.Admins.ContainsKey(session.GetHabbo().Id));
            response.AppendString((Azure.GetHabboById(group.CreatorId) == null) ? string.Empty : Azure.GetHabboById(group.CreatorId).UserName);
            response.AppendBool(newWindow);
            response.AppendBool(group.AdminOnlyDeco == 0u);
            response.AppendInteger(group.Requests.Count);
            response.AppendBool(group.HasForum);
            session.SendMessage(response);
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:38,代码来源:GroupManager.cs

示例12: RemoveBadge

        /// <summary>
        ///     Removes the badge.
        /// </summary>
        /// <param name="badge">The badge.</param>
        /// <param name="session">The session.</param>
        internal void RemoveBadge(string badge, GameClient session)
        {
            if (!HasBadge(badge))
                return;

            using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.SetQuery("DELETE FROM users_badges WHERE badge_id = @badge AND user_id = " + _userId);
                queryReactor.AddParameter("badge", badge);
                queryReactor.RunQuery();
            }

            BadgeList.Remove(GetBadge(badge));
            session.SendMessage(Serialize());
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:20,代码来源:BadgeComponent.cs

示例13: SendSuperNotif

        /// <summary>
        ///     Sends the super notif.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="notice">The notice.</param>
        /// <param name="picture">The picture.</param>
        /// <param name="client">The client.</param>
        /// <param name="link">The link.</param>
        /// <param name="linkTitle">The link title.</param>
        /// <param name="broadCast">if set to <c>true</c> [broad cast].</param>
        /// <param name="Event">if set to <c>true</c> [event].</param>
        internal void SendSuperNotif(string title, string notice, string picture, GameClient client, string link, string linkTitle, bool broadCast, bool Event)
        {
            var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));

            serverMessage.AppendString(picture);
            serverMessage.AppendInteger(4);
            serverMessage.AppendString("title");
            serverMessage.AppendString(title);
            serverMessage.AppendString("message");

            if (broadCast)
                if (Event)
                {
                    var text1 = Azure.GetLanguage().GetVar("ha_event_one");
                    var text2 = Azure.GetLanguage().GetVar("ha_event_two");
                    var text3 = Azure.GetLanguage().GetVar("ha_event_three");
                    serverMessage.AppendString(
                        $"<b>{text1} {client.GetHabbo().CurrentRoom.RoomData.Owner}!</b>\r\n {text2} .\r\n<b>{text3}</b>\r\n{notice}");
                }
                else
                {
                    var text4 = Azure.GetLanguage().GetVar("ha_title");
                    serverMessage.AppendString(string.Concat("<b>" + text4 + "</b>\r\n", notice, "\r\n- <i>",
                        client.GetHabbo().UserName, "</i>"));
                }
            else
                serverMessage.AppendString(notice);

            if (link != string.Empty)
            {
                serverMessage.AppendString("linkUrl");
                serverMessage.AppendString(link);
                serverMessage.AppendString("linkTitle");
                serverMessage.AppendString(linkTitle);
            }
            else
            {
                serverMessage.AppendString("linkUrl");
                serverMessage.AppendString("event:");
                serverMessage.AppendString("linkTitle");
                serverMessage.AppendString("ok");
            }

            if (broadCast)
            {
                QueueBroadcaseMessage(serverMessage);
                return;
            }

            client.SendMessage(serverMessage);
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:62,代码来源:GameClientManager.cs

示例14: ProgressUserQuest

        /// <summary>
        ///     Progresses the user quest.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="questType">Type of the quest.</param>
        /// <param name="eventData">The event data.</param>
        internal void ProgressUserQuest(GameClient session, QuestType questType, uint eventData = 0u)
        {
            if (session == null || session.GetHabbo() == null || session.GetHabbo().CurrentQuestId <= 0u)
                return;
            var quest = GetQuest(session.GetHabbo().CurrentQuestId);
            if (quest == null || quest.GoalType != questType)
                return;
            var questProgress = session.GetHabbo().GetQuestProgress(quest.Id);
            var num = questProgress;
            var flag = false;

            {
                if (questType != QuestType.ExploreFindItem)
                    switch (questType)
                    {
                        case QuestType.StandOn:
                        case QuestType.GiveItem:
                            if (eventData != quest.GoalData)
                                return;
                            num = (int) quest.GoalData;
                            flag = true;
                            goto IL_DC;
                        case QuestType.GiveCoffee:
                        case QuestType.WaveReindeer:
                        case QuestType.XmasParty:
                        case QuestType.FurniMove:
                            num++;
                            if ((num >= quest.GoalData))
                                flag = true;
                            goto IL_DC;
                    }
                if (eventData != quest.GoalData)
                    return;
                num = (int) quest.GoalData;
                flag = true;
                IL_DC:
                using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
                {
                    queryReactor.RunFastQuery(string.Concat("UPDATE users_quests_data SET progress = ", num,
                        " WHERE user_id = ", session.GetHabbo().Id, " AND quest_id =  ", quest.Id));
                    if (flag)
                        queryReactor.RunFastQuery(string.Format("UPDATE users_stats SET quest_id = 0 WHERE id = {0}",
                            session.GetHabbo().Id));
                }
                session.GetHabbo().Quests[session.GetHabbo().CurrentQuestId] = num;
                session.SendMessage(QuestStartedComposer.Compose(session, quest));
                if (!flag)
                    return;
                session.GetHabbo().CurrentQuestId = 0u;
                session.GetHabbo().LastQuestCompleted = quest.Id;
                session.SendMessage(QuestCompletedComposer.Compose(session, quest));
                session.GetHabbo().ActivityPoints += quest.Reward;
                session.GetHabbo().NotifyNewPixels(quest.Reward);
                session.GetHabbo().UpdateSeasonalCurrencyBalance();
                GetList(session, null);
            }
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:63,代码来源:QuestManager.cs

示例15: HandlePurchase

        /// <summary>
        ///     Handles the purchase.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="pageId">The page identifier.</param>
        /// <param name="itemId">The item identifier.</param>
        /// <param name="extraData">The extra data.</param>
        /// <param name="priceAmount">The price amount.</param>
        /// <param name="isGift">if set to <c>true</c> [is gift].</param>
        /// <param name="giftUser">The gift user.</param>
        /// <param name="giftMessage">The gift message.</param>
        /// <param name="giftSpriteId">The gift sprite identifier.</param>
        /// <param name="giftLazo">The gift lazo.</param>
        /// <param name="giftColor">Color of the gift.</param>
        /// <param name="undef">if set to <c>true</c> [undef].</param>
        /// <param name="theGroup">The theGroup.</param>
        internal void HandlePurchase(GameClient session, int pageId, uint itemId, string extraData, int priceAmount, bool isGift, string giftUser, string giftMessage, int giftSpriteId, int giftLazo, int giftColor, bool undef, uint theGroup)
        {
            priceAmount = (priceAmount < 1 || priceAmount > 100) ? 1 : priceAmount;

            var totalPrice = priceAmount;
            var limitedId = 0;
            var limtot = 0;

            if (priceAmount >= 6)
                totalPrice -= Convert.ToInt32(Math.Ceiling(Convert.ToDouble(priceAmount) / 6)) * 2 - 1;

            if (!Categories.Contains(pageId))
                return;

            var catalogPage = (CatalogPage)Categories[pageId];

            if (catalogPage == null || !catalogPage.Enabled || !catalogPage.Visible || session?.GetHabbo() == null)
                return;

            if (catalogPage.MinRank > session.GetHabbo().Rank || catalogPage.Layout == "sold_ltd_items")
                return;

            var item = catalogPage.GetItem(itemId);

            if (item == null)
                return;

            if (catalogPage.Layout == "vip_buy" || catalogPage.Layout == "club_buy" || HabboClubItems.Contains(item))
            {
                if (session.GetHabbo().Credits < item.CreditsCost)
                    return;
                if (session.GetHabbo().ActivityPoints < item.DucketsCost)
                    return;
                if (session.GetHabbo().Diamonds < item.DiamondsCost)
                    return;

                var array = item.Name.Split('_');

                double dayLength;

                if (item.Name.Contains("DAY"))
                    dayLength = double.Parse(array[3]);
                else if (item.Name.Contains("MONTH"))
                    dayLength = Math.Ceiling((double.Parse(array[3]) * 31) - 0.205);
                else if (item.Name.Contains("YEAR"))
                    dayLength = (double.Parse(array[3]) * 31 * 12);
                else
                    dayLength = 31;

                session.GetHabbo().GetSubscriptionManager().AddSubscription(dayLength);

                if (item.CreditsCost > 0)
                {
                    session.GetHabbo().Credits -= (int)item.CreditsCost * totalPrice;
                    session.GetHabbo().UpdateCreditsBalance();
                }
                if (item.DucketsCost > 0)
                {
                    session.GetHabbo().ActivityPoints -= (int)item.DucketsCost * totalPrice;
                    session.GetHabbo().UpdateActivityPointsBalance();
                }
                if (item.DiamondsCost > 0)
                {
                    session.GetHabbo().Diamonds -= (int)item.DiamondsCost * totalPrice;
                    session.GetHabbo().UpdateSeasonalCurrencyBalance();
                }

                return;
            }

            if (item.Name == "room_ad_plus_badge")
                return;

            if (item.ClubOnly && !session.GetHabbo().GetSubscriptionManager().HasSubscription)
            {
                var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("CatalogPurchaseNotAllowedMessageComposer"));
                serverMessage.AppendInteger(1);
                session.SendMessage(serverMessage);
                return;
            }

            var flag = item.Items.Keys.Any(current => InteractionTypes.AreFamiliar(GlobalInteractions.Pet, current.InteractionType));

            if (!flag && (item.CreditsCost * totalPrice < 0 || item.DucketsCost * totalPrice < 0 || item.DiamondsCost * totalPrice < 0))
//.........这里部分代码省略.........
开发者ID:kessiler,项目名称:azureEmulator,代码行数:101,代码来源:CatalogManager.cs


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