internal static void HandleSave(GameClient Session, uint itemID, Room room, ClientMessage clientMessage) { if (room == null || room.GetRoomItemHandler() == null) { return; } var item = room.GetRoomItemHandler().GetItem(itemID); if (item == null) { return; } if (item.wiredHandler != null) { item.wiredHandler.Dispose(); item.wiredHandler = null; } InteractorGenericSwitch.DoAnimation(item); var type = item.GetBaseItem().InteractionType; switch (type) { #region Causantes case InteractionType.triggeronusersay: { var junk = clientMessage.PopWiredInt32(); var isOnlyOwner = (clientMessage.PopWiredInt32() == 1); var message = clientMessage.PopFixedString(); IWiredTrigger handler = new UserSays(item, room.GetWiredHandler(), isOnlyOwner, message, room); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerwalkonfurni: { var junk = clientMessage.PopWiredInt32(); var message = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); IWiredTrigger handler = new WalksOnFurni(item, room.GetWiredHandler(), items); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerwalkofffurni: { var junk = clientMessage.PopWiredInt32(); var message = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); IWiredTrigger handler = new WalksOffFurni(item, room.GetWiredHandler(), items); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggergameend: { IWiredTrigger handler = new GameEnds(item, room.GetWiredHandler(), room.GetGameManager()); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggergamestart: { IWiredTrigger handler = new GameStarts(item, room.GetWiredHandler(), room.GetGameManager()); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggertimer: { var junk = clientMessage.PopWiredInt32(); var cycles = clientMessage.PopWiredInt32(); IWiredTrigger handler = new Timer(item, room.GetWiredHandler(), cycles, room.GetGameManager()); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerrepeater: { var junk = clientMessage.PopWiredInt32(); var cycleTimes = clientMessage.PopWiredInt32(); IWiredTrigger handler = new Repeater(room.GetWiredHandler(), item, cycleTimes); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerroomenter: { var junk = clientMessage.PopWiredInt32(); var users = clientMessage.PopFixedString(); IWiredTrigger handler = new EntersRoom(item, room.GetWiredHandler(), room.GetRoomUserManager(), !string.IsNullOrEmpty(users), users); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerscoreachieved: { var junk = clientMessage.PopWiredInt32(); var score = clientMessage.PopWiredInt32(); IWiredTrigger handler = new ScoreAchieved(item, room.GetWiredHandler(), score, room.GetGameManager()); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerstatechanged: { var junk = clientMessage.PopWiredInt32(); var junk3 = clientMessage.PopWiredBoolean(); var junk2 = clientMessage.PopWiredBoolean(); int furniAmount; var items = GetItems(clientMessage, room, out furniAmount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger handler = new StateChanged(room.GetWiredHandler(), item, items); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggercollision: { IWiredTrigger handler = new Collision(item, room.GetWiredHandler(), room.GetRoomUserManager()); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerlongperiodic: { var junk = clientMessage.PopWiredInt32(); var cycleTimes = clientMessage.PopWiredInt32(); IWiredTrigger handler = new LongRepeater(room.GetWiredHandler(), item, cycleTimes); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerbotreachedavtr: { var junk = clientMessage.PopWiredInt32(); var botname = clientMessage.PopFixedString(); IWiredTrigger handler = new BotAlcanzaUsuario(item, room.GetWiredHandler(), room.GetRoomUserManager(), botname); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.triggerbotreachedstf: { var junk = clientMessage.PopWiredInt32(); var botname = clientMessage.PopFixedString(); int furniAmount; var items = GetItems(clientMessage, room, out furniAmount); IWiredTrigger handler = new BotAlcanzaFurni(item, room.GetWiredHandler(), room.GetRoomUserManager(), items, botname); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } #endregion #region Efectos case InteractionType.actiongivescore: { var junk = clientMessage.PopWiredInt32(); var points = clientMessage.PopWiredInt32(); var games = clientMessage.PopWiredInt32(); IWiredTrigger action = new GiveScore(games, points, room.GetGameManager(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionposreset: { var junk = clientMessage.PopWiredInt32(); var state = clientMessage.PopWiredInt32(); var direction = clientMessage.PopWiredInt32(); var position = clientMessage.PopWiredInt32(); var junk3 = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger action = new PositionReset(items, delay, state + "," + direction + "," + position, new Dictionary <uint, OriginalItemLocation>(), room.GetRoomItemHandler(), room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionresettimer: { var junk = clientMessage.PopWiredInt32(); var junk3 = clientMessage.PopWiredBoolean(); var junk2 = clientMessage.PopWiredBoolean(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger action = new TimerReset(room, room.GetWiredHandler(), delay, item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionshowmessage: { var junk = clientMessage.PopWiredInt32(); var message = OtanixEnvironment.FilterInjectionChars(clientMessage.PopFixedString()); if (BlackWordsManager.Check(message, BlackWordType.Hotel, Session, "<WiredMensaje>")) { message = "Mensaje bloqueado por el filtro bobba."; } IWiredTrigger action = new ShowMessage(message, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionhandiitemcustom: { var junk = clientMessage.PopWiredInt32(); var message = OtanixEnvironment.FilterInjectionChars(clientMessage.PopFixedString()); int valorInteiro; bool inteiroCustom = int.TryParse(message, out valorInteiro); if (inteiroCustom) { IWiredTrigger action = new HandiCustom(message, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); } else { RoomUser usuario = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); usuario.WhisperComposer("Você não pode colocar letras neste wired, apenas números."); } break; } case InteractionType.actioneffectcustom: { var junk = clientMessage.PopWiredInt32(); var message = OtanixEnvironment.FilterInjectionChars(clientMessage.PopFixedString()); int valorInteiro; bool inteiroCustom = int.TryParse(message, out valorInteiro); if (inteiroCustom) { IWiredTrigger action = new EffectCustom(message, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); } else { RoomUser usuario = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); usuario.WhisperComposer("Você não pode colocar letras neste wired, apenas números."); } break; } case InteractionType.actiondiamantescustom: { var junk = clientMessage.PopWiredInt32(); var message = OtanixEnvironment.FilterInjectionChars(clientMessage.PopFixedString()); int valorInteiro; bool inteiroCustom = int.TryParse(message, out valorInteiro); if (inteiroCustom) { IWiredTrigger action = new DiamantesCustom(message, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } else { RoomUser usuario = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); usuario.WhisperComposer("Você não pode colocar letras neste wired, apenas números e hífen (-)."); } break; } case InteractionType.actiondancecustom: { var junk = clientMessage.PopWiredInt32(); var message = OtanixEnvironment.FilterInjectionChars(clientMessage.PopFixedString()); int valorInteiro; bool inteiroCustom = int.TryParse(message, out valorInteiro); if (inteiroCustom) { IWiredTrigger action = new DanceCustom(message, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); } else { RoomUser usuario = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); usuario.WhisperComposer("Você não pode colocar letras neste wired, apenas números."); } break; } case InteractionType.actionfastwalk: { var junk = clientMessage.PopWiredInt32(); var cycleTimes = clientMessage.PopWiredInt32(); IWiredTrigger handler = new FastWalkCustom(room.GetWiredHandler(), item, cycleTimes); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.actionfreezecustom: { var junk = clientMessage.PopWiredInt32(); var cycleTimes = clientMessage.PopWiredInt32(); IWiredTrigger handler = new FreezeCustom(room.GetWiredHandler(), item, cycleTimes); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.actionteleportto: { var junk = clientMessage.PopWiredInt32(); var junk2 = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger action = new TeleportToItem(room.GetGameMap(), room.GetWiredHandler(), items, delay, item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actiontogglestate: { var junk = clientMessage.PopWiredInt32(); var message = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger action = new ToggleItemState(room.GetWiredHandler(), items, delay, item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionmoverotate: { var junk = clientMessage.PopWiredInt32(); var movement = (MovementState)clientMessage.PopWiredInt32(); var rotation = (RotationState)clientMessage.PopWiredInt32(); var junk3 = clientMessage.PopWiredBoolean(); var junk2 = clientMessage.PopWiredBoolean(); var items = GetItems(clientMessage, room, out int furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger handler = new MoveRotate(movement, rotation, items, delay, room, room.GetWiredHandler(), item); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.actiongivereward: { if (!Session.GetHabbo().HasFuse("fuse_wired_rewards")) { Session.SendNotif("No tienes permitido usar este Wired."); break; } var junk = clientMessage.PopWiredInt32(); var often = clientMessage.PopWiredInt32(); var unique = clientMessage.PopWiredInt32(); var limite = clientMessage.PopWiredInt32(); var nInt = clientMessage.PopWiredInt32(); var extrainfo = clientMessage.PopFixedString(); #region Posible Bug? if (extrainfo.Contains(";")) { foreach (var s in extrainfo.Split(';')) { if (s.StartsWith("1")) { string value = s.Split(',')[1]; if (!value.StartsWith("diamonds:") && !value.StartsWith("alert:")) { try { int.Parse(value); } catch { Session.SendNotif("Has intentado poner un item inválido. Recuerda que debes poner el item_id."); return; } } } } } else { if (extrainfo.StartsWith("1")) { string value = extrainfo.Split(',')[1]; if (!value.StartsWith("diamonds:") && !value.StartsWith("alert:")) { try { int.Parse(value); } catch { Session.SendNotif("Has intentado poner un item inválido. Recuerda que debes poner el item_id."); return; } } } } #endregion OtanixEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, "", "WiredReward", "Wired Id: " + item.Id + ", RoomId: " + item.RoomId + "."); IWiredTrigger action = new GiveReward(extrainfo, limite, often, unique, nInt, item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionchase: { var junk = clientMessage.PopWiredInt32(); var junk2 = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger action = new Chase(items, delay, room, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionkickuser: { var junk = clientMessage.PopWiredInt32(); var message = clientMessage.PopFixedString(); IWiredTrigger action = new KickUser(message, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionescape: { var junk = clientMessage.PopWiredInt32(); var junk2 = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger action = new Escape(items, delay, room, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionjointoteam: { var junk = clientMessage.PopWiredInt32(); var teamid = (Team)clientMessage.PopWiredInt32(); IWiredTrigger action = new JoinToTeam(room.GetWiredHandler(), item, teamid); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionleaveteam: { IWiredTrigger action = new LeaveTeam(room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actiongiveteamscore: { var junk = clientMessage.PopWiredInt32(); var points = clientMessage.PopWiredInt32(); var games = clientMessage.PopWiredInt32(); var teamid = (Team)clientMessage.PopWiredInt32(); IWiredTrigger action = new GiveTeamScore(games, points, teamid, room.GetGameManager(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actioncallstacks: { var junk = clientMessage.PopWiredInt32(); var junk2 = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger action = new CallStacks(items, room, room.GetWiredHandler(), item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionmovetodir: { var junk = clientMessage.PopWiredInt32(); var movement = (MovementDirection)clientMessage.PopWiredInt32(); var rotation = (WhenMovementBlock)clientMessage.PopWiredInt32(); var junk3 = clientMessage.PopWiredBoolean(); var junk2 = clientMessage.PopWiredBoolean(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger handler = new MoveToDir(items, movement, rotation, room, room.GetWiredHandler(), item); HandleTriggerSave(handler, room.GetWiredHandler(), room, item); break; } case InteractionType.actionbotmove: { var junk = clientMessage.PopWiredInt32(); var botName = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredUInt(); IWiredTrigger action = new BotMove(item.Id, room, room.GetWiredHandler(), botName, items, delay); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionbotwhisper: { var junk = clientMessage.PopWiredInt32(); bool talkorwhisper = clientMessage.PopWiredInt32() == 1; string message = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); IWiredTrigger action = new BotTalkToUser(item.Id, room, room.GetWiredHandler(), message, talkorwhisper); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionbotteleport: { var junk = clientMessage.PopWiredInt32(); var botName = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredUInt(); IWiredTrigger action = new BotTeleport(item.Id, room, room.GetWiredHandler(), botName, items, delay); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionbotclothes: { int junk = clientMessage.PopWiredInt32(); string message = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredUInt(); IWiredTrigger action = new BotChangeLook(item.Id, room, room.GetWiredHandler(), message, delay); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionbottalk: { var junk = clientMessage.PopWiredInt32(); bool talkorshout = clientMessage.PopWiredInt32() == 1; string message = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredUInt(); IWiredTrigger action = new BotTalkToAll(item.Id, room, room.GetWiredHandler(), message, talkorshout, delay); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionbothanditem: { var junk = clientMessage.PopWiredInt32(); int handitem = clientMessage.PopWiredInt32(); string botname = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredUInt(); IWiredTrigger action = new BotGiveHandItem(item.Id, room, room.GetWiredHandler(), botname, handitem, delay); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionbotfollowavt: { var junk = clientMessage.PopWiredInt32(); bool followorstop = clientMessage.PopWiredInt32() == 1; string botname = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredUInt(); IWiredTrigger action = new BotFollowUser(item.Id, room, room.GetWiredHandler(), botname, followorstop, delay); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionmutetriggerer: { var junk = clientMessage.PopWiredInt32(); uint mutetimer = clientMessage.PopWiredUInt(); string botname = clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredUInt(); IWiredTrigger action = new MuteTriggerer(room.GetWiredHandler(), botname, mutetimer, delay, item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } case InteractionType.actionmovetofurni: { var junk = clientMessage.PopWiredInt32(); int direction = clientMessage.PopWiredInt32(); int length = clientMessage.PopWiredInt32(); clientMessage.PopFixedString(); int furniCount; var items = GetItems(clientMessage, room, out furniCount); var delay = clientMessage.PopWiredInt32(); IWiredTrigger action = new MoveToFurni(room.GetWiredHandler(), items, length, direction, delay, item); HandleTriggerSave(action, room.GetWiredHandler(), room, item); break; } #endregion } Session.SendMessage(new ServerMessage(Outgoing.SaveWired)); }
internal static void LoadWiredItem(RoomItem item, Room room, IQueryAdapter dbClient) { WiredLoaderSQL wired = new WiredLoaderSQL(item, room, dbClient); switch (item.GetBaseItem().InteractionType) { #region Cargar Causantes case InteractionType.triggerroomenter: { IWiredTrigger handler = new EntersRoom(item, room.GetWiredHandler(), room.GetRoomUserManager(), !string.IsNullOrEmpty(wired.StringSettings[0]), wired.StringSettings[0]); HandleItemLoad(handler, item); break; } case InteractionType.triggerwalkonfurni: { IWiredTrigger handler = new WalksOnFurni(item, room.GetWiredHandler(), wired.wiredItems); HandleItemLoad(handler, item); break; } case InteractionType.triggerwalkofffurni: { IWiredTrigger handler = new WalksOffFurni(item, room.GetWiredHandler(), wired.wiredItems); HandleItemLoad(handler, item); break; } case InteractionType.triggergameend: { IWiredTrigger handler = new GameEnds(item, room.GetWiredHandler(), room.GetGameManager()); HandleItemLoad(handler, item); break; } case InteractionType.triggergamestart: { IWiredTrigger handler = new GameStarts(item, room.GetWiredHandler(), room.GetGameManager()); HandleItemLoad(handler, item); break; } case InteractionType.triggertimer: { int time = 50; int.TryParse(wired.StringSettings[0], out time); IWiredTrigger handler = new Timer(item, room.GetWiredHandler(), time, room.GetGameManager()); HandleItemLoad(handler, item); break; } case InteractionType.triggerrepeater: { int time = 50; int.TryParse(wired.StringSettings[0], out time); IWiredTrigger handler = new Repeater(room.GetWiredHandler(), item, time); HandleItemLoad(handler, item); break; } case InteractionType.triggeronusersay: { IWiredTrigger handler = new UserSays(item, room.GetWiredHandler(), ((wired.StringSettings[2] == "true") ? true : false), wired.StringSettings[0], room); HandleItemLoad(handler, item); break; } case InteractionType.triggerscoreachieved: { int score = 0; int.TryParse(wired.StringSettings[0], out score); IWiredTrigger handler = new ScoreAchieved(item, room.GetWiredHandler(), score, room.GetGameManager()); HandleItemLoad(handler, item); break; } case InteractionType.triggerstatechanged: { IWiredTrigger handler = new StateChanged(room.GetWiredHandler(), item, wired.wiredItems); HandleItemLoad(handler, item); break; } case InteractionType.triggercollision: { IWiredTrigger handler = new Collision(item, room.GetWiredHandler(), room.GetRoomUserManager()); HandleItemLoad(handler, item); break; } case InteractionType.triggerlongperiodic: { int time = 10; int.TryParse(wired.StringSettings[0], out time); IWiredTrigger handler = new LongRepeater(room.GetWiredHandler(), item, time); HandleItemLoad(handler, item); break; } case InteractionType.triggerbotreachedavtr: { IWiredTrigger handler = new BotAlcanzaUsuario(item, room.GetWiredHandler(), room.GetRoomUserManager(), wired.StringSettings[0]); HandleItemLoad(handler, item); break; } case InteractionType.triggerbotreachedstf: { IWiredTrigger handler = new BotAlcanzaFurni(item, room.GetWiredHandler(), room.GetRoomUserManager(), wired.wiredItems, wired.StringSettings[0]); HandleItemLoad(handler, item); break; } #endregion #region Cargar Efectos case InteractionType.actiongivescore: { int maxCountPerGame = 1; int.TryParse(wired.StringSettings[1], out maxCountPerGame); int scoreToGive = 10; int.TryParse(wired.StringSettings[0], out scoreToGive); IWiredTrigger action = new GiveScore(maxCountPerGame, scoreToGive, room.GetGameManager(), item); HandleItemLoad(action, item); break; } case InteractionType.actionposreset: { int time = 5; int.TryParse(wired.StringSettings[0], out time); IWiredTrigger action = new PositionReset(wired.wiredItems, time, wired.StringSettings[1], wired.originalPositionList, room.GetRoomItemHandler(), room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actionresettimer: { int time = 5; int.TryParse(wired.StringSettings[0], out time); IWiredTrigger action = new TimerReset(room, room.GetWiredHandler(), time, item); HandleItemLoad(action, item); break; } case InteractionType.actionshowmessage: { IWiredTrigger action = new ShowMessage(wired.StringSettings[0], room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actionhandiitemcustom: { IWiredTrigger action = new HandiCustom(wired.StringSettings[0], room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actioneffectcustom: { IWiredTrigger action = new EffectCustom(wired.StringSettings[0], room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actiondiamantescustom: { IWiredTrigger action = new DiamantesCustom(wired.StringSettings[0], room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actiondancecustom: { IWiredTrigger action = new DanceCustom(wired.StringSettings[0], room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actionfastwalk: { int time = 2; int.TryParse(wired.StringSettings[0], out time); IWiredTrigger action = new FastWalkCustom(room.GetWiredHandler(), item, time); HandleItemLoad(action, item); break; } case InteractionType.actionfreezecustom: { int time = 2; int.TryParse(wired.StringSettings[0], out time); IWiredTrigger action = new FreezeCustom(room.GetWiredHandler(), item, time); HandleItemLoad(action, item); break; } case InteractionType.actionteleportto: { IWiredTrigger action = new TeleportToItem(room.GetGameMap(), room.GetWiredHandler(), wired.wiredItems, 0, item); HandleItemLoad(action, item); break; } case InteractionType.actiontogglestate: { int time = 5; int.TryParse(wired.StringSettings[0], out time); IWiredTrigger action = new ToggleItemState(room.GetWiredHandler(), wired.wiredItems, time, item); HandleItemLoad(action, item); break; } case InteractionType.actionmoverotate: { int time = 5; int.TryParse(wired.StringSettings[0], out time); Console.WriteLine(wired.StringSettings[0]); Console.WriteLine(wired.StringSettings[1]); int movementInt = 0; int rotationInt = 0; if (wired.StringSettings[1].Length > 0 && wired.StringSettings[1].Contains(",")) { int.TryParse(wired.StringSettings[1].Split(',')[0], out movementInt); int.TryParse(wired.StringSettings[1].Split(',')[1], out rotationInt); } IWiredTrigger action = new MoveRotate((MovementState)Convert.ToInt32(movementInt), (RotationState)Convert.ToInt32(rotationInt), wired.wiredItems, time, room, room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actiongivereward: { int Amount = 0; int Type = 0; int AllUsers = 0; int nInt = 1; if (wired.StringSettings[1].Length > 0 && wired.StringSettings[1].Contains(",") && wired.StringSettings[1].Split(',').Length >= 4) { int.TryParse(wired.StringSettings[1].Split(',')[0], out Amount); int.TryParse(wired.StringSettings[1].Split(',')[1], out Type); int.TryParse(wired.StringSettings[1].Split(',')[2], out AllUsers); int.TryParse(wired.StringSettings[1].Split(',')[3], out nInt); } IWiredTrigger action = new GiveReward(wired.StringSettings[0], Amount, Type, AllUsers, nInt, item); HandleItemLoad(action, item); break; } case InteractionType.actionchase: { IWiredTrigger action = new Chase(wired.wiredItems, 0, room, room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actionkickuser: { IWiredTrigger action = new KickUser(wired.StringSettings[0], room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actionescape: { IWiredTrigger action = new Escape(wired.wiredItems, 0, room, room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actionjointoteam: { int teamid = 1; int.TryParse(wired.StringSettings[0], out teamid); IWiredTrigger action = new JoinToTeam(room.GetWiredHandler(), item, (Team)teamid); HandleItemLoad(action, item); break; } case InteractionType.actionleaveteam: { IWiredTrigger action = new LeaveTeam(room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actiongiveteamscore: { int maxCountPerGame = 1; int scoreToGive = 10; if (wired.StringSettings[0].Contains(",")) { int.TryParse(wired.StringSettings[0].Split(',')[1], out maxCountPerGame); int.TryParse(wired.StringSettings[0].Split(',')[0], out scoreToGive); } int teamid = 1; int.TryParse(wired.StringSettings[1], out teamid); IWiredTrigger action = new GiveTeamScore(maxCountPerGame, scoreToGive, (Team)teamid, room.GetGameManager(), item); HandleItemLoad(action, item); break; } case InteractionType.actioncallstacks: { IWiredTrigger action = new CallStacks(wired.wiredItems, room, room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actionmovetodir: { int movementInt = 0; int rotationInt = 0; int.TryParse(wired.StringSettings[0], out movementInt); int.TryParse(wired.StringSettings[1], out rotationInt); IWiredTrigger action = new MoveToDir(wired.wiredItems, (MovementDirection)Convert.ToInt32(movementInt), (WhenMovementBlock)Convert.ToInt32(rotationInt), room, room.GetWiredHandler(), item); HandleItemLoad(action, item); break; } case InteractionType.actionbotmove: { string botName = wired.StringSettings[0]; uint time = 5; uint.TryParse(wired.StringSettings[1], out time); IWiredTrigger action = new BotMove(item.Id, room, room.GetWiredHandler(), botName, wired.wiredItems, time); HandleItemLoad(action, item); break; } case InteractionType.actionbotwhisper: { string message = wired.StringSettings[0]; uint time = 5; uint.TryParse(wired.StringSettings[1], out time); bool talkorwhisper = wired.StringSettings[2].ToLower() == "true"; IWiredTrigger action = new BotTalkToUser(item.Id, room, room.GetWiredHandler(), message, talkorwhisper); HandleItemLoad(action, item); break; } case InteractionType.actionbotteleport: { string message = wired.StringSettings[0]; uint time = 5; uint.TryParse(wired.StringSettings[1], out time); IWiredTrigger action = new BotTeleport(item.Id, room, room.GetWiredHandler(), message, wired.wiredItems, time); HandleItemLoad(action, item); break; } case InteractionType.actionbotclothes: { string message = wired.StringSettings[0]; uint time = 5; uint.TryParse(wired.StringSettings[2], out time); IWiredTrigger action = new BotChangeLook(item.Id, room, room.GetWiredHandler(), message, time); HandleItemLoad(action, item); break; } case InteractionType.actionbottalk: { string message = wired.StringSettings[0]; uint time = 5; uint.TryParse(wired.StringSettings[1], out time); bool talkorwhisper = wired.StringSettings[2].ToLower() == "true"; IWiredTrigger action = new BotTalkToAll(item.Id, room, room.GetWiredHandler(), message, talkorwhisper, time); HandleItemLoad(action, item); break; } case InteractionType.actionbothanditem: { string message = wired.StringSettings[0]; int handitem = 0; int.TryParse(wired.StringSettings[1], out handitem); uint time = 5; uint.TryParse(wired.StringSettings[2], out time); IWiredTrigger action = new BotGiveHandItem(item.Id, room, room.GetWiredHandler(), message, handitem, time); HandleItemLoad(action, item); break; } case InteractionType.actionbotfollowavt: { string botname = wired.StringSettings[0]; uint time = 0; uint.TryParse(wired.StringSettings[1], out time); bool followorstop = wired.StringSettings[2].ToLower() == "true"; IWiredTrigger action = new BotFollowUser(item.Id, room, room.GetWiredHandler(), botname, followorstop, time); HandleItemLoad(action, item); break; } case InteractionType.actionmutetriggerer: { string botname = wired.StringSettings[0]; uint mutetimer = 0; uint.TryParse(wired.StringSettings[1], out mutetimer); uint time = 0; uint.TryParse(wired.StringSettings[2], out time); IWiredTrigger action = new MuteTriggerer(room.GetWiredHandler(), botname, mutetimer, time, item); HandleItemLoad(action, item); break; } case InteractionType.actionmovetofurni: { int length = 0; int.TryParse(wired.StringSettings[0], out length); int direction = 0; int.TryParse(wired.StringSettings[1], out direction); int time = 0; int.TryParse(wired.StringSettings[2], out time); IWiredTrigger action = new MoveToFurni(room.GetWiredHandler(), wired.wiredItems, length, direction, time, item); HandleItemLoad(action, item); break; } #endregion #region Condiciones case InteractionType.conditionfurnishaveusers: { IWiredCondition furniHasUsers = new FurniHasUsers(item, wired.wiredItems); HandleConditionLoad(furniHasUsers, item, room); break; } case InteractionType.conditionhasfurnion: { int hasfurni = 0; int.TryParse(wired.StringSettings[0], out hasfurni); IWiredCondition furniHasFurni = new FurniHasFurni(item, wired.wiredItems, hasfurni); HandleConditionLoad(furniHasFurni, item, room); break; } case InteractionType.conditiontriggeronfurni: { IWiredCondition triggerUserIsOnFurni = new TriggerUserIsOnFurni(item, wired.wiredItems); HandleConditionLoad(triggerUserIsOnFurni, item, room); break; } case InteractionType.conditionstatepos: { IWiredCondition furnistatepos = new FurniStatePosMatch(item, wired.wiredItems, wired.StringSettings[0], wired.originalPositionList); HandleConditionLoad(furnistatepos, item, room); break; } case InteractionType.conditiontimelessthan: { int time = 18; int.TryParse(wired.StringSettings[0], out time); IWiredCondition timeLessThan = new LessThanTimer(time, room, item); HandleConditionLoad(timeLessThan, item, room); break; } case InteractionType.conditiontimemorethan: { int time = 18; int.TryParse(wired.StringSettings[0], out time); IWiredCondition timeMoreThan = new MoreThanTimer(time, room, item); HandleConditionLoad(timeMoreThan, item, room); break; } case InteractionType.conditionactoringroup: { IWiredCondition actionInGroup = new ActorInGroup(room.RoomData.GroupId, item); HandleConditionLoad(actionInGroup, item, room); break; } case InteractionType.conditionactorinteam: { int teamid = 1; int.TryParse(wired.StringSettings[0], out teamid); IWiredCondition actionInGroup = new ActorInTeam((Team)teamid, item); HandleConditionLoad(actionInGroup, item, room); break; } case InteractionType.conditionusercountin: { uint minUsers = 1; uint.TryParse(wired.StringSettings[0], out minUsers); uint maxUsers = 50; uint.TryParse(wired.StringSettings[1], out maxUsers); IWiredCondition userCountIn = new UserCountIn(minUsers, maxUsers, item); HandleConditionLoad(userCountIn, item, room); break; } case InteractionType.conditionstuffis: { IWiredCondition struffIn = new StuffIs(item, wired.wiredItems); HandleConditionLoad(struffIn, item, room); break; } case InteractionType.conditionhandleitemid: { int handleId = 18; int.TryParse(wired.StringSettings[0], out handleId); IWiredCondition handleItem = new HandleItemUser(handleId, item); HandleConditionLoad(handleItem, item, room); break; } case InteractionType.conditionnotfurnishaveusers: { IWiredCondition furniHasUsers = new NotFurniHasUsers(item, wired.wiredItems); HandleConditionLoad(furniHasUsers, item, room); break; } case InteractionType.conditionnotfurnion: { int hasfurni = 0; int.TryParse(wired.StringSettings[0], out hasfurni); IWiredCondition furniHasFurni = new NotFurniHasFurni(item, wired.wiredItems, hasfurni); HandleConditionLoad(furniHasFurni, item, room); break; } case InteractionType.conditionnottriggeronfurni: { IWiredCondition triggerUserIsOnFurni = new NotTriggerUserIsOnFurni(item, wired.wiredItems); HandleConditionLoad(triggerUserIsOnFurni, item, room); break; } case InteractionType.conditionnotstatepos: { IWiredCondition furnistatepos = new NotFurniStatePosMatch(item, wired.wiredItems, wired.StringSettings[0], wired.originalPositionList); HandleConditionLoad(furnistatepos, item, room); break; } case InteractionType.conditionnotingroup: { IWiredCondition actionInGroup = new NotActorInGroup(room.RoomData.GroupId, item); HandleConditionLoad(actionInGroup, item, room); break; } case InteractionType.conditionnotinteam: { int teamid = 1; int.TryParse(wired.StringSettings[0], out teamid); IWiredCondition actionInGroup = new NotActorInTeam((Team)teamid, item); HandleConditionLoad(actionInGroup, item, room); break; } case InteractionType.conditionnotusercount: { uint minUsers = 1; uint.TryParse(wired.StringSettings[0], out minUsers); uint maxUsers = 50; uint.TryParse(wired.StringSettings[1], out maxUsers); IWiredCondition userCountIn = new NotUserCountIn(minUsers, maxUsers, item); HandleConditionLoad(userCountIn, item, room); break; } case InteractionType.conditionnotstuffis: { IWiredCondition struffIn = new NotStuffIs(item, wired.wiredItems); HandleConditionLoad(struffIn, item, room); break; } case InteractionType.conditionwearingeffect: { uint effect = 0; uint.TryParse(wired.StringSettings[0], out effect); IWiredCondition wearingEffect = new UserWearingEffect(effect, item); HandleConditionLoad(wearingEffect, item, room); break; } case InteractionType.conditionnotwearingeffect: { uint effect = 0; uint.TryParse(wired.StringSettings[0], out effect); IWiredCondition notWearingEffect = new UserNotWearingEffect(effect, item); HandleConditionLoad(notWearingEffect, item, room); break; } case InteractionType.conditionwearingbadge: { string badge = wired.StringSettings[0]; IWiredCondition wearingBadge = new UserWearingBadge(badge, item); HandleConditionLoad(wearingBadge, item, room); break; } case InteractionType.conditionnotwearingbadge: { string badge = wired.StringSettings[0]; IWiredCondition notWearingBadge = new UserNotWearingBadge(badge, item); HandleConditionLoad(notWearingBadge, item, room); break; } case InteractionType.conditiondaterange: { int startDate = 0; int.TryParse(wired.StringSettings[0], out startDate); int endDate = 0; int.TryParse(wired.StringSettings[1], out endDate); IWiredCondition dateRangeActive = new DateRangeActive(startDate, endDate, item); HandleConditionLoad(dateRangeActive, item, room); break; } #endregion } }