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


C# GameClients.SendNotif方法代码示例

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


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

示例1: OnTrigger

        public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            if (Item == null || Item.GetRoom() == null || Session == null || Session.GetHabbo() == null)
                return;
            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            User.LastInteraction = SilverwaveEnvironment.GetUnixTimestamp();
            if (User == null)
            {
                return;
            }

            if ((User.LastInteraction - SilverwaveEnvironment.GetUnixTimestamp() < 0) && User.InteractingGate && User.GateId == Item.Id)
            {
                User.InteractingGate = false;
                User.GateId = 0;
            }

            if (!User.InteractingGate && User.GateId != Item.Id && Item.TollPrice > 0)
            {
                if (Session.GetHabbo().Credits < Item.TollPrice)
                {
                    Session.SendNotif("You have not got enough credits to get through this gate.\n" +
                        "You need atleast " + Item.TollPrice + " to get through this gate");
                    return;
                }
                Session.SendWhisper("This gate has a toll of " + Item.TollPrice + " credits.");
                Session.SendWhisper("To continue through it, double click again!");
                User.InteractingGate = true;
                User.GateId = Item.Id;
                User.LastInteraction = SilverwaveEnvironment.GetUnixTimestamp() + 7;
                return;
            }

            // Alright. But is this user in the right position?
            if (User.Coordinate == Item.Coordinate || User.Coordinate == Item.SquareInFront)
            {
                // Fine. But is this tele even free?
                if (Item.InteractingUser != 0)
                {
                    return;
                }

                if (!User.CanWalk || Session.GetHabbo().IsTeleporting || Session.GetHabbo().TeleporterId != 0 || (User.LastInteraction + 2) - SilverwaveEnvironment.GetUnixTimestamp() < 0)
                    return;

                if (Item.TollPrice > 0 && Session.GetHabbo().Credits > Item.TollPrice)
                {
                    Habbo Data = SilverwaveEnvironment.getHabboForId(Convert.ToUInt32(Item.GetRoom().OwnerId));
                    if (Data != null)
                    {
                        using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
                        {
                            dbClient.setQuery("SELECT online FROM users WHERE id=" + Data.Id + " LIMIT 1");
                            string online = dbClient.getString();
                            if (online == "0")
                            {
                                dbClient.runFastQuery("UPDATE users SET credits = credits+" + Item.TollPrice + " WHERE id=" + Data.Id + " LIMIT 1");
                            }
                            else if (online == "1")
                            {
                                GameClient H = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(Data.Id);
                                H.GetHabbo().Credits += Item.TollPrice;
                                H.GetHabbo().UpdateCreditsBalance();
                            }
                            else
                            {
                                Session.SendWhisper("An error occured!");
                                return;
                            }
                        }
                    }
                    Session.GetHabbo().Credits -= Item.TollPrice;
                    Session.GetHabbo().UpdateCreditsBalance();
                }
                else if (Session.GetHabbo().Credits < Item.TollPrice)
                {
                    User.InteractingGate = false;
                    User.GateId = 0;
                    return;
                }

                User.TeleDelay = 2;
                Item.InteractingUser = User.GetClient().GetHabbo().Id;

            }
            else if (User.CanWalk)
            {
                User.MoveTo(Item.SquareInFront);
            }
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:90,代码来源:InteractorTeleport.cs

示例2: OnTrigger

        public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            if (Session == null)
                return;
            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (Item.InteractingUser2 != User.userID)
                Item.InteractingUser2 = User.userID;

            if (User == null)
            {
                return;
            }

            if (User.Coordinate != Item.SquareInFront && User.CanWalk)
            {
                User.MoveTo(Item.SquareInFront);
                return;
            }
            if (!Item.GetRoom().GetGameMap().ValidTile(Item.SquareBehind.X, Item.SquareBehind.Y) || !Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, false)
                || !Item.GetRoom().GetGameMap().SquareIsOpen(Item.SquareBehind.X, Item.SquareBehind.Y, false))
            {
                return;
            }

            if ((User.LastInteraction - SilverwaveEnvironment.GetUnixTimestamp() < 0) && User.InteractingGate && User.GateId == Item.Id)
            {
                User.InteractingGate = false;
                User.GateId = 0;
            }

            if (!User.InteractingGate && User.GateId != Item.Id && Item.TollPrice > 0)
            {
                if (Session.GetHabbo().Credits < Item.TollPrice)
                {
                    Session.SendNotif("You have not got enough credits to get through this gate.\n" +
                        "You need atleast " + Item.TollPrice + " to get through this gate");
                    return;
                }
                Session.SendWhisper("This gate has a toll of " + Item.TollPrice + " credits.");
                Session.SendWhisper("To continue through it, double click again!");
                User.InteractingGate = true;
                User.GateId = Item.Id;
                User.LastInteraction = SilverwaveEnvironment.GetUnixTimestamp() + 7;
                return;
            }

            if (!Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, User.AllowOverride))
            {
                return;
            }

            if (Item.InteractingUser == 0)
            {
                User.InteractingGate = true;
                User.GateId = Item.Id;
                Item.InteractingUser = User.HabboId;

                User.CanWalk = false;

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

                if (Item.TollPrice > 0 && Session.GetHabbo().Credits > Item.TollPrice)
                {
                    Habbo Data = SilverwaveEnvironment.getHabboForId(Convert.ToUInt32(Item.GetRoom().OwnerId));
                    if (Data != null)
                    {
                        using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
                        {
                            dbClient.setQuery("SELECT online FROM users WHERE id=" + Data.Id + " LIMIT 1");
                            string online = dbClient.getString();
                            if (online == "0")
                            {
                                dbClient.runFastQuery("UPDATE users SET credits = credits+" + Item.TollPrice + " WHERE id=" + Data.Id + " LIMIT 1");
                            }
                            else if (online == "1")
                            {
                                GameClient H = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(Data.Id);
                                H.GetHabbo().Credits += Item.TollPrice;
                                H.GetHabbo().UpdateCreditsBalance();
                            }
                            else
                            {
                                Session.SendWhisper("An error occured!");
                                return;
                            }
                        }
                    }
                    Session.GetHabbo().Credits -= Item.TollPrice;
                    Session.GetHabbo().UpdateCreditsBalance();
                }
                else if (Session.GetHabbo().Credits < Item.TollPrice)
                {
                    User.InteractingGate = false;
                    User.GateId = 0;
                    return;
                }
//.........这里部分代码省略.........
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:101,代码来源:InteractorOneWayGate.cs


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