Ejemplo n.º 1
0
        /// <summary>
        ///     Called when [user enter room].
        /// </summary>
        /// <param name="user">The user.</param>
        internal override void OnUserEnterRoom(RoomUser user)
        {
            if (user.GetClient() == null || user.GetClient().GetHabbo() == null)
            {
                return;
            }

            RoomUser roomUser = GetRoomUser();

            if (roomUser == null || user.GetClient().GetHabbo().UserName != roomUser.PetData.OwnerName)
            {
                return;
            }

            Random random = new Random();

            string[] value   = PetLocale.GetValue("welcome.speech.pet");
            string   message = value[random.Next(0, value.Length - 1)];

            message += user.GetUserName();

            roomUser.Statusses.Clear();
            roomUser.UpdateNeeded = true;
            roomUser.Chat(null, message, false, 0);
        }
Ejemplo n.º 2
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];
            RoomUser bot      = Room.GetRoomUserManager().GetBotByName(OtherString);

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

            if (OtherBool)
            {
                ServerMessage whisp = new ServerMessage(LibraryParser.OutgoingRequest("WhisperMessageComposer"));
                whisp.AppendInteger(bot.VirtualId);
                whisp.AppendString(OtherExtraString);
                whisp.AppendInteger(0);
                whisp.AppendInteger(2);
                whisp.AppendInteger(0);
                whisp.AppendInteger(-1);
                roomUser.GetClient().SendMessage(whisp);
            }
            else
            {
                bot.Chat(null, roomUser.GetUserName() + " : " + OtherExtraString, false, 0);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
        {
            RoomUser user = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);

            if (user == null)
            {
                return;
            }

            if (user.CurrentEffect != 172 && user.CurrentEffect != 5 && user.CurrentEffect != 173)
            {
                return;
            }

            if (item.ExtraData != "5")
            {
                if (item.VikingCotieBurning)
                {
                    return;
                }

                item.ExtraData = "1";
                item.UpdateState();

                item.VikingCotieBurning = true;

                GameClient clientByUsername =
                    Yupi.GetGame().GetClientManager().GetClientByUserName(item.GetRoom().RoomData.Owner);

                if (clientByUsername != null)
                {
                    if (clientByUsername.GetHabbo().UserName != item.GetRoom().RoomData.Owner)
                    {
                        clientByUsername.SendNotif(string.Format(Yupi.GetLanguage().GetVar("viking_burn_started"),
                                                                 user.GetUserName()));
                    }
                }

                _mItem = item;

                Timer timer = new Timer(5000);
                timer.Elapsed += OnElapse;
                timer.Enabled  = true;
            }
            else
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("user_viking_error"));
            }
        }
Ejemplo n.º 4
0
        public override bool Execute(GameClient session, string[] pms)
        {
            Room room = Yupi.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);

            if (room == null)
            {
                return(true);
            }

            RoomUser user2 = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().LastSelectedUser);

            if (user2 == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }

            RoomUser user =
                room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().UserName);

            if (PathFinder.GetDistance(user.X, user.Y, user2.X, user2.Y) > 1)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("kil_command_error_1"));

                return(true);
            }
            if (user2.IsLyingDown || user2.IsSitting)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("kil_command_error_2"));
                return(true);
            }
            if (
                !string.Equals(user2.GetUserName(), session.GetHabbo().UserName,
                               StringComparison.CurrentCultureIgnoreCase))
            {
                user2.Statusses.Add("lay", "0.55");
                user2.IsLyingDown  = true;
                user2.UpdateNeeded = true;
                user.Chat(user.GetClient(), Yupi.GetLanguage().GetVar("command.kill.user"), true, 0, 3);
                user2.Chat(user2.GetClient(), Yupi.GetLanguage().GetVar("command.kill.userdeath"), true, 0,
                           3);
                return(true);
            }
            user.Chat(session, "I am sad", false, 0);
            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Manages attack speeches / and / or effects
        /// </summary>
        /// <param name="Attacking"></param>
        /// <param name="Damage"></param>
        /// <param name="DeathMisc"></param>
        /// <param name="MissedMisc"></param>
        internal void AttackMisc(RoomUser Attacking, int Damage, bool DeathMisc = false, bool MissedMisc = false)
        {
            string NormMsg  = null;
            string DeathMsg = null;
            string MissMsg;

            switch (RPType)
            {
            case "dragon":

                if (!MissedMisc)
                {
                    Attacking.GetClient().GetRoleplay().EffectSeconds = 5;
                    Attacking.ApplyEffect(25);
                }
                NormMsg  = "*Breathes fire at " + Attacking.GetUserName() + ", causing " + Damage + " damage*";
                DeathMsg = "*Breathes fire at " + Attacking.GetUserName() + ", causing " + Damage + " damage and killing them!*";
                MissMsg  = "*Breathes fire at " + Attacking.GetUserName() + ", but misses!*";
                break;

            default:
                NormMsg  = "*Bites " + Attacking.GetUserName() + ", causing " + Damage + " damage*";
                DeathMsg = "*Bites " + Attacking.GetUserName() + ", causing " + Damage + " damage and killing them!*";
                MissMsg  = "*Tries to bite " + Attacking.GetUserName() + ", but misses!*";
                break;
            }

            if (MissedMisc)
            {
                Shout(MissMsg);
                return;
            }

            if (DeathMisc)
            {
                Shout(DeathMsg);
                return;
            }

            if (!DeathMisc)
            {
                Shout(NormMsg);
                return;
            }
        }
Ejemplo n.º 6
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];

            if (!string.IsNullOrEmpty(OtherString) && roomUser.GetUserName() != OtherString &&
                !roomUser.GetClient().GetHabbo().IsTeleporting)
            {
                return(false);
            }

            List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this);
            List <IWiredItem> effects    = Room.GetWiredHandler().GetEffects(this);

            if (conditions.Any())
            {
                foreach (IWiredItem current in conditions)
                {
                    if (!current.Execute(roomUser))
                    {
                        return(false);
                    }

                    WiredHandler.OnEvent(current);
                }
            }

            if (effects.Any())
            {
                foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(roomUser, Type)))
                {
                    WiredHandler.OnEvent(current2);
                }
            }

            WiredHandler.OnEvent(this);
            return(true);
        }
Ejemplo n.º 7
0
        private static void AppendUserInfo(RoomUser user, StringBuilder text)
        {
            text.Append(
                $"## userId: {user.UserId}  name: {user.GetUserName()} rank: {user.GetClient().GetHabbo().Rank} \r");
            if (user.IsDancing)
            {
                text.Append("actions: dancing \r");
            }
            if (user.IsLyingDown)
            {
                text.Append("actions: lying \r");
            }
            if (user.IsSitting)
            {
                text.Append("actions: sitting \r");
            }
            if (user.CurrentEffect > 0)
            {
                text.Append("actions: effect." + user.CurrentEffect);
            }
            if (user.IsWalking)
            {
                text.Append($" walking.To(X/Y  {user.GoalX}/{user.GoalY})");
            }
            text.Append("\r");

            text.Append("room rights: ");
            if (user.GetClient().GetHabbo().HasFuse("fuse_mod"))
            {
                text.Append(" staff");
            }
            if (user.GetClient().GetHabbo().HasFuse("fuse_any_room_controller"))
            {
                text.Append(" controlAnyRoom");
            }
            if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), true))
            {
                text.Append(" owner");
            }
            if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), false, true))
            {
                text.Append(" groupAdmin");
            }
            else if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), false, false, true))
            {
                text.Append(" groupMember");
            }
            text.Append("\r");

            text.Append("prohibitions: ");
            if (!user.CanWalk)
            {
                text.Append(" walk");
            }
            if (user.GetClient().GetHabbo().Muted)
            {
                text.Append(" chat");
            }
            text.Append("\r");

            text.AppendLine($"X/Y/Z/Rot:  {user.X}/{user.Y}/{user.Z}/{user.RotBody}");
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Called when [user enter room].
        /// </summary>
        /// <param name="user">The user.</param>
        internal override void OnUserEnterRoom(RoomUser user)
        {
            if (user.GetClient() == null || user.GetClient().GetHabbo() == null)
                return;

            RoomUser roomUser = GetRoomUser();
            if (roomUser == null || user.GetClient().GetHabbo().UserName != roomUser.PetData.OwnerName)
                return;

            Random random = new Random();
            string[] value = PetLocale.GetValue("welcome.speech.pet");
            string message = value[random.Next(0, (value.Length - 1))];

            message += user.GetUserName();
            roomUser.Chat(null, message, false, 0, 0);
        }
Ejemplo n.º 9
0
        public bool Execute(params object[] stuff)
        {
            if (stuff[0] == null)
            {
                return(false);
            }

            RoomUser    roomUser = (RoomUser)stuff[0];
            Interaction item     = (Interaction)stuff[1];

            if (_mBanned.Contains(item))
            {
                return(false);
            }

            if (roomUser?.GetClient() != null && roomUser.GetClient().GetHabbo() != null &&
                !string.IsNullOrWhiteSpace(OtherString))
            {
                if (roomUser.GetClient().GetHabbo().HasFuse("fuse_mod") || Room.RoomData.Owner == roomUser.GetUserName())
                {
                    return(false);
                }

                roomUser.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(4, false);
                roomUser.GetClient().SendWhisper(OtherString);
                _mUsers.Add(roomUser);
            }

            if (_mTimer == null)
            {
                _mTimer = new Timer(2000);
            }

            _mTimer.Elapsed += ExecuteKick;
            _mTimer.Enabled  = true;

            return(true);
        }
Ejemplo n.º 10
0
        private static void AppendUserInfo(RoomUser user, StringBuilder text)
        {
            text.Append(string.Format("## userId: {0}  name: {1} rank: {2} \r", user.UserId, user.GetUserName(),
                user.GetClient().GetHabbo().Rank));
            if (user.IsDancing) text.Append("actions: dancing \r");
            if (user.IsLyingDown) text.Append("actions: lying \r");
            if (user.IsSitting) text.Append("actions: sitting \r");
            if (user.CurrentEffect > 0) text.Append("actions: effect." + user.CurrentEffect);
            if (user.IsWalking) text.Append(string.Format(" walking.To(X/Y  {0}/{1})", user.GoalX, user.GoalY));
            text.Append("\r");

            text.Append("room rights: ");
            if (user.GetClient().GetHabbo().HasFuse("moderator")) text.Append(" staff");
            if (user.GetClient().GetHabbo().HasFuse("user_control_any_room")) text.Append(" controlAnyRoom");
            if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), true)) text.Append(" owner");
            if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), false, true)) text.Append(" groupAdmin");
            else if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), false, false, true)) text.Append(" groupMember");
            text.Append("\r");

            text.Append("prohibitions: ");
            if (!user.CanWalk) text.Append(" walk");
            if (user.GetClient().GetHabbo().Muted) text.Append(" chat");
            text.Append("\r");

            text.AppendLine(string.Format("X/Y/Z/Rot:  {0}/{1}/{2}/{3}", user.X, user.Y, user.Z, user.RotBody));
        }
Ejemplo n.º 11
0
        private static void AppendUserInfo(RoomUser user, StringBuilder text)
        {
            text.Append(
                $"## userId: {user.UserId}  name: {user.GetUserName()} rank: {user.GetClient().GetHabbo().Rank} \r");
            if (user.IsDancing) text.Append("actions: dancing \r");
            if (user.IsLyingDown) text.Append("actions: lying \r");
            if (user.IsSitting) text.Append("actions: sitting \r");
            if (user.CurrentEffect > 0) text.Append("actions: effect." + user.CurrentEffect);
            if (user.IsWalking) text.Append($" walking.To(X/Y  {user.GoalX}/{user.GoalY})");
            text.Append("\r");

            text.Append("room rights: ");
            if (user.GetClient().GetHabbo().HasFuse("fuse_mod")) text.Append(" staff");
            if (user.GetClient().GetHabbo().HasFuse("fuse_any_room_controller")) text.Append(" controlAnyRoom");
            if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), true)) text.Append(" owner");
            if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), false, true))
                text.Append(" groupAdmin");
            else if (user.GetClient().GetHabbo().CurrentRoom.CheckRights(user.GetClient(), false, false, true))
                text.Append(" groupMember");
            text.Append("\r");

            text.Append("prohibitions: ");
            if (!user.CanWalk) text.Append(" walk");
            if (user.GetClient().GetHabbo().Muted) text.Append(" chat");
            text.Append("\r");

            text.AppendLine($"X/Y/Z/Rot:  {user.X}/{user.Y}/{user.Z}/{user.RotBody}");
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Attacks the victim
        /// </summary>
        internal void TryAttack(object StateInfo)
        {
            try
            {
                if (GetRoomUser() == null || GetRoom() == null ||
                    _AttackTimer == null || _Victim == null ||
                    _Victim.RoomId != GetRoom().RoomId)
                {
                    _Victim = null; return;
                }

                if (GetBotData().CoolDown != null)
                {
                    return;
                }

                GameClient Session = _Victim.GetClient();
                if (Session == null || Session.GetHabbo() == null || Session.GetRoleplay() == null || Session.GetHabbo().CurrentRoom == null)
                {
                    _AttackTimer.Change(2000, 2000); _Victim = null; return;
                }

                Vector2D VictimPOS = new Vector2D(_Victim.X, _Victim.Y);
                Vector2D MyPOS     = new Vector2D(GetRoomUser().X, GetRoomUser().Y);

                if (RoleplayManager.BotWithinAttackDistance(GetRoomUser(), _Victim))
                {
                    int ExtraDamage = (new Random()).Next(5, 15);
                    int Damage      = GetBotData().strength + ExtraDamage;

                    // Kill this punk
                    if (Session.GetRoleplay().CurHealth - Damage <= 0)
                    {
                        GetRoomUser().Chat(null, "*Da um soco em " + _Victim.GetUserName() + ", nocauteando-o*", true, 1);
                        Session.GetRoleplay().CurHealth = 120;
                        Session.GetRoleplay().Energy    = 120;
                        Session.GetRoleplay().Hunger    = 0;
                        Session.GetRoleplay().UpdateStats++;

                        // Tell this n***a he got f****d up by our bot
                        Session.SendNotif("Você foi nocauteado pelo BOT-" + GetBotData().Name);
                        _Victim = null;
                        // SEND THIS N***A BACK TO HIS SHIT HOLE
                        Session.GetMessageHandler().PrepareRoomForUser(Plus.GetGame().MafiaWars.GraveYardID, "");

                        // Get next victim init
                        LookForVictim();
                        _AttackTimer.Change(1000, 1000);
                        return;
                    }

                    GetRoomUser().Chat(null, "*Bate em " + _Victim.GetUserName() + ", causando " + Damage + " dano*", true, 1);
                    RoleplayManager.Shout(Session, "*[" + Session.GetRoleplay().CurHealth + "/" + Session.GetRoleplay().MaxHealth + "]*");

                    Session.GetRoleplay().CurHealth -= Damage;
                    Session.GetRoleplay().UpdateStats++;

                    GetBotData().ApplyCooldown();
                    _AttackTimer.Change(1000, 1000);
                    return;
                }

                if (RoleplayManager.Distance(MyPOS, VictimPOS) >= 1 && RoleplayManager.Distance(MyPOS, VictimPOS) <= 2)
                {
                    // Miss
                    GetRoomUser().Chat(null, "*Tenta bater em " + _Victim.GetUserName() + " mas erra*", true, 1);

                    GetBotData().ApplyCooldown(2000);
                    _AttackTimer.Change(1000, 1000);
                    return;
                }

                if (RoleplayManager.Distance(MyPOS, VictimPOS) >= 5)
                {
                    _AttackTimer.Change(1000, 1000);
                    return; // Don't even bother
                }
            }
            catch { }
        }