internal override bool OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights) { if (Session == null || Item == null) return false; if (!UserHasRights) return false; String ExtraInfo = ""; List<RoomItem> items = new List<RoomItem>(); using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { try { dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id "); dbClient.addParameter("id", (int)Item.Id); ExtraInfo = dbClient.getString(); } catch { } try { dbClient.setQuery("SELECT triggers_item FROM trigger_in_place WHERE original_trigger = @id"); dbClient.addParameter("id", (int)Item.Id); DataTable dTable = dbClient.getTable(); RoomItem targetItem; foreach (DataRow dRows in dTable.Rows) { targetItem = Item.GetRoom().GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0])); if (targetItem == null || items.Contains(targetItem)) continue; items.Add(targetItem); } } catch { } } switch (Item.GetBaseItem().InteractionType) { #region Triggers case InteractionType.triggerwalkonfurni: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); // stuffTypeSelectionEnabled message.AppendInt32(5); // furniLimit message.AppendInt32(items.Count); //stuffIds foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); // stuffTypeId message.AppendUInt(Item.Id); // id message.AppendString(ExtraInfo); // stringParam message.AppendInt32(0); // intParams message.AppendInt32(8); // type message.AppendInt32(0); // delayInPulses message.AppendInt32(0); // conflictingTriggers message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggergamestart: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(0); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(8); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggerroomenter: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(0); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(7); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggergameend: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(0); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(8); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggertimer: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(1); message.AppendInt32(1); message.AppendInt32(1); message.AppendInt32(3); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggerwalkofffurni: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(8); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggeronusersay: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(0); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggerscoreachieved: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(1); message.AppendInt32(100); message.AppendInt32(0); message.AppendInt32(10); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggerrepeater: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(1); message.AppendInt32(10); message.AppendInt32(0); message.AppendInt32(6); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.triggerstatechanged: { ServerMessage message = new ServerMessage(Outgoing.WiredFurniTrigger); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(8); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } #endregion #region Effects case InteractionType.actionposreset: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.actiongivescore: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(2); message.AppendInt32(5); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(6); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.actionresettimer: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.actiontogglestate: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(8); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.actionshowmessage: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(0); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(7); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.actionteleportto: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(8); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendByte(2); Session.SendMessage(message); break; } case InteractionType.actionmoverotate: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(2); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(4); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } #endregion #region Add-ons case InteractionType.specialrandom: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(8); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.specialunseen: { ServerMessage message = new ServerMessage(Outgoing.WiredEffect); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendString(ExtraInfo); message.AppendInt32(0); message.AppendInt32(8); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } #endregion #region Conditions case InteractionType.conditiontimelessthan: case InteractionType.conditiontimemorethan: { ServerMessage message = new ServerMessage(Outgoing.WiredCondition); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); //message.AppendBoolean(false); //message.AppendBoolean(false); //message.AppendInt32(7); //message.AppendBoolean(false); //message.AppendBoolean(false); Session.SendMessage(message); break; } case InteractionType.conditionfurnishaveusers: { ServerMessage message = new ServerMessage(Outgoing.WiredCondition); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(1); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.conditionstatepos: { ServerMessage message = new ServerMessage(Outgoing.WiredCondition); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(1); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } case InteractionType.conditiontriggeronfurni: { ServerMessage message = new ServerMessage(Outgoing.WiredCondition); message.AppendBoolean(false); message.AppendInt32(5); message.AppendInt32(items.Count); foreach (RoomItem item in items) message.AppendUInt(item.Id); message.AppendInt32(Item.GetBaseItem().SpriteId); message.AppendUInt(Item.Id); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); Session.SendMessage(message); break; } //Unknown: //2 radio + 5 selct #endregion } return true; }