private void AddSpecialItems(RoomItem item) { switch (item.GetBaseItem().InteractionType) { case InteractionType.fbgate: //IsTrans = true; room.GetSoccer().RegisterGate(item); string[] splittedExtraData = ((StringData)item.data).Data.Split(':'); if (string.IsNullOrEmpty(((StringData)item.data).Data) || splittedExtraData.Length <= 1) { item.Gender = "M"; switch (item.team) { case Team.yellow: item.Figure = "lg-275-93.hr-115-61.hd-207-14.ch-265-93.sh-305-62"; break; case Team.red: item.Figure = "lg-275-96.hr-115-61.hd-180-3.ch-265-96.sh-305-62"; break; case Team.green: item.Figure = "lg-275-102.hr-115-61.hd-180-3.ch-265-102.sh-305-62"; break; case Team.blue: item.Figure = "lg-275-108.hr-115-61.hd-180-3.ch-265-108.sh-305-62"; break; } } else { item.Gender = splittedExtraData[0]; item.Figure = splittedExtraData[1]; } break; case InteractionType.banzaifloor: { room.GetBanzai().AddTile(item, item.Id); break; } case InteractionType.banzaipyramid: { room.GetGameItemHandler().AddPyramid(item, item.Id); break; } case InteractionType.banzaitele: { room.GetGameItemHandler().AddTeleport(item, item.Id); ((StringData)item.data).Data = ""; break; } case InteractionType.banzaipuck: { room.GetBanzai().AddPuck(item); break; } case InteractionType.football: { room.GetSoccer().AddBall(item); break; } case InteractionType.freezetileblock: { room.GetFreeze().AddFreezeBlock(item); break; } case InteractionType.freezetile: { room.GetFreeze().AddFreezeTile(item); break; } case InteractionType.freezeexit: { RoomItem _item = room.GetFreeze().ExitTeleport; if (_item == null) { break; } if (item.Id == _item.Id) { room.GetFreeze().ExitTeleport = null; } break; } } }
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) { } }