Exemplo n.º 1
0
        public static void CheckBounty(GameClient user, string username)
        {
            if (BountyUsers.ContainsKey(username))
            {
                int junkBounty = BountyUsers[username];

                user.Shout("*Claims $" + BountyUsers[username] + " from " + username + "'s bounty*");
                user.SendWhisper("You have claimed $" + BountyUsers[username] + " from the bounty!");
                RoleplayManager.GiveMoney(user, +BountyUsers[username]);
                BountyUsers.TryRemove(username, out junkBounty);
            }
        }
Exemplo n.º 2
0
        public void HandleATM(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            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 (Session.GetRoleplay().inATM == true)
            {
                Session.SendWhisper("[ATM MSG] You are already logged in!");
                return;
            }

            Session.GetRoleplay().inATM = true;

            Session.SendWhisper("[ATM MSG] Processing transaction please wait...");

            int amount = Session.GetRoleplay().AtmSetAmount;

            if (amount > Session.GetRoleplay().Bank)
            {
                Session.SendWhisper("[ATM MSG] Transaction failed, insufficient funds!");
                Session.GetHabbo().GetRoomUser().UnlockWalking();
                Session.GetRoleplay().inATM = false;
                return;
            }
            else
            {
                System.Threading.Thread.Sleep(2000);

                Session.SendWhisper("[ATM MSG] Transaction succesful!");
                RoleplayManager.Shout(Session, "*Uses the ATM to withdraw $" + amount + " from their account [+$" + amount + "]*");
                Session.GetHabbo().GetRoomUser().UnlockWalking();
                Session.GetRoleplay().inATM = false;
                Session.GetRoleplay().Bank -= amount;
                Session.GetRoleplay().SaveQuickStat("bank", "" + Session.GetRoleplay().Bank);
                RoleplayManager.GiveMoney(Session, +amount);
                Session.GetRoleplay().AtmSetAmount = 20;
            }
        }
Exemplo n.º 3
0
        public void timerDone(object info)
        {
            try
            {
                timeLeft -= 60000;

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

                if (timeLeft > 0)
                {
                    int minutesRemaining = timeLeft / 60000;
                    Session.GetRoleplay().SaveStatusComponents("robbery");
                    Session.SendWhisper("You have " + minutesRemaining + " minute(s) left until you complete your robbery!");
                    timer.Change(60000, Timeout.Infinite);
                    return;
                }

                #endregion

                #region Execute
                Random rnd    = new Random();
                int    maxrob = (RoleplayManager.VaultRobbery < 666) ? (RoleplayManager.VaultRobbery / 2) : 666;
                int    money  = rnd.Next(0, maxrob);

                RoleplayManager.VaultRobbery -= money;

                if (RoleplayManager.VaultRobbery <= 0)
                {
                    Session.SendWhisper("The vault has $0 left, meaning it was completely robbed! Therefore, you didn't get any cash for robbing the vault!");
                    Session.GetRoleplay().Robbery = false;
                    Session.GetRoleplay().SaveStatusComponents("robbery");
                    stopTimer();
                    return;
                }

                RoleplayManager.Shout(Session, "*Finishes robbing the bank [+$" + money + "]*");
                RoleplayManager.GiveMoney(Session, +money);
                Session.SendWhisper("Vault cash remaining: $" + RoleplayManager.VaultRobbery + "!");
                Session.GetRoleplay().Robbery = false;
                Session.GetRoleplay().SaveStatusComponents("robbery");

                stopTimer();
                #endregion
            }
            catch { stopTimer(); }
        }
Exemplo n.º 4
0
        public void timerDone(object info)
        {
            try
            {
                timeLeft -= 60000;

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

                if (timeLeft > 0)
                {
                    int minutesRemaining = timeLeft / 60000;
                    Session.GetRoleplay().SaveStatusComponents("robbery");
                    Session.SendWhisper("You have " + minutesRemaining + " minute(s) left until you complete your robbery!");
                    timer.Change(60000, Timeout.Infinite);
                    return;
                }

                #endregion

                #region Execute
                Random rnd   = new Random();
                int    money = rnd.Next(0, 666);

                RoleplayManager.Shout(Session, "*Finishes robbing the bank [$" + money + "]*");
                RoleplayManager.GiveMoney(Session, +money);
                Session.GetRoleplay().Robbery = false;
                Session.GetRoleplay().SaveStatusComponents("robbery");

                stopTimer();
                #endregion
            }
            catch { stopTimer(); }
        }
Exemplo n.º 5
0
        public static void ExecuteAttack(GameClient Session, GameClient TargetSession, Room Room, RoomUser RoomUser, RoomUser Target)
        {

            #region Global Variables
            string WeaponName = WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].DisplayName;
            int Damage = CombatManager.DamageCalculator(Session, true);
            #endregion

            #region RPG
            if (Session.GetRoleplay().Equiped.Contains("rpg"))
            {
                if (!Target.CurrentEffect.Equals(175) && !Target.CurrentEffect.Equals(176))
                {
                    Session.SendWhisper("This user is not using a plane!");
                    return;
                }
                else
                {
                    Session.Shout("*Fires their RPG at " + TargetSession.GetHabbo().UserName + "'s plane, causing it to plummet to the ground*");
                    TargetSession.GetRoleplay().MultiCoolDown["plane_cooldown"] = 300;
                    TargetSession.GetRoleplay().CheckingMultiCooldown = true;
                    TargetSession.GetRoleplay().usingPlane = false;
                    TargetSession.GetRoleplay().planeUsing = 0;
                    Target.ApplyEffect(25);
                    return;
                }
            }
            #endregion

            else
            {

                #region Increment / Decrement Values
                if (TargetSession.GetRoleplay().Armor >= 1)
                {
                    TargetSession.GetRoleplay().Armor -= Damage;
                    #region Armor Broken?
                    if (TargetSession.GetRoleplay().Armor <= 0 && TargetSession.GetRoleplay().Armored == true)
                    {
                        TargetSession.GetRoleplay().Armored = false;
                        TargetSession.GetRoleplay().ArmoredFigSet = false;
                        Target.LastBubble = 3;
                        TargetSession.Shout("*Body-armor shatters*");
                        Target.LastBubble = 0;
                    }
                    #endregion
                }
                else
                {
                    TargetSession.GetRoleplay().CurHealth -= Damage;
                }


                Session.GetRoleplay().Energy -= WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy;
                Session.GetRoleplay().Bullets -= 1;
                Session.GetRoleplay().SaveQuickStat("bullets", "" + Session.GetRoleplay().Bullets);
                Session.GetRoleplay().GunShots++;
                #endregion

                if (TargetSession.GetRoleplay().CurHealth <= 0)
                {

                    int score = new Random().Next(0, 20);

                    if (!WeaponManager.WeaponsData.ContainsKey(Session.GetRoleplay().Equiped.ToLower()))
                    {
                        return;
                    }

                        Session.Shout("*Shoots their " + WeaponName + " at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage and killing them! [-" + WeaponManager.WeaponsData[Session.GetRoleplay().Equiped.ToLower()].Need_Energy + " Energy, +" + score + " PTS]*");
                    

                    #region Gang Rewards

                    if (Session.GetRoleplay().GangId > 0 && HabboHotel.Roleplay.Gangs.GangManager.validGang(Session.GetRoleplay().GangId, Session.GetRoleplay().GangRank))
                    {

                        Random _s = new Random();
                        using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor())
                        {
                            bool HasGang = false;
                            int gangpts = _s.Next((TargetSession.GetRoleplay().Strength + TargetSession.GetRoleplay().savedSTR) * 1 - (int)Math.Round((double)(TargetSession.GetRoleplay().Strength + TargetSession.GetRoleplay().savedSTR) / 3, 0), (TargetSession.GetRoleplay().Strength + TargetSession.GetRoleplay().savedSTR)* 2);
                            HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Kills++;
                            HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Points += gangpts;

                            if (TargetSession.GetRoleplay().GangId > 0 && HabboHotel.Roleplay.Gangs.GangManager.validGang(TargetSession.GetRoleplay().GangId, TargetSession.GetRoleplay().GangRank))
                            {
                                HasGang = true;
                            }

                            if (HasGang)
                            {
                                if (!Session.GetHabbo().HasFuse("fuse_owner"))
                                {
                                    HabboHotel.Roleplay.Gangs.GangManager.GangData[TargetSession.GetRoleplay().GangId].Deaths++;
                                }
                                dbClient.RunFastQuery("UPDATE rp_gangs SET deaths = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[TargetSession.GetRoleplay().GangId].Deaths + " WHERE id = " + TargetSession.GetRoleplay().GangId + "");
                            }

                            dbClient.RunFastQuery("UPDATE rp_gangs SET kills = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Kills + ", points = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Points + " WHERE id = " + Session.GetRoleplay().GangId + "");

                        }
                    }

                    #endregion

                    RoomUser.LastBubble = 3;
                    /*if (Session.GetRoleplay().LastKilled != TargetSession.GetHabbo().UserName)
                    {*/
                    Session.GetHabbo().AchievementPoints += score;
                    Session.GetHabbo().UpdateActivityPointsBalance();
                    Session.GetRoleplay().Kills++;
                    Session.GetRoleplay().GunKills++;
                    Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints));
                    /*}
                    if (Session.GetRoleplay().LastKilled == TargetSession.GetHabbo().UserName)
                    {
                        Misc.Shout(Session, "*Shoots their " + WeaponName + " at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage and killing them! [-" + weaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy + " Energy]*");
                        Session.SendWhisper("The last person you killed is this same person!");
                    }*/
                    RoomUser.LastBubble = 0;
                    if (!Session.GetHabbo().HasFuse("fuse_owner"))
                    {
                        TargetSession.GetRoleplay().Deaths++;
                    }
                    TargetSession.SendNotif("You were shot dead by " + Session.GetHabbo().UserName + ", and are being transported to the hospital.");

                    if (TargetSession.GetRoleplay().Working)
                    {
                        TargetSession.GetRoleplay().StopWork();
                    }

                    if (!Session.GetRoleplay().Equiped.Contains("police"))
                    {

                        #region Handle Death & Robbery
                        TargetSession.GetRoleplay().DeadFigSet = false;
                        TargetSession.GetRoleplay().DeadSeconds = 60;
                        TargetSession.GetRoleplay().DeadTimer = 2;
                        TargetSession.GetRoleplay().Dead = true;
                        if (TargetSession.GetRoleplay().usingCar == true)
                        {
                            TargetSession.GetRoleplay().usingCar = false;
                            Target.FastWalking = false;
                        }

                        RoleplayManager.HandleDeath(TargetSession);

                        int lol = new Random().Next(1, 25);
                        if (TargetSession.GetHabbo().Credits > lol && Session.GetRoleplay().LastKilled != TargetSession.GetHabbo().UserName)
                        {
                            RoleplayManager.GiveMoney(Session, +lol);
                            Session.Shout("*Steals $" + lol + " from " + TargetSession.GetHabbo().UserName + "'s wallet*");
                            RoleplayManager.GiveMoney(TargetSession, -lol);
                            TargetSession.SendNotif(Session.GetHabbo().UserName + " stole $" + lol + " from you");
                        }

                        #endregion

                        Misc.Bounties.CheckBounty(Session, TargetSession.GetHabbo().UserName);
                        Plus.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_Fighter", 1);
                        Plus.GetGame().GetAchievementManager().ProgressUserAchievement(TargetSession, "ACH_Death", 1);

                    }
                    else
                    {

                        #region Handle Arrest
                        int Time = 5;
                        if (RoleplayManager.WantedListData.ContainsKey(TargetSession.GetHabbo().UserName.ToLower()))
                        {
                            string Data = RoleplayManager.WantedListData[TargetSession.GetHabbo().UserName.ToLower()];
                            foreach (KeyValuePair<string, string> User in RoleplayManager.WantedListData)
                            {

                                string Name = User.Key;

                                if (Name != TargetSession.GetHabbo().UserName.ToLower())
                                {
                                    continue;

                                }

                                string[] Split = User.Value.Split('|');

                                Time = Convert.ToInt32(Split[0]);
                            }
                        }
                        else
                        {
                            Time = 10;
                        }

                        TargetSession.SendNotif("You have been arrested by " + Session.GetHabbo().UserName + " for " + Time + " minute(s)");
                        TargetSession.GetRoleplay().JailFigSet = false;
                        TargetSession.GetRoleplay().JailedSeconds = 60;
                        TargetSession.GetRoleplay().JailTimer = Time;
                        TargetSession.GetRoleplay().Jailed = true;
                        TargetSession.GetRoleplay().Arrested++;
                        TargetSession.GetRoleplay().UpdateStats++;

                        Session.GetRoleplay().Arrests++;
                        Session.GetRoleplay().UpdateStats++;
                        #endregion

                    }
                }
                else
                {

                    CombatManager.HandleGun(Session, TargetSession, Room, RoomUser, Target, WeaponName, Damage);

                    #region Increment Values / Cooldown
                    Session.GetRoleplay().CoolDown = 3;
                    Session.GetRoleplay().LastKilled = TargetSession.GetHabbo().UserName;
                    TargetSession.GetRoleplay().UpdateStats++;
                    Session.GetRoleplay().UpdateStats++;
                    #endregion
                }

            }
        }
Exemplo n.º 6
0
        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 (!Gamemap.TilesTouching(User.X, User.Y, Item.X, Item.Y))
            {
                User.MoveTo(Item.SquareInFront);
                return;
            }

            if (RoleplayManager.EmptyTrashCans.ContainsKey(Item.Id))
            {
                DateTime nowTime  = DateTime.Now;
                DateTime LastTime = RoleplayManager.EmptyTrashCans[Item.Id];
                TimeSpan span     = nowTime.Subtract(LastTime);
                int      timeleft = 5 - Convert.ToInt32(span.Minutes);

                if (timeleft > 0)
                {
                    User.GetClient().SendWhisper("This item has recently been interacted with.");
                    return;
                }
            }

            int Cash         = new Random().Next(1, 350);
            int Weed         = new Random().Next(1, 100);
            int Bullets      = new Random().Next(1, 50);
            int PhoneCredits = new Random().Next(1, 1000);

            #region Trash Can Items

            List <string> trash = new List <string>();
            trash.Add("[CASH]");
            trash.Add("[CASH]");
            trash.Add("[CASH]");
            trash.Add("[WEED]");
            trash.Add("[WEED]");
            trash.Add("[WEED]");
            trash.Add("[WEED]");
            trash.Add("[WEED]");
            trash.Add("[AMMO]");
            trash.Add("[AMMO]");
            trash.Add("[AMMO]");
            trash.Add("[AMMO]");
            trash.Add("[AMMO]");
            trash.Add("[PHONEC]");
            trash.Add("[PHONEC]");
            trash.Add("[PHONEC]");
            trash.Add("[PHONEC]");
            trash.Add("[PHONEC]");
            trash.Add("[VESTS]");
            trash.Add("[VESTS]");
            trash.Add("[VESTS]");
            trash.Add("[VESTS]");
            trash.Add("[VESTS]");
            trash.Add("[HOBO]");
            trash.Add("[HOBO]");
            trash.Add("[HOBO]");
            trash.Add("[HOBO]");
            trash.Add("[HOBO]");
            trash.Add("[HOBO]");
            trash.Add("[HOBO]");
            trash.Add("[HOBO]");
            trash.Add("[HOBO]");

            #endregion

            int    tc        = new Random().Next(trash.Count);
            string foundItem = trash[tc];
            string foundmsg  = "*Fails to find anything in the bin*";

            #region Rummage in bin task

            RoleplayManager.Shout(User.GetClient(), "*Begins to rummage in the bin*");
            User.ApplyEffect(4);

            if (RoleplayManager.EmptyTrashCans.ContainsKey(Item.Id))
            {
                DateTime trashJunk;
                RoleplayManager.EmptyTrashCans.TryRemove(Item.Id, out trashJunk);
            }

            RoleplayManager.EmptyTrashCans.TryAdd(Item.Id, DateTime.Now);
            Item.ExtraData = "1";
            Item.UpdateState(false, true);
            Item.ReqUpdate(4, true);

            int time = 300;
            time = time * 1000;
            System.Timers.Timer dispatcherTimer = new System.Timers.Timer(time);
            dispatcherTimer.Interval = time;
            dispatcherTimer.Elapsed += delegate
            {
                Item.InteractingUser = 0;
                Item.ExtraData       = "0";
                Item.UpdateState(false, true);
                Item.ReqUpdate(4, true);
            };
            dispatcherTimer.Start();
            System.Threading.Thread.Sleep(2000);
            User.ApplyEffect(0);

            #endregion

            #region Rummage in bin completion (found items?)

            if (foundItem.Equals("[CASH]"))
            {
                foundmsg = "*Finds $" + Cash + " in the bin*";
                RoleplayManager.GiveMoney(Session, +Cash);
            }
            else if (foundItem.Equals("[WEED]"))
            {
                foundmsg = "*Finds " + Weed + "g of Weed in the bin*";
                Session.GetRoleplay().Weed += Weed;
                Session.GetRoleplay().SaveQuickStat("weed", "" + Session.GetRoleplay().Weed);
            }
            else if (foundItem.Equals("[AMMO]"))
            {
                foundmsg = "*Finds " + Bullets + " Bullets in the bin*";
                Session.GetRoleplay().Bullets += Bullets;
                Session.GetRoleplay().SaveQuickStat("bullets", "" + Session.GetRoleplay().Bullets);
            }
            else if (foundItem.Equals("[VESTS]"))
            {
                foundmsg = "*Finds an old kevlar vest in the bin*";
                Session.GetRoleplay().Vests += 1;
                Session.GetRoleplay().SaveQuickStat("vests", "" + Session.GetRoleplay().Vests);
                Session.SendWhisper("Use :ba to use your kevlar vest!");
            }
            else if (foundItem.Equals("[PHONEC]"))
            {
                foundmsg = "*Finds $" + PhoneCredits + " worth of phone credits in the bin*";
                RoleplayManager.GiveCredit(Session, +PhoneCredits);
            }
            else if (foundItem.Equals("[HOBO]"))
            {
                //Credits in hand stealer
                HabboHotel.RoomBots.RoomBot NewParamedic = RoleplayManager.MakeQuickBot("[HOBO] Jim", HabboHotel.RoomBots.AIType.MiscBot, User.GetClient().GetHabbo().CurrentRoomId, "hr-676-61.cp-3207-62-1408.ca-3292-110.lg-275-1408.hd-3103-97541.fa-1205-110.ch-255-1331.he-1601-62", Item.X, Item.Y, 0, "M");
                NewParamedic.InteractingWith = User;
                RoleplayManager.SendBotToRoom(NewParamedic, User.GetClient().GetHabbo().CurrentRoomId);

                //Credits in bank stealer
                HabboHotel.RoomBots.RoomBot NewParamedicBank = RoleplayManager.MakeQuickBot("[HOBO 2] John", HabboHotel.RoomBots.AIType.MiscBot, User.GetClient().GetHabbo().CurrentRoomId, "hr-676-61.cp-3207-62-1408.ca-3292-110.lg-275-1408.hd-3103-97541.fa-1205-110.ch-255-1331.he-1601-62", Item.X, Item.Y, 0, "M");
                NewParamedicBank.InteractingWith = User;
                RoleplayManager.SendBotToRoom(NewParamedicBank, User.GetClient().GetHabbo().CurrentRoomId);
            }

            RoleplayManager.Shout(Session, foundmsg);

            #endregion
        }
Exemplo n.º 7
0
        public static void ExecuteAttack(GameClient Session, GameClient TargetSession)
        {
            //int Damage = Gun_weaponCombat.CalculateDamage(Session, TargetSession);
            int Damage = new Random().Next(1, 18);

            if (TargetSession.GetRoleplay().Armor >= 1)
            {
                TargetSession.GetRoleplay().Armor -= Damage;
                #region Armor Broken?
                if (TargetSession.GetRoleplay().Armor <= 0 && TargetSession.GetRoleplay().Armored == true)
                {
                    TargetSession.GetRoleplay().Armored               = false;
                    TargetSession.GetRoleplay().ArmoredFigSet         = false;
                    TargetSession.GetHabbo().GetRoomUser().LastBubble = 3;
                    Misc.RoleplayManager.Shout(TargetSession, "*Body-armor shatters!*");
                    TargetSession.GetHabbo().GetRoomUser().LastBubble = 0;
                }
                #endregion
            }
            else
            {
                TargetSession.GetRoleplay().CurHealth -= Damage;
            }
            Session.GetRoleplay().Energy -= 4;
            Session.GetRoleplay().Bombs  -= 1;
            Session.GetRoleplay().SaveQuickStat("bombs", "" + Session.GetRoleplay().Bombs);
            Session.GetRoleplay().GunShots++;

            if (TargetSession.GetRoleplay().CurHealth <= 0)
            {
                #region Gang Rewards

                if (Session.GetRoleplay().GangId > 0 && HabboHotel.Roleplay.Gangs.GangManager.validGang(Session.GetRoleplay().GangId, Session.GetRoleplay().GangRank))
                {
                    Random _s = new Random();
                    using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor())
                    {
                        bool HasGang = false;
                        int  gangpts = _s.Next(TargetSession.GetRoleplay().Strength * 1 - (int)Math.Round((double)TargetSession.GetRoleplay().Strength / 3, 0), TargetSession.GetRoleplay().Strength * 2);
                        HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Kills++;
                        HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Points += gangpts;

                        if (TargetSession.GetRoleplay().GangId > 0 && HabboHotel.Roleplay.Gangs.GangManager.validGang(TargetSession.GetRoleplay().GangId, TargetSession.GetRoleplay().GangRank))
                        {
                            HasGang = true;
                        }

                        if (HasGang)
                        {
                            if (!Session.GetHabbo().HasFuse("fuse_owner"))
                            {
                                HabboHotel.Roleplay.Gangs.GangManager.GangData[TargetSession.GetRoleplay().GangId].Deaths++;
                            }
                            dbClient.RunFastQuery("UPDATE rp_gangs SET deaths = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[TargetSession.GetRoleplay().GangId].Deaths + " WHERE id = " + TargetSession.GetRoleplay().GangId + "");
                        }

                        dbClient.RunFastQuery("UPDATE rp_gangs SET kills = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Kills + ", points = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Points + " WHERE id = " + Session.GetRoleplay().GangId + "");
                    }
                }

                #endregion

                Session.GetHabbo().GetRoomUser().LastBubble = 3;

                /*if (Session.GetRoleplay().LastKilled != TargetSession.GetHabbo().UserName)
                 * {*/
                int score = new Random().Next(0, 20);
                Session.GetHabbo().AchievementPoints += score;
                Session.GetHabbo().UpdateActivityPointsBalance();
                Session.GetRoleplay().Kills++;
                Session.GetRoleplay().BombKills++;
                Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints));
                RoleplayManager.Shout(Session, "*Joga minha granada em " + TargetSession.GetHabbo().UserName + ", causando " + Damage + " dano e matando ! [-4 Energia, +" + score + " PTS]*");

                /*}
                 * if (Session.GetRoleplay().LastKilled == TargetSession.GetHabbo().UserName)
                 * {
                 *  Misc.Shout(Session, "*Bombs " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage and killing them ! [-2 Energy]*");
                 *  Session.SendWhisper("The last person you killed is this same person!");
                 * }*/
                Session.GetHabbo().GetRoomUser().LastBubble = 0;
                if (!Session.GetHabbo().HasFuse("fuse_owner"))
                {
                    TargetSession.GetRoleplay().Deaths++;
                }

                /*string rekt = "";
                 *
                 * rekt += "Hello, \n\nYou have been bombed to death by " + Session.GetHabbo().UserName + ", and are being transported to the hospital.";*/

                TargetSession.SendNotif("Você foi bombardeado até a morte por " + Session.GetHabbo().UserName + ", e estão sendo transportados para o hospital.");

                if (TargetSession.GetRoleplay().Working)
                {
                    TargetSession.GetRoleplay().StopWork();
                }

                #region Handle Death & Robbery
                TargetSession.GetRoleplay().DeadFigSet  = false;
                TargetSession.GetRoleplay().DeadSeconds = 60;
                TargetSession.GetRoleplay().DeadTimer   = 2;
                TargetSession.GetRoleplay().Dead        = true;
                if (TargetSession.GetRoleplay().usingCar == true)
                {
                    TargetSession.GetRoleplay().usingCar = false;
                    TargetSession.GetHabbo().GetRoomUser().FastWalking = false;
                }

                RoleplayManager.HandleDeath(TargetSession);

                int lol = new Random().Next(1, 25);
                if (TargetSession.GetHabbo().Credits > lol)
                {
                    RoleplayManager.GiveMoney(Session, +lol);
                    RoleplayManager.Shout(Session, "*Steals $" + lol + " from " + TargetSession.GetHabbo().UserName + "'s wallet*");
                    RoleplayManager.GiveMoney(TargetSession, -lol);
                    TargetSession.SendNotif(Session.GetHabbo().UserName + " stole $" + lol + " from you");
                }

                #endregion

                Misc.Bounties.CheckBounty(Session, TargetSession.GetHabbo().UserName);
                Plus.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_Fighter", 1);
                Plus.GetGame().GetAchievementManager().ProgressUserAchievement(TargetSession, "ACH_Death", 1);
            }
            else
            {
                Session.GetHabbo().GetRoomUser().LastBubble       = 3;
                TargetSession.GetHabbo().GetRoomUser().LastBubble = 3;

                RoleplayManager.Shout(Session, "*Joga uma granada em " + TargetSession.GetHabbo().UserName + ", causando " + Damage + " dano [-4 Energia]*", 3);
                if (TargetSession.GetRoleplay().Armor >= 1)
                {
                    Misc.RoleplayManager.commandShout(TargetSession, "*[" + TargetSession.GetRoleplay().Armor + "AP Left!]*");
                }
                else
                {
                    Misc.RoleplayManager.commandShout(TargetSession, "*[" + TargetSession.GetRoleplay().CurHealth + "/" + TargetSession.GetRoleplay().MaxHealth + "]*");
                }
                TargetSession.GetHabbo().GetRoomUser().ApplyEffect(25);

                Session.GetHabbo().GetRoomUser().LastBubble       = 0;
                TargetSession.GetHabbo().GetRoomUser().LastBubble = 0;
            }

            Session.GetRoleplay().CoolDown   = 3;
            Session.GetRoleplay().LastKilled = TargetSession.GetHabbo().UserName;
            TargetSession.GetRoleplay().UpdateStats++;
            Session.GetRoleplay().UpdateStats++;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Checks if timer completed
        /// </summary>
        public void timerDone(object info)
        {
            if (Session != null && Session.GetHabbo() != null)
            {
                try
                {
                    var user = Session.GetHabbo().GetRoomUser();
                    var room = Misc.RoleplayManager.GenerateRoom(slot.RoomId);

                    if (timeleft <= 0)
                    {
                        if (slot != null)
                        {
                            RemoveTiles1();
                            CalculatePrize();

                            #region Debug Check

                            /*
                             * timeleft = 8000; PlaceTiles2();
                             * timeleft = 6000; PlaceTiles2();
                             * timeleft = 4000; PlaceTiles2();
                             * timeleft = 2000; PlaceTiles2();
                             * timeleft = 0; PlaceTiles2();
                             */
                            #endregion

                            RoleplayManager.GiveMoney(Session, +Prize);
                            if (Prize != 0)
                            {
                                RoleplayManager.Shout(Session, "*Looks at the bottom of the slot machine and collects their reward of $" + Prize + "!*", 5);
                            }
                            if (Prize == 0)
                            {
                                RoleplayManager.Shout(Session, "*Feels ashamed to look at the bottom of the slot machine as they have won nothing*", 5);
                            }

                            #region Jackpot Check
                            if (Jackpot == true)
                            {
                                string Notice = Session.GetHabbo().UserName + " has just won the " + JackpotType + " Jackpot of: $" + Prize + "!";

                                lock (Plus.GetGame().GetClientManager().Clients.Values)
                                {
                                    foreach (GameClient mClient in Plus.GetGame().GetClientManager().Clients.Values)
                                    {
                                        if (mClient == null)
                                        {
                                            continue;
                                        }
                                        if (mClient.GetHabbo() == null)
                                        {
                                            continue;
                                        }
                                        if (mClient.GetHabbo().CurrentRoom == null)
                                        {
                                            continue;
                                        }
                                        if (mClient.GetConnection() == null)
                                        {
                                            continue;
                                        }
                                        mClient.GetHabbo().GetRoomUser().LastBubble = 33;
                                        mClient.SendWhisper("[Casino]: " + Notice);
                                        mClient.GetHabbo().GetRoomUser().LastBubble = 0;
                                    }
                                }
                            }
                            #endregion

                            Session.GetRoleplay().inSlotMachine      = false;
                            Session.GetHabbo().GetRoomUser().CanWalk = true;

                            slot.beingRolled = false;
                            timer.Dispose();
                        }
                    }
                    else
                    {
                        timeleft -= 500;
                        timer.Change(500, Timeout.Infinite);

                        PlaceTiles2();
                        SlotUpdater();
                        SlotCheck();
                        RemoveTiles1();
                        PlaceTiles1();
                    }
                }
                catch
                {
                    slot.beingRolled = false;
                    timer.Dispose();
                }
            }
            else
            {
                slot.beingRolled = false;
                timer.Dispose();
            }
        }
Exemplo n.º 9
0
        public static void ExecuteAttack(GameClient Session, GameClient TargetSession)
        {
            {
                int    Damage     = MeleeCombat.CalculateDamage(Session, TargetSession);
                string WeaponName = WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Name;
                if (TargetSession.GetRoleplay().Armor >= 1)
                {
                    TargetSession.GetRoleplay().Armor -= Damage;
                    #region Armor Broken?
                    if (TargetSession.GetRoleplay().Armor <= 0 && TargetSession.GetRoleplay().Armored == true)
                    {
                        TargetSession.GetRoleplay().Armored               = false;
                        TargetSession.GetRoleplay().ArmoredFigSet         = false;
                        TargetSession.GetHabbo().GetRoomUser().LastBubble = 3;
                        Misc.RoleplayManager.Shout(TargetSession, "*Body-armor shatters!*");
                        TargetSession.GetHabbo().GetRoomUser().LastBubble = 0;
                    }
                    #endregion
                }
                else
                {
                    TargetSession.GetRoleplay().CurHealth -= Damage;
                }
                Session.GetRoleplay().Energy -= WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy;

                if (TargetSession.GetRoleplay().CurHealth <= 0)
                {
                    #region Gang Rewards

                    if (Session.GetRoleplay().GangId > 0 && HabboHotel.Roleplay.Gangs.GangManager.validGang(Session.GetRoleplay().GangId, Session.GetRoleplay().GangRank))
                    {
                        Random _s = new Random();
                        using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor())
                        {
                            bool HasGang = false;
                            int  gangpts = _s.Next((TargetSession.GetRoleplay().Strength + TargetSession.GetRoleplay().savedSTR) * 1 - (int)Math.Round((double)(TargetSession.GetRoleplay().Strength + TargetSession.GetRoleplay().savedSTR) / 3, 0), (TargetSession.GetRoleplay().Strength + TargetSession.GetRoleplay().savedSTR) * 2);
                            HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Kills++;
                            HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Points += gangpts;

                            if (TargetSession.GetRoleplay().GangId > 0 && HabboHotel.Roleplay.Gangs.GangManager.validGang(TargetSession.GetRoleplay().GangId, TargetSession.GetRoleplay().GangRank))
                            {
                                HasGang = true;
                            }

                            if (HasGang)
                            {
                                if (!Session.GetHabbo().HasFuse("fuse_owner"))
                                {
                                    HabboHotel.Roleplay.Gangs.GangManager.GangData[TargetSession.GetRoleplay().GangId].Deaths++;
                                }
                                dbClient.RunFastQuery("UPDATE rp_gangs SET deaths = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[TargetSession.GetRoleplay().GangId].Deaths + " WHERE id = " + TargetSession.GetRoleplay().GangId + "");
                            }

                            dbClient.RunFastQuery("UPDATE rp_gangs SET kills = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Kills + ", points = " + HabboHotel.Roleplay.Gangs.GangManager.GangData[Session.GetRoleplay().GangId].Points + " WHERE id = " + Session.GetRoleplay().GangId + "");
                        }
                    }

                    #endregion

                    Session.GetHabbo().GetRoomUser().LastBubble = 3;

                    /*if (Session.GetRoleplay().LastKilled != TargetSession.GetHabbo().UserName)
                     * {*/
                    int score = new Random().Next(0, 20);
                    Session.GetHabbo().AchievementPoints += score;
                    Session.GetHabbo().UpdateActivityPointsBalance();
                    Session.GetRoleplay().Kills++;
                    Session.GetRoleplay().MeleeKills++;
                    Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints));
                    RoleplayManager.Shout(Session, "*Swings their " + WeaponName + " at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage and killing them! [-" + WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy + " Energy] [+" + score + " PTS]*");

                    /*}
                     * if (Session.GetRoleplay().LastKilled == TargetSession.GetHabbo().UserName)
                     * {
                     *  Misc.Shout(Session, "*Swings their " + WeaponName + " at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage and killing them! [-" + weaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy + " Energy]*");
                     *  Session.SendWhisper("The last person you killed is this same person!");
                     * }*/
                    Session.GetHabbo().GetRoomUser().LastBubble = 0;
                    if (!Session.GetHabbo().HasFuse("fuse_owner"))
                    {
                        TargetSession.GetRoleplay().Deaths++;
                    }
                    TargetSession.SendNotif("You were meleed to death by " + Session.GetHabbo().UserName + ", and are being transported to the hospital.");

                    if (TargetSession.GetRoleplay().Working)
                    {
                        TargetSession.GetRoleplay().StopWork();
                    }

                    if (!Session.GetRoleplay().Equiped.Contains("police"))
                    {
                        #region Handle Death & Robbery
                        TargetSession.GetRoleplay().DeadFigSet  = false;
                        TargetSession.GetRoleplay().DeadSeconds = 60;
                        TargetSession.GetRoleplay().DeadTimer   = 2;
                        TargetSession.GetRoleplay().Dead        = true;
                        if (TargetSession.GetRoleplay().usingCar == true)
                        {
                            TargetSession.GetRoleplay().usingCar = false;
                            TargetSession.GetHabbo().GetRoomUser().FastWalking = false;
                        }

                        RoleplayManager.HandleDeath(TargetSession);

                        int lol = new Random().Next(1, 25);
                        if (TargetSession.GetHabbo().Credits > lol && Session.GetRoleplay().LastKilled != TargetSession.GetHabbo().UserName)
                        {
                            RoleplayManager.GiveMoney(Session, +lol);
                            RoleplayManager.Shout(Session, "*Steals $" + lol + " from " + TargetSession.GetHabbo().UserName + "'s wallet*");
                            RoleplayManager.GiveMoney(TargetSession, -lol);
                            TargetSession.SendNotif(Session.GetHabbo().UserName + " stole $" + lol + " from you");
                        }

                        #endregion

                        Misc.Bounties.CheckBounty(Session, TargetSession.GetHabbo().UserName);
                        Plus.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_Fighter", 1);
                        Plus.GetGame().GetAchievementManager().ProgressUserAchievement(TargetSession, "ACH_Death", 1);
                    }
                    else
                    {
                        #region Handle Arrest
                        int Time = 5;
                        if (RoleplayManager.WantedListData.ContainsKey(TargetSession.GetHabbo().UserName.ToLower()))
                        {
                            string Data = RoleplayManager.WantedListData[TargetSession.GetHabbo().UserName.ToLower()];
                            foreach (KeyValuePair <string, string> User in RoleplayManager.WantedListData)
                            {
                                string Name = User.Key;

                                if (Name != TargetSession.GetHabbo().UserName.ToLower())
                                {
                                    continue;
                                }

                                string[] Split = User.Value.Split('|');

                                Time = Convert.ToInt32(Split[0]);
                            }
                        }
                        else
                        {
                            Time = 10;
                        }

                        TargetSession.SendNotif("You have been arrested by " + Session.GetHabbo().UserName + " for " + Time + " minute(s)");
                        TargetSession.GetRoleplay().JailFigSet    = false;
                        TargetSession.GetRoleplay().JailedSeconds = 60;
                        TargetSession.GetRoleplay().JailTimer     = Time;
                        TargetSession.GetRoleplay().Jailed        = true;
                        TargetSession.GetRoleplay().Arrested++;
                        TargetSession.GetRoleplay().UpdateStats++;

                        Session.GetRoleplay().Arrests++;
                        Session.GetRoleplay().UpdateStats++;
                        #endregion
                    }
                }
                else
                {
                    Session.GetHabbo().GetRoomUser().LastBubble       = 3;
                    TargetSession.GetHabbo().GetRoomUser().LastBubble = 3;

                    if (WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Speech == null || WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Speech == "")
                    {
                        RoleplayManager.Shout(Session, "*Swings their " + WeaponName + " at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage [-" + WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy + " Energy]*");
                    }
                    else
                    {
                        string finalspeech = WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Speech.Replace("%energy%", Convert.ToString(WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy));
                        Session.Shout(finalspeech);
                    }

                    if (TargetSession.GetRoleplay().Armor >= 1)
                    {
                        Misc.RoleplayManager.commandShout(TargetSession, "*[" + TargetSession.GetRoleplay().Armor + "AP Left!]*");
                    }
                    else
                    {
                        Misc.RoleplayManager.commandShout(TargetSession, "*[" + TargetSession.GetRoleplay().CurHealth + "/" + TargetSession.GetRoleplay().MaxHealth + "]*");
                    }
                    Session.GetHabbo().GetRoomUser().LastBubble       = 0;
                    TargetSession.GetHabbo().GetRoomUser().LastBubble = 0;
                }

                Session.GetRoleplay().CoolDown   = 3;
                Session.GetRoleplay().LastKilled = TargetSession.GetHabbo().UserName;
                TargetSession.GetRoleplay().UpdateStats++;
                Session.GetRoleplay().UpdateStats++;
            }
        }
Exemplo n.º 10
0
        public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            int SlotsCost = RoleplayManager.SlotsMachineCost;

            Slot theSlot = SlotsManager.getSlotbyItem(Item);

            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (Item.InteractingUser2 != User.UserId)
            {
                Item.InteractingUser2 = User.UserId;
            }

            if (User == null)
            {
                return;
            }

            if (Session.GetRoleplay().Working&& Session.GetHabbo().Rank <= 2)
            {
                Session.SendWhisperBubble("You cannot roll the slots while working!");
                return;
            }

            if (!Session.GetHabbo().CurrentRoom.RoomData.Description.Contains("CASINO") == true)
            {
                Session.SendWhisperBubble("You must be in the casino to roll slots! [Room ID: 200 & 201]", 1);
                return;
            }

            if (Session.GetRoleplay().inSlotMachine == true)
            {
                Session.SendWhisperBubble("[SLOT MACHINE] You have already pulled the handle!", 1);
                return;
            }

            if (Session.GetHabbo().Credits < SlotsCost)
            {
                Session.SendWhisperBubble("[SLOT MACHINE] You don't have enough money! This machine cost: $" + SlotsCost + " to use.", 1);
                return;
            }

            if (theSlot != null && SlotsManager.isUserNearMachine(theSlot, User))
            {
                if (theSlot.beingRolled == false)
                {
                    slotsTimer timer = new slotsTimer(Session, theSlot);
                    timer.startTimer();

                    Session.GetRoleplay().inSlotMachine      = true;
                    Session.GetHabbo().GetRoomUser().CanWalk = false;
                    RoleplayManager.GiveMoney(Session, -SlotsCost);
                }
                else
                {
                    Session.SendWhisperBubble("[SLOT MACHINE] This machine is already in use!", 1);
                }
            }
            else
            {
                Session.SendWhisperBubble("[SLOT MACHINE] You aren't close enough to pull the handle!", 1);
            }
        }
Exemplo n.º 11
0
        internal override void OnTimerTick()
        {
            if (base.GetBotData() != null)
            {
                #region Ammunation
                if (base.GetRoom().RoomData.Description.Contains("AMMUNATION"))
                {
                    if (base.GetRoomUser().RotBody != 2)
                    {
                        base.GetRoomUser().RotBody = 2;
                        base.GetRoomUser().RotHead = 2;
                    }
                }
                #endregion

                #region Hobo

                if (base.GetBotData().InteractingWith != null && base.GetBotData().Name.Contains("HOBO"))
                {
                    HabboHotel.PathFinding.Vector2D Pos1 = new HabboHotel.PathFinding.Vector2D(base.GetRoomUser().X, base.GetRoomUser().Y);

                    HabboHotel.PathFinding.Vector2D Pos2 = new HabboHotel.PathFinding.Vector2D(base.GetBotData().InteractingWith.X, base.GetBotData().InteractingWith.Y);

                    if (LActionTimer <= 5)
                    {
                        List <Point> list = base.GetRoom().GetGameMap().getWalkableList();
                        if (list.Count == 0)
                        {
                            return;
                        }
                        int randomNumber = new Random(DateTime.Now.Millisecond + this._virtualId ^ 2).Next(0, list.Count - 1);
                        base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y, true);

                        LActionTimer++;
                    }
                    else
                    {
                        if (!Robbed)
                        {
                            if (RoleplayManager.Distance(Pos1, Pos2) > 1)
                            {
                                base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);
                            }
                            else
                            {
                                base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);
                                Robbed = true;
                            }
                        }

                        if (!Robbed && !base.GetRoomUser().IsWalking)
                        {
                            base.GetBotData().TimesTried++;
                        }

                        if (base.GetBotData().TimesTried >= 20)
                        {
                            base.GetRoomUser().Chat(null, "Filho da puta!", true, 1);
                            System.Threading.Thread.Sleep(2000);
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }

                        if (Robbed && !Done)
                        {
                            Random _s   = new Random();
                            int    Amnt = _s.Next(5, 100);

                            if (base.GetBotData().InteractingWith.GetClient() == null)
                            {
                                Done = true;
                            }

                            if (base.GetBotData().InteractingWith.GetClient().GetHabbo() == null)
                            {
                                Done = true;
                            }

                            if (base.GetBotData().InteractingWith.GetClient().GetHabbo().Credits - Amnt <= 0)
                            {
                                base.GetRoomUser().Chat(null, "Droga, você está sem dinheiro, vou deixar você ir desta vez!", true, 1);
                                Done = true;
                                return;
                            }

                            base.GetRoomUser().Chat(null, "*Rouba $" + Amnt + " de " + base.GetBotData().InteractingWith.GetClient().GetHabbo().UserName + " e foge*", true, 1);
                            RoleplayManager.GiveMoney(base.GetBotData().InteractingWith.GetClient(), -Amnt);
                            Done = true;
                        }

                        if (Done)
                        {
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }
                    }
                }
                else
                {
                    if (base.GetBotData() != null)
                    {
                        if (base.GetBotData().Name.Contains("HOBO"))
                        {
                            if (base.GetBotData().InteractingWith == null && base.GetBotData().Name.Contains("HOBO") || base.GetBotData().InteractingWith.GetClient().GetHabbo().CurrentRoomId != base.GetBotData().RoomId)
                            {
                                RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                            }
                        }
                    }
                }

                #endregion

                #region Hobo 2

                if (base.GetBotData().InteractingWith != null && base.GetBotData().Name.Contains("HOBO 2"))
                {
                    HabboHotel.PathFinding.Vector2D Pos1 = new HabboHotel.PathFinding.Vector2D(base.GetRoomUser().X, base.GetRoomUser().Y);

                    HabboHotel.PathFinding.Vector2D Pos2 = new HabboHotel.PathFinding.Vector2D(base.GetBotData().InteractingWith.X, base.GetBotData().InteractingWith.Y);

                    if (LActionTimer <= 5)
                    {
                        List <Point> list = base.GetRoom().GetGameMap().getWalkableList();
                        if (list.Count == 0)
                        {
                            return;
                        }
                        int randomNumber = new Random(DateTime.Now.Millisecond + this._virtualId ^ 2).Next(0, list.Count - 1);
                        base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y, true);

                        LActionTimer++;
                    }
                    else
                    {
                        if (!Robbed)
                        {
                            if (RoleplayManager.Distance(Pos1, Pos2) > 1)
                            {
                                base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);
                            }
                            else
                            {
                                base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);
                                Robbed = true;
                            }
                        }

                        if (!Robbed && !base.GetRoomUser().IsWalking)
                        {
                            base.GetBotData().TimesTried++;
                        }

                        if (base.GetBotData().TimesTried >= 20)
                        {
                            base.GetRoomUser().Chat(null, "Filho da puta!", true, 1);
                            System.Threading.Thread.Sleep(2000);
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }

                        if (Robbed && !Done)
                        {
                            Random _s       = new Random();
                            int    AmntBank = _s.Next(5, 500);

                            if (base.GetBotData().InteractingWith.GetClient() == null)
                            {
                                Done = true;
                            }

                            if (base.GetBotData().InteractingWith.GetClient().GetHabbo() == null)
                            {
                                Done = true;
                            }

                            if (base.GetBotData().InteractingWith.GetClient().GetRoleplay().Bank - AmntBank <= 0)
                            {
                                base.GetRoomUser().Chat(null, "Droga, você está sem dinheiro, vou deixar você ir desta vez!", true, 1);
                                Done = true;
                                return;
                            }

                            base.GetRoomUser().Chat(null, "*Rouba $" + AmntBank + " de " + base.GetBotData().InteractingWith.GetClient().GetHabbo().UserName + " e foge*", true, 1);
                            base.GetBotData().InteractingWith.GetClient().GetRoleplay().SaveQuickStat("bank", "" + (base.GetBotData().InteractingWith.GetClient().GetRoleplay().Bank - AmntBank));
                            base.GetBotData().InteractingWith.GetClient().GetRoleplay().Bank -= AmntBank;
                            Done = true;
                        }

                        if (Done)
                        {
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }
                    }
                }
                else
                {
                    if (base.GetBotData() != null)
                    {
                        if (base.GetBotData().Name.Contains("HOBO 2"))
                        {
                            if (base.GetBotData().InteractingWith == null && base.GetBotData().Name.Contains("HOBO 2") || base.GetBotData().InteractingWith.GetClient().GetHabbo().CurrentRoomId != base.GetBotData().RoomId)
                            {
                                RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                            }
                        }
                    }
                }

                #endregion

                #region Free Roam Bot



                #endregion

                #region Store Bot

                if (robber != null)
                {
                    if (robber.GetHabbo() == null)
                    {
                        beingRobbed = false;
                        gatherNum   = 0;
                        gatherMsg   = 0;
                        amount      = 0;
                        return;
                    }

                    if (robber.GetHabbo().GetRoomUser() == null)
                    {
                        beingRobbed = false;
                        gatherNum   = 0;
                        gatherMsg   = 0;
                        amount      = 0;
                        return;
                    }


                    if (robber.GetRoleplay() == null)
                    {
                        beingRobbed = false;
                        gatherNum   = 0;
                        gatherMsg   = 0;
                        amount      = 0;
                        return;
                    }

                    if (robber.GetHabbo().GetRoomUser().Frozen || robber.GetRoleplay().Jailed || robber.GetRoleplay().Dead)
                    {
                        amount    = 0;
                        gatherMsg = 0;
                        gatherNum = 0;
                        robber.GetRoleplay().robbingStore = 0;
                        robber = null;
                        base.GetRoomUser().ApplyEffect(13);
                        disableRob  = true;
                        beingRobbed = false;
                        return;
                    }

                    if (gatherMsg <= 0)
                    {
                        base.GetRoomUser().Chat(null, "*Begins taking money from cash register*", true, 1);

                        if (gatherSpeed == 1)
                        {
                            gatherMsg = 10;
                        }

                        if (gatherSpeed == 2)
                        {
                            gatherMsg = 5;
                        }

                        if (gatherSpeed == 0)
                        {
                            gatherMsg = 20;
                        }


                        gatherNum++;
                    }
                    else
                    {
                        gatherMsg--;
                    }


                    if (gatherNum == 5)
                    {
                        int amount = new Random().Next(0, 100);

                        if (attack <= 6)
                        {
                            if (robber == null)
                            {
                                amount    = 0;
                                gatherMsg = 0;
                                gatherNum = 0;
                                robber.GetRoleplay().robbingStore = 0;
                                robber = null;
                                base.GetRoomUser().ApplyEffect(13);
                                disableRob  = true;
                                beingRobbed = false;
                                return;
                            }
                            else
                            {
                                attackCount++;

                                base.GetRoomUser().Chat(null, "*Takes out their pump shotgun*", true, 1);
                                base.GetRoomUser().ApplyEffect(164);

                                base.GetRoomUser().Chat(null, "*Shoots " + robber.GetHabbo().UserName + ", killing them!*", true, 1);

                                robber.GetRoleplay().DeadFigSet  = false;
                                robber.GetRoleplay().DeadSeconds = 60;
                                robber.GetRoleplay().DeadTimer   = 2;
                                robber.GetRoleplay().Dead        = true;
                                robber.GetRoleplay().SaveStatusComponents("dead");
                                RoleplayManager.HandleDeath(robber);
                                robber.SendNotif("You have been killed by a store clerk.");
                                return;
                            }
                        }

                        base.GetRoomUser().Chat(null, "*Drops money* Theres your money, now leave me alone!! [-$" + amount + "]", true, 1);
                        RoleplayManager.GiveMoney(robber, +amount);

                        amount    = 0;
                        gatherMsg = 0;
                        gatherNum = 0;
                        robber.GetRoleplay().robbingStore = 0;
                        robber = null;
                        base.GetRoomUser().ApplyEffect(13);
                        disableRob  = true;
                        beingRobbed = false;
                    }
                }
                else
                {
                    beingRobbed = false;
                    gatherNum   = 0;
                    gatherMsg   = 0;
                    amount      = 0;
                }

                lastRobbed++;
                if (lastRobbed > 5000 && disableRob)
                {
                    disableRob = false;
                    lastRobbed = 0;
                    base.GetRoomUser().ApplyEffect(0);
                }
            }

            #endregion

            #region Eatery Bot
            if (base.GetRoom() == null)
            {
                return;
            }
            if (base.GetRoom().RoomData.Description.Contains("EATERY"))
            {
                if (event_serving && event_serving_orderPlaced && !event_serving_delivered && !GetRoomUser().IsWalking)
                {
                    if (!resetted)
                    {
                        if (order_tick >= 15)
                        {
                            resetted = true;
                            GetRoomUser().Chat(null, "An error occured with pathfinding and I was unable to get to you, sorry about that!", true, 1);
                            serving.SendWhisper("Order has been aborted! Try sitting closer maybe?");
                            ResetVariablesFor("eatery");
                        }
                        else
                        {
                            order_tick++;
                        }
                    }
                }

                if (event_serving)
                {
                    if (event_serving_orderPlaced && !event_serving_delivered)
                    {
                        RoomUser User = serving.GetHabbo().GetRoomUser();


                        #region Delete Serve Session
                        if (serving == null)
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        if (serving.GetHabbo() == null)
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        if (serving.GetRoleplay() == null)
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        if (serving.GetHabbo().CurrentRoom == null)
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        if (serving.GetHabbo().CurrentRoom != GetRoom())
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        #endregion
                        if (!event_set_items)
                        {
                            event_serving_plate   = retrieveItem("diner_tray_0", true, User);
                            event_serving_oneway  = retrieveItem("one_way_door*1");
                            event_serving_oneway2 = retrieveItem("one_way_door*4");
                            event_set_items       = true;

                            if (event_serving_plate == null)
                            {
                                GetRoomUser().Chat(null, "Can you sit near an empty plate please?", true, 1);
                                ResetVariablesFor("eatery");
                                return;
                            }
                        }
                        else
                        {
                            /*
                             * Vector2D TargetVector = new Vector2D(event_serving_plate.GetX,event_serving_plate.GetY);
                             * Vector2D CurrentPos = new Vector2D(GetRoomUser().X,GetRoomUser().Y);
                             * if(Plus.Misc.Distance(TargetVector,CurrentPos) > 2)
                             * {
                             *
                             * }*/

                            if (Undefined_Timer_Tick_2 != 2)
                            {
                                passing_cur_gate       = false;
                                Undefined_Timer_Tick_2 = 2;
                            }

                            if (!event_serving_passedGate1)
                            {
                                HandleGatePass(event_serving_oneway);
                            }
                            else
                            {
                                GetRoomUser().AllowOverride = false;
                                if (!event_serving_atTable)
                                {
                                    if (GetRoomUser().X == RoleplayManager.GetPosSquare("behind", User).X&& GetRoomUser().Y == RoleplayManager.GetPosSquare("behind", User).Y)
                                    {
                                        GetRoomUser().RotBody = User.RotBody;
                                        GetRoomUser().RotHead = User.RotBody;
                                        event_serving_atTable = true;
                                    }
                                    else
                                    {
                                        GetRoomUser().MoveTo(RoleplayManager.GetPosSquare("behind", User));
                                    }
                                }
                                else
                                {
                                    if (!event_serving_delivered)
                                    {
                                        Food nFood = Substances.GetFoodByUName(event_serving_fooditem);

                                        RoleplayManager.ReplaceItem(serving, event_serving_plate, nFood.Item_Name);
                                        event_serving_delivered = true;
                                        GetRoomUser().Chat(null, "There you go, enjoy!", true, 1);

                                        ServerMessage action = new ServerMessage(LibraryParser.OutgoingRequest("RoomUserActionMessageComposer"));
                                        action.AppendInteger(GetRoomUser().VirtualId);
                                        action.AppendInteger(2);
                                        GetRoom().SendMessage(action);

                                        passing_cur_gate = false;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!event_serving_passedGate2)
                        {
                            HandleGatePass(event_serving_oneway2);
                        }
                        else
                        {
                            ResetVariablesFor("eatery");
                        }
                    }
                }
            }
            #endregion
        }
Exemplo n.º 12
0
        public void timerDone(object info)
        {
            try
            {
                timeLeft -= 60000;

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

                if (timeLeft == 4 * 60000)
                {
                    Session.Shout("*Hits the ATM with a crowbar, forming a small hole*", 3);
                }
                else if (timeLeft == 3 * 60000)
                {
                    Session.Shout("*Increases the hole size by prying it with crowbar*", 3);
                }
                else if (timeLeft == 2 * 60000)
                {
                    Session.Shout("*Stabs another hole into the ATM using the crowbar*", 3);
                }
                else if (timeLeft == 1 * 60000)
                {
                    Session.Shout("*Uses their strength of " + (Session.GetRoleplay().Strength + Session.GetRoleplay().savedSTR) + " to pry open the hole in the machine");
                }
                if (timeLeft > 0)
                {
                    int minutesRemaining = timeLeft / 60000;
                    Session.SendWhisper("Você tem " + minutesRemaining + " minutos para roubar o ATM!");
                    timer.Change(60000, Timeout.Infinite);
                    return;
                }

                #endregion

                #region Execute
                Random rnd   = new Random();
                int    money = 0;
                if (Session.GetRoleplay().Intelligence < 5)
                {
                    money = rnd.Next(0, 100);
                }
                else if (Session.GetRoleplay().Intelligence < 15)
                {
                    money = rnd.Next(100, 225);
                }
                else
                {
                    money = rnd.Next(200, 400);
                }


                RoleplayManager.Shout(Session, "*Obtem sucesso ao roubar o ATM e recebe [+$" + money + "]*", 6);
                RoleplayManager.GiveMoney(Session, +money);
                Session.GetRoleplay().ATMRobbery = false;

                stopTimer();
                #endregion
            }
            catch { stopTimer(); }
        }