Exemple #1
0
        public void timerDone(object info)
        {
            try
            {
                timeLeft -= 60000;

                #region Conditions
                if (Session == null)
                {
                    stopTimer(); return;
                }


                if (timeLeft > 0)
                {
                    int minutesRemaining = timeLeft / 60000;

                    lock (Plus.GetGame().GetClientManager().Clients.Values)
                    {
                        foreach (GameClient client in Plus.GetGame().GetClientManager().Clients.Values)
                        {
                            if (client == null)
                            {
                                continue;
                            }
                            if (client.GetHabbo() == null)
                            {
                                continue;
                            }
                            if (client.GetHabbo().CurrentRoom == null)
                            {
                                continue;
                            }
                            if (client.GetConnection() == null)
                            {
                                continue;
                            }

                            client.SendWhisper("The nuke is about to go off, hurry to the hospital! (" + minutesRemaining + " seconds)!");
                        }

                        Session.SendWhisper("The nuke will go off in: (" + minutesRemaining + " seconds)!");
                    }

                    timer.Change(1000, Timeout.Infinite);
                    return;
                }

                #endregion

                #region Execute

                int kills = 0;

                RoleplayManager.Shout(Session, "*Successfully breaks into the nuke system, causing the whole hotel to nuke*");

                lock (Plus.GetGame().GetClientManager().Clients.Values)
                {
                    foreach (GameClient client in Plus.GetGame().GetClientManager().Clients.Values)
                    {
                        if (client == null)
                        {
                            continue;
                        }
                        if (client.GetHabbo() == null)
                        {
                            continue;
                        }
                        if (client.GetHabbo().CurrentRoom == null)
                        {
                            continue;
                        }
                        if (client.GetConnection() == null)
                        {
                            continue;
                        }

                        if (RoleplayManager.BypassRights(client))
                        {
                            continue;
                        }
                        if (client.GetRoleplay().inColourWars)
                        {
                            continue;
                        }
                        if (client.GetRoleplay().InMafiaWars)
                        {
                            continue;
                        }
                        if (client.GetRoleplay().inBrawl)
                        {
                            continue;
                        }

                        if (client.GetHabbo().CurrentRoom.RoomData.Description.Contains("NPA_INSIDE"))
                        {
                            client.SendWhisper("The nuke exploded, but you found refuge in the NPA room! [+50 Points]");
                        }
                        else if (client.GetHabbo().CurrentRoom.RoomData.Description.Contains("HOSP"))
                        {
                            client.SendWhisper("The nuke exploded, but you found refuge in the hospital! [+50 Points]");
                        }
                        else if (client.GetHabbo().CurrentRoom.RoomData.Description.Contains("JAIL"))
                        {
                            client.SendWhisper("The nuke exploded, but you found refuge in prison! [+50 Points]");
                        }
                        else
                        {
                            kills++;

                            client.GetRoleplay().DeadFigSet  = false;
                            client.GetRoleplay().DeadSeconds = 60;
                            client.GetRoleplay().DeadTimer   = 5;
                            client.GetRoleplay().Dead        = true;
                            client.GetRoleplay().SaveStatusComponents("dead");
                            RoleplayManager.HandleDeath(client);
                            client.SendNotif("The nuke exploded, the radioactivity killed you!");
                        }
                    }

                    Session.GetRoleplay().Kills += kills;
                    Session.GetRoleplay().UpdateStats++;

                    Session.GetRoleplay().NPA = false;
                    RoomItem Itemm            = null;

                    foreach (RoomItem Item in Session.GetHabbo().CurrentRoom.GetRoomItemHandler().FloorItems.Values)
                    {
                        if (1 == 1)
                        {
                            Itemm = Item;
                        }
                    }

                    Itemm.OnNPAUsing = false;
                }

                stopTimer();
                #endregion
            }
            catch { stopTimer(); }
        }
Exemple #2
0
        /// <summary>
        /// Sends the instant message.
        /// </summary>
        /// <param name="toId">To identifier.</param>
        /// <param name="message">The message.</param>
        internal void SendInstantMessage(uint toId, string message)
        {
            int credit = new Random().Next(1, 15);

            if (!GetClient().GetHabbo().HasFuse("fuse_owner") && AntiPublicistas.CheckPublicistas(message))
            {
                GetClient().PublicistCount++;
                GetClient().HandlePublicista(message);
                return;
            }
            if (!FriendshipExists(toId))
            {
                DeliverInstantMessageError(6, toId);
                return;
            }

            if (GetClient().GetRoleplay().Phone == 0)
            {
                GetClient().SendWhisperBubble("Você não tem telefone! Você pode comprar um na loja de telefone! [Room ID: 5]", 1);
                return;
            }
            if (GetClient().GetHabbo().ActivityPoints < credit)
            {
                GetClient().SendWhisperBubble("Você tem fundos de crédito insuficientes! Você pode comprar mais na loja de telefone! [Room ID: 5]", 1);
                return;
            }

            if (toId == 0) // Staff Chat
            {
                var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ConsoleChatMessageComposer"));
                serverMessage.AppendInteger(0); //userid
                serverMessage.AppendString(GetClient().GetHabbo().UserName + " : " + message);
                serverMessage.AppendInteger(0);
                Plus.GetGame().GetClientManager().StaffAlert(serverMessage, GetClient().GetHabbo().Id);
            }
            else
            {
                var clientByUserId = Plus.GetGame().GetClientManager().GetClientByUserId(toId);
                if (clientByUserId == null || clientByUserId.GetHabbo().GetMessenger() == null)
                {
                    if (Plus.OfflineMessages.ContainsKey(toId))
                    {
                        Plus.OfflineMessages[toId].Add(new OfflineMessage(GetClient().GetHabbo().Id, message,
                                                                          Plus.GetUnixTimeStamp()));
                    }
                    else
                    {
                        Plus.OfflineMessages.Add(toId, new List <OfflineMessage>());
                        Plus.OfflineMessages[toId].Add(new OfflineMessage(GetClient().GetHabbo().Id, message,
                                                                          Plus.GetUnixTimeStamp()));
                    }
                    OfflineMessage.SaveMessage(Plus.GetDatabaseManager().GetQueryReactor(), toId,
                                               GetClient().GetHabbo().Id, message);
                    return;
                }
                if (GetClient().GetHabbo().Muted)
                {
                    DeliverInstantMessageError(4, toId);
                    return;
                }
                if (clientByUserId.GetHabbo().Muted)
                {
                    DeliverInstantMessageError(3, toId);
                }
                if (message == "")
                {
                    return;
                }
                clientByUserId.GetHabbo().GetMessenger().DeliverInstantMessage(message, _userId);

                #region Whisper
                if (GetClient().GetHabbo().CurrentRoomId != 0)
                {
                    var      roomUserByRank = GetClient().GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByRank(2);
                    RoomUser u  = GetClient().GetHabbo().GetRoomUser();
                    RoomUser u2 = clientByUserId.GetHabbo().GetRoomUser();

                    foreach (var current2 in roomUserByRank)
                    {
                        if (current2 != null && current2.HabboId != u2.HabboId &&
                            current2.HabboId != u.HabboId && current2.GetClient() != null)
                        {
                            if (RoleplayManager.BypassRights(current2.GetClient()))
                            {
                                var whispStaff = new ServerMessage(LibraryParser.OutgoingRequest("WhisperMessageComposer"));
                                whispStaff.AppendInteger(u.VirtualId);
                                whispStaff.AppendString(string.Format("PM to {0}: {1}", clientByUserId.GetHabbo().UserName, message));
                                whispStaff.AppendInteger(0);
                                whispStaff.AppendInteger(0);
                                whispStaff.AppendInteger(0);
                                whispStaff.AppendInteger(-1);
                                current2.GetClient().SendMessage(whispStaff);
                            }
                        }
                    }
                }
                #endregion

                RoleplayManager.GiveCredit(GetClient(), -credit);
            }
            LogPM(_userId, toId, message);
        }
Exemple #3
0
        /// <summary>
        /// Callback for time elapsed (1 second)
        /// </summary>
        /// <param name="info"></param>
        public void Ticked(object info)
        {
            try
            {
                {
                    if (On)
                    {
                        if (RoleplayData.Data["freeze.debug.show.msgs"] == "true")
                        {
                            Wielder.SendWhisper("Values:::::: Freezecount " + RetrieveFontalUsers().Count + " || Releaseseconds: " + ReleasingSeconds + " || Releasing: " + Releasing.ToString() + " || Charging: " + Charging.ToString() + " || Charging Seconds: " + ChargingSeconds + " || Charging Mins: " + ChargingMins + " || ReleaseCooldown: " + ReleaseCdMins + " || releasecooldown secs" + ReleaseCdSecs);
                        }

                        #region Conditions

                        if (Wielder == null)
                        {
                            stopTimer();
                            return;
                        }
                        if (Wielder.GetHabbo() == null)
                        {
                            stopTimer();
                            return;
                        }
                        if (Wielder.GetRoleplay() == null)
                        {
                            stopTimer();
                            return;
                        }

                        /* if (Wielder.GetHabbo().GetRoomUser() == null)
                         *   stopTimer();*/
                        if (Wielder.GetRoleplay().Dead)
                        {
                            On = false;
                        }
                        if (Wielder.GetRoleplay().Jailed)
                        {
                            On = false;
                        }
                        if (Wielder.GetRoleplay().WorkingOut)
                        {
                            On = false;
                        }
                        if (Wielder.GetRoleplay().WeightLifting)
                        {
                            On = false;
                        }
                        if (Wielder.GetRoleplay().Working)
                        {
                            On = false;
                        }
                        if (Wielder.GetRoleplay().Learning)
                        {
                            On = false;
                        }


                        #endregion

                        //Do stuff here

                        #region Release CD

                        if (ReleaseCdMins > 0)
                        {
                            if (ReleaseCdSecs - 1 > 0)
                            {
                                ReleaseCdSecs--;
                            }
                            else
                            {
                                ReleaseCdMins--;
                                ReleaseCdSecs = 60;
                            }

                            Timer.Change(1000, Timeout.Infinite);
                            //return;
                        }

                        #endregion

                        #region Charging Super Blast Timer
                        if (Charging)
                        {
                            if (ChargingMins > 0 && !(RoleplayManager.BypassRights(Wielder)))
                            {
                                if (ChargingSeconds - 1 > 0)
                                {
                                    ChargingSeconds--;
                                    if (ChargingSeconds < 6)
                                    {
                                        Wielder.SendWhisper(ChargingSeconds.ToString());
                                    }
                                }
                                else
                                {
                                    ChargingMins -= 1;
                                    if (ChargingMins > 0)
                                    {
                                        Wielder.SendWhisper("Your freeze ray blast will finish charging in " + ChargingMins + " minutes");
                                        ChargingSeconds = 60;
                                    }
                                }
                            }
                            else
                            {
                                //Stop charging
                                Wielder.SendWhisper("Your freeze ray mega blast is now ready to launch! Type :freezerelease to unleash it!");
                                Charged  = true;
                                Charging = false;
                            }

                            Timer.Change(1000, Timeout.Infinite);
                            return;
                        }
                        #endregion

                        #region Releasing Super Blast Timer

                        if (Releasing && Charged)
                        {
                            if (ReleasingSeconds > 0)
                            {
                                if (RoleplayData.Data["freeze.debug.show.msgs"] == "true")
                                {
                                    Wielder.SendWhisper("Freeze User Radius Count: " + RetrieveFontalUsers().Count + " || Releasing Secnds Left: " + ReleasingSeconds + "");
                                }
                                ReleaseMassFreeze();
                                ReleasingSeconds--;
                            }
                            else
                            {
                                //Stop releasing freeze blast
                                FreezeSurrounding();
                                Wielder.Shout("*Deactivates their freeze emitting a strong wave blasting everybody surrounding them*");
                                Releasing     = false;
                                Charged       = false;
                                ReleaseCdMins = Convert.ToInt32(RoleplayData.Data["freeze.ray.default.cdreleasetime"]);
                            }


                            Timer.Change(1000, Timeout.Infinite);
                            return;
                        }
                        #endregion
                    }
                    else
                    {
                    }

                    if (!PreparingMsg)
                    {
                        Timer.Change(1000, Timeout.Infinite);
                    }
                }
            }
            catch (Exception e) {
                if (RoleplayData.Data["freeze.debug.show.msgs"] == "true")
                {
                    Console.WriteLine("FreezeRay:::: " + e.ToString() + "||" + e.StackTrace);
                }
            }
        }
Exemple #4
0
        internal override void OnUserSay(Rooms.RoomUser User, string Message)
        {
            string[] special    = { "pedir panquecas", "pedir bife", "pedir batata", "pedir ovos", "pedir spaghetti", "pedir milkshakes" };
            bool     SpecialMsg = false;
            string   specialMsg = "";

            foreach (string spe in special)
            {
                if (Message.ToLower() == spe.ToLower())
                {
                    SpecialMsg = true;
                    specialMsg = spe;
                }
            }

            /*
             * if (Gamemap.TileDistance(GetRoomUser().X, GetRoomUser().Y, User.X, User.Y) > 8 && SpecialMsg)
             * {
             *  User.GetClient().SendWhisper("You must get closer to do this!");
             *  return;
             * }*/

            #region Ammunation


            if (base.GetRoom().RoomData.Description.Contains("AMMUNATION"))
            {
                if (SpecialMsg)
                {
                    bool HasWeapon = false;

                    foreach (KeyValuePair <string, Weapon> Wep in User.GetClient().GetRoleplay().Weapons)
                    {
                        if (HabboHotel.Roleplay.Combat.WeaponManager.GetWeaponName(Wep.Key) == specialMsg)
                        {
                            HasWeapon = true;
                        }
                    }

                    if (HasWeapon)
                    {
                        User.GetClient().SendWhisper("You already have a " + specialMsg + "!");
                        return;
                    }

                    User.GetClient().GetRoleplay().OfferData.Clear();

                    User.GetClient().SendWhisper("You were offered a " + specialMsg + " for $" + WeaponManager.WeaponsData[specialMsg].Price + ". Type #accept to accept or #deny to deny!");
                    base.GetRoomUser().Chat(null, "*Offers " + User.GetClient().GetHabbo().UserName + " a " + specialMsg + " for $" + WeaponManager.WeaponsData[specialMsg].Price + "*", false, 1);
                    User.GetClient().GetRoleplay().OfferData.Add(specialMsg, new Offer(null, specialMsg, 1, WeaponManager.WeaponsData[specialMsg].Price));
                }
            }

            #endregion

            #region Phone Shop
            if (base.GetRoom().RoomData.Description.Contains("PHONE"))
            {
                if (SpecialMsg)
                {
                    if (User.GetClient().GetRoleplay().Phone == 1)
                    {
                        User.GetClient().SendWhisper("You already have a phone!");
                        return;
                    }

                    base.GetRoomUser().Chat(null, "*Offers " + User.GetClient().GetHabbo().UserName + "a Nokia phone for $50*", true, 1);
                    User.GetClient().SendWhisper("You are being offered a phone for $50. Type #accept to accept or #deny to deny!");
                    User.GetClient().GetRoleplay().OfferData.Add("phone", new Offer(null, "phone", 1, 50));
                }
            }
            #endregion

            #region Store Rob

            if (base.GetRoom().RoomData.Description.Contains("STORE"))
            {
                #region Activate Store Robbing
                if (Message == "activate")
                {
                    if (RoleplayManager.BypassRights(User.GetClient()))
                    {
                        lastRobbed = 5001;
                        User.GetClient().SendWhisper("Store robbing re-activated!");
                    }
                }
                #endregion

                #region Stop Store Robbing
                if (Message == "stop")
                {
                    if (RoleplayManager.BypassRights(User.GetClient()))
                    {
                        robber      = null;
                        beingRobbed = false;
                        User.GetClient().GetRoleplay().robbingStore = 0;
                        User.GetClient().SendWhisper("Store robbing de-activated/restarted!");
                    }
                }
                #endregion

                #region Faster
                if (Message == "faster")
                {
                    if (beingRobbed)
                    {
                        if (robber.GetHabbo().Id == User.GetClient().GetHabbo().Id)
                        {
                            RoleplayManager.Shout(User.GetClient(), "Go faster or else ill blow you to bits!");
                            User.GetClient().GetHabbo().GetRoomUser().ApplyEffect(164);
                            base.GetRoomUser().Chat(null, "I'm sorry, please wait, im going my fastest!!", true, 1);
                            gatherSpeed = 2;
                        }
                    }
                }
                #endregion

                #region Rob

                if (Message == "rob")
                {
                    if (beingRobbed)
                    {
                        User.GetClient().SendWhisper("This place is currently being robbed!");
                        return;
                    }
                    else
                    {
                        if (disableRob)
                        {
                            User.GetClient().SendWhisper("This place was recently robbed!");
                            return;
                        }
                        else
                        {
                            if (!base.GetRoom().RoomData.Description.Contains("STOREROB"))
                            {
                                User.GetClient().SendWhisper("This cannot rob this place!");
                                return;
                            }
                            else
                            {
                                if (robberCount > 0)
                                {
                                    User.GetClient().SendWhisper("This place is already being robbed!");
                                    return;
                                }
                                else
                                {
                                    robber = User.GetClient();

                                    RoleplayManager.Shout(User.GetClient(), "Give me all your cash, before I blow your head to bits!");

                                    robber.GetRoleplay().robbingStore = Convert.ToInt32(robber.GetHabbo().CurrentRoomId);
                                    if (!RoleplayManager.PurgeTime)
                                    {
                                        robber.GetRoleplay().Wanted = 10;
                                        robber.GetRoleplay().SaveQuickStat("wanted", "" + 10);

                                        if (!RoleplayManager.WantedListData.ContainsKey(robber.GetHabbo().UserName.ToLower()))
                                        {
                                            RoleplayManager.WantedListData.TryAdd(robber.GetHabbo().UserName.ToLower(), 10 + "|" + Convert.ToInt32(robber.GetHabbo().CurrentRoomId));
                                        }

                                        robber.SendWhisper("You are now wanted for store robbery!");

                                        lock (Plus.GetGame().GetClientManager().Clients.Values)
                                        {
                                            foreach (GameClient client in Plus.GetGame().GetClientManager().Clients.Values)
                                            {
                                                if (client == null)
                                                {
                                                    continue;
                                                }
                                                if (client.GetRoleplay() == null)
                                                {
                                                    continue;
                                                }
                                                if (!JobManager.validJob(client.GetRoleplay().JobId, client.GetRoleplay().JobRank))
                                                {
                                                    continue;
                                                }
                                                if (!client.GetRoleplay().JobHasRights("police"))
                                                {
                                                    continue;
                                                }
                                                if (!client.GetRoleplay().Working)
                                                {
                                                    continue;
                                                }

                                                client.GetHabbo().GetRoomUser().LastBubble = 30;
                                                client.SendWhisper("<b>[Police Radio]:</b> " + robber.GetHabbo().UserName + " is robbing the store at " + robber.GetHabbo().CurrentRoomId + ", get there fast!");
                                                client.GetHabbo().GetRoomUser().LastBubble = 0;
                                            }
                                        }
                                    }

                                    base.GetRoomUser().Chat(null, "Okay, okay! Hold on please!!", true, 1);

                                    gatherSpeed = 0;
                                    gatherMsg   = 20;
                                    gatherNum   = 1;
                                    beingRobbed = true;
                                    attack      = new Random().Next(1, 10);
                                }
                            }
                        }
                    }
                }


                #endregion

                #endregion

                #region Eatery
                if (base.GetRoom().RoomData.Description.Contains("EATERY"))
                {
                    if (!event_serving)
                    {
                        if (SpecialMsg)
                        {
                            if (!User.GetClient().GetRoleplay().MultiCoolDown.ContainsKey("order_cooldown"))
                            {
                                User.GetClient().GetRoleplay().MultiCoolDown.Add("order_cooldown", 0);
                            }
                            if (User.GetClient().GetRoleplay().MultiCoolDown["order_cooldown"] > 0)
                            {
                                User.GetClient().SendWhisper("Você recentemente pediu algo, por favor, aguarde um pouco para encomendar novamente!");
                                return;
                            }

                            if (specialMsg.Contains("pedir"))
                            {
                                if (OriginalPosition == null)
                                {
                                    OriginalPosition = new Vector2D(GetRoomUser().X, GetRoomUser().Y);
                                }

                                serving = User.GetClient();
                                string   food = "";
                                string[] sp   = specialMsg.Split(' ');
                                foreach (string param in sp)
                                {
                                    food = sp[1];
                                }


                                event_serving_plate = retrieveItem("diner_tray_0", true, User);


                                if (event_serving_plate == null)
                                {
                                    User.GetClient().SendWhisper("Você precisa se sentar perto de um prato vazio!");
                                    return;
                                }

                                if (User.GetClient().GetRoleplay().Hunger <= 0)
                                {
                                    User.GetClient().SendWhisper("Parece que você já está cheio, você não precisa mais de comida!");
                                    return;
                                }

                                GetRoomUser().Chat(null, "Olá " + serving.GetHabbo().UserName + ", uma porção de " + food + " chegando!", true, 0);


                                event_serving_orderPlaced = true;
                                event_serving_fooditem    = food;
                                event_serving             = true;

                                //User.GetClient().GetRoleplay().MultiCoolDown["order_cooldown"] = 30;
                            }
                        }
                    }
                    else
                    {
                        if (SpecialMsg)
                        {
                            User.GetClient().SendWhisper("Alguém está fazendo o pedido, por favor, aguarde a sua vez!");

                            #region Delete Serve Session
                            if (serving == null)
                            {
                                event_serving = false;
                                return;
                            }
                            if (serving.GetHabbo() == null)
                            {
                                event_serving = false;
                                return;
                            }
                            if (serving.GetRoleplay() == null)
                            {
                                event_serving = false;
                                return;
                            }
                            if (serving.GetHabbo().CurrentRoom == null)
                            {
                                event_serving = false;
                                return;
                            }
                            if (serving.GetHabbo().CurrentRoom != GetRoom())
                            {
                                event_serving = false;
                                return;
                            }
                            #endregion
                        }
                    }
                }
                #endregion
            }
        }