internal void UserWalksOffFurni(RoomUnit unit) { if (OnUserWalksOffFurni != null) { OnUserWalksOffFurni(this, new UnitWalksOnArgs(unit)); } }
public bool OnCycle() { if (disposed) { return(false); } cycles++; if (cycles > delay) { if (delayedTriggeringUsers.Count > 0) { lock (delayedTriggeringUsers.SyncRoot) { while (delayedTriggeringUsers.Count > 0) { RoomUnit unit = (RoomUnit)delayedTriggeringUsers.Dequeue(); ToggleItems(unit); } } } return(false); } return(true); }
private bool ToggleItems(RoomUnit unit) { RoomUser user = unit as RoomUser; if (disposed || user == null) { 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 (unit != null && user.GetClient() != null) { i.Interactor.OnTrigger(user.GetClient(), i, 0, true); } else { i.Interactor.OnTrigger(null, i, 0, true); } itemTriggered = true; } return(itemTriggered); }
internal void OnTrigger(RoomUnit unit) { if (itemTriggerEventHandler != null) { itemTriggerEventHandler(null, new ItemTriggeredArgs(unit, this)); } }
public void Handle(GameClient session, ClientMessage message) { if (session != null && session.GetHabbo() != null) { RoomUnit roomUser = session.GetHabbo().GetRoomSession().GetRoomUser(); if (roomUser != null) { string motto = TextUtilies.FilterString(message.PopFixedString()); if (!TextUtilies.HaveBlacklistedWords(motto)) { session.GetHabbo().Motto = motto; using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("userId", session.GetHabbo().ID); dbClient.AddParamWithValue("motto", motto); dbClient.ExecuteQuery("UPDATE users SET motto = @motto WHERE id = @userId LIMIT 1"); if (session.GetHabbo().GetUserSettings().FriendStream) { dbClient.ExecuteQuery("INSERT INTO user_friend_stream(type, user_id, timestamp, extra_data) VALUES('3', @userId, UNIX_TIMESTAMP(), @motto)"); } } session.SendMessage(OutgoingPacketsEnum.UpdateUser, new ValueHolder("VirtualID", -1, "Look", session.GetHabbo().Look, "Gender", session.GetHabbo().Gender, "Motto", session.GetHabbo().Motto, "AchievementPoints", session.GetHabbo().GetUserStats().AchievementPoints)); roomUser.Room.SendToAll(OutgoingPacketsEnum.UpdateUser, new ValueHolder("VirtualID", roomUser.VirtualID, "Look", session.GetHabbo().Look, "Gender", session.GetHabbo().Gender, "Motto", session.GetHabbo().Motto, "AchievementPoints", session.GetHabbo().GetUserStats().AchievementPoints)); Skylight.GetGame().GetAchievementManager().AddAchievement(session, "ChangeMotto", 1); } } } }
internal void RemoveUnitFromMap(RoomUnit unit, Point coord) { if (_unitMap.ContainsKey(coord)) { ((List <RoomUnit>)_unitMap[coord]).Remove(unit); } }
public override bool OnUse(GameClient session, string[] args) { RoomUnit user = session.GetHabbo().GetRoomSession().GetRoomUser(); session.SendNotif("X: " + user.X + "\nY: " + user.Y + "\nZ: " + user.Z + "\nRotation: " + user.HeadRotation); return(true); }
private bool TeleportUser(RoomUnit unit) { RoomUser user = unit as RoomUser; if (user == null || disposed) { return(false); } if (items.Count > 1) { int toTest = 0; RoomItem item; for (int i = 0; i < items.Count; i++) { toTest = rnd.Next(0, items.Count); item = items[toTest]; if (item.Coordinate != unit.Coordinate) { gamemap.TeleportToItem(user, item); user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(0); return(true); } } } else if (items.Count == 1) { gamemap.TeleportToItem(user, items.First()); user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(0); return(true); } return(false); }
internal ServerMessage UpdateUnitOnRoller(RoomUnit unit, Point pNextCoord, uint pRollerID, Double NextZ) { ServerMessage mMessage = new ServerMessage(0); mMessage.Init(Outgoing.ObjectOnRoller); // Cf mMessage.AppendInt32(unit.X); mMessage.AppendInt32(unit.Y); mMessage.AppendInt32(pNextCoord.X); mMessage.AppendInt32(pNextCoord.Y); mMessage.AppendInt32(0); mMessage.AppendUInt(pRollerID); mMessage.AppendInt32(2); mMessage.AppendInt32(unit.VirtualID); mMessage.AppendString(TextHandling.GetString(unit.Z)); mMessage.AppendString(TextHandling.GetString(NextZ)); room.GetGameMap().UpdateUnitMovement(new Point(unit.X, unit.Y), new Point(pNextCoord.X, pNextCoord.Y), unit); room.GetGameMap().Map[unit.X, unit.Y] = 1; unit.X = pNextCoord.X; unit.Y = pNextCoord.Y; unit.Z = NextZ; room.GetGameMap().Map[unit.X, unit.Y] = 0; return(mMessage); }
public bool AllowsExecution(RoomUnit unit) { if (room.lastTimerReset == null) return false; TimeSpan sinceTimerReset = DateTime.Now - room.lastTimerReset; return (sinceTimerReset.TotalSeconds < timeout); }
public bool AllowsExecution(RoomUnit unit) { foreach (RoomItem item in items) { if (item.Coordinate == unit.Coordinate) return true; } return false; }
public void Handle(GameClient session, ClientMessage message) { if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession() != null) { RoomUnit user = session.GetHabbo().GetRoomSession().GetRoomUser(); if (user != null && user.Room != null) { uint itemId = message.PopWiredUInt(); RoomItem item = user.Room.RoomItemManager.TryGetRoomItem(itemId); if (item != null) { if (item.GetBaseItem().ItemName.StartsWith("CF_") || item.GetBaseItem().ItemName.StartsWith("CFC_") || item.GetBaseItem().ItemName.StartsWith("PixEx_") || item.GetBaseItem().ItemName.StartsWith("PntEx_")) { user.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"); } string[] array = item.GetBaseItem().ItemName.Split(new char[] { '_' }); if (!item.GetBaseItem().ItemName.StartsWith("PntEx_")) { int value = int.Parse(array[1]); if (item.GetBaseItem().ItemName.StartsWith("CF_") || item.GetBaseItem().ItemName.StartsWith("CFC_")) { session.GetHabbo().Credits += value; session.GetHabbo().UpdateCredits(true); } else { if (item.GetBaseItem().ItemName.StartsWith("PixEx_")) { session.GetHabbo().AddActivityPoints(0, value); session.GetHabbo().UpdateActivityPoints(0, true); } } } else //point excahange { int key = int.Parse(array[1]); int value = int.Parse(array[2]); session.GetHabbo().AddActivityPoints(key, value); session.GetHabbo().UpdateActivityPoints(key, true); } } } } } }
public bool AllowsExecution(RoomUnit unit) { foreach (RoomItem item in items) { if (item.data != item.originalExtraData || item.Coordinate != item.GetPlacementPosition()) return false; } return true; }
public void ComputeDisplay() { Clean(); foreach (Player player in PhotonNetwork.CurrentRoom.Players.Values) { RoomUnit unit = Instantiate(ru, target); allObjects.Add(unit); unit.SetText(player.NickName); } }
public void UserWalkOff(RoomUnit unit) { if (unit.IsRealUser && unit is RoomUnitUser user) { if (this.Type == "pool_exit" || this.Type == "ws_right" || this.Type == "ws_left") { user.Override = false; } } }
internal void RemoveRoomUnit(RoomUnit unit) { UnitList.Remove(unit.VirtualID); room.GetGameMap().Map[unit.X, unit.Y] = unit.SqState; room.GetGameMap().RemoveUnitFromMap(unit, new Point(unit.X, unit.Y)); ServerMessage LeaveMessage = new ServerMessage(Outgoing.UserLeftRoom); LeaveMessage.AppendString(unit.VirtualID.ToString()); room.SendMessage(LeaveMessage); }
public void Handle(GameClient session, ClientMessage message) { if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession() != null) { RoomUnit user = session.GetHabbo().GetRoomSession().CurrentRoomRoomUser; if (user != null && user.Room != null) { user.Room.SendToAll(new MultiRevisionServerMessage(OutgoingPacketsEnum.TypingStatus, new ValueHolder().AddValue("VirtualID", user.VirtualID).AddValue("Typing", false))); } } }
public bool AllowsExecution(RoomUnit unit) { if (room.lastTimerReset == null) { return(false); } TimeSpan sinceTimerReset = DateTime.Now - room.lastTimerReset; return(sinceTimerReset.TotalSeconds > timeout); }
public override void Init() { base.Init(); foreach (Player plyr in PhotonNetwork.CurrentRoom.Players.Values.OrderByDescending(x => x.CustomProperties["Score"])) { RoomUnit ru = Instantiate(prefab, trsf); ru.SetText(plyr.NickName + " : " + plyr.CustomProperties["Score"]); allRoomUnit.Add(ru); } StartCoroutine(Restart()); }
public bool AllowsExecution(RoomUnit unit) { foreach (RoomItem item in items) { if (item.Coordinate == unit.Coordinate) { return(true); } } return(false); }
/// <summary> /// Called when an unit is removed from UnitList dictionary. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void UnitList_onRemove(object sender, EventArgs args) { try { KeyValuePair <int, RoomUnit> removedPair = (KeyValuePair <int, RoomUnit>)sender; RoomUnit unit = removedPair.Value; RoomUser user = unit as RoomUser; if (user == null) { return; } GameClient session = user.GetClient(); int key = removedPair.Key; //freeIDs[key] = null; // make sure to bring any pets the user might have left List <PetBot> petsToRemove = new List <PetBot>(); foreach (RoomUnit unit2 in UnitList.Values) { RoomAI bot = unit2 as RoomAI; if (bot == null) { continue; } bot.BaseAI.OnUserLeaveRoom(session); PetBot pet = bot as PetBot; if (pet != null && pet.OwnerID == user.ID) { petsToRemove.Add(pet); } } foreach (PetBot toRemove in petsToRemove) { if (user.GetClient() == null || user.GetClient().GetHabbo() == null || user.GetClient().GetHabbo().GetInventoryComponent() == null) { continue; } user.GetClient().GetHabbo().GetInventoryComponent().AddPet(toRemove.PetData); RemoveRoomUnit(toRemove); } } catch (Exception e) { Logging.LogCriticalException(e.ToString()); } }
public void Handle(GameClient session, ClientMessage message) { RoomUnit user = session.GetHabbo().GetRoomSession().GetRoomUser(); if (!user.HasStatus("lay")) { if (user.BodyRotation == 0 || user.BodyRotation == 2 || user.BodyRotation == 4 || user.BodyRotation == 6) { user.AddStatus("sit", TextUtilies.DoubleWithDotDecimal((user.Z + 1) / 2 - user.Z * 0.5)); } } }
public bool AllowsExecution(RoomUnit unit) { foreach (RoomItem item in items) { if (item.data != item.originalExtraData || item.Coordinate != item.GetPlacementPosition()) { return(false); } } return(true); }
public bool Handle(RoomUnit unit, Team team, RoomItem item) { cycles = 0; if (delay == 0) { return HandleItems(); } else { handler.RequestCycle(this); } return false; }
public bool Handle(RoomUnit unit, Team team, RoomItem item) { RoomUser user = unit as RoomUser; if (user != null && team != Team.none && maxCountPerGame > currentGameCount) { currentGameCount++; gameManager.AddPointToTeam(team, scoreToGive, user); gameManager.GetRoom().GetWiredHandler().OnEvent(itemID); return true; } return false; }
public bool Handle(RoomUnit unit, Team team, RoomItem item) { cycles = 0; if (delay == 0) { return(HandleItems()); } else { handler.RequestCycle(this); } return(false); }
internal void AddUnitToMap(RoomUnit unit, Point coord) { if (_unitMap.ContainsKey(coord)) { ((List <RoomUnit>)_unitMap[coord]).Add(unit); } else { List <RoomUnit> units = new List <RoomUnit>(); units.Add(unit); _unitMap.Add(coord, units); } }
public bool Handle(RoomUnit unit, Team team, RoomItem item) { RoomUser user = unit as RoomUser; if (user != null && team != Team.none && maxCountPerGame > currentGameCount) { currentGameCount++; gameManager.AddPointToTeam(team, scoreToGive, user); gameManager.GetRoom().GetWiredHandler().OnEvent(itemID); return(true); } return(false); }
internal bool AllowsHandling(Point coordinate, RoomUnit unit) { if (!roomMatrix.ContainsKey(coordinate)) return true; List<IWiredCondition> conditions = (List<IWiredCondition>)roomMatrix[coordinate]; foreach (IWiredCondition condition in conditions) { if (!condition.AllowsExecution(unit)) return false; } return true; }
public bool Handle(RoomUnit unit, Team team, RoomItem item) { if (delay > 0) { cycles = 0; handler.RequestCycle(this); } else { return ResetTimers(); } return false; }
public bool Handle(RoomUnit unit, Team team, RoomItem item) { if (delay > 0) { cycles = 0; handler.RequestCycle(this); } else { return(ResetTimers()); } return(false); }
internal void RequestStackHandle(Point coordinate, RoomItem item, RoomUnit unit, Team team) { List <RoomItem> items = null; if (actionStacks.ContainsKey(coordinate) && conditionHandler.AllowsHandling(coordinate, unit)) { bool hasRandomEffectAddon = false; items = (List <RoomItem>)actionStacks[coordinate]; List <IWiredEffect> availableEffects = new List <IWiredEffect>(); foreach (RoomItem stackItem in items) { if (stackItem.wiredHandler is IWiredEffect) { availableEffects.Add((IWiredEffect)stackItem.wiredHandler); } else if (stackItem.GetBaseItem().Name == "wf_xtra_random") { hasRandomEffectAddon = true; ((StringData)stackItem.data).Data = "1"; OnEvent(stackItem.Id); } } if (hasRandomEffectAddon) { availableEffects[FirewindEnvironment.GetRandomNumber(0, availableEffects.Count - 1)].Handle(unit, team, item); } else { foreach (IWiredEffect effect in availableEffects) { effect.Handle(unit, team, item); } } bool shouldBeHandled = false; CheckHandlingState(ref shouldBeHandled, new Point(coordinate.X, coordinate.Y + 1)); CheckHandlingState(ref shouldBeHandled, new Point(coordinate.X + 1, coordinate.Y)); CheckHandlingState(ref shouldBeHandled, new Point(coordinate.X, coordinate.Y - 1)); CheckHandlingState(ref shouldBeHandled, new Point(coordinate.X - 1, coordinate.Y)); if (shouldBeHandled) { room.GetWiredHandler().TriggerOnWire(coordinate); } } }
public override bool OnUse(GameClient session, string[] args) { if (args.Length >= 2) { GameClient target = Skylight.GetGame().GetGameClientManager().GetGameClientByUsername(args[1]); if (target != null) { RoomUnit me = session.GetHabbo().GetRoomSession().GetRoomUser(); RoomUnitUser other = target.GetHabbo().GetRoomSession().GetRoomUser(); if (target.GetHabbo().GetRoomSession().IsInRoom&& target.GetHabbo().GetRoomSession().CurrentRoomID == session.GetHabbo().GetRoomSession().CurrentRoomID) { bool doit = true; if ((me.X + 1 != other.X || me.Y != other.Y) && (me.X - 1 != other.X || me.Y != other.Y) && (me.Y + 1 != other.Y || me.X != other.X)) { bool skip = false; if (me.X - 1 == other.X) { if (me.Y == other.Y) { skip = true; } } if (!skip) { doit = me.X == other.X || me.Y == other.Y; } } if (doit) { me.Speak("*RKO'S " + other.Session.GetHabbo().Username + " OUT OF NO WHERE*", true); other.Speak("Ouch", true); if (!other.HasStatus("lay") && !other.HasStatus("sit")) { if (other.BodyRotation == 0 || other.BodyRotation == 2 || other.BodyRotation == 4 || other.BodyRotation == 6) { other.AddStatus("sit", TextUtilies.DoubleWithDotDecimal((other.Z + 1) / 2 - other.Z * 0.5)); } } } return(true); } } } return(false); }
private void setGrounded(RaycastHit2D hit) { this.grounded = (hit != false && hit.transform != transform); if (this.grounded) { footing = hit.transform.GetComponent <RoomUnit>(); transform.SetParent(footing.transform); } else if (footing != null) { footing = null; transform.SetParent(transform.root); } }
public override void Init() { base.Init(); float ratio = 0; img.sprite = databank.sprt; fitter.aspectRatio = databank.ratio; foreach (string str in Manager.GetInstance().choices.Keys) { RoomUnit roomu = Instantiate(ru, target); roomu.SetText(str); units.Add(roomu); } }
public override GameObject construct(GameObject prefab, Transform parent) { GameObject created = base.construct(prefab, parent); RoomUnit unit = created.GetComponent <RoomUnit>(); unit.Setup( movingFlag, activeFlag, moveSpeed, created.transform.position, created.transform.position + (Vector3)movement ); return(created); }
public void Handle(GameClient session, ClientMessage message) { if (session != null && session.GetHabbo() != null) { RoomUnit roomUser = session.GetHabbo().GetRoomSession().GetRoomUser(); if (roomUser != null) { string motto = TextUtilies.FilterString(message.PopFixedString()); if (!TextUtilies.HaveBlacklistedWords(motto)) { session.GetHabbo().Motto = motto; using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("userId", session.GetHabbo().ID); dbClient.AddParamWithValue("motto", motto); dbClient.ExecuteQuery("UPDATE users SET motto = @motto WHERE id = @userId LIMIT 1"); if (session.GetHabbo().GetUserSettings().FriendStream) { dbClient.ExecuteQuery("INSERT INTO user_friend_stream(type, user_id, timestamp, extra_data) VALUES('3', @userId, UNIX_TIMESTAMP(), @motto)"); } } ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108); message_.Init(r63aOutgoing.UpdateUser); message_.AppendInt32(-1); message_.AppendString(session.GetHabbo().Look); message_.AppendString(session.GetHabbo().Gender.ToLower()); message_.AppendString(session.GetHabbo().Motto); message_.AppendInt32(session.GetHabbo().GetUserStats().AchievementPoints); session.SendMessage(message_); ServerMessage message_2 = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108); message_2.Init(r63aOutgoing.UpdateUser); message_2.AppendInt32(roomUser.VirtualID); message_2.AppendString(session.GetHabbo().Look); message_2.AppendString(session.GetHabbo().Gender.ToLower()); message_2.AppendString(session.GetHabbo().Motto); message_2.AppendInt32(session.GetHabbo().GetUserStats().AchievementPoints); roomUser.Room.SendToAll(message_2); Skylight.GetGame().GetAchievementManager().AddAchievement(session, "ChangeMotto", 1); } } } }
public bool Handle(RoomUnit unit, Team team, RoomItem i) { if (disposed) return false; cycles = 0; if (delay == 0 && unit != null) { return ToggleItems(unit); } else { lock (delayedTriggeringUsers.SyncRoot) { delayedTriggeringUsers.Enqueue(unit); } handler.RequestCycle(this); } return false; }
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 Handle(RoomUnit unit, Team team, RoomItem item) { RoomUser user = unit as RoomUser; if (user == null) return false; user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(4); cycles = 0; if (delay == 0 ) { return TeleportUser(user); } else { lock (delayedUsers.SyncRoot) { delayedUsers.Enqueue(user); } handler.RequestCycle(this); } return false; }
internal void RequestStackHandle(Point coordinate, RoomItem item, RoomUnit unit, Team team) { List<RoomItem> items = null; if (actionStacks.ContainsKey(coordinate) && conditionHandler.AllowsHandling(coordinate, unit)) { bool hasRandomEffectAddon = false; items = (List<RoomItem>)actionStacks[coordinate]; List<IWiredEffect> availableEffects = new List<IWiredEffect>(); foreach (RoomItem stackItem in items) { if (stackItem.wiredHandler is IWiredEffect) { availableEffects.Add((IWiredEffect)stackItem.wiredHandler); } else if (stackItem.GetBaseItem().Name == "wf_xtra_random") { hasRandomEffectAddon = true; ((StringData)stackItem.data).Data = "1"; OnEvent(stackItem.Id); } } if (hasRandomEffectAddon) { availableEffects[FirewindEnvironment.GetRandomNumber(0, availableEffects.Count - 1)].Handle(unit, team, item); } else { foreach (IWiredEffect effect in availableEffects) { effect.Handle(unit, team, item); } } bool shouldBeHandled = false; CheckHandlingState(ref shouldBeHandled, new Point(coordinate.X, coordinate.Y + 1)); CheckHandlingState(ref shouldBeHandled, new Point(coordinate.X + 1, coordinate.Y)); CheckHandlingState(ref shouldBeHandled, new Point(coordinate.X, coordinate.Y - 1)); CheckHandlingState(ref shouldBeHandled, new Point(coordinate.X - 1, coordinate.Y)); if (shouldBeHandled) { room.GetWiredHandler().TriggerOnWire(coordinate); } } }
internal void UpdateUnitMovement(Point oldCoord, Point newCoord, RoomUnit unit) { RemoveUnitFromMap(unit, oldCoord); AddUnitToMap(unit, newCoord); }
internal void RemoveUnitFromMap(RoomUnit unit, Point coord) { if (_unitMap.ContainsKey(coord)) ((List<RoomUnit>)_unitMap[coord]).Remove(unit); }
public UnitWalksFurniValue(RoomUnit unit, RoomItem item) { this.unit = unit; this.item = item; }
internal void UpdateUserStatus(RoomUnit unit, bool cyclegameitems) { try { if (unit == null) return; RoomUser user = unit as RoomUser; bool isBot = user == null; if (isBot) cyclegameitems = false; if (unit.Statuses.ContainsKey("lay") || unit.Statuses.ContainsKey("sit")) { unit.Statuses.Remove("lay"); unit.Statuses.Remove("sit"); unit.UpdateNeeded = true; } if (unit.Statuses.ContainsKey("sign")) { unit.Statuses.Remove("sign"); unit.UpdateNeeded = true; } //List<RoomItem> ItemsOnSquare = GetFurniObjects(User.X, User.Y); CoordItemSearch ItemSearch = new CoordItemSearch(room.GetGameMap().CoordinatedItems); List<RoomItem> ItemsOnSquare = ItemSearch.GetAllRoomItemForSquare(unit.X, unit.Y); double newZ; //if (user.isMounted == true && user.IsPet == false) //{ // newZ = room.GetGameMap().SqAbsoluteHeight(user.X, user.Y, ItemsOnSquare) + 1; //} //else { newZ = room.GetGameMap().SqAbsoluteHeight(unit.X, unit.Y, ItemsOnSquare); } if (!isBot) { if (newZ != user.Z) { user.Z = newZ; if (user.IsFlying) user.Z += 4 + (0.5 * Math.Sin(0.7 * user.FlyCounter)); user.UpdateNeeded = true; } } DynamicRoomModel Model = room.GetGameMap().Model; if (Model.SqState[unit.X, unit.Y] == SquareState.SEAT) { if (!unit.Statuses.ContainsKey("sit")) { unit.Statuses.Add("sit", "1.0"); } unit.Z = Model.SqFloorHeight[unit.X, unit.Y]; if (!isBot && user.IsFlying) user.Z += 4 + (0.5 * Math.Sin(0.7 * user.FlyCounter)); unit.RotHead = Model.SqSeatRot[unit.X, unit.Y]; unit.RotBody = Model.SqSeatRot[unit.X, unit.Y]; unit.UpdateNeeded = true; } foreach (RoomItem Item in ItemsOnSquare) { if (cyclegameitems) { Item.UserWalksOnFurni(user); } if (Item.GetBaseItem().IsSeat) { if (!unit.Statuses.ContainsKey("sit")) { unit.Statuses.Add("sit", TextHandling.GetString(Item.GetBaseItem().Height)); } unit.Z = Item.GetZ; if (!isBot && user.IsFlying) user.Z += 4 + (0.5 * Math.Sin(0.7 * user.FlyCounter)); unit.RotHead = Item.Rot; unit.RotBody = Item.Rot; unit.UpdateNeeded = true; } switch (Item.GetBaseItem().InteractionType) { case InteractionType.bed: { if (!unit.Statuses.ContainsKey("lay")) { unit.Statuses.Add("lay", TextHandling.GetString(Item.GetBaseItem().Height) + " null"); } unit.Z = Item.GetZ; if (!isBot && user.IsFlying) user.Z += 4 + (0.2 * 0.5 * Math.Sin(0.7 * user.FlyCounter)); unit.RotHead = Item.Rot; unit.RotBody = Item.Rot; unit.UpdateNeeded = true; break; } case InteractionType.fbgate: { if (cyclegameitems) { if (user.Team != Item.team) user.Team = Item.team; else if (user.Team == Item.team) user.Team = Team.none; if (!string.IsNullOrEmpty(Item.Figure)) { //User = GetUserForSquare(Item.Coordinate.X, Item.Coordinate.Y); if (user != null) { if (user.Coordinate == Item.Coordinate) { if (user.GetClient().GetHabbo().Gender != Item.Gender && user.GetClient().GetHabbo().Look != Item.Figure) { user.GetClient().GetHabbo().tempGender = user.GetClient().GetHabbo().Gender; user.GetClient().GetHabbo().tempLook = user.GetClient().GetHabbo().Look; user.GetClient().GetHabbo().Gender = Item.Gender; user.GetClient().GetHabbo().Look = Item.Figure; } else { user.GetClient().GetHabbo().Gender = user.GetClient().GetHabbo().tempGender; user.GetClient().GetHabbo().Look = user.GetClient().GetHabbo().tempLook; } ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation); RoomUpdate.AppendInt32(user.VirtualID); RoomUpdate.AppendStringWithBreak(user.GetClient().GetHabbo().Look); RoomUpdate.AppendStringWithBreak(user.GetClient().GetHabbo().Gender.ToLower()); RoomUpdate.AppendStringWithBreak(user.GetClient().GetHabbo().Motto); RoomUpdate.AppendInt32(user.GetClient().GetHabbo().AchievementPoints); room.SendMessage(RoomUpdate); } } } } break; } //33: Red //34: Green //35: Blue //36: Yellow case InteractionType.banzaigategreen: case InteractionType.banzaigateblue: case InteractionType.banzaigatered: case InteractionType.banzaigateyellow: { if (cyclegameitems) { int effectID = (int)Item.team + 32; TeamManager t = user.GetClient().GetHabbo().CurrentRoom.GetTeamManagerForBanzai(); AvatarEffectsInventoryComponent efectmanager = user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent(); if (user.Team != Item.team) { if (t.CanEnterOnTeam(Item.team)) { if (user.Team != Team.none) t.OnUserLeave(user); user.Team = Item.team; t.AddUser(user); if (efectmanager.CurrentEffect != effectID) efectmanager.ApplyCustomEffect(effectID); } } else { //usersOnTeam--; t.OnUserLeave(user); if (efectmanager.CurrentEffect == effectID) efectmanager.ApplyCustomEffect(0); user.Team = Team.none; } //((StringData)Item.data).Data = usersOnTeam.ToString(); //Item.UpdateState(false, true); } break; } case InteractionType.freezeyellowgate: case InteractionType.freezeredgate: case InteractionType.freezegreengate: case InteractionType.freezebluegate: { if (cyclegameitems) { int effectID = (int)Item.team + 39; TeamManager t = user.GetClient().GetHabbo().CurrentRoom.GetTeamManagerForFreeze(); //int usersOnTeam = 0; //if (((StringData)Item.data).Data != "") //usersOnTeam = int.Parse(((StringData)Item.data).Data); AvatarEffectsInventoryComponent efectmanager = user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent(); if (user.Team != Item.team) { if (t.CanEnterOnTeam(Item.team)) { if (user.Team != Team.none) t.OnUserLeave(user); user.Team = Item.team; t.AddUser(user); if (efectmanager.CurrentEffect != effectID) efectmanager.ApplyCustomEffect(effectID); } } else { //usersOnTeam--; t.OnUserLeave(user); if (efectmanager.CurrentEffect == effectID) efectmanager.ApplyCustomEffect(0); user.Team = Team.none; } //((StringData)Item.data).Data = usersOnTeam.ToString(); //Item.UpdateState(false, true); ServerMessage message = new ServerMessage(700); message.AppendBoolean((user.Team != Team.none)); user.GetClient().SendMessage(message); } break; } case InteractionType.banzaitele: { room.GetGameItemHandler().onTeleportRoomUserEnter(user, Item); break; } } } if (cyclegameitems) { if (room.GotSoccer()) room.GetSoccer().OnUserWalk(user); if (room.GotBanzai()) room.GetBanzai().OnUserWalk(user); //if (room.GotFreeze()) room.GetFreeze().OnUserWalk(user); } } catch (Exception e) { } }
public ItemTriggeredArgs(RoomUnit unit, RoomItem item) { this.TriggeringUnit = unit; this.TriggeringItem = item; }
private bool ToggleItems(RoomUnit unit) { RoomUser user = unit as RoomUser; if (disposed || user == null) 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 (unit != null && user.GetClient() != null) i.Interactor.OnTrigger(user.GetClient(), i, 0, true); else i.Interactor.OnTrigger(null, i, 0, true); itemTriggered = true; } return itemTriggered; }
private bool TeleportUser(RoomUnit unit) { RoomUser user = unit as RoomUser; if (user == null || disposed) return false; if (items.Count > 1) { int toTest = 0; RoomItem item; for (int i = 0; i < items.Count; i++) { toTest = rnd.Next(0, items.Count); item = items[toTest]; if (item.Coordinate != unit.Coordinate) { gamemap.TeleportToItem(user, item); user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(0); return true; } } } else if (items.Count == 1) { gamemap.TeleportToItem(user, items.First()); user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(0); return true; } return false; }
public UnitWalksOnArgs(RoomUnit unit) { this.user = unit; }
internal void Dispose() { unit = null; message = null; }
internal void AddUnitToMap(RoomUnit unit, Point coord) { if (_unitMap.ContainsKey(coord)) { ((List<RoomUnit>)_unitMap[coord]).Add(unit); } else { List<RoomUnit> units = new List<RoomUnit>(); units.Add(unit); _unitMap.Add(coord, units); } }
internal ServerMessage UpdateUnitOnRoller(RoomUnit unit, Point pNextCoord, uint pRollerID, Double NextZ) { ServerMessage mMessage = new ServerMessage(0); mMessage.Init(Outgoing.ObjectOnRoller); // Cf mMessage.AppendInt32(unit.X); mMessage.AppendInt32(unit.Y); mMessage.AppendInt32(pNextCoord.X); mMessage.AppendInt32(pNextCoord.Y); mMessage.AppendInt32(0); mMessage.AppendUInt(pRollerID); mMessage.AppendInt32(2); mMessage.AppendInt32(unit.VirtualID); mMessage.AppendString(TextHandling.GetString(unit.Z)); mMessage.AppendString(TextHandling.GetString(NextZ)); room.GetGameMap().UpdateUnitMovement(new Point(unit.X, unit.Y), new Point(pNextCoord.X, pNextCoord.Y), unit); room.GetGameMap().Map[unit.X, unit.Y] = 1; unit.X = pNextCoord.X; unit.Y = pNextCoord.Y; unit.Z = NextZ; room.GetGameMap().Map[unit.X, unit.Y] = 0; return mMessage; }
public InvokedChatMessage(RoomUnit unit, string message, bool shout) { this.unit = unit; this.message = message; this.shout = shout; }