Exemplo n.º 1
0
        public void startKilling(GameClient Session, RoomUser RUser)
        {
            if (!Session.GetRoleplay().Dead)
            {
                Random rand   = new Random();
                int    health = rand.Next(40, 70);
                if (Session.GetRoleplay().CurHealth - health > 0)
                {
                    Session.GetRoleplay().CurHealth -= health;
                    Session.GetRoleplay().UpdateStats++;
                }
                else
                {
                    GameClient TargetSession = Session;

                    Session.Shout("*Dies from lack of oxygen*");

                    Session.SendNotif("You died from lack of oxygen! Always wear a space suit when in space!");

                    TargetSession.GetRoleplay().DeadFigSet  = false;
                    TargetSession.GetRoleplay().DeadSeconds = 60;
                    TargetSession.GetRoleplay().DeadTimer   = 2;
                    TargetSession.GetRoleplay().Dead        = true;
                    TargetSession.GetRoleplay().SaveStatusComponents("dead");
                    RoleplayManager.HandleDeath(TargetSession);
                }
            }
        }
Exemplo n.º 2
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.º 3
0
        public void timerDone(object info)
        {
            try
            {
                timeLeft -= 60000;

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


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

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

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

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

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

                #endregion

                #region Execute

                int kills = 0;

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

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

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

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

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

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

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

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

                    Itemm.OnNPAUsing = false;
                }

                stopTimer();
                #endregion
            }
            catch { stopTimer(); }
        }
Exemplo n.º 4
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.º 5
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.º 6
0
        public void timerDone(object info)
        {
            try
            {
                timeLeft -= 60000;

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

                if (timeLeft > 0)
                {
                    if (Session.GetRoleplay().Hunger >= 100)
                    {
                        Random rand       = new Random();
                        int    Randhealth = rand.Next(5, 9);
                        int    Randenergy = rand.Next(5, 10);
                        if (Session.GetRoleplay().CurHealth - Randhealth > 0)
                        {
                            Session.GetRoleplay().CurHealth -= Randhealth;
                            if (Session.GetRoleplay().Energy - Randenergy >= 0)
                            {
                                Session.GetRoleplay().Energy -= Randenergy;
                            }
                            Session.SendWhisper("You have lost some energy and health from lack of food, get some quick before you die!");
                            Session.SendWhisper("Food can be found at the following room: 24");
                            Session.GetRoleplay().CurHealth -= 10;
                            Session.GetRoleplay().UpdateStats++;
                            RoleplayManager.MakeLay(Session.GetHabbo().GetRoomUser());
                        }
                        else
                        {
                            Session.GetRoleplay().UpdateStats++;
                            Session.SendNotif("You have died from starvation!");
                            if (Session.GetRoleplay().Working)
                            {
                                Session.GetRoleplay().StopWork();
                            }
                            Session.GetRoleplay().Hunger      = 0;
                            Session.GetRoleplay().DeadFigSet  = false;
                            Session.GetRoleplay().DeadSeconds = 60;
                            Session.GetRoleplay().DeadTimer   = 2;
                            Session.GetRoleplay().Dead        = true;
                            RoleplayManager.HandleDeath(Session);
                        }
                    }
                    timer.Change(60000, Timeout.Infinite);
                    return;
                }

                #endregion

                #region Execute

                if (Session.GetRoleplay().Hunger < 100)
                {
                    if (Session.GetRoleplay().Hunger + 2 <= 100)
                    {
                        Session.GetRoleplay().UpdateStats++;
                        Session.GetRoleplay().Hunger += 2;
                    }
                    else
                    {
                        Session.GetRoleplay().Hunger = 100;
                    }
                }
                Session.GetRoleplay().SaveQuickStat("hunger", "" + Session.GetRoleplay().Hunger);

                stopTimer();

                Session.GetRoleplay().HungerDecrement = false;
                #endregion
            }
            catch { stopTimer(); }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Actually does the attack
        /// </summary>
        /// <param name="User"></param>
        internal void ExecuteAttack(RoomUser User)
        {
            if (User == null)
            {
                return;
            }

            if (!User.IsBot)
            {
                if (_Victim == null)
                {
                    return;
                }

                if (_Victim.GetClient().GetRoleplay().Dead)
                {
                    _Victim = null;
                    return;
                }

                if (!InSameRoom(_Victim))
                {
                    _Victim = null;
                    return;
                }

                GameClient Session = User.GetClient();

                int Damage = DamageCalculator();

                // Kill this punk
                if (Session.GetRoleplay().CurHealth - Damage <= 0)
                {
                    AttackMisc(User, Damage, true);
                    GameClient TargetSession = Session;

                    TargetSession.GetRoleplay().DeadFigSet  = false;
                    TargetSession.GetRoleplay().DeadSeconds = 60;
                    TargetSession.GetRoleplay().DeadTimer   = 10;
                    TargetSession.GetRoleplay().Dead        = true;
                    TargetSession.GetRoleplay().SaveStatusComponents("dead");
                    RoleplayManager.HandleDeath(TargetSession);

                    // Tell this n***a he got f****d up by our bot
                    Session.SendNotif("You got killed by PET-" + GetBotData().Name);
                    //_Victim = null;
                    FollowPlayer(GetRoomUser().FollowingOwner);
                    GetRoomUser().ClearMovement();
                    return;
                }

                AttackMisc(User, Damage);
                RoleplayManager.Shout(Session, "*[" + Session.GetRoleplay().CurHealth + "/" + Session.GetRoleplay().MaxHealth + "]*");

                Session.GetRoleplay().CurHealth -= Damage;
                Session.GetRoleplay().UpdateStats++;
            }
            else
            {
                AttackBot(User);
            }
        }
Exemplo n.º 8
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.º 9
0
        public void OnUserWalk(GameClient Session, RoomItem Item, RoomUser User)
        {
            if (Session == null)
            {
                return;
            }

            if (Session.GetRoleplay().usingCar == true || Session.GetRoleplay().usingPlane == true)
            {
                Session.GetRoleplay().usingCar               = false;
                Session.GetRoleplay().usingPlane             = false;
                Session.GetHabbo().GetRoomUser().FastWalking = false;
            }

            User.ClearMovement();

            CryptoRandom rand   = new CryptoRandom();
            int          Chance = rand.Next(1, 101);
            int          Damage = rand.Next(50, 150);

            if (Chance >= 8 && Session.GetRoleplay().StaffDuty == false)
            {
                Item.ExtraData    = "2";
                Item.UpdateNeeded = true;
                Item.UpdateState();

                if (Session.GetRoleplay().Armor >= 1)
                {
                    Session.GetRoleplay().Armor         = 0;
                    Session.GetRoleplay().Armored       = false;
                    Session.GetRoleplay().ArmoredFigSet = false;
                    RoleplayManager.Shout(Session, "*Body-armor shatters*", 4);
                }

                if (Session.GetRoleplay().CurHealth - Damage <= 0)
                {
                    RoleplayManager.Shout(Session, "*Steps onto a mine, causing it to blow up kill them*", 32);
                    Session.GetRoleplay().DeadFigSet  = false;
                    Session.GetRoleplay().DeadSeconds = 60;
                    Session.GetRoleplay().DeadTimer   = 2;
                    Session.GetRoleplay().Dead        = true;
                    Session.GetRoleplay().SaveStatusComponents("dead");
                    Session.GetRoleplay().Deaths++;
                    RoleplayManager.HandleDeath(Session);
                }
                else
                {
                    Session.GetRoleplay().CurHealth = Session.GetRoleplay().CurHealth - Damage;
                    Session.GetRoleplay().SaveQuickStat("curhealth", "" + Session.GetRoleplay().CurHealth);
                    RoleplayManager.Shout(Session, "*Steps onto a mine, causing it to blow up and dealing " + Damage + " damage*", 22);
                }
            }
            else
            {
                RoleplayManager.Shout(Session, "*Steps onto a mine, but nothing happens*", 3);
                Item.ExtraData    = "1";
                Item.UpdateNeeded = true;
                Item.UpdateState();
            }
            Item.ExtraData    = "0";
            Item.UpdateNeeded = true;
            Item.UpdateState();
        }
Exemplo n.º 10
0
        public static void ExecuteAttack(GameClient Session, GameClient TargetSession)
        {
            if (CombatManager.CanAttack(Session, TargetSession))
            {
                bool Boxed  = false;
                int  Damage = CombatManager.DamageCalculator(Session);

                if (TargetSession.GetRoleplay().Armor >= 1 && TargetSession.GetRoleplay().inColourWars == false)
                {
                    TargetSession.GetRoleplay().Armor -= Damage;
                    #region Armor Broken?
                    if (TargetSession.GetRoleplay().Armor <= 0 && TargetSession.GetRoleplay().Armored == true)
                    {
                        TargetSession.GetRoleplay().Armored       = false;
                        TargetSession.GetRoleplay().ArmoredFigSet = false;
                        Session.GetRoleplay().ApplySpecialStatus("armored");
                        TargetSession.GetHabbo().GetRoomUser().LastBubble = 3;
                        RoleplayManager.Shout(TargetSession, "*Body-armor shatters*");
                        TargetSession.GetHabbo().GetRoomUser().LastBubble = 0;
                    }
                    #endregion
                }
                else
                {
                    TargetSession.GetRoleplay().CurHealth -= Damage;
                }

                if (!Session.GetRoleplay().inColourWars&& Session.GetRoleplay().InMafiaWars == false)
                {
                    Session.GetRoleplay().Energy -= 2;
                }

                Session.GetRoleplay().Punches++;

                if (TargetSession.GetRoleplay().CurHealth <= 0)
                {
                    if (TargetSession.GetRoleplay().IsBoxing)
                    {
                        if (TargetSession == Session)
                        {
                            Session.GetRoleplay().CurHealth = 1;
                            Session.SendWhisper("You cannot kill yourself!");
                            return;
                        }

                        if (Session.GetRoleplay().BoxingRoom != null && Session.GetRoleplay().BoxingRoom.SoloQueue != null)
                        {
                            RoleplayManager.Shout(Session, "*Swings my fist at " + TargetSession.GetHabbo().UserName + ", knocking them out winning the round!*");

                            Boxed = true;
                            Session.GetRoleplay().BoxingRoom.SoloQueue.EndMatch(Session.GetHabbo().UserName, true);
                        }
                    }
                    if (TargetSession.GetRoleplay().inColourWars)
                    {
                        if (TargetSession == Session)
                        {
                            Session.GetRoleplay().CurHealth = 1;
                            Session.SendWhisper("You cannot kill yourself!");
                            return;
                        }
                        Session.GetHabbo().GetRoomUser().LastBubble = 3;
                        Session.GetRoleplay().GiveColorWarPoints(ColourManager.KillPoints);

                        Session.Shout("*Clecnhes my fist, swinging it hard and fast at " + TargetSession.GetHabbo().UserName + ", Landing a blow on their face causing " + Damage + " damage, sending them back to the graveyard! [+ " + ColourManager.KillPoints + " Color Wars Pts]*");

                        TargetSession.GetRoleplay().Transport(ColourManager.GraveYardID, 2);
                        TargetSession.GetRoleplay().CurHealth = 100;
                        TargetSession.GetRoleplay().Energy    = 100;
                        TargetSession.GetRoleplay().Hunger    = 0;

                        new DeadTimer(TargetSession);

                        // Add color points
                    }

                    if (TargetSession.GetRoleplay().InMafiaWars)
                    {
                        if (TargetSession == Session)
                        {
                            Session.GetRoleplay().CurHealth = 1;
                            Session.SendWhisper("You cannot kill yourself!");
                            return;
                        }
                        Session.GetHabbo().GetRoomUser().LastBubble = 3;

                        Session.GetRoleplay().GiveMafiaWarPoints(MafiaWarManager.KillPoints);
                        RoleplayManager.Shout(Session, "*Swings my fist at " + TargetSession.GetHabbo().UserName + ", Landing a blow on their face causing " + Damage + " damage, sending them back to the start! [+ " + MafiaWarManager.KillPoints + " Mafia Wars Pts]*");


                        TargetSession.GetRoleplay().Transport(Plus.GetGame().MafiaWars.GraveYardID, 2);
                        TargetSession.GetRoleplay().CurHealth = 100;
                        TargetSession.GetRoleplay().Energy    = 100;
                        TargetSession.GetRoleplay().Hunger    = 0;
                    }

                    if (TargetSession.GetRoleplay().Brawl == true)
                    {
                        Session.GetRoleplay().GiveColorWarPoints(1);
                        Session.GetHabbo().GetRoomUser().LastBubble = 3;

                        RoleplayManager.Shout(Session, "*Swings at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage, and kicking them out of brawl! [+5BP]*");

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

                        Session.GetRoleplay().Brawl_Pts += 5;
                        Session.GetRoleplay().SaveQuickStat("brawl_pts", Session.GetRoleplay().Brawl_Pts + "");
                        TargetSession.GetRoleplay().Brawl   = false;
                        TargetSession.GetRoleplay().inBrawl = false;
                        if (TargetSession.GetRoleplay().Working)
                        {
                            TargetSession.GetRoleplay().StopWork();
                        }

                        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;
                        }


                        RoomUser User1 = null;
                        User1 = TargetSession.GetHabbo().GetRoomUser();

                        RoleplayManager.HandleDeath(TargetSession);
                    }
                    else if (TargetSession.GetRoleplay().Brawl == false && TargetSession.GetRoleplay().inColourWars == false && !TargetSession.GetRoleplay().InMafiaWars&& Boxed == false)
                    {
                        #region Gang Rewards

                        if (Session.GetRoleplay().GangId > 0 && 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 * 2);
                                GangManager.GangData[Session.GetRoleplay().GangId].Kills++;
                                GangManager.GangData[Session.GetRoleplay().GangId].Points += gangpts;

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

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

                                dbClient.RunFastQuery("UPDATE rp_gangs SET kills = " + GangManager.GangData[Session.GetRoleplay().GangId].Kills + ", points = " + 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().PunchKills++;
                        Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints));
                        Session.Shout("*Lands a final blow to their face " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage sending them to hospital! [-2 Energy, +" + score + " PTS]*");

                        /*}
                         * if (Session.GetRoleplay().LastKilled == TargetSession.GetHabbo().UserName)
                         * {
                         *  Shout(Session, "*Swings at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage and knocking them out! [-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++;
                        }
                        TargetSession.SendNotif("You were knocked out by " + Session.GetHabbo().UserName + ", and being transported to the hospital!");

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

                        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;
                        }


                        RoomUser User = null;
                        User = TargetSession.GetHabbo().GetRoomUser();

                        RoleplayManager.HandleDeath(TargetSession);

                        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;

                    Session.Shout("*Swings at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage [-2 Energy]*");
                    if (TargetSession.GetRoleplay().Armor >= 1 && TargetSession.GetRoleplay().inColourWars == false)
                    {
                        RoleplayManager.commandShout(TargetSession, "*[" + TargetSession.GetRoleplay().Armor + "AP Left!]*", 3);
                    }
                    else
                    {
                        RoleplayManager.commandShout(TargetSession, "*[" + TargetSession.GetRoleplay().CurHealth + "/" + TargetSession.GetRoleplay().MaxHealth + "]*", 3);
                    }

                    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++;
            }
            else
            {
                return;
            }
        }