public bool Execute(params object[] stuff) { List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (IWiredItem current in conditions) { if (!current.Execute(null)) { return(false); } WiredHandler.OnEvent(current); } } if (effects.Any()) { foreach (IWiredItem current2 in effects) { foreach (RoomUser current3 in Room.GetRoomUserManager().UserList.Values) { current2.Execute(new object[] { current3, Type }); } WiredHandler.OnEvent(current2); } } WiredHandler.OnEvent(this); return(true); }
public bool OnCycle() { long num = Yupi.Now(); if (_mNext >= num) { return(false); } List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (IWiredItem current in conditions.Where(current => current.Execute())) { WiredHandler.OnEvent(current); } } if (effects.Any()) { foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(null, Type))) { WiredHandler.OnEvent(current2); } } _mNext = Yupi.Now() + Delay; return(false); }
private bool ToggleItems(RoomUser user) { if (disposed) { return(false); } handler.OnEvent(itemID); bool itemTriggered = false; foreach (RoomItem item in items) { if (item == null) { continue; } if (user != null && user.GetClient() != null) { item.Interactor.OnTrigger(user.GetClient(), item, 0, true); } else { item.Interactor.OnTrigger(null, item, 0, true); } itemTriggered = true; } return(itemTriggered); }
private bool ToggleItems(RoomUser user) { if (disposed) { return(false); } handler.OnEvent(item.Id); bool itemTriggered = false; //Logging.WriteLine("serialize action babe!"); foreach (RoomItem i in items) { if (i == null) { continue; } //Logging.WriteLine("do it!"); if (user != null && user.GetClient() != null) { i.Interactor.OnTrigger(user.GetClient(), i, 0, true); } else { i.Interactor.OnTrigger(null, i, 0, true); } itemTriggered = true; } return(itemTriggered); }
public bool Execute(params object[] stuff) { RoomUser roomUser = (RoomUser)stuff[0]; RoomItem roomItem = (RoomItem)stuff[1]; if (roomUser == null || roomItem == null) { return(false); } if (!Items.Contains(roomItem)) { return(false); } _mUsers.Add(roomUser); if (Delay == 0) { WiredHandler.OnEvent(this); OnCycle(); } else { if (_mNext == 0L || _mNext < Yupi.Now()) { _mNext = Yupi.Now() + Delay; } Room.GetWiredHandler().EnqueueCycle(this); } return(true); }
private void roomUserManager_OnUserSays(object sender, UserSaysArgs e, out bool messageHandled) { RoomUser userSaying = e.user; string message = e.message; if ((!isOwnerOnly && canBeTriggered(message)) || (isOwnerOnly && userSaying.IsOwner() && canBeTriggered(message))) { // Send whisper to self ServerMessage servermsg = new ServerMessage(); servermsg.Init(Outgoing.Whisp); servermsg.AppendInt32(userSaying.VirtualID); servermsg.AppendString(message); servermsg.AppendInt32(0); servermsg.AppendInt32(0); servermsg.AppendInt32(-1); userSaying.GetClient().SendMessage(servermsg); handler.RequestStackHandle(item.Coordinate, null, userSaying, Games.Team.none); handler.OnEvent(item.Id); messageHandled = true; } else { messageHandled = false; } }
public bool Execute(params object[] stuff) { List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (IWiredItem current in conditions) { if (!current.Execute(null, Type)) { return(false); } WiredHandler.OnEvent(current); } } if (effects.Any()) { foreach (IWiredItem current2 in effects) { if (current2.Execute(null, Type)) { WiredHandler.OnEvent(current2); } } } WiredHandler.OnEvent(this); return(true); }
public bool Execute(params object[] stuff) { var roomUser = (RoomUser)stuff[0]; var roomItem = (RoomItem)stuff[1]; if (roomUser == null || roomItem == null) { return(false); } if (!this.Items.Contains(roomItem)) { return(false); } this._mUsers.Add(roomUser); if (this.Delay == 0) { WiredHandler.OnEvent(this); this.OnCycle(); } else { if (this._mNext == 0L || this._mNext < Plus.Now()) { this._mNext = (Plus.Now() + (this.Delay)); } Room.GetWiredHandler().EnqueueCycle(this); } return(true); }
public bool Execute(params object[] stuff) { RoomUser roomUser = (RoomUser)stuff[0]; List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (IWiredItem current in conditions) { WiredHandler.OnEvent(current); if (!current.Execute(roomUser)) { return(true); } } } if (!effects.Any()) { return(true); } foreach (IWiredItem wiredItem in effects.Where(wiredItem => wiredItem != null && wiredItem.Type != Interaction.ActionChase && wiredItem.Execute(roomUser, Type))) { WiredHandler.OnEvent(wiredItem); } return(true); }
public bool OnCycle() { var num = Plus.Now(); if (_mNext >= num) { return(false); } var conditions = Room.GetWiredHandler().GetConditions(this); var effects = Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (var current in conditions) { if (!current.Execute(null)) { return(false); } WiredHandler.OnEvent(current); } } if (effects.Any()) { foreach (var current2 in effects) { current2.Execute(null, Type); WiredHandler.OnEvent(current2); } } _mNext = (Plus.Now() + (Delay)); return(false); }
public bool Execute(params object[] stuff) { var roomUser = (RoomUser)stuff[0]; if (!string.IsNullOrEmpty(OtherString) && roomUser.GetUserName() != OtherString && !roomUser.GetClient().GetHabbo().IsTeleporting) { return(false); } var conditions = Room.GetWiredHandler().GetConditions(this); var effects = Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (var current in conditions) { if (!current.Execute(roomUser)) { return(false); } WiredHandler.OnEvent(current); } } if (effects.Any()) { foreach (var current2 in effects.Where(current2 => current2.Execute(roomUser, Type))) { WiredHandler.OnEvent(current2); } } WiredHandler.OnEvent(this); return(true); }
private void gameManager_OnScoreChanged(object sender, TeamScoreChangedArgs e) { if (e.Points > scoreLevel && !used) { used = true; handler.RequestStackHandle(item.Coordinate, null, e.user, e.Team); handler.OnEvent(item.Id); } }
private void roomUserManager_OnUserEnter(object sender, EventArgs e) { RoomUser user = (RoomUser)sender; if ((!user.IsBot && isOneUser && !string.IsNullOrEmpty(userName) && user.GetUsername() == userName) || !isOneUser) { handler.OnEvent(item.Id); handler.RequestStackHandle(item.Coordinate, null, user, Team.none); } }
public bool Execute(params object[] stuff) { RoomUser roomUser = (RoomUser)stuff[0]; foreach (IWiredItem wired in Items.Where(item => item.IsWired).Select(item => Room.GetWiredHandler().GetWired(item)).Where(wired => wired != null)) { WiredHandler.OnEvent(wired); wired.Execute(roomUser, Type); } return(true); }
public bool OnCycle() { cycleCount++; if (cycleCount > cyclesRequired) { handler.RequestStackHandle(item.Coordinate, null, null, Games.Team.none); handler.OnEvent(item.Id); cycleCount = 0; } return(true); }
public bool OnCycle() { long num = Yupi.Now(); if (_mNext >= num) { return(false); } List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = Room.GetWiredHandler().GetEffects(this); foreach (RoomUser current in _mUsers) { if (conditions.Any()) { RoomUser current3 = current; if (current3 == null) { continue; } foreach (IWiredItem current2 in conditions.Where(current2 => current2.Execute(current3))) { WiredHandler.OnEvent(current2); } } if (!effects.Any()) { continue; } RoomUser current1 = current; if (current1 == null) { continue; } foreach (IWiredItem current3 in effects.Where(current3 => current3.Execute(current1, Type))) { WiredHandler.OnEvent(current3); } } WiredHandler.OnEvent(this); _mNext = 0L; return(true); }
public bool Execute(params object[] stuff) { var roomUser = (RoomUser)stuff[0]; if (roomUser == null) { return(false); } int scoreToGet; int.TryParse(this.OtherString, out scoreToGet); if (this.Room.GetGameManager().TeamPoints[(int)roomUser.Team] < scoreToGet) { return(false); } List <IWiredItem> conditions = this.Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = this.Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (IWiredItem current in conditions) { if (!current.Execute(new object[] { roomUser })) { return(false); } WiredHandler.OnEvent(current); } } if (effects.Any()) { foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(new object[] { roomUser, Type }))) { WiredHandler.OnEvent(current2); } } WiredHandler.OnEvent(this); return(true); }
public bool OnCycle() { if (currentCycle > requiredCycles) { if (requestQueue.Count > 0) { lock (requestQueue.SyncRoot) { while (requestQueue.Count > 0) { UserWalksFurniValue obj = (UserWalksFurniValue)requestQueue.Dequeue(); handler.RequestStackHandle(item.Coordinate, obj.item, obj.user, Games.Team.none); } } handler.OnEvent(item.Id); } return(false); } else { currentCycle++; return(true); } }
public bool OnCycle() { if (requiredCycles > currentCycle) { handler.RequestStackHandle(item.Coordinate, null, null, Team.none); handler.OnEvent(item.Id); resetTimer(); return(false); } else { currentCycle++; return(true); } }
private bool HandleItems() { handler.OnEvent(itemID); bool itemHandled = false; foreach (RoomItem item in items) { if (HandleMovement(item)) { itemHandled = true; } } return(itemHandled); }
private void roomUserManager_OnUserSays(object sender, UserSaysArgs e, out bool messageHandled) { RoomUser userSaying = e.user; string message = e.message; if ((!isOwnerOnly && canBeTriggered(message)) || (isOwnerOnly && userSaying.IsOwner() && canBeTriggered(message))) { handler.RequestStackHandle(item.Coordinate, null, userSaying, Games.Team.none); handler.OnEvent(item.Id); messageHandled = true; } else { messageHandled = false; } }
private bool HandleItems() { handler.OnEvent(itemID); bool itemIsMoved = false; foreach (RoomItem item in items) { Point oldCoordinate = item.GetPlacementPosition(); if (roomItemHandler.SetFloorItem(null, item, oldCoordinate.X, oldCoordinate.Y, item.Rot, false, false, true)) { itemIsMoved = true; } } return(itemIsMoved); }
public bool OnCycle() { long num = Plus.Now(); if (num <= this._mNext) { return(false); } lock (this.ToWork.SyncRoot) { while (this.ToWork.Count > 0) { var roomUser = (RoomUser)this.ToWork.Dequeue(); List <IWiredItem> conditions = this.Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = this.Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (IWiredItem current in conditions) { if (!current.Execute(new object[] { roomUser })) { return(false); } WiredHandler.OnEvent(current); } } if (!effects.Any()) { continue; } foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(new object[] { roomUser, Type }))) { WiredHandler.OnEvent(current2); } } } this._mNext = 0L; WiredHandler.OnEvent(this); return(true); }
public bool Handle(RoomUser user, Team team, RoomItem item) { if (user != null && !user.IsBot && user.GetClient() != null) { ServerMessage servermsg = new ServerMessage(); servermsg.Init(25); servermsg.AppendInt32(user.VirtualId); servermsg.AppendStringWithBreak(message); servermsg.AppendBoolean(false); user.GetClient().SendMessage(servermsg); handler.OnEvent(itemID); return(true); } return(false); }
public bool Execute(params object[] stuff) { RoomUser roomUser = (RoomUser)stuff[0]; string text = (string)stuff[1]; if (string.IsNullOrEmpty(OtherString)) { return(false); } if (!string.Equals(text, OtherString, StringComparison.CurrentCultureIgnoreCase)) { return(false); } List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (IWiredItem current in conditions) { WiredHandler.OnEvent(current); if (!current.Execute(roomUser)) { return(true); } } } roomUser.GetClient().SendWhisper(text); if (effects.Any()) { foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(roomUser, Type))) { WiredHandler.OnEvent(current2); } } WiredHandler.OnEvent(this); return(true); }
public bool Handle(RoomUnit unit, Team team, RoomItem item) { RoomUser user = unit as RoomUser; if (user != null && user.GetClient() != null) { ServerMessage servermsg = new ServerMessage(); servermsg.Init(Outgoing.Whisp); servermsg.AppendInt32(user.VirtualID); servermsg.AppendString(message); servermsg.AppendInt32(0); servermsg.AppendInt32(0); servermsg.AppendInt32(-1); user.GetClient().SendMessage(servermsg); handler.OnEvent(itemID); return(true); } return(false); }
public bool OnCycle() { var num = Plus.Now(); if (num <= _mNext) { return(false); } lock (ToWork.SyncRoot) { while (ToWork.Count > 0) { var roomUser = (RoomUser)ToWork.Dequeue(); var conditions = Room.GetWiredHandler().GetConditions(this); var effects = Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (var current in conditions) { if (!current.Execute(roomUser)) { return(false); } WiredHandler.OnEvent(current); } } if (!effects.Any()) { continue; } foreach (var current2 in effects.Where(current2 => current2.Execute(roomUser, Type))) { WiredHandler.OnEvent(current2); } } } _mNext = 0L; WiredHandler.OnEvent(this); return(true); }
public bool Execute(params object[] stuff) { var roomUser = (RoomUser)stuff[0]; if (roomUser == null) { return(false); } List <IWiredItem> conditions = this.Room.GetWiredHandler().GetConditions(this); List <IWiredItem> effects = this.Room.GetWiredHandler().GetEffects(this); if (conditions.Any()) { foreach (IWiredItem current in conditions) { if (!current.Execute(new object[] { roomUser })) { return(false); } WiredHandler.OnEvent(current); } } if (effects.Any()) { foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(new object[] { roomUser, Type }))) { WiredHandler.OnEvent(current2); } } WiredHandler.OnEvent(this); return(true); }
private bool ResetTimers() { handler.OnEvent(itemID); bool itemReset = false; foreach (RoomItem item in items) { if (item.wiredHandler != null) { IWiredTimer timer = item.wiredHandler as IWiredTimer; if (timer == null) { continue; } timer.ResetTimer(); itemReset = true; } } return(itemReset); }
private void onTrigger(ItemTriggeredArgs e) { handler.RequestStackHandle(item.Coordinate, e.TriggeringItem, e.TriggeringUser, Games.Team.none); handler.OnEvent(item.Id); }