public void BeginPlacingFoodFurni(Food.Food Food, GameClient Client, Point UserPoint) { if (Client == null) { return; } if (Client.GetRoomUser() == null) { return; } if (base.CachedBot.DRoom == null) { return; } double MaxHeight = 0.0; Item ItemInFront; if (base.CachedBot.DRoom.GetGameMap().GetHighestItemForSquare(Client.GetRoomUser().SquareInFront, out ItemInFront)) { if (ItemInFront != null) { MaxHeight = ItemInFront.TotalHeight; } } base.CachedBot.DRoomUser.SetRot(Client.GetRoomUser().RotBody, false); RoleplayManager.PlaceItemToRoom(Client, Food.ItemId, 0, Client.GetRoomUser().SquareInFront.X, Client.GetRoomUser().SquareInFront.Y, MaxHeight, Client.GetRoomUser().RotBody, false, base.CachedBot.DRoom.Id, false, Food.ExtraData); }
private bool DropCrate() { Point DeliveryDropPoint = new Point(this.InteractingBot.oX, this.InteractingBot.oY); if (this.InteractingBot.DRoomUser.Coordinate != DeliveryDropPoint) { return(false); } else { if (!this.DroppedCrate) { var SquareInFront = new Point(this.InteractingBot.DRoomUser.SquareInFront.X, this.InteractingBot.DRoomUser.SquareInFront.Y); double MaxHeight = 0.0; Item ItemInFront; if (this.InteractingBot.DRoom.GetGameMap().GetHighestItemForSquare(SquareInFront, out ItemInFront)) { if (ItemInFront != null) { MaxHeight = ItemInFront.TotalHeight; } } RoleplayManager.PlaceItemToRoom(null, 8029, 0, SquareInFront.X, SquareInFront.Y, MaxHeight, this.InteractingBot.DRoomUser.RotBody, false, this.InteractingBot.DRoom.Id, false, "0", false, "weapon"); this.DroppedCrate = true; } } return(true); }
public void SpawnDice() { try { Room Room = RoleplayManager.GenerateRoom(this.RoomId); this.Furni = RoleplayManager.PlaceItemToRoom(null, this.ItemId, 0, this.X, this.Y, this.Z, this.Rotation, false, this.RoomId, false, "0", false, "", null, null, this); } catch (Exception e) { Logging.LogRPGamesError("Error in SpawnDice() void: " + e); } }
public void HandleDelivery() { var SquareInFront = new Point(base.CachedBot.DRoomUser.SquareInFront.X, base.CachedBot.DRoomUser.SquareInFront.Y); double MaxHeight = 0.0; Item ItemInFront; if (base.CachedBot.DRoom.GetGameMap().GetHighestItemForSquare(SquareInFront, out ItemInFront)) { if (ItemInFront != null) { MaxHeight = ItemInFront.TotalHeight; } } RoleplayManager.PlaceItemToRoom(null, 8029, 0, SquareInFront.X, SquareInFront.Y, MaxHeight, base.CachedBot.DRoomUser.RotBody, false, base.CachedBot.DRoom.Id, false, "0", false, "weapon"); }
public void SpawnSign() { Room Room = RoleplayManager.GenerateRoom(this.RoomId, false); if (Room != null && this.Item != null) { if (Room.GetRoomItemHandler().GetFloor.Where(x => x.Id == this.Item.Id).ToList().Count > 0) { foreach (Item Item in Room.GetRoomItemHandler().GetFloor.Where(x => x.Id == this.Item.Id).ToList()) { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id); } } } if (Room != null) { this.Item = RoleplayManager.PlaceItemToRoom(null, this.ItemId, 0, this.X, this.Y, this.Z, 0, false, this.RoomId, false, "0", false, "", null, this); this.Spawned = true; } }
/// <summary> /// Plants the seed on the dirt nest /// </summary> public static void PlantSeed(GameClient Session, Item Item) { if (Session == null || Session.GetHabbo() == null || Session.GetRoleplay() == null || Session.GetRoomUser() == null || Item == null || Item.GetRoom() == null) { return; } if (Item.GetRoom() == null) { return; } if (Session.GetRoleplay().TryGetCooldown("farming", false)) { return; } #region Check Rentable Space if (Item.GetRoom().GetRoomItemHandler() != null && Item.GetRoom().GetRoomItemHandler().GetFloor != null) { lock (Item.GetRoom().GetRoomItemHandler().GetFloor) { List <Item> OwnedRentableSpaces = Item.GetRoom().GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().InteractionType == InteractionType.RENTABLE_SPACE && x.RentableSpaceData != null && x.RentableSpaceData.FarmingSpace != null && x.RentableSpaceData.FarmingSpace.OwnerId == Session.GetHabbo().Id).ToList(); if (OwnedRentableSpaces.Count <= 0) { Session.SendWhisper("Você não possui esse terreno para cultivar!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } Item SpaceItem = OwnedRentableSpaces.FirstOrDefault(); List <Point> SpacePoints = SpaceItem.GetAffectedTiles; if (!SpacePoints.Contains(Item.Coordinate)) { Session.SendWhisper("Você não possui esse terreno para cultivar!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } } } #endregion if (!GroupManager.HasJobCommand(Session, "farming")) { Session.SendWhisper("Desculpe, apenas um agricultor pode plantar sementes!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } if (!Session.GetRoleplay().IsWorking) { Session.SendWhisper("Você deve estar trabalhando para plantar sementes!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } if (RoleplayManager.FarmingCAPTCHABox) { if (Session.GetRoleplay().CaptchaSent) { Session.SendWhisper("Você deve inserir o código no AFK para continuar cultivando!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } } if (Item.GetRoom().GetGameMap().GetRoomItemForSquare(Item.GetX, Item.GetY).Where(x => x.GetBaseItem().InteractionType == InteractionType.FARMING).ToList().Count > 0) { Item FarmItem = Item.GetRoom().GetGameMap().GetRoomItemForSquare(Item.GetX, Item.GetY).FirstOrDefault(x => x.GetBaseItem().InteractionType == InteractionType.FARMING); if (FarmItem == null) { return; } if (FarmItem.Interactor == null) { return; } FarmItem.Interactor.OnTrigger(Session, FarmItem, 0, true); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } if (Session.GetRoleplay().FarmingItem == null) { Session.SendWhisper("Você ainda não selecionou uma semente para plantar! Use o comando ':plantar <id>' para selecionar um!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } ItemData Furni; if (!PlusEnvironment.GetGame().GetItemManager().GetItem(Session.GetRoleplay().FarmingItem.BaseItem, out Furni)) { Session.SendWhisper("Desculpe, mas a planta que você selecionou é inválida! Use o comando ':plantar <id>' para selecionar outro!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } int Amount; if (!GetSatchelAmount(Session, false, out Amount)) { Session.SendWhisper("Desculpe, mas a planta que você selecionou é inválida! Use o comando ':plantar <id>' para selecionar outro!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } if (Amount <= 0) { Session.SendWhisper("Parece que você ficou sem sementes " + Furni.PublicName + "!", 1); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; } if (!Gamemap.TilesTouching(Session.GetRoomUser().Coordinate.X, Session.GetRoomUser().Coordinate.Y, Item.GetX, Item.GetY)) { Session.GetRoomUser().MoveTo(Item.Coordinate); return; } IncreaseSatchelCount(Session, Session.GetRoleplay().FarmingItem, -1, false); RoleplayManager.PlaceItemToRoom(null, Furni.Id, 0, Item.GetX, Item.GetY, (Item.GetZ + 0.01), 0, false, Item.GetRoom().Id, false); Session.Shout("*Planta uma semente " + Furni.PublicName + "no refugo*", 4); Session.GetRoleplay().CooldownManager.CreateCooldown("farming", 500); return; }
/// <summary> /// Responds to the event /// </summary> public void Execute(object Source, object[] Params) { GameClient Client = (GameClient)Source; if (Client == null || Client.GetRoleplay() == null || Client.GetHabbo() == null) { return; } Room Room = (Room)Params[0]; TutorialBadge(Client, Params); if (Client.GetRoleplay().PoliceTrial) { Client.GetRoleplay().PoliceTrial = false; } #region WebSocket Dialogue Check Client.GetRoleplay().ClearWebSocketDialogue(); #endregion #region Police Car Enable Check if (Client.GetRoomUser() != null) { if (Client.GetRoomUser().CurrentEffect == EffectsList.CarPolice) { Client.GetRoomUser().ApplyEffect(EffectsList.None); } } #endregion #region Spawn/Update Texas Hold 'Em Furni if (TexasHoldEmManager.GetGamesByRoomId(Room.RoomId).Count > 0) { List <TexasHoldEm> Games = TexasHoldEmManager.GetGamesByRoomId(Room.RoomId); foreach (TexasHoldEm Game in Games) { if (Game != null) { #region PotSquare Check if (Game.PotSquare.Furni != null) { if (Game.PotSquare.Furni.GetX != Game.PotSquare.X && Game.PotSquare.Furni.GetY != Game.PotSquare.Y && Game.PotSquare.Furni.GetZ != Game.PotSquare.Z && Game.PotSquare.Furni.Rotation != Game.PotSquare.Rotation) { if (Room.GetRoomItemHandler().GetFloor.Contains(Game.PotSquare.Furni)) { Room.GetRoomItemHandler().RemoveFurniture(null, Game.PotSquare.Furni.Id); } Game.PotSquare.SpawnDice(); } } else { Game.PotSquare.SpawnDice(); } #endregion #region JoinGate Check if (Game.JoinGate.Furni != null) { if (Game.JoinGate.Furni.GetX != Game.JoinGate.X && Game.JoinGate.Furni.GetY != Game.JoinGate.Y && Game.JoinGate.Furni.GetZ != Game.JoinGate.Z && Game.JoinGate.Furni.Rotation != Game.JoinGate.Rotation) { if (Room.GetRoomItemHandler().GetFloor.Contains(Game.JoinGate.Furni)) { Room.GetRoomItemHandler().RemoveFurniture(null, Game.JoinGate.Furni.Id); } Game.JoinGate.SpawnDice(); } } else { Game.JoinGate.SpawnDice(); } #endregion #region Player1 Check foreach (TexasHoldEmItem Item in Game.Player1.Values) { if (Item.Furni != null) { if (Item.Furni.GetX != Item.X && Item.Furni.GetY != Item.Y && Item.Furni.GetZ != Item.Z && Item.Furni.Rotation != Item.Rotation) { if (Room.GetRoomItemHandler().GetFloor.Contains(Item.Furni)) { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Furni.Id); } Item.SpawnDice(); } } else { Item.SpawnDice(); } } #endregion #region Player2 Check foreach (TexasHoldEmItem Item in Game.Player2.Values) { if (Item.Furni != null) { if (Item.Furni.GetX != Item.X && Item.Furni.GetY != Item.Y && Item.Furni.GetZ != Item.Z && Item.Furni.Rotation != Item.Rotation) { if (Room.GetRoomItemHandler().GetFloor.Contains(Item.Furni)) { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Furni.Id); } Item.SpawnDice(); } } else { Item.SpawnDice(); } } #endregion #region Player3 Check foreach (TexasHoldEmItem Item in Game.Player3.Values) { if (Item.Furni != null) { if (Item.Furni.GetX != Item.X && Item.Furni.GetY != Item.Y && Item.Furni.GetZ != Item.Z && Item.Furni.Rotation != Item.Rotation) { if (Room.GetRoomItemHandler().GetFloor.Contains(Item.Furni)) { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Furni.Id); } Item.SpawnDice(); } } else { Item.SpawnDice(); } } #endregion #region Banker Check foreach (TexasHoldEmItem Item in Game.Banker.Values) { if (Item.Furni != null) { if (Item.Furni.GetX != Item.X && Item.Furni.GetY != Item.Y && Item.Furni.GetZ != Item.Z && Item.Furni.Rotation != Item.Rotation) { if (Room.GetRoomItemHandler().GetFloor.Contains(Item.Furni)) { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Furni.Id); } Item.SpawnDice(); } } else { Item.SpawnDice(); } } #endregion } } } #endregion #region Spawn/Update Turf Flag Furni if (Room.TurfEnabled) { Turf Turf = TurfManager.GetTurf(Room.RoomId); if (Turf != null) { if (Turf.FlagSpawned) { if (Turf.Flag.GroupId != Turf.GangId || (Turf.Flag.GetX != Turf.FlagX && Turf.Flag.GetY != Turf.FlagY)) { Turf.SpawnFlag(); } } else { Turf.SpawnFlag(); } } } #endregion #region Spawn/Update House Signs List <House> Houses = PlusEnvironment.GetGame().GetHouseManager().GetHousesBySignRoomId(Room.Id); if (Houses.Count > 0) { foreach (House House in Houses) { if (House.Sign.Spawned) { if (House.Sign.Item.GetX != House.Sign.X && House.Sign.Item.GetY != House.Sign.Y && House.Sign.Item.GetZ != House.Sign.Z) { House.SpawnSign(); } } else { House.SpawnSign(); } } } #endregion #region Spawn/Update Farming Spaces List <FarmingSpace> FarmingSpaces = FarmingManager.GetFarmingSpacesByRoomId(Room.Id); if (FarmingSpaces.Count > 0) { foreach (FarmingSpace Space in FarmingSpaces) { if (Space.Spawned) { if (Space.Item.GetX != Space.X && Space.Item.GetY != Space.Y && Space.Item.GetZ != Space.Z) { Space.SpawnSign(); } } else { Space.SpawnSign(); } } } #endregion #region Spawn Jailbreak Fence if (Room.RoomId == Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")) && !JailbreakManager.JailbreakActivated) { int X = Convert.ToInt32(RoleplayData.GetData("jailbreak", "fencex")); int Y = Convert.ToInt32(RoleplayData.GetData("jailbreak", "fencey")); int Rot = Convert.ToInt32(RoleplayData.GetData("jailbreak", "fencerotation")); if (Room.GetRoomItemHandler().GetFloor.Where(x => x.BaseItem == 8049 && x.GetX == X && x.GetY == Y).ToList().Count <= 0) { double MaxHeight = 0.0; Item ItemInFront; if (Room.GetGameMap().GetHighestItemForSquare(new Point(X, Y), out ItemInFront)) { if (ItemInFront != null) { MaxHeight = ItemInFront.TotalHeight; } } RoleplayManager.PlaceItemToRoom(null, 8049, 0, X, Y, MaxHeight, Rot, false, Room.RoomId, false); } } #endregion #region Taxi Message if (Client.GetRoleplay().AntiArrowCheck) { Client.GetRoleplay().AntiArrowCheck = false; } if (Client.GetRoleplay().InsideTaxi) { int Bubble = (Client.GetHabbo().GetPermissions().HasRight("mod_tool") && Client.GetRoleplay().StaffOnDuty) ? 23 : 4; Client.GetRoleplay().InsideTaxi = false; new Thread(() => { Thread.Sleep(500); RoleplayManager.Shout(Client, "*Chega ao meu destino*", Bubble); }).Start(); } else { PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Client, QuestType.SOCIAL_VISIT); } #endregion #region Room Entrance Message if (Room.EnterRoomMessage != "none") { new Thread(() => { Thread.Sleep(500); Client.SendWhisper(Room.EnterRoomMessage, 34); }).Start(); } #endregion #region Main checks BotInteractionCheck(Client, Params); if (Client.GetRoleplay().Game == null && Client.GetRoleplay().Team == null) { HomeRoomCheck(Client, Params); JobCheck(Client, Params); SendhomeCheck(Client, Params); DeathCheck(Client, Params); JailCheck(Client, Params); WantedCheck(Client, Params); ProbationCheck(Client, Params); #region AFK check if (Client.GetRoomUser() != null) { Client.GetHabbo().Poof(true); } #endregion } #endregion #region Event/Game Checks else { if (Client.GetRoleplay().Game != null && Client.GetRoleplay().Team != null) { if (!Client.GetRoleplay().GameSpawned || Client.GetRoleplay().NeedsRespawn) { if (Client.GetRoleplay().Game != Games.RoleplayGameManager.GetGame(Games.GameMode.Brawl)) { var OldCoord = new Point(Client.GetRoomUser().Coordinate.X, Client.GetRoomUser().Coordinate.Y); var NewCoord = new Point(Client.GetRoleplay().Team.SpawnPoint.X, Client.GetRoleplay().Team.SpawnPoint.Y); Client.GetHabbo().CurrentRoom.GetGameMap().UpdateUserMovement(OldCoord, NewCoord, Client.GetRoomUser()); Client.GetRoomUser().SetPos(NewCoord.X, NewCoord.Y, Client.GetHabbo().CurrentRoom.GetGameMap().GetHeightForSquare(NewCoord)); if (Client.GetRoleplay().NeedsRespawn) { if (Client.GetRoomUser() != null) { Client.GetRoomUser().CanWalk = false; } } if (!Client.GetRoleplay().GameSpawned) { Client.GetRoleplay().GameSpawned = true; Client.SendNotification(Client.GetRoleplay().Game.GetName() + " Começou! Boa sorte!"); } } } } } #endregion }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { #region Variables RoomUser User = Session.GetRoomUser(); Group Group = GroupManager.GetJob(Session.GetRoleplay().JobId); GroupRank GroupRank = GroupManager.GetJobRank(Session.GetRoleplay().JobId, Session.GetRoleplay().JobRank); #endregion #region Conditions if (User == null) { return; } if (Params.Length == 1) { Session.SendWhisper("Digite [:servir (item)]! Você só pode servir os seguintes itens: " + FoodManager.GetServableItems(Session) + "!", 1); return; } string FoodName = Params[1].ToString(); Food Food = FoodManager.GetFoodAndDrink(FoodName); if (!Session.GetRoleplay().IsWorking) { Session.SendWhisper("Você deve estar trabalhando para fazer isso!", 1); return; } if (Session.GetRoleplay().IsDead) { Session.SendWhisper("Você não pode servir alimentos ou bebidas enquanto está morto!", 1); return; } if (Session.GetRoleplay().IsJailed) { Session.SendWhisper("Você não pode servir alimentos ou bebidas enquanto está preso!", 1); return; } if (!GroupManager.HasJobCommand(Session, "serve")) { Session.SendWhisper("Você não tem permissão para usar este comando!", 1); return; } if (!GroupRank.CanWorkHere(Session.GetHabbo().CurrentRoomId)) { Session.SendWhisper("Você não trabalha aqui! Seu(s) quarto de trabalho é [Quarto ID(s): " + String.Join(",", GroupRank.WorkRooms) + "]", 1); return; } if (Food == null) { Session.SendWhisper("Este não é um tipo de alimento ou bebida válido! Você só pode servir: " + FoodManager.GetServableItems(Session) + "!", 1); return; } if (!FoodManager.CanServe(User)) { Session.SendWhisper("Encontre uma mesa agradável para servir!", 1); return; } if (Food.Type == "food" && !GroupManager.HasJobCommand(Session, "food")) { Session.SendWhisper("Desculpe! Você só pode servir: " + FoodManager.GetServableItems(Session) + "!", 1); return; } if (Food.Type == "drink" && !GroupManager.HasJobCommand(Session, "drinks")) { Session.SendWhisper("Desculpe! Você só pode servir: " + FoodManager.GetServableItems(Session) + "!", 1); return; } if (!Food.Servable) { if (Food.Type == "drink") { Session.SendWhisper("Desculpe! Você só pode servir: " + FoodManager.GetServableItems(Session) + "!", 1); } else { Session.SendWhisper("Desculpe! Você só pode servir: " + FoodManager.GetServableItems(Session) + "!", 1); } return; } #endregion #region Execute double MaxHeight = 0.0; Item ItemInFront; if (Room.GetGameMap().GetHighestItemForSquare(User.SquareInFront, out ItemInFront)) { if (ItemInFront != null) { MaxHeight = ItemInFront.TotalHeight; } } Session.Shout(Food.ServeText, 4); RoleplayManager.PlaceItemToRoom(Session, Food.ItemId, 0, User.SquareInFront.X, User.SquareInFront.Y, MaxHeight, User.RotBody, false, Room.Id, false, Food.ExtraData, true); #endregion }
/// <summary> /// Places the users bet onto the pot square /// </summary> public void PlacePotFurni(int Number, int Amount) { try { Room Room = RoleplayManager.GenerateRoom(this.RoomId); if (Room == null || Room.GetRoomItemHandler() == null || Room.GetGameMap() == null) { return; } TexasHoldEmPlayer Player = this.PlayerList[Number]; if (Player == null) { return; } if (Player.TotalAmount - Amount < 0) { return; } Player.TotalAmount -= Amount; Player.CurrentBet += Amount; int X = PotSquare.X; int Y = PotSquare.Y; int Thousands = 0; int Hundreds = 0; int Fifties = 0; int Tens = 0; int Fives = 0; double Height = Room.GetGameMap().GetHeightForSquare(new Point(X, Y)); #region Set Values if (Amount >= 1000) { Thousands = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 1000))); Amount -= 1000 * Thousands; } if (Amount >= 100) { Hundreds = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 100))); Amount -= 100 * Hundreds; } if (Amount >= 50) { Fifties = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 50))); Amount -= 50 * Fifties; } if (Amount >= 10) { Tens = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 10))); Amount -= 10 * Tens; } if (Amount >= 5) { Fives = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 5))); Amount -= 5 * Fives; } #endregion #region Spawn Bars if (Thousands > 0) { while (Thousands > 0) { // Obsidian Bar RoleplayManager.PlaceItemToRoom(null, 200059, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Thousands--; } } if (Hundreds > 0) { while (Hundreds > 0) { // Diamond Bar RoleplayManager.PlaceItemToRoom(null, 200054, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Hundreds--; } } if (Fifties > 0) { while (Fifties > 0) { // Emerald Bar RoleplayManager.PlaceItemToRoom(null, 200062, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Fifties--; } } if (Tens > 0) { while (Tens > 0) { // Ruby Bar RoleplayManager.PlaceItemToRoom(null, 200058, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Tens--; } } if (Fives > 0) { while (Fives > 0) { // Sapphire Bar RoleplayManager.PlaceItemToRoom(null, 200056, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Fives--; } } #endregion } catch (Exception e) { Logging.LogRPGamesError("Error in AddPlayerToGame() void: " + e); } }
/// <summary> /// Places the players total amount (join cost) furni in the spawn point /// </summary> public void SpawnBetFurni(int Number, int Amount) { try { Room Room = RoleplayManager.GenerateRoom(this.RoomId); if (Room == null || Room.GetRoomItemHandler() == null || Room.GetGameMap() == null) { return; } string[] Data; if (Number == 1) { Data = this.Player1Data; } else if (Number == 2) { Data = this.Player2Data; } else { Data = this.Player3Data; } int X = Convert.ToInt32(Data[2]); int Y = Convert.ToInt32(Data[3]); int Hundreds = 0; int Fifties = 0; int Tens = 0; int Fives = 0; double Height = Room.GetGameMap().GetHeightForSquare(new Point(X, Y)); #region Set Values if (Amount >= 100) { Hundreds = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 100))); Amount -= 100 * Hundreds; } if (Amount >= 50) { Fifties = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 50))); Amount -= 50 * Fifties; } if (Amount >= 10) { Tens = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 10))); Amount -= 10 * Tens; } if (Amount >= 5) { Fives = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 5))); Amount -= 5 * Fives; } #endregion #region Spawn Bars if (Hundreds > 0) { while (Hundreds > 0) { // Diamond Bar RoleplayManager.PlaceItemToRoom(null, 200054, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Hundreds--; } } if (Fifties > 0) { while (Fifties > 0) { // Emerald Bar RoleplayManager.PlaceItemToRoom(null, 200062, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Fifties--; } } if (Tens > 0) { while (Tens > 0) { // Ruby Bar RoleplayManager.PlaceItemToRoom(null, 200058, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Tens--; } } if (Fives > 0) { while (Fives > 0) { // Sapphire Bar RoleplayManager.PlaceItemToRoom(null, 200056, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Fives--; } } #endregion } catch (Exception e) { Logging.LogRPGamesError("Error in SpawnBetFurni() void: " + e); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { #region Conditions if (Params.Length == 1 && Params[0].ToLower() != "explodir" && Params[0].ToLower() != "reparar") { if (Params[0].ToLower() == "plantar") { Session.SendWhisper("Digite o ID da planta que você deseja usar! Digite ':agricultura' para ver os IDs da planta.", 1); return; } else { Session.SendWhisper("Digite o item que deseja colocar para baixo!", 1); return; } } string Type; if (Params[0].ToLower() == "explodir") { Type = "dinamite"; } else if (Params[0].ToLower() == "reparar") { Type = "grade"; } else if (Params[0].ToLower() == "plantar") { Type = "planta"; } else { Type = Params[1].ToLower(); } #endregion switch (Type) { #region Dynamite case "dynamite": case "dinamite": { if (Session.GetRoleplay().Dynamite < 1) { Session.SendWhisper("Você não tem nenhuma dinamite para colocar!", 1); return; } if (JailbreakManager.JailbreakActivated) { Session.SendWhisper("Uma fuga da prisão já está em andamento!", 1); JailbreakManager.JailbreakActivated = false; return; } int RoomId = Convert.ToInt32(RoleplayData.GetData("jail", "outsideroomid")); int X = Convert.ToInt32(RoleplayData.GetData("jailbreak", "xposition")); int Y = Convert.ToInt32(RoleplayData.GetData("jailbreak", "yposition")); double Z = Convert.ToDouble(RoleplayData.GetData("jailbreak", "zposition")); int Rot = Convert.ToInt32(RoleplayData.GetData("jailbreak", "rotation")); if (Session.GetRoomUser() == null) { return; } if (Room.Id != RoomId) { Session.SendWhisper("Você não está fora da prisão para iniciar uma fuga!", 1); return; } Item BTile = Room.GetRoomItemHandler().GetFloor.FirstOrDefault(x => x.GetBaseItem().ItemName.ToLower() == "bb_rnd_tele" && x.Coordinate == Session.GetRoomUser().Coordinate); if (BTile == null) { Session.SendWhisper("Você deve estar parado em um tele banzai da prisao para começar a explosão e causar a fuga!", 1); return; } List <GameClient> CurrentJailedUsers = PlusEnvironment.GetGame().GetClientManager().GetClients.Where(x => x != null && x.GetHabbo() != null && x.GetRoleplay() != null && x.GetRoleplay().IsJailed).ToList(); if (CurrentJailedUsers == null || CurrentJailedUsers.Count <= 0) { Session.SendWhisper("Não há ninguém na prisão agora!", 1); return; } Session.GetRoleplay().Dynamite--; JailbreakManager.JailbreakActivated = true; Session.Shout("*Coloca uma dinamite na parede, tentando explodir e libertar os prisioneiros*", 4); if (!Session.GetRoleplay().WantedFor.Contains("fugindo da prisão")) { Session.GetRoleplay().WantedFor = Session.GetRoleplay().WantedFor + "fugindo da prisão, "; } Item Item = RoleplayManager.PlaceItemToRoom(null, 6088, 0, X, Y, Z, Rot, false, Room.Id, false, "0"); Item Item2 = RoleplayManager.PlaceItemToRoom(null, 3011, 0, X, Y, 0, Rot, false, Room.Id, false, "0"); object[] Items = { Session, Item, Item2 }; RoleplayManager.TimerManager.CreateTimer("dinamite", 500, false, Items); break; } #endregion #region Fence Repair case "repair": case "reparar": { if (!JailbreakManager.FenceBroken) { Session.SendWhisper("Não há grade que precise de reparo!", 1); return; } if (!GroupManager.HasJobCommand(Session, "guide") && !Session.GetHabbo().GetPermissions().HasRight("corporation_rights")) { Session.SendWhisper("Apenas um policial tem o equipamento certo para reparar essa grade!", 1); return; } if (!Session.GetRoleplay().IsWorking&& !Session.GetHabbo().GetPermissions().HasRight("corporation_rights")) { Session.SendWhisper("Você deve estar trabalhando para reparar essa grade!", 1); return; } if (Session.GetRoleplay().TimerManager.ActiveTimers.ContainsKey("reparar")) { Session.SendWhisper("Você já está reparando a grade!", 1); return; } Item BTile = Room.GetRoomItemHandler().GetFloor.FirstOrDefault(x => x.GetBaseItem().ItemName.ToLower() == "bb_rnd_tele" && x.Coordinate == Session.GetRoomUser().Coordinate); if (BTile == null) { Session.SendWhisper("Você deve estar parado em um tele banzai para começar a reparar a grade!", 1); return; } Session.Shout("*Comece a reparar a grade*", 4); Session.SendWhisper("Você tem 2 minutos até você reparar essa grade!", 1); Session.GetRoleplay().TimerManager.CreateTimer("reparar", 1000, false, BTile.Id); if (Session.GetRoomUser().CurrentEffect != 59) { Session.GetRoomUser().ApplyEffect(59); } break; } #endregion #region Plant case "plant": case "plantar": { int Id; if (!int.TryParse(Params[1], out Id)) { Session.SendWhisper("Digite o ID da planta que você deseja usar! Digite ':agricultura' para ver os IDs das plantas.", 1); break; } if (!Session.GetRoleplay().FarmingStats.HasSeedSatchel) { Session.SendWhisper("Você não tem uma bolsa de sementes para transportar sementes!", 1); return; } if (Id == 0) { Session.SendWhisper("Você guardou todas as suas sementes de volta ao seu saco de sementes", 1); Session.GetRoleplay().FarmingItem = null; break; } FarmingItem Item = FarmingManager.GetFarmingItem(Id); ItemData Furni; if (Item.BaseItem == null) { Session.SendWhisper("Desculpe, mas este ID da planta não existe! Digite ':agricultura' para ver os IDs das planta.", 1); return; } if (!PlusEnvironment.GetGame().GetItemManager().GetItem(Item.BaseItem, out Furni) || Item == null) { Session.SendWhisper("Desculpe, mas este ID da planta não existe! Digite ':agricultura' para ver os IDs das planta.", 1); return; } if (Item.LevelRequired > Session.GetRoleplay().FarmingStats.Level) { Session.SendWhisper("Desculpe, mas você não tem um nível de agricultura alto suficiente para esta semente!", 1); return; } Session.GetRoleplay().FarmingItem = Item; int Amount; if (FarmingManager.GetSatchelAmount(Session, false, out Amount)) { if (Amount <= 0) { Session.SendWhisper("Você não tem nenhuma semente para plantar! Compre alguma no supermercado.", 1); Session.GetRoleplay().FarmingItem = null; break; } else { Session.SendWhisper("Você preparou sua semente " + Amount + " " + Furni.PublicName + " para a plantação!", 1); break; } } else { Session.SendWhisper("Você não tem sementes para plantar! Compre alguma no supermercado.", 1); Session.GetRoleplay().FarmingItem = null; break; } } #endregion #region Default default: { Session.SendWhisper("Desculpe, mas este item não pode ser encontrado!", 1); break; } #endregion } }