internal HabboHotel.Items.RoomItem retrieveItem(string item_name, bool nearUser = false, RoomUser User = null) { HabboHotel.Items.RoomItem Item = null; if (!nearUser) { foreach (HabboHotel.Items.RoomItem item in GetRoom().GetRoomItemHandler().FloorItems.Values) { if (item.GetBaseItem().Name.ToLower() == item_name.ToLower()) { // Console.WriteLine(item.GetBaseItem().Name); Item = item; } } } else { foreach (HabboHotel.Items.RoomItem item in GetRoom().GetRoomItemHandler().FloorItems.Values) { Vector2D Pos1 = new Vector2D(item.X, item.Y); Vector2D Pos2 = new Vector2D(User.X, User.Y); if (RoleplayManager.Distance(Pos1, Pos2) <= 1 && item.GetBaseItem().Name.ToLower() == item_name.ToLower()) { Item = item; } } } return(Item); }
/// <summary> /// Checks if user is near the slot machine /// </summary> public static bool isUserNearMachine(Slot slot, RoomUser user) { if (slot != null && user != null) { try { if (RoleplayManager.Distance(new Vector2D(slot.X, slot.Y), new Vector2D(user.X, user.Y)) <= 1 && user.RoomId == slot.RoomId) { return(true); } return(false); } catch { return(false); } } return(false); }
public static bool isUserNearFarmingSpot(FarmingSpot farmingspot, RoomUser user) { if (farmingspot != null && user != null) { try { if (RoleplayManager.Distance(new Vector2D(farmingspot.x, farmingspot.y), new Vector2D(user.X, user.Y)) <= 1 && user.RoomId == farmingspot.roomid) { return(true); } return(false); } catch { return(false); } } return(false); }
public static bool isUserNearTree(Tree tree, RoomUser user) { if (tree != null && user != null) { try { if (RoleplayManager.Distance(new Vector2D(tree.x, tree.y), new Vector2D(user.X, user.Y)) <= 2 && user.RoomId == tree.roomid) { return(true); } return(false); } catch { return(false); } } return(false); }
public static bool isUserNearRock(Rock rock, RoomUser user) { if (rock != null && user != null) { try { if (RoleplayManager.Distance(new Vector2D(rock.x, rock.y), new Vector2D(user.X, user.Y)) <= 1 && user.RoomId == rock.roomid) { return(true); } return(false); } catch { return(false); } } return(false); }
public void handleEnergyDrinkPurchase(GameClient Session, RoomItem Item) //3514 { // 25 health if (Session.GetHabbo().Credits < 4) { Session.SendWhisper("This drink costs $4, you do not have enough money"); return; } if (Session.GetHabbo().CurrentRoomId != 460) { return; } if (RoleplayManager.Distance(new Vector2D(Item.X, Item.Y), new Vector2D(Session.GetHabbo().GetRoomUser().X, Session.GetHabbo().GetRoomUser().Y)) > 2) { Session.SendWhisper("You must be closer to the object you wish to purchase"); return; } Session.GetHabbo().Credits -= 4; Session.GetHabbo().UpdateCreditsBalance(); Session.Shout("*Purchases Energy Drink for $4 [-$4]*"); Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.BaseItem, "0", 0u, true, false, 0, 0, string.Empty); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); }
public void handleBroteinPurchase(GameClient Session, RoomItem Item) //4495 { //+2 STR Health if (Session.GetHabbo().Credits < 16) { Session.SendWhisper("Brotein costs $16, you do not have enough money"); return; } if (Session.GetHabbo().CurrentRoomId != 460) { return; } if (RoleplayManager.Distance(new Vector2D(Item.X, Item.Y), new Vector2D(Session.GetHabbo().GetRoomUser().X, Session.GetHabbo().GetRoomUser().Y)) > 2) { Session.SendWhisper("You must be closer to the object you wish to purchase"); return; } Session.GetHabbo().Credits -= 16; Session.GetHabbo().UpdateCreditsBalance(); Session.Shout("*Purchases Brotein for $16 [-$16]*"); Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.BaseItem, "0", 0u, true, false, 0, 0, string.Empty); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); }
public static bool CanExecuteAttack(GameClient Session, GameClient TargetSession) { if (TargetSession == null || TargetSession.GetHabbo().CurrentRoomId != Session.GetHabbo().CurrentRoomId) { Session.SendWhisper("Este usuário não foi encontrado nesta sala!"); return(false); } Room Room = Plus.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser RoomUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().UserName); RoomUser Target = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetSession.GetHabbo().UserName); Vector2D Pos1 = new Vector2D(RoomUser.X, RoomUser.Y); Vector2D Pos2 = new Vector2D(Target.X, Target.Y); #region Distance if (Room.RoomData.Description.Contains("NOSHOOT") && RoleplayManager.PurgeTime == false) { Session.SendWhisper("Sorry, but this is a non bombing zone!"); return(false); } if (Room.RoomData.Description.Contains("SAFEZONE")) { Session.SendWhisper("Sorry, but this is a safezone!"); return(false); } int MyJobId = Session.GetRoleplay().JobId; int MyJobRank = Session.GetRoleplay().JobRank; if (Session.GetRoleplay().Bombs <= 0 && (!JobManager.JobRankData[MyJobId, MyJobRank].hasRights("army") && !Session.GetRoleplay().Working)) { Session.SendWhisper("You do not have any bombs!"); return(false); } #endregion #region Status Conditions if (Session.GetRoleplay().Energy <= 0) { Session.SendWhisper("You ran out of energy "); return(false); } if (Session.GetRoleplay().inBrawl == true) { Session.SendWhisper("Cannot do this in a Brawl"); return(false); } if (Session.GetRoleplay().Dead) { Session.SendWhisper("Cannot complete this action while you are dead!"); return(false); } if (Session.GetRoleplay().Jailed) { Session.SendWhisper("Cannot complete this action while you are jailed!"); return(false); } if (TargetSession.GetRoleplay().Dead) { Session.SendWhisper("Cannot complete this action as this user is dead!"); return(false); } if (TargetSession.GetRoleplay().Jailed) { Session.SendWhisper("Cannot complete this action as this user is jailed!"); return(false); } if (RoomUser.Stunned) { Session.SendWhisper("Cannot complete this action while you are stunned!"); return(false); } if (Target.IsAsleep) { Session.SendWhisper("Cannot complete this action as this user is AFK!"); return(false); } if (Session.GetRoleplay().GunShots >= 7) { Session.GetHabbo().GetRoomUser().LastBubble = 3; Session.Shout("*Stops to stretch their arm, cramped from throwing so many bombs*"); Session.GetHabbo().GetRoomUser().LastBubble = 0; ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer")); message.AppendInteger(5); Session.GetHabbo().GetRoomUser().IsGunReloaded = true; Session.GetHabbo().GetRoomUser().ReloadExpiryTime = Plus.GetUnixTimeStamp() + 5; Session.GetHabbo().GetRoomUser().GetClient().SendMessage(message); Session.GetRoleplay().GunShots = 0; return(false); } if (TargetSession.GetRoleplay().usingPlane&& !WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Name.ToLower().Contains("rpg")) { RoleplayManager.Shout(Session, "*Attempts to shoot " + TargetSession.GetHabbo().UserName + ", but misses as they are in a plane*"); Session.GetRoleplay().GunShots++; return(false); } if (RoleplayManager.Distance(Pos1, Pos2) > 6) { Session.GetHabbo().GetRoomUser().LastBubble = 3; RoleplayManager.Shout(Session, "*Throws my Grenade at " + TargetSession.GetHabbo().UserName + ", but misses*", 3); Session.GetHabbo().GetRoomUser().LastBubble = 0; Session.GetRoleplay().GunShots++; return(false); } if (Session.GetRoleplay().IsNoob) { if (!Session.GetRoleplay().NoobWarned) { Session.SendNotif("If you choose to do this again your temporary God Protection will be disabled!"); Session.GetRoleplay().NoobWarned = true; return(false); } else { using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.RunFastQuery("UPDATE rp_stats SET is_noob = 0 WHERE id = '" + Session.GetHabbo().Id + "'"); } Session.SendWhisper("Your god protection has been disabled!"); Session.GetRoleplay().IsNoob = false; Session.GetRoleplay().SaveQuickStat("is_noob", "0"); } } if (TargetSession.GetRoleplay().IsNoob) { Session.SendWhisper("Cannot complete this action as this user is under God Protection!"); return(false); } #endregion return(true); }
/// <summary> /// Retrieves The list of users who can be frozen near you /// </summary> /// <param name="surrounding">If it is true, it checks for people surrounding you, false for people within your line</param> /// <returns></returns> internal List <RoomUser> RetrieveFontalUsers(bool surrounding = false) { List <RoomUser> Frontal = new List <RoomUser>(); List <Vector2D> SprayPoints = new List <Vector2D>(); RoomUser Me = Wielder.GetHabbo().GetRoomUser(); lock (Wielder.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUsers()) { Vector2D fPoint = new Vector2D(Me.SquareInFront.X, Me.SquareInFront.Y); lock (SprayPoints) { for (int i = 0; i < WeaponManager.WeaponsData[Wielder.GetRoleplay().Equiped].Range; i++) { SprayPoints.Add(new Vector2D(fPoint.X, fPoint.Y + i)); } for (int i = 0; i > -WeaponManager.WeaponsData[Wielder.GetRoleplay().Equiped].Range; i--) { SprayPoints.Add(new Vector2D(fPoint.X + i, fPoint.Y)); } foreach (RoomUser User in Wielder.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUsers()) { #region Checks if (User == null) { continue; } if (User.GetClient() == null) { continue; } if (User.GetClient().GetHabbo() == null) { continue; } if (User.GetClient().GetHabbo().GetRoomUser() == null) { continue; } if (User.GetClient().GetRoleplay() == null) { continue; } if (User.GetClient().GetRoleplay().StaffDuty) { continue; } if (User == Me) { continue; } if (User.GetClient().GetRoleplay().RayFrozen) { continue; } #endregion if (!surrounding) { if (OnSprayPoint(SprayPoints, User)) { Frontal.Add(User); } } else { if (RoleplayManager.Distance(new Vector2D(Me.X, Me.Y), new Vector2D(User.X, User.Y)) > WeaponManager.WeaponsData[Wielder.GetRoleplay().Equiped].Spread) { continue; } Frontal.Add(User); } } } } return(Frontal); }
public static bool CanExecuteAttack(GameClient Session, GameClient TargetSession) { if (Session == null) { return(false); } if (Session.GetHabbo() == null) { return(false); } if (Session.GetHabbo().CurrentRoom == null) { return(false); } if (Session.GetHabbo().GetRoomUser() == null) { return(false); } if (Session.GetRoleplay().Equiped == null) { Session.SendWhisper("You have not equiped a weapon!"); return(false); } if (TargetSession == null) { Session.SendWhisper("This user was not found in this room!"); return(false); } if (TargetSession.GetHabbo() == null) { Session.SendWhisper("This user was not found in this room!"); return(false); } if (TargetSession.GetHabbo().GetRoomUser() == null) { Session.SendWhisper("This user was not found in this room!"); return(false); } if (TargetSession.GetHabbo().CurrentRoom == null) { Session.SendWhisper("This user was not found in this room!"); return(false); } if (TargetSession.GetRoleplay() == null) { return(false); } if (TargetSession.GetHabbo().CurrentRoom != Session.GetHabbo().CurrentRoom) { Session.SendWhisper("This user was not found in this room!"); return(false); } Room Room = Session.GetHabbo().CurrentRoom; RoomUser RoomUser = Session.GetHabbo().GetRoomUser(); RoomUser Target = TargetSession.GetHabbo().GetRoomUser(); Vector2D Pos1 = new Vector2D(RoomUser.X, RoomUser.Y); Vector2D Pos2 = new Vector2D(Target.X, Target.Y); #region Distance if (Room.RoomData.Description.Contains("NOMELEE") && RoleplayManager.PurgeTime == false) { Session.SendWhisper("Sorry, but this is a no melee zone!"); return(false); } if (Room.RoomData.Description.Contains("SAFEZONE")) { Session.SendWhisper("Sorry, but this is a safe zone!"); return(false); } if (Session.GetRoleplay().Equiped == null) { Session.SendWhisper("You do not have a weapon equipped!"); return(false); } if (TargetSession.GetRoleplay().usingPlane) { RoleplayManager.Shout(Session, "*Attempts to melee " + TargetSession.GetHabbo().UserName + ", but misses as they are in a plane*"); Session.GetRoleplay().CoolDown = 3; return(false); } if (Session.GetRoleplay().Intelligence < WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Min_Intel) { Session.SendWhisper("You must have an intelligence level of at least " + WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Min_Intel + " to use this weapon!"); return(false); } if ((Session.GetRoleplay().Strength + Session.GetRoleplay().savedSTR) < WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Str) { Session.SendWhisper("You must have a strength level of at least " + WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Str + " to use this weapon!"); return(false); } if (Session.GetRoleplay().CoolDown > 0) { Session.SendWhisper("You are cooling down! [" + Session.GetRoleplay().CoolDown + "/3]"); return(false); } if (RoleplayManager.Distance(Pos1, Pos2) > WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Range) { Session.GetHabbo().GetRoomUser().LastBubble = 3; Session.Shout("*Swings their " + WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Name + " at " + TargetSession.GetHabbo().UserName + ", but misses*"); Session.GetHabbo().GetRoomUser().LastBubble = 0; Session.GetRoleplay().CoolDown = 3; return(false); } #endregion #region Status Conditions if (Session.GetRoleplay().Energy < WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy) { Session.SendWhisper("You do not have enough energy to do this!"); return(false); } if (Session.GetRoleplay().inBrawl == true) { Session.SendWhisper("Unequip your melee weapon for the brawl!"); return(false); } if (Session.GetRoleplay().Dead) { Session.SendWhisper("Cannot complete this action while you are dead!"); return(false); } if (Session.GetRoleplay().Jailed) { Session.SendWhisper("Cannot complete this action while you are jailed!"); return(false); } if (TargetSession.GetRoleplay().Dead) { Session.SendWhisper("Cannot complete this action as this user is dead!"); return(false); } if (TargetSession.GetRoleplay().Jailed) { Session.SendWhisper("Cannot complete this action as this user is jailed!"); return(false); } if (RoomUser.Stunned) { Session.SendWhisper("Cannot complete this action while you are stunned!"); return(false); } if (Target.IsAsleep) { Session.SendWhisper("Cannot complete this action as this user is AFK!"); return(false); } if (RoomUser.IsAsleep) { Session.SendWhisper("Cannot complete this action as this user is AFK!"); return(false); } if (Session.GetRoleplay().IsNoob) { if (!Session.GetRoleplay().NoobWarned) { Session.SendNotif("If you choose to do this again your temporary God Protection will be disabled!"); Session.GetRoleplay().NoobWarned = true; return(false); } else { using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.RunFastQuery("UPDATE rp_stats SET is_noob = 0 WHERE id = '" + Session.GetHabbo().Id + "'"); } Session.SendWhisper("Your god protection has been disabled!"); Session.GetRoleplay().IsNoob = false; Session.GetRoleplay().SaveQuickStat("is_noob", "0"); } } if (TargetSession.GetRoleplay().IsNoob) { Session.SendWhisper("Cannot complete this action as this user is under God Protection!"); return(false); } #endregion return(true); }
/// <summary> /// Attacks the victim /// </summary> internal void TryAttack() { Vector2D VictimPOS = new Vector2D(_Victim.X, _Victim.Y); Vector2D MyPOS = new Vector2D(GetRoomUser().X, GetRoomUser().Y); #region Conditions if (_Victim == null) { _Victim = null; FollowPlayer(GetRoomUser().FollowingOwner); return; } if (_Victim.IsAsleep) { _Victim = null; Shout("Dammnit, hes asleep.."); FollowPlayer(GetRoomUser().FollowingOwner); return; } if (_Victim.GetClient() != null) { if (_Victim.GetClient().GetRoleplay().Dead) { _Victim = null; FollowPlayer(GetRoomUser().FollowingOwner); return; } } if (!InSameRoom(_Victim)) { _Victim = null; FollowPlayer(GetRoomUser().FollowingOwner); return; } #endregion #region Following Cooldown if (CurCoolDown > 0) { if (CurWalkInterval > 0) { RunRandomly(); CurWalkInterval--; } else { CurWalkInterval = WalkInterval; } CurCoolDown--; return; } else { if (CurFollowInterval > FollowInterval) { CurFollowInterval--; return; } else { CurFollowInterval++; FollowPlayer(_Victim); } } #endregion #region Lands Attack if (RoleplayManager.BotWithinAttackDistance(GetRoomUser(), _Victim)) { uint victimroom = 0; uint petroom = 0; if (_Victim.GetClient() != null) { if (_Victim.GetClient().GetHabbo() != null) { victimroom = _Victim.GetClient().GetHabbo().CurrentRoomId; petroom = GetRoom().RoomId; if (petroom != 0) { if (victimroom != petroom) { _Victim = null; FollowPlayer(GetRoomUser().FollowingOwner); return; } } } } CurCoolDown = CoolDown; ExecuteAttack(_Victim); RunRandomly(); return; } #endregion #region Misses Attack if (RoleplayManager.Distance(MyPOS, VictimPOS) >= 1 && RoleplayManager.Distance(MyPOS, VictimPOS) <= 2 && _Victim.IsWalking) { // Miss FollowInterval -= Difficulty_IncrementNum; AttackMisc(_Victim, 0, false, true); } #endregion #region Pursues Attack if (RoleplayManager.Distance(MyPOS, VictimPOS) >= 5) { if (CurFollowInterval > FollowInterval) { CurFollowInterval--; return; } else { CurFollowInterval++; FollowPlayer(_Victim); } return; // Don't even bother } #endregion }
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 }
public static bool CanAttack(GameClient User1, GameClient User2, bool Weapon = false) { #region Fundamental Null Checks if (User2 == null) { User1.SendWhisper("This user was not found in this room!"); return(false); } if (User2.GetHabbo() == null) { User1.SendWhisper("This user was not found in this room!"); return(false); } if (User2.GetHabbo().CurrentRoom == null) { User1.SendWhisper("This user was not found in this room!"); return(false); } if (User2.GetHabbo().CurrentRoom != User1.GetHabbo().CurrentRoom) { User1.SendWhisper("This user was not found in this room!"); return(false); } #endregion Room Room = User1.GetHabbo().CurrentRoom; RoomUser RoomUser1 = User1.GetHabbo().GetRoomUser(); RoomUser RoomUser2 = User2.GetHabbo().GetRoomUser(); Vector2D Pos1 = new Vector2D(RoomUser1.X, RoomUser1.Y); Vector2D Pos2 = new Vector2D(RoomUser2.X, RoomUser2.Y); #region Cooldown Checks if (!Weapon) { if (User1.GetRoleplay().CoolDown > 0) { User1.SendWhisper("You are cooling down! [" + User1.GetRoleplay().CoolDown + "/3]"); return(false); } } #endregion #region Game Checks if (User2.GetRoleplay().inColourWars&& !User1.GetRoleplay().inColourWars) { Room mRoom = RoleplayManager.GenerateRoom(ColourManager.MainLobby); User1.GetRoleplay().RequestedTaxi_Arrived = false; User1.GetRoleplay().RecentlyCalledTaxi = true; User1.GetRoleplay().RecentlyCalledTaxi_Timeout = 10; User1.GetRoleplay().RequestedTaxiDestination = mRoom; User1.GetRoleplay().RequestedTaxi = true; User1.GetRoleplay().taxiTimer = new taxiTimer(User1); User1.SendNotif("You cannot attack this person as they are in color wars! Please taxi out of the color wars room."); return(false); } if (User1.GetRoleplay().inColourWars&& !User2.GetRoleplay().inColourWars) { User1.SendNotif("You cannot attack this person as they are not in color wars!"); return(false); } #endregion #region Special Checks if (User1.GetRoleplay().RayFrozen) { User1.SendWhisper("You cannot do this as you are frozen!"); return(false); } #endregion if (!Weapon) { #region Fundamental Checks if (Room.RoomData.Description.Contains("NOHIT") && RoleplayManager.PurgeTime == false) { User1.SendWhisper("Sorry, but this is a no hitting zone!"); User1.GetRoleplay().CoolDown = 3; return(false); } #endregion #region Secondary Checks if (Room.RoomData.Description.Contains("SAFEZONE")) { User1.SendWhisper("Sorry, but this is a safezone!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (Room.RoomData.Description.Contains("BRAWL") && !User1.GetRoleplay().inBrawl&& !User1.GetRoleplay().Brawl) { User1.SendWhisper("You are not in a brawl, so you cannot do this!"); return(false); } if (User2.GetRoleplay().usingPlane) { User1.SendWhisper("You cannot hit this user as they are in the sky!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (User1.GetRoleplay().Energy <= 0 && !User1.GetRoleplay().inColourWars) { User1.SendWhisper("You do not have enough energy to do this!"); return(false); } if (User1.GetRoleplay().Dead) { User1.SendWhisper("Cannot complete this action while you are dead!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (User1.GetRoleplay().Jailed) { User1.SendWhisper("Cannot complete this action while you are jailed!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (User2.GetRoleplay().Dead) { User1.SendWhisper("Cannot complete this action as this user is dead!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (User2.GetRoleplay().Jailed) { User1.SendWhisper("Cannot complete this action as this user is jailed!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (RoomUser1.Stunned) { User1.SendWhisper("Cannot complete this action while you are stunned!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (RoomUser2.IsAsleep) { User1.SendWhisper("Cannot complete this action as this user is AFK!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (User1.GetRoleplay().IsNoob&& !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("COLOR") && !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("MAFIA")) { if (!User1.GetRoleplay().NoobWarned) { User1.SendNotif("If you choose to do this again your temporary God Protection will be disabled!"); User1.GetRoleplay().NoobWarned = true; return(false); } else { using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.RunFastQuery("UPDATE rp_stats SET is_noob = 0 WHERE id = '" + User1.GetHabbo().Id + "'"); } User1.SendWhisper("Your god protection has been disabled!"); User1.GetRoleplay().IsNoob = false; User1.GetRoleplay().SaveQuickStat("is_noob", "0"); } } if (User2.GetRoleplay().IsNoob&& !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("COLOR") && !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("MAFIA") && !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("NPA")) { User1.SendWhisper("Cannot complete this action as this user is under God Protection!"); return(false); } #endregion #region Final Checks if (RoleplayManager.WithinAttackDistance(RoomUser1, RoomUser2)) { } else if (RoleplayManager.Distance(Pos1, Pos2) > 2 && RoleplayManager.Distance(Pos1, Pos2) <= 4) { RoomUser1.LastBubble = 3; User1.Shout("*Swings at " + User2.GetHabbo().UserName + ", but misses*"); User1.GetRoleplay().CoolDown = 3; RoomUser1.LastBubble = 0; return(false); } else if (RoleplayManager.Distance(Pos1, Pos2) >= 5) { User1.SendWhisper("You are too far away!"); User1.GetRoleplay().CoolDown = 3; return(false); } #endregion } else if (Weapon) { #region Fundamental Checks if (User1.GetRoleplay().Energy < WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Need_Energy) { User1.SendWhisper("You do not have enough energy to do this!"); return(false); } if (User1.GetRoleplay().inBrawl == true) { User1.SendWhisper("Cannot do this in a Brawl"); return(false); } if (User1.GetRoleplay().Dead) { User1.SendWhisper("Cannot complete this action while you are dead!"); return(false); } if (User1.GetRoleplay().Jailed) { User1.SendWhisper("Cannot complete this action while you are jailed!"); return(false); } if (User2.GetRoleplay().Dead) { User1.SendWhisper("Cannot complete this action as this user is dead!"); return(false); } if (User2.GetRoleplay().Jailed) { User1.SendWhisper("Cannot complete this action as this user is jailed!"); return(false); } if (RoomUser1.Stunned) { User1.SendWhisper("Cannot complete this action while you are stunned!"); return(false); } if (RoomUser2.IsAsleep) { User1.SendWhisper("Cannot complete this action as this user is AFK!"); return(false); } if (RoomUser1.IsAsleep) { User1.SendWhisper("Cannot complete this action as this user is AFK!"); return(false); } if (User1.GetRoleplay().IsNoob&& !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("COLOR") && !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("MAFIA")) { if (!User1.GetRoleplay().NoobWarned) { User1.SendNotif("If you choose to do this again your temporary God Protection will be disabled!"); User1.GetRoleplay().NoobWarned = true; return(false); } else { using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.RunFastQuery("UPDATE rp_stats SET is_noob = 0 WHERE id = '" + User1.GetHabbo().Id + "'"); } User1.SendWhisper("Your god protection has been disabled!"); User1.GetRoleplay().IsNoob = false; User1.GetRoleplay().SaveQuickStat("is_noob", "0"); } } if (User2.GetRoleplay().IsNoob&& !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("COLOR") && !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("MAFIA") && !User1.GetHabbo().CurrentRoom.RoomData.Description.Contains("NPA")) { User1.SendWhisper("Cannot complete this action as this user is under God Protection!"); return(false); } #endregion #region Secondary Checks if (Room.RoomData.Description.Contains("NOSHOOT") && RoleplayManager.PurgeTime == false) { User1.SendWhisper("Sorry, but this is a non shooting zone!"); return(false); } if (Room.RoomData.Description.Contains("SAFEZONE")) { User1.SendWhisper("Sorry, but this is a safe zone!"); return(false); } if (User1.GetRoleplay().Equiped == null) { User1.SendWhisper("You have not equiped a weapon!"); return(false); } if (!WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Type.ToLower().Contains("gun")) { User1.SendWhisper("The weapon you have equiped is not a gun!"); return(false); } if (User2.GetRoleplay().usingPlane&& !WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Name.ToLower().Contains("rpg")) { User1.Shout("*Attempts to shoot " + User2.GetHabbo().UserName + ", but misses as they are in a plane*"); User1.GetRoleplay().GunShots++; return(false); } int MyJobId = User1.GetRoleplay().JobId; int MyJobRank = User1.GetRoleplay().JobRank; if (User1.GetRoleplay().Bullets <= 0 && (!JobManager.JobRankData[MyJobId, MyJobRank].hasRights("army") && !User1.GetRoleplay().Working)) { User1.SendWhisper("You do not have any bullets!"); return(false); } if (User1.GetRoleplay().Intelligence < WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Min_Intel) { User1.SendWhisper("You must have an intelligence level of at least " + WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Min_Intel + " to use this weapon!"); return(false); } if (User1.GetRoleplay().Strength + User1.GetRoleplay().savedSTR < WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Need_Str) { User1.SendWhisper("You must have a strength level of at least " + WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Need_Str + " to use this weapon!"); return(false); } if (User1.GetRoleplay().GunShots >= WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Reload_Time) { RoomUser1.LastBubble = 3; User1.Shout("*Reloads their " + WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].DisplayName + ", and loads more bullets*"); RoomUser1.LastBubble = 0; ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer")); message.AppendInteger(5); RoomUser1.IsGunReloaded = true; RoomUser1.ReloadExpiryTime = Plus.GetUnixTimeStamp() + 5; User1.SendMessage(message); User1.GetRoleplay().GunShots = 0; // will re-inplement this later -> HabboHotel.Misc.ChatCommandHandler.Parse(User1, ":shoot " + TargetUser1.GetHabbo().UserName); return(false); } #endregion #region Final Checks if (RoleplayManager.Distance(Pos1, Pos2) > WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Range) { /*if (Misc.Distance(Pos1, Pos2) > weaponManager.WeaponsData[User1.GetRoleplay().Equiped].Range + 4) * { * User1.SendWhisper("You must be closer to do this!"); * return false; * }*/ RoomUser1.LastBubble = 3; User1.Shout("*Shoots their " + WeaponManager.WeaponsData[User1.GetRoleplay().Equiped].Name + " at " + User2.GetHabbo().UserName + ", but misses*"); RoomUser1.LastBubble = 0; User1.GetRoleplay().GunShots++; return(false); } #endregion } return(true); }
/// <summary> /// Attacks the victim /// </summary> internal void TryAttack(object StateInfo) { try { if (GetRoomUser() == null || GetRoom() == null || _AttackTimer == null || _Victim == null || _Victim.RoomId != GetRoom().RoomId) { _Victim = null; return; } if (GetBotData().CoolDown != null) { return; } GameClient Session = _Victim.GetClient(); if (Session == null || Session.GetHabbo() == null || Session.GetRoleplay() == null || Session.GetHabbo().CurrentRoom == null) { _AttackTimer.Change(2000, 2000); _Victim = null; return; } Vector2D VictimPOS = new Vector2D(_Victim.X, _Victim.Y); Vector2D MyPOS = new Vector2D(GetRoomUser().X, GetRoomUser().Y); if (RoleplayManager.BotWithinAttackDistance(GetRoomUser(), _Victim)) { int ExtraDamage = (new Random()).Next(5, 15); int Damage = GetBotData().strength + ExtraDamage; // Kill this punk if (Session.GetRoleplay().CurHealth - Damage <= 0) { GetRoomUser().Chat(null, "*Da um soco em " + _Victim.GetUserName() + ", nocauteando-o*", true, 1); Session.GetRoleplay().CurHealth = 120; Session.GetRoleplay().Energy = 120; Session.GetRoleplay().Hunger = 0; Session.GetRoleplay().UpdateStats++; // Tell this n***a he got f****d up by our bot Session.SendNotif("Você foi nocauteado pelo BOT-" + GetBotData().Name); _Victim = null; // SEND THIS N***A BACK TO HIS SHIT HOLE Session.GetMessageHandler().PrepareRoomForUser(Plus.GetGame().MafiaWars.GraveYardID, ""); // Get next victim init LookForVictim(); _AttackTimer.Change(1000, 1000); return; } GetRoomUser().Chat(null, "*Bate em " + _Victim.GetUserName() + ", causando " + Damage + " dano*", true, 1); RoleplayManager.Shout(Session, "*[" + Session.GetRoleplay().CurHealth + "/" + Session.GetRoleplay().MaxHealth + "]*"); Session.GetRoleplay().CurHealth -= Damage; Session.GetRoleplay().UpdateStats++; GetBotData().ApplyCooldown(); _AttackTimer.Change(1000, 1000); return; } if (RoleplayManager.Distance(MyPOS, VictimPOS) >= 1 && RoleplayManager.Distance(MyPOS, VictimPOS) <= 2) { // Miss GetRoomUser().Chat(null, "*Tenta bater em " + _Victim.GetUserName() + " mas erra*", true, 1); GetBotData().ApplyCooldown(2000); _AttackTimer.Change(1000, 1000); return; } if (RoleplayManager.Distance(MyPOS, VictimPOS) >= 5) { _AttackTimer.Change(1000, 1000); return; // Don't even bother } } catch { } }
internal override void OnTimerTick() { if (base.GetBotData() != null) { if (base.GetBotData().Name.ToLower().Contains("doctor")) { if (base.GetRoomUser().RotBody != 4) { base.GetRoomUser().RotBody = 4; base.GetRoomUser().RotHead = 4; } if (!base.GetRoomUser().Statusses.ContainsKey("sit")) { base.GetRoomUser().Statusses.Add("sit", "1.0"); base.GetRoomUser().Z = 0.00; base.GetRoomUser().IsSitting = true; base.GetRoomUser().UpdateNeeded = true; } } switch (base.GetBotData().HospBotType) { #region Paramedic Bot case "paramedic_bot": { bool LeaveRoom = false; if (base.GetBotData().InteractingWith == null) { LeaveRoom = true; } if (!base.GetBotData().InteractingWith.GetClient().GetRoleplay().Dead) { LeaveRoom = true; } if (base.GetBotData() != null) { if (base.GetBotData().InteractingWith != null) { if (base.GetBotData().InteractingWith.GetClient() != null) { if (base.GetBotData().InteractingWith.GetClient().GetHabbo() != null) { if (base.GetBotData().InteractingWith.GetClient().GetHabbo().CurrentRoomId != base.GetBotData().RoomId) { LeaveRoom = true; } } } } } if (base.GetRoom() == null) { LeaveRoom = true; } #region Leaveroom if (LeaveRoom) { if (LActionTimer < 20) { base.GetRoomUser().ApplyEffect(20); 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); LActionTimer++; } else { RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId); } } #endregion if (!LeaveRoom) { base.GetRoomUser().ApplyEffect(20); 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 (RoleplayManager.Distance(Pos1, Pos2) > 3) { if (!base.GetRoomUser().IsWalking) { base.GetBotData().TimesTried++; } base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true); if (base.GetBotData().TimesTried >= 7) { base.GetRoomUser().SetPos(Pos2.X, Pos2.Y, 0); base.GetRoomUser().UpdateNeeded = true; } } else { if (LActionTimer < 5) { LActionTimer++; } else { if (!LoadedUser) { base.GetRoomUser().Chat(null, "*Loads " + base.GetBotData().InteractingWith.GetClient().GetHabbo().UserName + " into the ambulance strecher*", true, 1); base.GetBotData().InteractingWith.ApplyEffect(23); LoadedUser = true; } else { if (LActionTimer < 10) { LActionTimer++; } else { if (!TransferedUser) { base.GetBotData().InteractingWith.GetClient().GetMessageHandler().PrepareRoomForUser(2, null); base.GetRoomUser().Chat(null, "*Takes " + base.GetBotData().InteractingWith.GetClient().GetHabbo().UserName + " to the hospital in their ambulance*", true, 1); base.GetRoomUser().ApplyEffect(3); TransferedUser = true; } else { if (LActionTimer < 15) { if (LActionTimer == 13) { 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 (LActionTimer < 20) { base.GetRoomUser().ApplyEffect(20); 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); LActionTimer++; } else { RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId); } } } } } } } } } break; #endregion } } }
internal static bool ExecuteAttackBot(GameClient User1, RoomUser RoomUser2, Pet Pet, RoomBot BotData) { Room Room = User1.GetHabbo().CurrentRoom; RoomUser RoomUser1 = User1.GetHabbo().GetRoomUser(); Vector2D Pos1 = new Vector2D(RoomUser1.X, RoomUser1.Y); Vector2D Pos2 = new Vector2D(RoomUser2.X, RoomUser2.Y); bool canattack = false; #region Cooldown if (User1.GetRoleplay().CoolDown > 0) { User1.SendWhisper("Cooling down [" + User1.GetRoleplay().CoolDown + "/3]"); return(false); } #endregion #region Distance if (RoleplayManager.WithinAttackDistance(RoomUser1, RoomUser2)) { canattack = true; } else if (RoleplayManager.Distance(Pos1, Pos2) > 1 && RoleplayManager.Distance(Pos1, Pos2) <= 4) { User1.Shout("*Swings at " + BotData.Name + ", but misses*"); return(false); } else if (RoleplayManager.Distance(Pos1, Pos2) >= 5) { User1.SendWhisper("You are too far away!"); return(false); } #endregion #region Status Conditions if (Room.RoomData.Description.Contains("NOHIT") && RoleplayManager.PurgeTime == false) { User1.SendWhisper("Sorry, but this is a no hitting zone!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (Room.RoomData.Description.Contains("SAFEZONE")) { User1.SendWhisper("Sorry, but this is a safezone!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (User1.GetRoleplay().Energy <= 0) { User1.SendWhisper("You do not have enough energy to do this!"); return(false); } if (User1.GetRoleplay().Dead) { User1.SendWhisper("Cannot complete this action while you are dead!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (User1.GetRoleplay().Jailed) { User1.SendWhisper("Cannot complete this action while you are jailed!"); User1.GetRoleplay().CoolDown = 3; return(false); } if (RoomUser1.Stunned) { User1.SendWhisper("Cannot complete this action while you are stunned!"); User1.GetRoleplay().CoolDown = 3; return(false); } #endregion if (canattack) { GameClient Session = User1; int Damage = CombatManager.DamageCalculator(User1); BotData.cur_Health -= Damage; if (BotData.cur_Health <= 0) { if (RoomUser2.BotData != null && RoomUser2.BotData._Boss) { Session.GetRoleplay().GiveMafiaWarPoints(MafiaWarManager.BossKillPoints); User1.Shout("*Swings at " + BotData.Name + ", causing " + Damage + " damage and killing them and winning the Game! [+ " + MafiaWarManager.BossKillPoints + " Mafia Wars Pts]*"); } else if (!RoomUser2.BotData._Boss) { Session.GetRoleplay().GiveMafiaWarPoints(MafiaWarManager.ThugKillPoints); User1.Shout("*Swings at " + BotData.Name + ", causing " + Damage + " damage and killing them! [+ " + MafiaWarManager.ThugKillPoints + " Mafia Wars Pts]*"); } RoomUser2.Chat(null, "*Passes out*", true, 1); User1.GetHabbo().GetRoomUser().Attacker = null; RoomUser2.BotAI._Victim = null; if (RoomUser2.IsPet) { if (RoomUser2.FollowingOwner != null) { RoomUser2.FollowingOwner.GetClient().GetMessageHandler().PickUpPet(RoomUser2.FollowingOwner.GetClient(), RoomUser2.PetData.PetId, true); return(true); } else { Room.GetRoomUserManager().RemoveBot(RoomUser2.VirtualId, true); } } else { Room.GetRoomUserManager().RemoveBot(RoomUser2.VirtualId, true); } if (RoomUser2.BotData != null && RoomUser2.BotData._Boss) { Session.GetRoleplay().GiveMafiaWarPoints(MafiaWarManager.BossKillPoints); if (RoomUser2.BotData._Team.TeamName == "Green") { Plus.GetGame().MafiaWars.TeamWon("Blue"); } else { Plus.GetGame().MafiaWars.TeamWon("Green"); } } } else { User1.Shout("*Swings at " + BotData.Name + ", causing " + Damage + " damage*"); RoomUser2.Chat(null, "[" + BotData.cur_Health + "/" + BotData.max_Health + "]", true, 1); if (User1.GetHabbo().GetRoomUser().Attacker != null) { User1.GetHabbo().GetRoomUser().Attacker = null; RoomUser2.BotAI._Victim = User1.GetHabbo().GetRoomUser(); } User1.GetRoleplay().LastHitBot = RoomUser2; } Session.GetRoleplay().CoolDown = 3; } return(true); }