internal static void HandleConditionSave(uint itemID, Room room, ClientMessage clientMessage) { RoomItem item = room.GetRoomItemHandler().GetItem(itemID); if (item == null) { return; } if (item.wiredHandler != null) { item.wiredHandler.Dispose(); item.wiredHandler = null; } InteractionType type = item.GetBaseItem().InteractionType; if (type != InteractionType.conditionfurnishaveusers && type != InteractionType.conditionstatepos && type != InteractionType.conditiontimelessthan && type != InteractionType.conditiontimemorethan && type != InteractionType.conditiontriggeronfurni) { return; } clientMessage.AdvancePointer(1); bool a = clientMessage.ReadBoolean(); bool b = clientMessage.ReadBoolean(); bool c = clientMessage.ReadBoolean(); clientMessage.AdvancePointer(2); int furniCount; List <RoomItem> items = GetItems(clientMessage, room, out furniCount); IWiredCondition handler = null; switch (type) { case InteractionType.conditionfurnishaveusers: { handler = new FurniHasUser(item, items); break; } case InteractionType.conditionstatepos: { handler = new FurniStatePosMatch(item, items); break; } case InteractionType.conditiontimelessthan: { handler = new LessThanTimer(500, room, item); break; } case InteractionType.conditiontimemorethan: { handler = new MoreThanTimer(500, room, item); break; } case InteractionType.conditiontriggeronfurni: { handler = new TriggerUserIsOnFurni(item, items); break; } default: return; } item.wiredCondition = handler; room.GetWiredHandler().conditionHandler.AddOrIgnoreRefferance(item); using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { handler.SaveToDatabase(dbClient); } }
internal static void HandleConditionSave(GameClient Session, uint itemID, Room room, ClientMessage clientMessage) { // // id, resolveIntParams, resolveStringParam, getStuffIds, resolveStuffSelectionType RoomItem item = room.GetRoomItemHandler().GetItem(itemID); if (item == null) { return; } if (item.wiredCondition != null) { item.wiredCondition.Dispose(); item.wiredCondition = null; } InteractionType type = item.GetBaseItem().InteractionType; if (type != InteractionType.conditionfurnishaveusers && type != InteractionType.conditionstatepos && type != InteractionType.conditiontimelessthan && type != InteractionType.conditiontimemorethan && type != InteractionType.conditiontriggeronfurni) { return; } // Parse data int[] intParams = new int[clientMessage.ReadInt32()]; for (int i = 0; i < intParams.Length; i++) { intParams[i] = clientMessage.ReadInt32(); } string stringParam = clientMessage.ReadString(); int furniCount; List <RoomItem> items = GetItems(clientMessage, room, out furniCount); int stuffSelectionType = clientMessage.ReadInt32(); IWiredCondition handler = null; switch (type) { case InteractionType.conditionfurnishaveusers: { handler = new FurniHasUser(item, items); break; } case InteractionType.conditionstatepos: { handler = new FurniStatePosMatch(item, items); break; } case InteractionType.conditiontimelessthan: { handler = new LessThanTimer(500, room, item); break; } case InteractionType.conditiontimemorethan: { handler = new MoreThanTimer(500, room, item); break; } case InteractionType.conditiontriggeronfurni: { handler = new TriggerUserIsOnFurni(item, items); break; } default: return; } item.wiredCondition = handler; room.GetWiredHandler().conditionHandler.AddOrIgnoreRefferance(item); using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { handler.SaveToDatabase(dbClient); } Session.SendMessage(new ServerMessage(Outgoing.SaveWired)); }