public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { if (!hasRights) return; if (item == null || item.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.Gate) return; var modes = item.GetBaseItem().Modes - 1; if (modes <= 0) item.UpdateState(false, true); if (item.GetRoom() == null || item.GetRoom().GetGameMap() == null || item.GetRoom().GetGameMap().SquareHasUsers(item.X, item.Y)) return; int currentMode; int.TryParse(item.ExtraData, out currentMode); int newMode; if (currentMode <= 0) newMode = 1; else if (currentMode >= modes) newMode = 0; else newMode = currentMode + 1; if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y)) return; item.ExtraData = newMode.ToString(); item.UpdateState(); item.GetRoom().GetGameMap().UpdateMapForItem(item); item.GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item); }
/// <summary> /// Delivers the random pinata item. /// </summary> /// <param name="user">The user.</param> /// <param name="room">The room.</param> /// <param name="item">The item.</param> internal void DeliverRandomPinataItem(RoomUser user, Room room, RoomItem item) { if (room == null || item == null || item.GetBaseItem().InteractionType != Interaction.Pinata || !Pinatas.ContainsKey(item.GetBaseItem().ItemId)) return; PinataItem pinataItem; Pinatas.TryGetValue(item.GetBaseItem().ItemId, out pinataItem); if (pinataItem == null || pinataItem.Rewards.Count < 1) return; item.RefreshItem(); item.BaseItem = pinataItem.Rewards[new Random().Next((pinataItem.Rewards.Count - 1))]; item.ExtraData = string.Empty; room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id, false); using (var queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor()) { queryReactor.RunFastQuery(string.Format("UPDATE items_rooms SET base_item='{0}', extra_data='' WHERE id='{1}'", item.BaseItem, item.Id)); queryReactor.RunQuery(); } if (!room.GetRoomItemHandler().SetFloorItem(user.GetClient(), item, item.X, item.Y, 0, true, false, true)) user.GetClient().GetHabbo().GetInventoryComponent().AddItem(item); }
/// <summary> /// Delivers the random pinata item. /// </summary> /// <param name="user">The user.</param> /// <param name="room">The room.</param> /// <param name="item">The item.</param> internal void DeliverRandomPinataItem(RoomUser user, Room room, RoomItem item) { if (room == null || item == null || item.GetBaseItem().InteractionType != Interaction.Pinata || !Pinatas.ContainsKey(item.GetBaseItem().ItemId)) return; PinataItem pinataItem; Pinatas.TryGetValue(item.GetBaseItem().ItemId, out pinataItem); if (pinataItem == null || pinataItem.Rewards.Count < 1) return; item.RefreshItem(); //@TODO :: KESSILER, now PINATA DOESNT WORK. MUST CREATE SOLUTION LATER. //item.BaseName = pinataItem.Rewards[new Random().Next((pinataItem.Rewards.Count - 1))]; item.ExtraData = string.Empty; room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id, false); using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) queryReactor.RunFastQuery( $"UPDATE items_rooms SET item_name='{item.BaseName}', extra_data='' WHERE id='{item.Id}'"); if (!room.GetRoomItemHandler().SetFloorItem(user.GetClient(), item, item.X, item.Y, 0, true, false, true)) user.GetClient().GetHabbo().GetInventoryComponent().AddItem(item); }
internal static ServerMessage GenerateMessage(RoomItem wiredItem) { ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniConditionEvent); InteractionType type = wiredItem.GetBaseItem().InteractionType; if (NeedsFurni(type)) { message.AddBoolean(true); message.AddInt32(BaseWiredInteractor.MAX_FURNI_SELECTION); List<RoomItem> list; if (wiredItem.wiredCondition != null) { list = wiredItem.wiredCondition.getAffectedItemList(); } else { list = new List<RoomItem>(); } message.AddInt32(list.Count); foreach (RoomItem item2 in list) { message.AddInt32((int)item2.Id); } } else { message.AddBoolean(false); message.AddInt32(0); message.AddInt32(0); } message.AddInt32(wiredItem.GetBaseItem().SpriteId); message.AddInt32((int)wiredItem.Id); message.AddString(""); if (wiredItem.wiredCondition != null && NeedsSettings(type)) { int max = 1; if(type == InteractionType.conditionhasfurnionfurni) { message.AddInt32(1); } else { message.AddInt32(3); max = 3; } string[] settings = (wiredItem.wiredCondition as IWiredSettingsTrigger).GetSettings(); for (int i = 0; i < max; i++) { message.AddInt32(settings[i].ToLower() == "true" ? 1 : 0); } } else { message.AddInt32(0); } message.AddInt32(0); // does nothing, seriously message.AddInt32(GetDialogtype(type)); return (message); }
protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights) { ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniActionEvent); if (Item.wiredHandler != null) { MoveRotate handler = (MoveRotate)Item.wiredHandler; message.AddBoolean(false); message.AddInt32(MAX_FURNI_SELECTION); message.AddInt32(handler.items.Count); foreach (RoomItem item in handler.items) { message.AddInt32((int)item.Id); } message.AddInt32(Item.GetBaseItem().SpriteId); message.AddUInt32(Item.Id); message.AddString(string.Empty); message.AddInt32(2); message.AddInt32((int)handler.movement); message.AddInt32((int)handler.rotation); message.AddInt32(0); message.AddInt32(4); message.AddInt32(handler.delay); message.AddInt32(0); message.AddString(string.Empty); } else { message.AddBoolean(false); message.AddInt32(MAX_FURNI_SELECTION); message.AddInt32(0); message.AddInt32(Item.GetBaseItem().SpriteId); message.AddUInt32(Item.Id); message.AddString(string.Empty); message.AddInt32(2); message.AddInt32(0); message.AddInt32(0); message.AddInt32(0); message.AddInt32(4); message.AddInt32(0); message.AddInt32(0); message.AddString(string.Empty); } Session.SendMessage(message); }
public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights) { checked { int num = Item.GetBaseItem().Modes - 1; if (Session == null || !HasRights || num <= 0 || Item.GetBaseItem().InteractionType == InteractionType.pinata) { return; } CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.FURNI_SWITCH, 0u); int num2 = 0; int.TryParse(Item.ExtraData, out num2); int num3; if (num2 <= 0) { num3 = 1; } else { if (num2 >= num) { num3 = 0; } else { num3 = num2 + 1; } } Item.ExtraData = num3.ToString(); Item.UpdateState(); Item.GetRoom().GetWiredHandler().ExecuteWired(WiredItemType.TriggerToggleFurni, new object[] { Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id), Item }); if (Item.GetBaseItem().StackMultipler) { Room room = Item.GetRoom(); foreach (RoomUser current in room.GetRoomUserManager().UserList.Values) { if (current.Statusses.ContainsKey("sit")) { room.GetRoomUserManager().UpdateUserStatus(current, true); } } } } }
protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights) { ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent); message.AddBoolean(false); message.AddInt32(0); message.AddInt32(0); message.AddInt32(Item.GetBaseItem().SpriteId); message.AddUInt32(Item.Id); if (Item.wiredHandler != null) { EntersRoom handler = (EntersRoom)Item.wiredHandler; if (!string.IsNullOrEmpty(handler.userName)) message.AddString(handler.userName); else message.AddString(string.Empty); } else { message.AddString(string.Empty); } message.AddInt32(0); message.AddInt32(0); message.AddInt32(7); message.AddInt32(0); message.AddString(string.Empty); Session.SendMessage(message); }
void IFurniTrigger.OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { RoomUser User = null; if (Session != null) User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) return; if (!Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y)) { return; } int Modes = (Item.GetBaseItem().Modes - 1); if (Modes < 0) { Modes = 0; } if (Session != null) ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.FURNI_SWITCH); if (!UserHasRights) { return; } if (Modes == 0) { return; } int currentMode = 0; int newMode = 0; try { currentMode = int.Parse(Item.ExtraData); } catch // (Exception e) { //Logging.HandleException(e, "InteractorGenericSwitch.OnTrigger"); } if (currentMode <= 0) { newMode = 1; } else if (currentMode >= Modes) { newMode = 0; } else { newMode = currentMode + 1; } Item.ExtraData = newMode.ToString(); Item.UpdateState(); }
protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights) { ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent); message.AddBoolean(false); message.AddInt32(5); message.AddInt32(0); message.AddInt32(Item.GetBaseItem().SpriteId); message.AddUInt32(Item.Id); message.AddString(string.Empty); message.AddInt32(1); if (Item.wiredHandler != null) { ScoreAchieved handler = (ScoreAchieved)Item.wiredHandler; message.AddInt32(handler.scoreLevel); } else { message.AddInt32(0); } message.AddInt32(0); message.AddInt32(10); message.AddInt32(0); message.AddString(string.Empty); Session.SendMessage(message); }
internal ServerMessage GetServerMessage(ServerMessage message, RoomItem item) { var cracks = 0; var cracks_max = MaxCracks(item.GetBaseItem().Name); if (AzureEmulator.IsNum(item.ExtraData)) cracks = Convert.ToInt16(item.ExtraData); var state = "0"; if (cracks >= cracks_max) state = "14"; else if (cracks >= cracks_max * 6 / 7) state = "12"; else if (cracks >= cracks_max * 5 / 7) state = "10"; else if (cracks >= cracks_max * 4 / 7) state = "8"; else if (cracks >= cracks_max * 3 / 7) state = "6"; else if (cracks >= cracks_max * 2 / 7) state = "4"; else if (cracks >= cracks_max * 1 / 7) state = "2"; message.AppendInteger(7); message.AppendString(state); //state (0-7) message.AppendInteger(cracks); //actual message.AppendInteger(cracks_max); //max return message; }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { ServerMessage message = new ServerMessage(Outgoing.WiredCondition); message.AppendBoolean(false); if (Session.GetHabbo().HasFuse("wired_unlimitedselects")) message.AppendInt32(1000000); else message.AppendInt32(5); message.AppendInt32(0); message.AppendInt32(RoomItem_0.GetBaseItem().Sprite); message.AppendInt32(RoomItem_0.uint_0); message.AppendString(""); message.AppendInt32(2); if (!string.IsNullOrEmpty(RoomItem_0.string_3)) { message.AppendInt32(int.Parse(RoomItem_0.string_3.Split(';')[0])); message.AppendInt32(int.Parse(RoomItem_0.string_3.Split(';')[1])); } else { message.AppendInt32(1); message.AppendInt32(50); } message.AppendBoolean(false); message.AppendInt32(0); message.AppendInt32(1290); Session.SendMessage(message); } }
public override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { if (UserHasRights && Session != null) { Item.method_9(); ServerMessage Message = new ServerMessage(652u); Message.AppendInt32(0); Message.AppendInt32(5); if (Item.string_5.Length > 0) { Message.AppendString(Item.string_5); } else { Message.AppendInt32(0); } Message.AppendInt32(Item.GetBaseItem().Sprite); Message.AppendUInt(Item.uint_0); Message.AppendStringWithBreak(""); Message.AppendString("J"); if (Item.string_3.Length > 0) { Message.AppendString(Item.string_3); } else { Message.AppendString("HHH"); } Session.SendMessage(Message); } }
public override void OnWiredTrigger(RoomItem item) { uint num = item.GetBaseItem().Modes - 1; if (num <= 0) item.UpdateState(false, true); int num2; int.TryParse(item.ExtraData, out num2); int num3; if (num2 <= 0) num3 = 1; else { if (num2 >= num) num3 = 0; else num3 = num2 + 1; } if (num3 == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y)) return; item.ExtraData = num3.ToString(); item.UpdateState(); item.GetRoom().GetGameMap().UpdateMapForItem(item); }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (bool_0) { ServerMessage Message = new ServerMessage(Outgoing.WiredCondition); // Updated Message.AppendBoolean(false); if (Session.GetHabbo().HasFuse("wired_unlimitedselects")) Message.AppendInt32(1000000); else Message.AppendInt32(5); Message.AppendInt32(0); Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite); Message.AppendUInt(RoomItem_0.uint_0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Session.SendMessage(Message); } }
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { if (item.ExtraData == "1" || !item.GetBaseItem().VendingIds.Any() || item.InteractingUser != 0u || session == null) return; var roomUserByHabbo = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); if (roomUserByHabbo == null) return; if (!Gamemap.TilesTouching(roomUserByHabbo.X, roomUserByHabbo.Y, item.X, item.Y)) { roomUserByHabbo.MoveTo(item.SquareInFront); return; } item.InteractingUser = session.GetHabbo().Id; roomUserByHabbo.CanWalk = false; roomUserByHabbo.ClearMovement(); roomUserByHabbo.SetRot(PathFinder.CalculateRotation(roomUserByHabbo.X, roomUserByHabbo.Y, item.X, item.Y)); item.ReqUpdate(2, true); item.ExtraData = "1"; item.UpdateState(false, true); }
internal void OnGateRemove(RoomItem item) { switch (item.GetBaseItem().InteractionType) { case Interaction.FootballGoalGreen: case Interaction.FootballCounterGreen: _room.GetGameManager().RemoveFurnitureFromTeam(item, Team.green); return; case Interaction.FootballGoalYellow: case Interaction.FootballCounterYellow: _room.GetGameManager().RemoveFurnitureFromTeam(item, Team.yellow); return; case Interaction.FootballGoalBlue: case Interaction.FootballCounterBlue: _room.GetGameManager().RemoveFurnitureFromTeam(item, Team.blue); return; case Interaction.FootballGoalRed: case Interaction.FootballCounterRed: _room.GetGameManager().RemoveFurnitureFromTeam(item, Team.red); return; default: return; } }
void IFurniTrigger.OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { if (Item.ExtraData != "1" && Item.GetBaseItem().VendingIds.Count >= 1 && Item.InteractingUser == 0 && Session != null) { RoomUser user = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (user == null) return; if (!Gamemap.TilesTouching(user.X, user.Y, Item.GetX, Item.GetY)) { user.MoveTo(Item.SquareInFront); return; } Item.InteractingUser = Session.GetHabbo().Id; //user.ClearMovement(true); user.SetRot(Rotation.Calculate(user.X, user.Y, Item.GetX, Item.GetY), false); Item.ReqUpdate(2, true); Item.ExtraData = "1"; Item.UpdateState(false, true); } }
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { RoomUser roomUser = null; if (session != null) roomUser = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); if (roomUser == null) return; if (Gamemap.TilesTouching(item.X, item.Y, roomUser.X, roomUser.Y)) { var num = item.GetBaseItem().Modes - 1; int num2, num3; int.TryParse(item.ExtraData, out num2); if (num2 <= 0) num3 = 1; else { if (num2 >= num) num3 = 0; else num3 = num2 + 1; } item.ExtraData = num3.ToString(); item.UpdateState(); item.GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerStateChanged, roomUser, item); return; } roomUser.MoveTo(item.SquareInFront); }
protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights) { ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniActionEvent); message.AddBoolean(false); message.AddInt32(0); message.AddInt32(0); message.AddInt32(Item.GetBaseItem().SpriteId); message.AddUInt32(Item.Id); message.AddString(string.Empty); message.AddInt32(2); if (Item.wiredHandler != null) { GiveScore handler = (GiveScore)Item.wiredHandler; message.AddInt32(handler.scoreToGive); message.AddInt32(handler.maxCountPerGame); } else { message.AddInt32(0); //Points message.AddInt32(0); //Rounds } message.AddInt32(0); message.AddInt32(6); message.AddInt32(0); message.AddInt32(0); message.AddString(string.Empty); Session.SendMessage(message); }
public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights) { int Modes = Item.GetBaseItem().Modes - 1; if (Session == null || !HasRights || Modes <= 0) { return; } SilverwaveEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.FURNI_SWITCH); int CurrentMode = 0; int NewMode = 0; if (!int.TryParse(Item.ExtraData, out CurrentMode)) { } if (CurrentMode <= 0) { NewMode = 1; } else if (CurrentMode >= Modes) { NewMode = 0; } else { NewMode = CurrentMode + 1; } Item.ExtraData = NewMode.ToString(); Item.UpdateState(); Item.GetRoom().GetWiredHandler().ExecuteWired(Rooms.Wired.WiredItemType.TriggerToggleFurni, Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id), Item); if (Item.GetBaseItem().StackMultipler) { Room room = Item.GetRoom(); foreach (RoomUser User in room.GetRoomUserManager().UserList.Values) { if (User.Statusses.ContainsKey("sit")) { room.GetRoomUserManager().UpdateUserStatus(User, true); } } } }
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { if (!hasRights) { return; } if (item?.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.Gate) { return; } uint modes = item.GetBaseItem().Modes - 1; if (modes <= 0) { item.UpdateState(false, true); } if (item.GetRoom() == null || item.GetRoom().GetGameMap() == null || item.GetRoom().GetGameMap().SquareHasUsers(item.X, item.Y)) { return; } int currentMode; int.TryParse(item.ExtraData, out currentMode); int newMode; if (currentMode <= 0) { newMode = 1; } else if (currentMode >= modes) { newMode = 0; } else { newMode = currentMode + 1; } if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y)) { return; } item.ExtraData = newMode.ToString(); item.UpdateState(); item.GetRoom().GetGameMap().UpdateMapForItem(item); item.GetRoom() .GetWiredHandler() .ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item); }
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { Habbo user = session.GetHabbo(); bool ishc = user.Vip; if (!ishc) { ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("CustomUserNotificationMessageComposer")); message.AppendInteger(3); session.SendMessage(message); return; } if (item?.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.HcGate) { return; } uint modes = item.GetBaseItem().Modes - 1; if (modes <= 0) { item.UpdateState(false, true); } int currentMode; int.TryParse(item.ExtraData, out currentMode); int newMode; if (currentMode <= 0) { newMode = 1; } else if (currentMode >= modes) { newMode = 0; } else { newMode = currentMode + 1; } if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y)) { return; } item.ExtraData = newMode.ToString(); item.UpdateState(); item.GetRoom().GetGameMap().UpdateMapForItem(item); item.GetRoom() .GetWiredHandler() .ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item); }
internal static WiredLoaderObject LoadItem(RoomItem item, Room room, IQueryAdapter dbClient) { InteractionType type = item.GetBaseItem().InteractionType; List<RoomItem> items = null; if (NeedsFurnitures(type)) { dbClient.setQuery("SELECT trigger_item FROM wired_to_item WHERE wired_id = " + item.Id); DataTable dTable = dbClient.getTable(); RoomItem targetItem; items = new List<RoomItem>(5); foreach (DataRow dRows in dTable.Rows) { targetItem = room.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0])); if (targetItem == null || items.Contains(targetItem)) { continue; } items.Add(targetItem); } } string[] settings = null; if(HasSettings(type)) { settings = new string[4]; dbClient.setQuery("SELECT data_one, data_two,data_three, data_four FROM wired_data WHERE wired_id = " + item.Id); DataRow dRow = dbClient.getRow(); if (dRow != null) { for (int i = 0; i < 4; i++) { settings[i] = dRow[i].ToString(); } } else { settings = new string[] { "", "", "", "" }; } } Dictionary<uint, OriginalItemLocation> originalPositionList = null; if (HasOriginalItemLocations(type)) { originalPositionList = new Dictionary<uint, OriginalItemLocation>(5); dbClient.setQuery("SELECT item_id, original_x, original_y, rotation, height, extradata FROM wired_original_item_locations WHERE wired_id = " + item.Id); DataTable dTable = dbClient.getTable(); foreach (DataRow dRows in dTable.Rows) { originalPositionList.Add(uint.Parse(dRows[0].ToString()), new OriginalItemLocation(uint.Parse(dRows[0].ToString()), int.Parse(dRows[1].ToString()), int.Parse(dRows[2].ToString()), (double)Convert.ToDecimal(dRows[4]), int.Parse(dRows[3].ToString()), dRows[5].ToString())); } } return new WiredLoaderObject(items, originalPositionList, settings); }
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { Habbo user = session.GetHabbo(); bool ishc = user.Vip; if (!ishc) { ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("CustomUserNotificationMessageComposer")); message.AppendInteger(3); session.SendMessage(message); return; } if (item?.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.HcGate) return; uint modes = item.GetBaseItem().Modes - 1; if (modes <= 0) item.UpdateState(false, true); int currentMode; int.TryParse(item.ExtraData, out currentMode); int newMode; if (currentMode <= 0) newMode = 1; else if (currentMode >= modes) newMode = 0; else newMode = currentMode + 1; if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y)) return; item.ExtraData = newMode.ToString(); item.UpdateState(); item.GetRoom().GetGameMap().UpdateMapForItem(item); item.GetRoom() .GetWiredHandler() .ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item); }
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { if (!hasRights) return; RoomUser user = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); if (user == null) return; Room room = session.GetHabbo().CurrentRoom; if (room == null) return; int effectId = Convert.ToInt32(item.GetBaseItem().Name.Replace("fxbox_fx", "")); try { while (PathFinder.GetDistance(user.X, user.Y, item.X, item.Y) > 1) { if (user.RotBody == 0) { user.MoveTo(item.X, item.Y + 1); } else if (user.RotBody == 2) { user.MoveTo(item.X - 1, item.Y); } else if (user.RotBody == 4) { user.MoveTo(item.X, item.Y - 1); } else if(user.RotBody == 6) { user.MoveTo(item.X + 1, item.Y); } else { user.MoveTo(item.X, item.Y + 1); // Diagonal user... } } } catch (Exception) { } finally { if (user.Coordinate == item.SquareInFront) { session.GetHabbo().GetAvatarEffectsInventoryComponent().AddNewEffect(effectId, -1, 0); session.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(effectId); Thread.Sleep(500); //Wait 0.5 second until remove furniture. (Delay) room.GetRoomItemHandler().RemoveFurniture(session, item.Id, false); using (var queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor()) { queryReactor.RunFastQuery("DELETE FROM items_rooms WHERE id = " + item.Id); } } } }
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { { var num = item.GetBaseItem().Modes - 1; if (session == null || !hasRights || num <= 0 || item.GetBaseItem().InteractionType == Interaction.Pinata) { return; } AzureEmulator.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.FurniSwitch, 0u); int num2; int.TryParse(item.ExtraData, out num2); int num3; if (num2 <= 0) { num3 = 1; } else { if (num2 >= num) { num3 = 0; } else { num3 = num2 + 1; } } item.ExtraData = num3.ToString(); item.UpdateState(); item.GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item); if (!item.GetBaseItem().StackMultipler) { return; } Room room = item.GetRoom(); foreach (RoomUser current in room.GetRoomUserManager().UserList.Values.Where(current => current.Statusses.ContainsKey("sit"))) { room.GetRoomUserManager().UpdateUserStatus(current, true); } } }
internal void DeliverRandomPinataItem(RoomUser User, Room Room, RoomItem Item) { if (Room == null || Item == null || Item.GetBaseItem().InteractionType != InteractionType.pinata || !this.Pinatas.ContainsKey(Item.GetBaseItem().ItemId)) { return; } PinataItem pinataItem; this.Pinatas.TryGetValue(Item.GetBaseItem().ItemId, out pinataItem); if (pinataItem == null || pinataItem.Rewards.Count < 1) { return; } int getX = Item.GetX; int getY = Item.GetY; double getZ = Item.GetZ; Thread.Sleep(900); Item.refreshItem(); Item.BaseItem = pinataItem.Rewards[new Random().Next(checked(pinataItem.Rewards.Count - 1))]; Item.ExtraData = ""; Room.GetRoomItemHandler().RemoveFurniture(User.GetClient(), Item.Id, false); using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "UPDATE items SET base_item = '", Item.BaseItem, "', extra_data = '' WHERE id = ", Item.Id })); queryreactor.runQuery(); } Room.GetRoomItemHandler().SetFloorItem(Item, getX, getY, getZ, 0, false); ServerMessage serverMessage = new ServerMessage(Outgoing.AddFloorItemMessageComposer); Item.Serialize(serverMessage); serverMessage.AppendString(Room.Owner); Room.SendMessage(serverMessage); Room.GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, Item.GetX, Item.GetY, 0, true, false, true); }
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { uint num = item.GetBaseItem().Modes - 1; if (session == null || !hasRights || num <= 0 || item.GetBaseItem().InteractionType == Interaction.Pinata) return; int num2; int.TryParse(item.ExtraData, out num2); int num3; if (num2 <= 0) num3 = 1; else { if (num2 >= num) num3 = 0; else num3 = num2 + 1; } item.ExtraData = num3.ToString(); item.UpdateState(); item.GetRoom() .GetWiredHandler() .ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item); if (!item.GetBaseItem().StackMultipler) return; Room room = item.GetRoom(); foreach ( RoomUser current in room.GetRoomUserManager().UserList.Values.Where(current => current.Statusses.ContainsKey("sit"))) room.GetRoomUserManager().UpdateUserStatus(current, true); }
public override void OnTrigger(GameClients.GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if(bool_0) { int Id = 33; if (RoomItem_0.GetBaseItem().InteractionType == "wf_cnd_hasnot_purse") Id = 34; string currency = "credits"; uint number = 1337; if(RoomItem_0.string_2.Length > 0 && RoomItem_0.string_2.Contains(";")) { currency = RoomItem_0.string_2.Split(';')[0]; number = uint.Parse(RoomItem_0.string_2.Split(';')[1]);} Essential.getWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send(Id+"|" + RoomItem_0.uint_0 + "|" + currency + "|" + number); } }
public void ExecuteAction(RoomItem theItem) { if (theItem.ExtraData == "1") { RoomUser User = theItem.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(theItem.InteractingUser); if (User != null) { User.UnlockWalking(); if (theItem.GetBaseItem().VendingIds.Count > 0) { int randomDrink = theItem.GetBaseItem().VendingIds[ButterflyEnvironment.GetRandomNumber(0, (theItem.GetBaseItem().VendingIds.Count - 1))]; User.CarryItem(randomDrink); } } theItem.InteractingUser = 0; theItem.ExtraData = "0"; theItem.UpdateState(false, true); } }
void IFurniTrigger.OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { string[] extraData = Item.ExtraData.Split(':'); int state = 0; if (extraData.Length > 1) state = TextHandling.ParseInt32(extraData[1]); state++; if (state > Item.GetBaseItem().Modes) state = 0; Item.ExtraData = extraData[0] + ':' + state; Item.UpdateState(); }
public override void OnWiredTrigger(RoomItem item) { uint num = item.GetBaseItem().Modes - 1; if (num == 0) return; int num2; if (!int.TryParse(item.ExtraData, out num2)) return; int num3; if (num2 <= 0) num3 = 1; else { if (num2 >= num) num3 = 0; else num3 = num2 + 1; } item.ExtraData = num3.ToString(); item.UpdateState(); if (!item.GetBaseItem().StackMultipler) return; Room room = item.GetRoom(); foreach ( RoomUser current in room.GetRoomUserManager().UserList.Values.Where(current => current.Statusses.ContainsKey("sit"))) room.GetRoomUserManager().UpdateUserStatus(current, true); }
public bool Execute(params object[] stuff) { if (!Items.Any()) { return(true); } RoomItem lastitem = null; foreach (var current in Items) { if (lastitem == null) { lastitem = current; continue; } if (current.GetBaseItem().InteractionType == Interaction.None || lastitem.GetBaseItem().InteractionType == Interaction.None) { if (current.GetBaseItem().SpriteId == lastitem.GetBaseItem().SpriteId) { return(false); } } else { if (current.GetBaseItem().InteractionType.ToString().StartsWith("banzai") && lastitem.GetBaseItem().InteractionType.ToString().StartsWith("banzai")) { return(false); } if (current.GetBaseItem().InteractionType.ToString().StartsWith("football") && lastitem.GetBaseItem().InteractionType.ToString().StartsWith("football")) { return(false); } if (current.GetBaseItem().InteractionType.ToString().StartsWith("freeze") && lastitem.GetBaseItem().InteractionType.ToString().StartsWith("freeze")) { return(false); } if (current.GetBaseItem().InteractionType == lastitem.GetBaseItem().InteractionType) { return(false); } } } return(true); }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (bool_0) { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); // Updated message.AppendBoolean(false); if (Session.GetHabbo().HasFuse("wired_unlimitedselects")) { message.AppendInt32(1000000); } else { message.AppendInt32(5); } message.AppendInt32(0); message.AppendInt32(RoomItem_0.GetBaseItem().Sprite); message.AppendInt32(RoomItem_0.uint_0); message.AppendString(""); message.AppendInt32(2); if (RoomItem_0.string_2 != "") { message.AppendInt32(int.Parse(RoomItem_0.string_2)); } else { message.AppendInt32(5); } if (RoomItem_0.string_3 != "") { message.AppendInt32(int.Parse(RoomItem_0.string_3)); } else { message.AppendInt32(1); } message.AppendInt32(0); message.AppendInt32(6); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); } }
// ID: 3015 public void GetGuildFurniInfo() { // int (item id), int (group id) int itemID = Request.ReadInt32(); int groupID = Request.ReadInt32(); if (Session.GetHabbo().CurrentRoom == null) { return; } RoomItem item = Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem((uint)itemID); if (item == null || item.data.GetTypeID() != 2 || (item.GetBaseItem().InteractionType != InteractionType.guildgeneric && item.GetBaseItem().InteractionType != InteractionType.guilddoor)) { return; } Group group = FirewindEnvironment.GetGame().GetGroupManager().GetGroup(groupID); if (group == null) { return; } StringArrayStuffData data = item.data as StringArrayStuffData; int actualGroupID; if (!int.TryParse(data.Data[1], out actualGroupID) || groupID != actualGroupID) // data[1] = group id { return; } Response.Init(Outgoing.GuildFurniInfo); // int (item id),int,string,int,bool Response.AppendInt32(itemID); Response.AppendInt32(groupID); Response.AppendString(group.Name); Response.AppendInt32(group.RoomID); Response.AppendBoolean(group.GetMemberType(Session.GetHabbo().Id) > 0); SendResponse(); }
public override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { if (UserHasRights && Session != null) { Item.method_9(); ServerMessage Message = new ServerMessage(651u); Message.AppendInt32(0); Message.AppendInt32(50); if (Item.string_5.Length > 0) { Message.AppendString(Item.string_5); } else { Message.AppendInt32(0); } Message.AppendInt32(Item.GetBaseItem().Sprite); Message.AppendUInt(Item.uint_0); Message.AppendStringWithBreak(""); Message.AppendString("K"); if (Item.string_3.Length > 0) { Message.AppendString(Item.string_3); } else { Message.AppendString("HHH"); } Message.AppendString("IK"); if (Item.string_6.Length > 0) { Message.AppendInt32(Convert.ToInt32(Item.string_6)); } else { Message.AppendInt32(0); } Message.AppendStringWithBreak("H"); Message.AppendInt32(50); Session.SendMessage(Message); } }
public void Handle(GameClient session, ClientMessage message) { Room room = session.GetHabbo().GetRoomSession().GetRoom(); if (room != null && room.HaveOwnerRights(session)) { uint roomId = message.PopWiredUInt(); RoomItem item = room.RoomItemManager.TryGetRoomItem(roomId); if (item != null && item.GetBaseItem().InteractionType.ToLower() == "postit") { room.RoomItemManager.RemoveItem(session, item); using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("itemId", item.ID); dbClient.ExecuteQuery("DELETE FROM items WHERE id = @itemId LIMIT 1"); } } } }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (bool_0) { ServerMessage Message = new ServerMessage(Outgoing.WiredEffect); // Updated Message.AppendBoolean(false); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite); Message.AppendUInt(RoomItem_0.uint_0); Message.AppendStringWithBreak(RoomItem_0.string_2); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(7); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Session.SendMessage(Message); } }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { ServerMessage Message = new ServerMessage(Outgoing.WiredFurniTrigger); // Updated Message.AppendBoolean(false); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite); Message.AppendUInt(RoomItem_0.uint_0); Message.AppendStringWithBreak(RoomItem_0.string_2); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(7); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Session.SendMessage(Message); } }
private void AddFurnitureToItems(RoomItem item) { InteractionType type = item.GetBaseItem().InteractionType; if (!WiredUtillity.TypeIsWired(type)) { return; } if (actionItems.ContainsKey(type)) { ((List <RoomItem>)actionItems[type]).Add(item); } else { List <RoomItem> stack = new List <RoomItem>(); stack.Add(item); actionItems.Add(type, stack); } }
public override void OnTrigger(GameClients.GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (bool_0) { ServerMessage Message = new ServerMessage(Outgoing.WiredEffect); Message.AppendBoolean(true); if (Session.GetHabbo().HasFuse("wired_unlimitedselects")) { Message.AppendInt32(1000000); } else { Message.AppendInt32(5); } if (RoomItem_0.string_2 != "") { Message.AppendInt32(RoomItem_0.string_2.Split(';').Length); string ItemId = ""; foreach (string condstring in RoomItem_0.string_2.Split(';')) { ItemId = condstring.Split(',')[0]; Message.AppendInt32(int.Parse(ItemId)); } } else { Message.AppendInt32(0); } Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite); Message.AppendUInt(RoomItem_0.uint_0); Message.AppendString(RoomItem_0.string_2); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(11); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Session.SendMessage(Message); } }
private void RemoveRoomItem(RoomItem Item) { if (Item.IsWallItem) { ServerMessage Message = new ServerMessage(84); Message.AppendRawUInt(Item.Id); Message.AppendStringWithBreak(""); Message.AppendBoolean(false); room.SendMessage(Message); } else if (Item.IsFloorItem) { ServerMessage Message = new ServerMessage(94); Message.AppendRawUInt(Item.Id); Message.AppendStringWithBreak(""); Message.AppendBoolean(false); room.SendMessage(Message); } if (Item.IsWallItem) { mWallItems.Remove(Item.Id); } else { room.GetGameMap().RemoveFromMap(Item); mFloorItems.Remove(Item.Id); } RemoveItem(Item); room.GetRoomUserManager().UpdateUserStatusses(); if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType)) { room.GetWiredHandler().RemoveWiredItem(Item.Coordinate); } }
public override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { if (UserHasRights && Session != null) { Item.CheckExtraData4(); ServerMessage Message = new ServerMessage(Outgoing.WiredEffect); // Updated Message.AppendBoolean(false); if (Session.GetHabbo().HasFuse("wired_unlimitedselects")) { Message.AppendInt32(1000000); } else { Message.AppendInt32(5); } if (Item.string_4 != "") { Message.AppendInt32(Item.string_4.Split(',').Length); foreach (string ItemId in Item.string_4.Split(',')) { Message.AppendInt32(int.Parse(ItemId)); } } else { Message.AppendInt32(0); } Message.AppendInt32(Item.GetBaseItem().Sprite); Message.AppendUInt(Item.uint_0); Message.AppendStringWithBreak(""); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Session.SendMessage(Message); } }
internal void RemoveFurniture(GameClient Session, uint pId) { RoomItem Item = GetItem(pId); if (Item == null) { return; } if (Item.GetBaseItem().InteractionType == InteractionType.fbgate) { room.GetSoccer().UnRegisterGate(Item); } Item.Interactor.OnRemove(Session, Item); RemoveRoomItem(Item); if (Item.wiredHandler != null) { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { Item.wiredHandler.DeleteFromDatabase(dbClient); Item.wiredHandler.Dispose(); room.GetWiredHandler().RemoveFurniture(Item); } Item.wiredHandler = null; } if (Item.wiredCondition != null) { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { Item.wiredCondition.DeleteFromDatabase(dbClient); Item.wiredCondition.Dispose(); room.GetWiredHandler().conditionHandler.ClearTile(Item.Coordinate); } Item.wiredCondition = null; } }
public override void OnWiredTrigger(RoomItem item) { uint num = item.GetBaseItem().Modes - 1; if (num <= 0) { item.UpdateState(false, true); } int num2; int.TryParse(item.ExtraData, out num2); int num3; if (num2 <= 0) { num3 = 1; } else { if (num2 >= num) { num3 = 0; } else { num3 = num2 + 1; } } if (num3 == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y)) { return; } item.ExtraData = num3.ToString(); item.UpdateState(); item.GetRoom().GetGameMap().UpdateMapForItem(item); }
public override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { if (UserHasRights && Session != null) { Item.method_9(); ServerMessage Message = new ServerMessage(652u); Message.AppendInt32(0); if (Session.GetHabbo().HasFuse("wired_unlimitedselects")) { Message.AppendInt32(50); } else { Message.AppendInt32(5); } if (Item.string_5.Length > 0) { Message.AppendString(Item.string_5); } else { Message.AppendInt32(0); } Message.AppendInt32(Item.GetBaseItem().Sprite); Message.AppendUInt(Item.uint_0); Message.AppendStringWithBreak(""); Message.AppendString("J"); if (Item.string_3.Length > 0) { Message.AppendString(Item.string_3); } else { Message.AppendString("HHH"); } Session.SendMessage(Message); } }
public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights) { if (Item.ExtraData != "1" && Item.GetBaseItem().VendingIds.Count >= 1 && Item.InteractingUser == 0u && Session != null) { RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (roomUserByHabbo == null) { return; } if (!Gamemap.TilesTouching(roomUserByHabbo.X, roomUserByHabbo.Y, Item.GetX, Item.GetY)) { roomUserByHabbo.MoveTo(Item.SquareInFront); return; } Item.InteractingUser = Session.GetHabbo().Id; roomUserByHabbo.CanWalk = false; roomUserByHabbo.ClearMovement(true); roomUserByHabbo.SetRot(PathFinder.CalculateRotation(roomUserByHabbo.X, roomUserByHabbo.Y, Item.GetX, Item.GetY)); Item.ReqUpdate(2, true); Item.ExtraData = "1"; Item.UpdateState(false, true); } }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (bool_0 && Session != null) { RoomItem_0.method_10(); ServerMessage Message = new ServerMessage(652u); Message.AppendInt32(0); Message.AppendInt32(50); if (RoomItem_0.string_2.Length > 0) { Message.AppendString(RoomItem_0.string_2); } else { Message.AppendInt32(0); } Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite); Message.AppendUInt(RoomItem_0.uint_0); Message.AppendStringWithBreak(""); Message.AppendStringWithBreak("HH"); Session.SendMessage(Message); } }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (RoomItem_0.ExtraData != "1" && RoomItem_0.GetBaseItem().VendingIds.Count >= 1 && RoomItem_0.uint_3 == 0u) { if (Session != null) { RoomUser @class = RoomItem_0.method_8().GetRoomUserByHabbo(Session.GetHabbo().Id); if (@class == null) { return; } if (!RoomItem_0.method_8().method_99(@class.X, @class.Y, RoomItem_0.Int32_0, RoomItem_0.Int32_1)) { if ([email protected]_0) { return; } try { @class.MoveTo(RoomItem_0.GStruct1_1); return; } catch { return; } } RoomItem_0.uint_3 = Session.GetHabbo().Id; @class.bool_0 = false; @class.method_3(true); @class.method_9(Class107.smethod_0(@class.X, @class.Y, RoomItem_0.Int32_0, RoomItem_0.Int32_1)); } RoomItem_0.ReqUpdate(2); RoomItem_0.ExtraData = "1"; RoomItem_0.UpdateState(false, true); } }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (RoomItem_0.ExtraData != "1" && RoomItem_0.GetBaseItem().VendingIds.Count >= 1 && RoomItem_0.InteractingUser == 0u) { if (Session != null) { RoomUser @class = RoomItem_0.GetRoom().GetRoomUserByHabbo(Session.GetHabbo().Id); if (@class == null) { return; } if (!RoomItem_0.GetRoom().method_99(@class.X, @class.Y, RoomItem_0.GetX, RoomItem_0.GetY)) { if ([email protected]) { return; } try { @class.MoveTo(RoomItem_0.SquareInFront); return; } catch { return; } } RoomItem_0.InteractingUser = Session.GetHabbo().Id; @class.CanWalk = false; @class.ClearMovement(true); @class.SetRot(Rotation.Calculate(@class.X, @class.Y, RoomItem_0.GetX, RoomItem_0.GetY)); } RoomItem_0.ReqUpdate(2); RoomItem_0.ExtraData = "1"; RoomItem_0.UpdateState(false, true); } }
private void RemoveSpecialItem(RoomItem item) { switch (item.GetBaseItem().InteractionType) { case InteractionType.fbgate: room.GetSoccer().UnRegisterGate(item); break; case InteractionType.banzaifloor: room.GetBanzai().RemoveTile(item.Id); break; case InteractionType.banzaipuck: room.GetBanzai().RemovePuck(item.Id); break; case InteractionType.banzaipyramid: room.GetGameItemHandler().RemovePyramid(item.Id); break; case InteractionType.banzaitele: room.GetGameItemHandler().RemoveTeleport(item.Id); break; case InteractionType.football: room.GetSoccer().RemoveBall(item.Id); break; case InteractionType.freezetile: room.GetFreeze().RemoveFreezeTile(item.Id); break; case InteractionType.freezetileblock: room.GetFreeze().RemoveFreezeBlock(item.Id); break; } }
public void OnWiredTrigger(RoomItem Item) { checked { int num = Item.GetBaseItem().Modes - 1; if (num <= 0) { Item.UpdateState(false, true); } int num2 = 0; int.TryParse(Item.ExtraData, out num2); int num3; if (num2 <= 0) { num3 = 1; } else { if (num2 >= num) { num3 = 0; } else { num3 = num2 + 1; } } if (num3 == 0 && !Item.GetRoom().GetGameMap().itemCanBePlacedHere(Item.GetX, Item.GetY)) { return; } Item.ExtraData = num3.ToString(); Item.UpdateState(); Item.GetRoom().GetGameMap().updateMapForItem(Item); } }
public void parse(GameClient Session, ClientMessage Event) { Event.PopWiredInt32(); Room @class = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (@class != null && @class.CheckRights(Session, true)) { RoomItem class2 = @class.GetItem(Event.PopWiredUInt()); if (class2 != null) { string text = class2.GetBaseItem().InteractionType.ToLower(); if (text == null || !(text == "postit")) { @class.RemoveFurniture(Session, class2.Id, false, true); Session.GetHabbo().GetInventoryComponent().AddItem(class2.Id, class2.BaseItem, class2.ExtraData, false); Session.GetHabbo().GetInventoryComponent().UpdateItems(true); if (Session.GetHabbo().CurrentQuestId == 10u) { PhoenixEnvironment.GetGame().GetQuestManager().ProgressUserQuest(10u, Session); } } } } }
public void Handle(GameClient Session, ClientMessage Event) { Event.PopWiredInt32(); Room @class = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (@class != null && @class.CheckRights(Session, true)) { RoomItem class2 = @class.method_28(Event.PopWiredUInt()); if (class2 != null) { string text = class2.GetBaseItem().InteractionType.ToLower(); if (text == null || !(text == "postit")) { @class.method_29(Session, class2.uint_0, false, true); Session.GetHabbo().method_23().method_11(class2.uint_0, class2.uint_2, class2.ExtraData, false); Session.GetHabbo().method_23().method_9(true); if (Session.GetHabbo().CurrentQuestId == 10u) { GoldTree.GetGame().GetQuestManager().ProgressUserQuest(10u, Session); } } } } }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (bool_0) { ServerMessage Message = new ServerMessage(650u); Message.AppendInt32(0); Message.AppendInt32(5); Message.AppendInt32(0); Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite); Message.AppendUInt(RoomItem_0.uint_0); Message.AppendStringWithBreak(""); Message.AppendString("I"); if (RoomItem_0.string_3.Length > 0) { Message.AppendString(RoomItem_0.string_3); } else { Message.AppendString("PY"); } Message.AppendStringWithBreak("HRBH"); Session.SendMessage(Message); } }
internal void OnCycle() { if (ball != null) { if (ball.ballIsMoving) { if (ball.GetBaseItem().Name == "futebol_rebug") { rebugMove.MoveBallProcess(ball); } else if (ball.GetBaseItem().Name == "futebol_push") { pushMove.MoveBallProcess(ball); } else if (ball.GetBaseItem().Name == "futebol_cloud") { cloudMove.MoveBallProcess(ball); } } } }
public void Handle(GameClient Session, ClientMessage Event) { Room @class = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomItem class2 = @class.method_28(Event.PopWiredUInt()); if (@class != null && class2 != null) { string text = class2.GetBaseItem().InteractionType.ToLower(); if (text != null) { if (!(text == "wf_trg_onsay")) { if (!(text == "wf_trg_enterroom")) { if (!(text == "wf_trg_timer")) { if (!(text == "wf_trg_attime")) { if (text == "wf_trg_atscore") { Event.PopWiredBoolean(); string text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2)); string[] array = text2.Split(new char[] { '@' }); class2.string_3 = array[0]; class2.string_2 = Convert.ToString(Event.PopWiredInt32()); } if (text != null && (text == "wf_cnd_time_more_than" || text == "wf_cnd_time_less_than")) { Event.PopWiredBoolean(); string text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2)); string[] array = text2.Split(new char[] { '@' }); class2.string_3 = array[0]; class2.string_2 = Convert.ToString(Convert.ToString((double)Event.PopWiredInt32() * 0.5)); } } else { Event.PopWiredBoolean(); string text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2)); string[] array = text2.Split(new char[] { '@' }); class2.string_3 = array[0]; class2.string_2 = Convert.ToString(Convert.ToString((double)Event.PopWiredInt32() * 0.5)); } } else { Event.PopWiredBoolean(); string text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2)); string[] array = text2.Split(new char[] { '@' }); class2.string_3 = array[0]; class2.string_2 = Convert.ToString(Convert.ToString((double)Event.PopWiredInt32() * 0.5)); } } else { Event.PopWiredBoolean(); string text3 = Event.PopFixedString(); class2.string_2 = text3; } } else { Event.PopWiredBoolean(); bool value = Event.PopWiredBoolean(); string text3 = Event.PopFixedString(); text3 = GoldTree.DoFilter(text3, false, true); if (text3.Length > 100) { text3 = text3.Substring(0, 100); } class2.string_2 = text3; class2.string_3 = Convert.ToString(value); } } class2.UpdateState(true, false); } }
private bool ConstructMapForItem(RoomItem Item, Point Coord) { try { if (Coord.X > (Model.MapSizeX - 1)) { Model.AddX(); GenerateMaps(); return(false); } if (Coord.Y > (Model.MapSizeY - 1)) { Model.AddY(); GenerateMaps(); return(false); } if (Model.SqState[Coord.X, Coord.Y] == SquareState.BLOCKED) { Model.OpenSquare(Coord.X, Coord.Y, Item.GetZ); Model.SetUpdateState(); } if (mItemHeightMap[Coord.X, Coord.Y] <= Item.TotalHeight) { mItemHeightMap[Coord.X, Coord.Y] = Item.TotalHeight - mDynamicModel.SqFloorHeight[Item.GetX, Item.GetY]; mUserItemEffect[Coord.X, Coord.Y] = 0; switch (Item.GetBaseItem().InteractionType) { case InteractionType.pool: mUserItemEffect[Coord.X, Coord.Y] = 1; break; case InteractionType.normslaskates: mUserItemEffect[Coord.X, Coord.Y] = 2; break; case InteractionType.iceskates: mUserItemEffect[Coord.X, Coord.Y] = 3; break; case InteractionType.lowpool: mUserItemEffect[Coord.X, Coord.Y] = 4; break; case InteractionType.haloweenpool: mUserItemEffect[Coord.X, Coord.Y] = 5; break; } //if (Item.GetBaseItem().InteractionType == Butterfly.HabboHotel.Items.InteractionType.pool) // mUserItemEffect[Coord.X, Coord.Y] = 1; //else if (Item.GetBaseItem().InteractionType == Butterfly.HabboHotel.Items.InteractionType.normslaskates) // mUserItemEffect[Coord.X, Coord.Y] = 2; //else if (Item.GetBaseItem().InteractionType == Butterfly.HabboHotel.Items.InteractionType.iceskates) // mUserItemEffect[Coord.X, Coord.Y] = 3; //else if (Item.GetBaseItem().InteractionType == Butterfly.HabboHotel.Items.InteractionType.lowpool) // mUserItemEffect[Coord.X, Coord.Y] = 4; //SwimHalloween if (Item.GetBaseItem().Walkable)// If this item is walkable and on the floor, allow users to walk here. { if (mGameMap[Coord.X, Coord.Y] != 3) { mGameMap[Coord.X, Coord.Y] = 1; } } else if (Item.GetZ <= (Model.SqFloorHeight[Item.GetX, Item.GetY] + 0.1) && Item.GetBaseItem().InteractionType == Pici.HabboHotel.Items.InteractionType.gate && Item.ExtraData == "1") // If this item is a gate, open, and on the floor, allow users to walk here. { if (mGameMap[Coord.X, Coord.Y] != 3) { mGameMap[Coord.X, Coord.Y] = 1; } } else if (Item.GetBaseItem().IsSeat || Item.GetBaseItem().InteractionType == Pici.HabboHotel.Items.InteractionType.bed) { mGameMap[Coord.X, Coord.Y] = 3; } else // Finally, if it's none of those, block the square. { if (mGameMap[Coord.X, Coord.Y] != 3) { mGameMap[Coord.X, Coord.Y] = 0; } } } // Set bad maps if (Item.GetBaseItem().InteractionType == Pici.HabboHotel.Items.InteractionType.bed) { mGameMap[Coord.X, Coord.Y] = 3; } } catch (Exception e) { Logging.LogException("Error during map generation for room " + room.RoomId + ". Exception: " + e.ToString()); //Console.WriteLine("Mapsize X: " + mItemHeightMap.GetUpperBound(0) + "Mapsize Y: " + mItemHeightMap.GetUpperBound(1)); //Console.WriteLine("Original mapsize: " + Model.MapSizeX + "Mapsize Y: " + Model.MapSizeY); //Console.WriteLine("Coord X: " + Coord.X + " Y: " + Coord.Y); } return(true); }
internal bool AddItemToMap(RoomItem Item, bool handleGameItem) { if (handleGameItem) { if (room.GotWired() && WiredUtillity.TypeIsWired(Item.GetBaseItem().InteractionType)) { room.GetWiredHandler().AddFurniture(Item); } AddSpecialItems(Item); switch (Item.GetBaseItem().InteractionType) { case InteractionType.footballgoalred: case InteractionType.footballcounterred: case InteractionType.banzaiscorered: case InteractionType.freezeredcounter: case InteractionType.freezeredgate: { room.GetGameManager().AddFurnitureToTeam(Item, Games.Team.red); break; } case InteractionType.footballgoalgreen: case InteractionType.footballcountergreen: case InteractionType.banzaiscoregreen: case InteractionType.freezegreencounter: case InteractionType.freezegreengate: { room.GetGameManager().AddFurnitureToTeam(Item, Games.Team.green); break; } case InteractionType.footballgoalblue: case InteractionType.footballcounterblue: case InteractionType.banzaiscoreblue: case InteractionType.freezebluecounter: case InteractionType.freezebluegate: { room.GetGameManager().AddFurnitureToTeam(Item, Games.Team.blue); break; } case InteractionType.footballgoalyellow: case InteractionType.footballcounteryellow: case InteractionType.banzaiscoreyellow: case InteractionType.freezeyellowcounter: case InteractionType.freezeyellowgate: { room.GetGameManager().AddFurnitureToTeam(Item, Games.Team.yellow); break; } case InteractionType.freezeexit: { room.GetFreeze().ExitTeleport = Item; break; } case InteractionType.roller: { if (!room.GetRoomItemHandler().mRollers.ContainsKey(Item.Id)) { room.GetRoomItemHandler().mRollers.Add(Item.Id, Item); } break; } } } if (Item.GetBaseItem().Type != 's') { return(true); } foreach (Point coord in Item.GetCoords) { Point point = new Point(coord.X, coord.Y); AddCoordinatedItem(Item, point); } if (Item.GetX > (Model.MapSizeX - 1)) { Model.AddX(); GenerateMaps(); return(false); } if (Item.GetY > (Model.MapSizeY - 1)) { Model.AddY(); GenerateMaps(); return(false); } foreach (Point coord in Item.GetCoords) { if (!ConstructMapForItem(Item, coord)) { return(false); } } return(true); }
private void AddSpecialItems(RoomItem item) { switch (item.GetBaseItem().InteractionType) { case InteractionType.fbgate: //IsTrans = true; room.GetSoccer().RegisterGate(item); string[] splittedExtraData = item.ExtraData.Split(':'); if (string.IsNullOrEmpty(item.ExtraData) || splittedExtraData.Length <= 1) { item.Gender = "M"; switch (item.team) { case Team.yellow: item.Figure = "lg-275-93.hr-115-61.hd-207-14.ch-265-93.sh-305-62"; break; case Team.red: item.Figure = "lg-275-96.hr-115-61.hd-180-3.ch-265-96.sh-305-62"; break; case Team.green: item.Figure = "lg-275-102.hr-115-61.hd-180-3.ch-265-102.sh-305-62"; break; case Team.blue: item.Figure = "lg-275-108.hr-115-61.hd-180-3.ch-265-108.sh-305-62"; break; } } else { item.Gender = splittedExtraData[0]; item.Figure = splittedExtraData[1]; } break; case InteractionType.banzaifloor: { room.GetBanzai().AddTile(item, item.Id); break; } case InteractionType.banzaipyramid: { room.GetGameItemHandler().AddPyramid(item, item.Id); break; } case InteractionType.banzaitele: { room.GetGameItemHandler().AddTeleport(item, item.Id); item.ExtraData = ""; break; } case InteractionType.banzaipuck: { room.GetBanzai().AddPuck(item); break; } case InteractionType.football: { room.GetSoccer().AddBall(item); break; } case InteractionType.freezetileblock: { room.GetFreeze().AddFreezeBlock(item); break; } case InteractionType.freezetile: { room.GetFreeze().AddFreezeTile(item); break; } case InteractionType.freezeexit: { RoomItem _item = room.GetFreeze().ExitTeleport; if (_item == null) { break; } if (item.Id == _item.Id) { room.GetFreeze().ExitTeleport = null; } break; } } }