internal override void OnUserEnterRoom(RoomUser User) { if (User.GetClient() != null && User.GetClient().GetHabbo() != null) { RoomUser roomUser = base.GetRoomUser(); if (roomUser != null && User.GetClient().GetHabbo().Username == roomUser.PetData.OwnerName) { Random random = new Random(); string[] value = PetLocale.GetValue("welcome.speech.pet"); string message = value[random.Next(0, checked(value.Length - 1))]; message += User.GetUsername(); roomUser.Chat(null, message, false, 0, 0); } } }
private void PullUser(RoomUser roomuserTarget, RoomUser roomuserSource) { if (roomuserTarget == null) return; Point userSquare = roomuserTarget.Coordinate; Point closestSquare = roomuserTarget.Coordinate; Point a = new Point(userSquare.X, userSquare.Y++); if (CoordinationUtil.GetDistance(closestSquare, a) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate)) closestSquare = a; Point b = new Point(userSquare.X, userSquare.Y--); if (CoordinationUtil.GetDistance(closestSquare, b) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate)) closestSquare = b; Point c = new Point(userSquare.X++, userSquare.Y); if (CoordinationUtil.GetDistance(closestSquare, c) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate)) closestSquare = c; Point d = new Point(userSquare.X--, userSquare.Y++); if (CoordinationUtil.GetDistance(closestSquare, d) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate)) closestSquare = d; Point e = new Point(userSquare.X++, userSquare.Y--); if (CoordinationUtil.GetDistance(closestSquare, e) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate)) closestSquare = e; Point f = new Point(userSquare.X--, userSquare.Y); if (CoordinationUtil.GetDistance(closestSquare, f) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate)) closestSquare = f; roomuserTarget.MoveTo(closestSquare); roomuserSource.Chat(Session, string.Format(LanguageLocale.GetValue("commands.pulluser"), roomuserTarget.GetUsername()), true); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } Room Room; if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if (!Room.CanTradeInRoom) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (Session.GetHabbo().TradingLockExpiry > 0) { if (Session.GetHabbo().TradingLockExpiry > RocketEmulador.GetUnixTimestamp()) { Session.SendNotification("You're currently banned from trading."); return; } else { Session.GetHabbo().TradingLockExpiry = 0; Session.SendNotification("Your trading ban has now expired, please do not scam again."); using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1"); } } } RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByVirtualId(Packet.PopInt()); if (TargetUser == null || TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null) { return; } if (TargetUser.IsTrading) { Session.SendMessage(new TradingErrorComposer(8, TargetUser.GetUsername())); return; } if (!Session.GetHabbo().GetPermissions().HasRight("room_trade_override")) { if (Room.TradeSettings == 1 && Room.OwnerId != Session.GetHabbo().Id)//Owner only. { Session.SendMessage(new TradingErrorComposer(6, TargetUser.GetUsername())); return; } else if (Room.TradeSettings == 0 && Room.OwnerId != Session.GetHabbo().Id)//Trading is disabled. { Session.SendMessage(new TradingErrorComposer(6, TargetUser.GetUsername())); return; } } if (TargetUser.GetClient().GetHabbo().TradingLockExpiry > 0) { Session.SendNotification("Oops, it appears this user is currently banned from trading!"); return; } Room.TryStartTrade(User, TargetUser); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int pId = Packet.PopInt(); bool isConfirmed = Packet.PopBoolean(); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } Item Item = Room.GetRoomItemHandler().GetItem(pId); if (Item == null || Item.GetBaseItem() == null || Item.GetBaseItem().InteractionType != InteractionType.LOVELOCK) { return; } int UserOneId = Item.InteractingUser; int UserTwoId = Item.InteractingUser2; RoomUser UserOne = Room.GetRoomUserManager().GetRoomUserByHabbo(UserOneId); RoomUser UserTwo = Room.GetRoomUserManager().GetRoomUserByHabbo(UserTwoId); if (UserOne == null && UserTwo == null) { Item.InteractingUser = 0; Item.InteractingUser2 = 0; Session.SendNotification("Su pareja ha salido de la sala o ha cancelado sus candados del amor."); return; } else if (UserOne.GetClient() == null || UserTwo.GetClient() == null) { Item.InteractingUser = 0; Item.InteractingUser2 = 0; Session.SendNotification("Su pareja ha salido de la sala o ha cancelado sus candados del amor."); return; } else if (UserOne == null) { UserTwo.CanWalk = true; UserTwo.GetClient().SendNotification("Su pareja ha salido de la sala o ha cancelado sus candados del amor."); UserTwo.LLPartner = 0; Item.InteractingUser = 0; Item.InteractingUser2 = 0; return; } else if (UserTwo == null) { UserOne.CanWalk = true; UserOne.GetClient().SendNotification("Su pareja ha salido de la sala o ha cancelado sus candados del amor."); UserOne.LLPartner = 0; Item.InteractingUser = 0; Item.InteractingUser2 = 0; return; } else if (Item.ExtraData.Contains(Convert.ToChar(5).ToString())) { UserTwo.CanWalk = true; UserTwo.GetClient().SendNotification("Parece que este candado del amor ya ha sido bloqueado."); UserTwo.LLPartner = 0; UserOne.CanWalk = true; UserOne.GetClient().SendNotification("Parece que este candado del amor ya ha sido bloqueado."); UserOne.LLPartner = 0; Item.InteractingUser = 0; Item.InteractingUser2 = 0; return; } else if (!isConfirmed) { Item.InteractingUser = 0; Item.InteractingUser2 = 0; UserOne.LLPartner = 0; UserTwo.LLPartner = 0; UserOne.CanWalk = true; UserTwo.CanWalk = true; return; } else { if (UserOneId == Session.GetHabbo().Id) { Session.SendMessage(new LoveLockDialogueSetLockedMessageComposer(pId)); UserOne.LLPartner = UserTwoId; } else if (UserTwoId == Session.GetHabbo().Id) { Session.SendMessage(new LoveLockDialogueSetLockedMessageComposer(pId)); UserTwo.LLPartner = UserOneId; } if (UserOne.LLPartner == 0 || UserTwo.LLPartner == 0) { return; } else { Item.ExtraData = "1" + (char)5 + UserOne.GetUsername() + (char)5 + UserTwo.GetUsername() + (char)5 + UserOne.GetClient().GetHabbo().Look + (char)5 + UserTwo.GetClient().GetHabbo().Look + (char)5 + DateTime.Now.ToString("dd/MM/yyyy"); Item.InteractingUser = 0; Item.InteractingUser2 = 0; UserOne.LLPartner = 0; UserTwo.LLPartner = 0; Item.UpdateState(true, true); using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE items SET extra_data = @extraData WHERE id = @ID LIMIT 1"); dbClient.AddParameter("extraData", Item.ExtraData); dbClient.AddParameter("ID", Item.Id); dbClient.RunQuery(); } UserOne.GetClient().SendMessage(new LoveLockDialogueCloseMessageComposer(pId)); UserTwo.GetClient().SendMessage(new LoveLockDialogueCloseMessageComposer(pId)); UserOne.CanWalk = true; UserTwo.CanWalk = true; UserOne = null; UserTwo = null; } } }
private bool UserCommand(RoomUser user) { bool Result = false; switch (this.Effet) { case "missioncontais": case "notmissioncontais": { if (!user.IsBot && user.GetClient().GetHabbo().Motto.Contains(Value)) { Result = true; } break; } case "mission": case "notmission": { if (!user.IsBot && user.GetClient().GetHabbo().Motto == Value) { Result = true; } break; } case "favogroupid": case "notfavogroupid": { int GroupId = 0; int.TryParse(Value, out GroupId); if (!user.IsBot && user.GetClient().GetHabbo().FavouriteGroupId == GroupId) { Result = true; } break; } case "usergirl": case "notusergirl": { if (!user.IsBot && user.GetClient().GetHabbo().Gender.ToUpper() == "F") { Result = true; } break; } case "userboy": case "notuserboy": { if (!user.IsBot && user.GetClient().GetHabbo().Gender.ToUpper() == "M") { Result = true; } break; } case "namebot": case "notnamebot": { if (user.IsBot && user.BotData.Name == Value) { Result = true; } break; } case "isbot": case "notisbot": { if (user.IsBot) { Result = true; } break; } case "allowshoot": case "notallowshoot": { if (user.AllowShoot) { Result = true; } break; } case "winteam": case "notwinteam": { if (user.team == Team.none) { break; } Room room = this.item.GetRoom(); if (room == null) { break; } Team winningTeam = room.GetGameManager().getWinningTeam(); if (user.team == winningTeam) { Result = true; } break; } case "freeze": case "notfreeze": { if (user.Freeze) { Result = true; } break; } case "ingame": case "notingame": { if (user.InGame) { Result = true; } break; } case "usertimer": { int Points = 0; int.TryParse(Value, out Points); if (user.UserTimer == Points) { Result = true; } break; } case "usertimerplus": { int Points = 0; int.TryParse(Value, out Points); if (user.UserTimer > Points) { Result = true; } break; } case "usertimermoins": { int Points = 0; int.TryParse(Value, out Points); if (user.UserTimer < Points) { Result = true; } break; } case "point": { int Points = 0; int.TryParse(Value, out Points); if (user.WiredPoints == Points) { Result = true; } break; } case "pointplus": { int Points = 0; int.TryParse(Value, out Points); if (user.WiredPoints > Points) { Result = true; } break; } case "pointmoins": { int Points = 0; int.TryParse(Value, out Points); if (user.WiredPoints < Points) { Result = true; } break; } case "ingroup": case "innotgroup": { int GroupId = 0; int.TryParse(Value, out GroupId); if (GroupId == 0) { break; } if (user.IsBot || user.GetClient() != null && user.GetClient().GetHabbo() != null && user.GetClient().GetHabbo().MyGroups.Contains(GroupId)) { Result = true; } break; } case "userteam": case "usernotteam": { if (user.team != Team.none) { Result = true; } break; } case "sit": case "notsit": { if (user._statusses.ContainsKey("sit")) { Result = true; } break; } case "lay": case "notlay": { if (user._statusses.ContainsKey("lay")) { Result = true; } break; } case "rot": case "notrot": { if (user.RotBody.ToString() == this.Value) { Result = true; } break; } case "transf": case "nottransf": { if (user.transformation) { Result = true; } break; } case "username": case "notusername": { if (user.GetUsername() == this.Value) { Result = true; } break; } case "handitem": case "nothanditem": { if (user.CarryItemID.ToString() == this.Value) { Result = true; } break; } case "badge": case "notbadge": { if (user.IsBot || user.GetClient() == null || user.GetClient().GetHabbo() == null || user.GetClient().GetHabbo().GetBadgeComponent() == null) { break; } if (user.GetClient().GetHabbo().GetBadgeComponent().HasBadge(this.Value)) { Result = true; } break; } case "enable": case "notenable": { if (user.CurrentEffect.ToString() == this.Value) { Result = true; } break; } case "rank": { if (user.IsBot) { break; } if (user.GetClient().GetHabbo().Rank.ToString() == this.Value) { Result = true; } break; } case "rankplus": { if (user.IsBot) { break; } if (user.GetClient().GetHabbo().Rank > Convert.ToInt32(this.Value)) { Result = true; } break; } case "rankmoin": { if (user.IsBot) { break; } if (user.GetClient().GetHabbo().Rank < Convert.ToInt32(this.Value)) { Result = true; } break; } } return(Result); }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Session.GetHabbo().Rank != 6 && Session.GetHabbo().Rank != 8 && Session.GetHabbo().Rank != 9 && Session.GetHabbo().Rank != 11 && Session.GetHabbo().TeamRank != 9) { Session.SendWhisper("No puedes dar premios por que no eres Manager, Game Master o Ayudante de Juego."); return; } if (Params.Length == 1) { Session.SendWhisper("Por favor introduce un nombre de usuario para premiar.", 34); return; } GameClient Target = RavenEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Target == null) { Session.SendWhisper("Oops, No se ha conseguido este usuario " + Params[1] + "!"); return; } RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Target.GetHabbo().Id); if (TargetUser == null) { Session.SendWhisper("Usuario no encontrado! " + Params[1] + " tal vez no esté en línea o en esta sala."); return; } if (Target.GetHabbo().Username == Session.GetHabbo().Username) { Session.SendWhisper("Men no seas estupid@, no puedes premiarte tu mismo!"); return; } Target.SendMessage(RavenEnvironment.GetGame().GetNuxUserGiftsManager().NuxUserGifts.Serialize()); // Notificacion de evento por Andre string figure = Target.GetHabbo().Look; RavenEnvironment.GetGame().GetClientManager().SendMessage(RoomNotificationComposer.SendBubble("fig/" + figure, TargetUser.GetUsername() + " ha ganado un evento en el hotel. Felicitaciones!", "")); Session.SendWhisper("Has activado correctamente el premio para " + Target.GetHabbo().Username, 34); foreach (RoomUser RoomUser in Room.GetRoomUserManager().GetUserList().ToList()) { if (RoomUser == null || RoomUser.IsBot || RoomUser.GetClient() == null || RoomUser.GetClient().GetHabbo() == null || RoomUser.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool") || RoomUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id) { continue; } RoomUser.GetClient().SendNotification("El evento se terminó, muchas gracias por participar, si quieres ganar muchos premios más, participa en otros eventos del hotel."); Room.GetRoomUserManager().RemoveUserFromRoom(RoomUser.GetClient(), true, false); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Por favor, digite o usuário que deseja premiar!"); return; } GameClient Target = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Target == null) { Session.SendWhisper("Opps, não foi possível encontrar esse usuário!"); return; } RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Target.GetHabbo().Id); if (TargetUser == null) { Session.SendWhisper("Usuário não encontrado!"); return; } if (Target.GetHabbo().Username == Session.GetHabbo().Username) { Session.SendWhisper("Você não pode se premiar!"); return; } if (Params.Length != 3) { Session.SendWhisper("Por favor, indique o código do emblema que gostaria de enviar!"); return; } RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) { return; } else { PlusEnvironment.GetGame().GetClientManager().SendPacket(new RoomNotificationComposer("rank", "message", "O usuário " + TargetUser.GetUsername() + " ganhou o evento!")); Target.GetHabbo().Credits = Target.GetHabbo().Credits += 500; Target.SendPacket(new CreditBalanceComposer(Target.GetHabbo().Credits)); if (Session.GetHabbo().Id != Session.GetHabbo().Id) { Target.SendWhisper("Parabéns, você ganhou um evento!"); } Session.SendWhisper("Concedido com sucesso " + 500 + " Creditos ao usuário " + Target.GetHabbo().Username + "!"); Target.SendPacket(new RoomNotificationComposer("goldapple", "message", "Você ganhou " + 500 + " créditos, parabéns " + Target.GetHabbo().Username + "!")); Target.GetHabbo().Duckets += 500; Target.SendPacket(new HabboActivityPointNotificationComposer(Target.GetHabbo().Duckets, 500)); if (Target.GetHabbo().Id != Session.GetHabbo().Id) { Session.SendWhisper("Concedido com sucesso " + 500 + " Duckets ao usuário " + Target.GetHabbo().Username + "!"); } Target.SendPacket(new RoomNotificationComposer("coracao2", "message", "Você ganhou " + 500 + " duckets! parabéns " + Target.GetHabbo().Username + "!")); Target.GetHabbo().Diamonds += 5; Target.SendPacket(new HabboActivityPointNotificationComposer(Target.GetHabbo().Diamonds, 5, 5)); if (Target.GetHabbo().Id != Session.GetHabbo().Id) { Session.SendWhisper("Concedido com sucesso " + 5 + " diamantes ao usuário " + Target.GetHabbo().Username + "!"); } Target.GetHabbo().GOTWPoints = Target.GetHabbo().GOTWPoints + 5; Target.SendPacket(new HabboActivityPointNotificationComposer(Target.GetHabbo().GOTWPoints, 5, 103)); if (Target.GetHabbo().Id != Session.GetHabbo().Id) { Session.SendWhisper("Concedido com sucesso " + 5 + " GOTW point(s) ao " + Target.GetHabbo().Username + "!"); } Target.SendPacket(new RoomNotificationComposer("control", "message", "Você ganhou " + 500 + " GOTW point(s)! parabéns " + Target.GetHabbo().Username + "!")); if (!Target.GetHabbo().GetBadgeComponent().HasBadge(Params[2])) { Target.GetHabbo().GetBadgeComponent().GiveBadge(Params[2], true, Target); if (Target.GetHabbo().Id != Session.GetHabbo().Id) { Target.SendPacket(new RoomNotificationComposer("game", "message", "Você acaba de receber um emblema game!")); } } else { Session.SendWhisper("Opps, esse usuário já possui este emblema (" + Params[2] + ") !"); } foreach (RoomUser RoomUser in Room.GetRoomUserManager().GetUserList().ToList()) { if (RoomUser == null || RoomUser.IsBot || RoomUser.GetClient() == null || RoomUser.GetClient().GetHabbo() == null || RoomUser.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool") || RoomUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id) { continue; } RoomUser.GetClient().SendNotification("Esse evento acaba de ser finalizado, até o próximo!"); Room.GetRoomUserManager().RemoveUserFromRoom(RoomUser.GetClient(), true, false); } Session.SendWhisper("Você deu com sucesso emblema " + Params[2] + "!"); Session.SendWhisper("Todos os usuários foram kikados com sucesso."); Session.SendWhisper("Você acabou de finalizar um evento."); } }
public void Execute(GameClient Session, Room Room, RoomUser UserRoom, string[] Params) { if (Params.Length != 2) { return; } if (!Room.RpRoom || !Room.Pvp) { return; } RolePlayer Rp = UserRoom.Roleplayer; if (Rp == null) { return; } if (Rp.Dead || Rp.SendPrison) { return; } RoomUser TargetRoomUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Params[1].ToString()); if (TargetRoomUser == null) { return; } RolePlayer RpTwo = TargetRoomUser.Roleplayer; if (RpTwo == null) { return; } if (TargetRoomUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id) { return; } if (RpTwo.Dead || RpTwo.SendPrison) { return; } if (RpTwo.SendPrison) { return; } if (Math.Floor((double)((double)RpTwo.Health / (double)RpTwo.HealthMax) * 100) > 75) { UserRoom.OnChat("*Tente d'arrêter " + TargetRoomUser.GetUsername() + "*"); UserRoom.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("rp.prisonnotallowed", Session.Langue)); return; } if (!((Math.Abs((TargetRoomUser.X - UserRoom.X)) >= 2) || (Math.Abs((TargetRoomUser.Y - UserRoom.Y)) >= 2))) { UserRoom.OnChat("*Arrête et envoie en prison " + TargetRoomUser.GetUsername() + "*"); TargetRoomUser.ApplyEffect(729, true); TargetRoomUser.RotBody = 2; TargetRoomUser.RotHead = 2; TargetRoomUser.SetStatus("sit", "0.5"); TargetRoomUser.Freeze = true; TargetRoomUser.FreezeEndCounter = 0; TargetRoomUser.IsSit = true; TargetRoomUser.UpdateNeeded = true; RpTwo.SendPrison = true; RpTwo.PrisonTimer = 10 * 2; } //UserRoom.ApplyEffect(737, true); //UserRoom.TimerResetEffect = 2; if (UserRoom.FreezeEndCounter <= 2) { UserRoom.Freeze = true; UserRoom.FreezeEndCounter = 2; } }