Current work for v9
parent
ce30ee601b
commit
912204b63b
|
@ -1,33 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Inventory.Achievements;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Achievements;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Achievement;
|
||||
|
||||
public class RequestAchievementsMessageEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly IAchievementManager _achievementManager;
|
||||
|
||||
public RequestAchievementsMessageEvent(IGameSessionManager gameSessionManager, IAchievementManager achievementManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_achievementManager = achievementManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.AchievementList;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new AchievementsScoreComposer(gameSession.Habbo.AchievementScore));
|
||||
await gameSession.SendComposerAsync(new AchievementsComposer(_achievementManager.Achievements.Values,
|
||||
gameSession.Habbo));
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Catalog;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Catalogue;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Catalog;
|
||||
|
||||
public class GetCatalogIndexEvent : IMessageEvent
|
||||
{
|
||||
private readonly ICatalogueManager _catalogueManager;
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
|
||||
public GetCatalogIndexEvent(ICatalogueManager catalogueManager, IGameSessionManager gameSessionManager)
|
||||
{
|
||||
_catalogueManager = catalogueManager;
|
||||
_gameSessionManager = gameSessionManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.GetCatalogIndex;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
var mode = request.ReadString();
|
||||
|
||||
var categories =
|
||||
_catalogueManager.Pages.Values.Where(
|
||||
p => p.Parent is null && p.Modes.Contains(mode.ToLower()) && p.MinRank <= gameSession.Habbo.Rank);
|
||||
|
||||
await gameSession.SendComposerAsync(new CatalogPagesListComposer(categories, mode));
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Catalog;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Catalogue;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Catalog;
|
||||
|
||||
public class GetCatalogPageEvent : IMessageEvent
|
||||
{
|
||||
private readonly ICatalogueManager _catalogueManager;
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
|
||||
public GetCatalogPageEvent(ICatalogueManager catalogueManager, IGameSessionManager gameSessionManager)
|
||||
{
|
||||
_catalogueManager = catalogueManager;
|
||||
_gameSessionManager = gameSessionManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.GetCatalogPage;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
var pageId = request.ReadInt32();
|
||||
var offerId = request.ReadInt32();
|
||||
var mode = request.ReadString();
|
||||
|
||||
if (!_catalogueManager.Pages.TryGetValue(pageId, out var page) || !page.Enabled ||
|
||||
page.MinRank > gameSession.Habbo.Rank || !page.Modes.Contains(mode.ToLower()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var featuredPages = page.Layout.Equals("frontpage4")
|
||||
? _catalogueManager.FeaturedPages.Values
|
||||
: new List<CatalogueFeaturedPage>();
|
||||
|
||||
await gameSession.SendComposerAsync(new CatalogPageMessageComposer(page, offerId, mode, featuredPages));
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Catalog;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Catalogue;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Catalog;
|
||||
|
||||
public class GetClubOffersMessageEvent : IMessageEvent
|
||||
{
|
||||
private readonly ICatalogueManager _catalogueManager;
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
|
||||
public GetClubOffersMessageEvent(ICatalogueManager catalogueManager, IGameSessionManager gameSessionManager)
|
||||
{
|
||||
_catalogueManager = catalogueManager;
|
||||
_gameSessionManager = gameSessionManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.GetClubOffers;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
var currentSubscription = gameSession.Habbo.GetActiveSubscription();
|
||||
|
||||
await gameSession.SendComposerAsync(new HabboClubOffersMessageComposer(
|
||||
_catalogueManager.ClubOffers.Values.Where(co =>
|
||||
co.DiscountExtension == currentSubscription is
|
||||
{
|
||||
MonthsLeft: 0, DaysInMonthLeft: <= 5 and > 0
|
||||
}).ToList(), currentSubscription));
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Catalogue;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Catalog;
|
||||
|
||||
public class PurchaseFromCatalogEvent : IMessageEvent
|
||||
{
|
||||
private readonly ICatalogueManager _catalogueManager;
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
|
||||
public PurchaseFromCatalogEvent(ICatalogueManager catalogueManager, IGameSessionManager gameSessionManager)
|
||||
{
|
||||
_catalogueManager = catalogueManager;
|
||||
_gameSessionManager = gameSessionManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.CatalogPurchase;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
var pageId = request.ReadInt32();
|
||||
var offerId = request.ReadInt32();
|
||||
var extraData = request.ReadString();
|
||||
var amount = request.ReadInt32();
|
||||
|
||||
if (amount < 0 || !_catalogueManager.Pages.TryGetValue(pageId, out var page))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (page.Layout.Equals("vip_buy"))
|
||||
{
|
||||
await _catalogueManager.PurchaseClubOffer(offerId, gameSession);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Handshake;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Security;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Handshake;
|
||||
|
||||
public class GenerateKeyEvent : IMessageEvent
|
||||
{
|
||||
public IncomingHeaders Header => IncomingHeaders.GenerateKey;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
var publicKey = HabboEncryption.GenerateKey();
|
||||
var decodedKey = HabboEncryption.DecodeKey(publicKey);
|
||||
gameSession.Rc4 = new Rc4(decodedKey);
|
||||
|
||||
await gameSession.SendComposerAsync(new SecretKeyComposer(publicKey));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Handshake;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Handshake;
|
||||
|
||||
public class GetSessionParametersEvent : IMessageEvent
|
||||
{
|
||||
public IncomingHeaders Header => IncomingHeaders.GetSessionParameters;
|
||||
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
await gameSession.SendComposerAsync(new SessionParametersComposer(0, true,
|
||||
false, false, true, "d-M-Y"));
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.User.Data;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Handshake;
|
||||
|
||||
public class InfoRetrieveMessageEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
|
||||
public InfoRetrieveMessageEvent(IGameSessionManager gameSessionManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.UserInfo;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new UserInfoComposer(gameSession.Habbo));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Handshake;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Handshake;
|
||||
|
||||
public class SsoEvent : IMessageEvent
|
||||
{
|
||||
private readonly IRepository<Habbo> _habboRepository;
|
||||
|
||||
public SsoEvent(IRepository<Habbo> habboRepository)
|
||||
{
|
||||
_habboRepository = habboRepository;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.Sso;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
var habbo = await _habboRepository.FindOneByAsync(h => h.SsoTicket == request.ReadString());
|
||||
|
||||
if (habbo == null)
|
||||
{
|
||||
await gameSession.CloseAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
gameSession.Habbo = habbo;
|
||||
|
||||
await gameSession.SendComposerAsync(new LoginOkComposer());
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Notifications;
|
||||
using Tiger.Communication.Messages.Outgoing.Security;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Achievements;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Game.Settings;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Handshake;
|
||||
|
||||
public class SsoTicketMessageEvent : IMessageEvent
|
||||
{
|
||||
private readonly IRepository<Habbo> _habboRepository;
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly ISettingManager _settingManager;
|
||||
private readonly ILogger<SsoTicketMessageEvent> _logger;
|
||||
private readonly IAchievementManager _achievementManager;
|
||||
|
||||
public SsoTicketMessageEvent(IRepository<Habbo> habboRepository, IGameSessionManager gameSessionManager, ISettingManager settingManager, ILogger<SsoTicketMessageEvent> logger, IAchievementManager achievementManager)
|
||||
{
|
||||
_habboRepository = habboRepository;
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_settingManager = settingManager;
|
||||
_logger = logger;
|
||||
_achievementManager = achievementManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.SecurityTicket;
|
||||
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
var habbo = await _habboRepository.FindOneByAsync(h => h.SsoTicket == request.ReadString());
|
||||
|
||||
if (habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("User not found", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
gameSession.Habbo = habbo;
|
||||
gameSession.Habbo.LastLogin = DateTime.Now;
|
||||
gameSession.Habbo.Online = true;
|
||||
_habboRepository.SaveAsync(gameSession.Habbo);
|
||||
|
||||
if (DateTime.Now.Hour == 15)
|
||||
{
|
||||
_achievementManager.UpdateAchievementAsync("ACH_HappyHour", 1, gameSession);
|
||||
}
|
||||
|
||||
_logger.LogInformation("{User} logged in", gameSession.Habbo.Username);
|
||||
|
||||
await gameSession.SendComposerAsync(new AuthenticatedComposer());
|
||||
await gameSession.SendComposerAsync(new HabboBroadcastMessageComposer(
|
||||
_settingManager.GetSetting<string>("welcome.message")
|
||||
.Replace("{user}", gameSession.Habbo.Username)
|
||||
));
|
||||
}
|
||||
}
|
|
@ -1,469 +1,22 @@
|
|||
namespace Tiger.Communication.Messages.Incoming;
|
||||
|
||||
public enum IncomingHeaders : short
|
||||
public enum IncomingHeaders
|
||||
{
|
||||
AchievementList = 219,
|
||||
Authentication = -1,
|
||||
BotConfiguration = 1986,
|
||||
BotPickup = 3323,
|
||||
BotPlace = 1592,
|
||||
BotSkillSave = 2624,
|
||||
GetClubOffers = 3285,
|
||||
GetClubGiftInfo = 487,
|
||||
GetCatalogIndex = 1195,
|
||||
GetCatalogPage = 412,
|
||||
CatalogPurchase = 3492,
|
||||
CatalogPurchaseGift = 1411,
|
||||
GetProductOffer = 2594,
|
||||
ClientLatency = 295,
|
||||
ClientLatencyMeasure = 96,
|
||||
ClientPolicy = 26979,
|
||||
ClientPong = 2596,
|
||||
ClientToolbarToggle = 2313,
|
||||
ClientVariables = 1053,
|
||||
GetCurrentTimingCode = 2912,
|
||||
DesktopView = 105,
|
||||
GetBundleDiscountRuleset = 223,
|
||||
EventTracker = 3457,
|
||||
FindNewFriends = 516,
|
||||
FurnitureAliases = 3898,
|
||||
FurnitureFloorUpdate = 248,
|
||||
FurnitureMultistate = 99,
|
||||
FurniturePickup = 3456,
|
||||
FurniturePlace = 1258,
|
||||
FurniturePostitPlace = 2248,
|
||||
FurniturePostitSaveStickyPole = 3283,
|
||||
FurnitureRandomstate = 3617,
|
||||
FurnitureWallMultistate = 210,
|
||||
FurnitureWallUpdate = 168,
|
||||
GamesInit = 2914,
|
||||
GamesList = 741,
|
||||
Acceptgameinvite = 3802,
|
||||
Gameunloadedmessage = 3207,
|
||||
Getgameachievementsmessage = 2399,
|
||||
Getgamestatusmessage = 3171,
|
||||
Getusergameachievementsmessage = 389,
|
||||
Joinqueuemessage = 1458,
|
||||
Leavequeuemessage = 2384,
|
||||
Resetresolutionachievementmessage = 3144,
|
||||
Getweeklygamerewardwinners = 1054,
|
||||
Game2Getaccountgamestatusmessage = 11,
|
||||
Game2Checkgamedirectorystatusmessage = 3259,
|
||||
Game2Exitgamemessage = 1445,
|
||||
Game2Gamechatmessage = 2502,
|
||||
Game2Loadstagereadymessage = 2415,
|
||||
Game2Playagainmessage = 3196,
|
||||
Game2Requestfullstatusupdatemessage = 1598,
|
||||
Game2Getweeklyfriendsleaderboard = 1232,
|
||||
Game2Getweeklyleaderboard = 2565,
|
||||
GetGiftWrappingConfig = 418,
|
||||
GroupAdminAdd = 2894,
|
||||
GroupAdminRemove = 722,
|
||||
GroupCreateOptions = 798,
|
||||
GroupFavorite = 3549,
|
||||
GetForumStats = 3149,
|
||||
GetForumThreads = 873,
|
||||
GetForumsList = 436,
|
||||
GetForumMessages = 232,
|
||||
GetForumThread = 3900,
|
||||
GetUnreadForumsCount = 2908,
|
||||
ForumModerateMessage = 286,
|
||||
ForumModerateThread = 1397,
|
||||
ForumPostMessage = 3529,
|
||||
UpdateForumReadMarker = 1855,
|
||||
UpdateForumSettings = 2214,
|
||||
ForumUpdateThread = 3045,
|
||||
GroupInfo = 2991,
|
||||
GroupDelete = 1134,
|
||||
GroupMemberRemoveConfirm = 3593,
|
||||
GroupMemberRemove = 593,
|
||||
GroupMembers = 312,
|
||||
GroupMemberships = 367,
|
||||
GroupRequest = 998,
|
||||
GroupRequestAccept = 3386,
|
||||
GroupRequestDecline = 1894,
|
||||
GroupSettings = 1004,
|
||||
GroupParts = 813,
|
||||
GroupBuy = 230,
|
||||
GroupSaveInformation = 3137,
|
||||
GroupSaveBadge = 1991,
|
||||
GroupSaveColors = 1764,
|
||||
GroupSavePreferences = 3435,
|
||||
GroupBadges = 21,
|
||||
GroupUnblockMember = 2864,
|
||||
GetBadgePointsLimits = 1371,
|
||||
Requestabadge = 3077,
|
||||
Getisbadgerequestfulfilled = 1364,
|
||||
ItemClothingRedeem = 3374,
|
||||
ItemColorWheelClick = 2144,
|
||||
ItemDiceClick = 1990,
|
||||
ItemDiceClose = 1533,
|
||||
ItemDimmerSave = 1648,
|
||||
ItemDimmerSettings = 2813,
|
||||
ItemDimmerToggle = 2296,
|
||||
ItemExchangeRedeem = 3115,
|
||||
ItemPaint = 711,
|
||||
SetObjectData = 3608,
|
||||
ItemStackHelper = 3839,
|
||||
MarketplaceConfig = 2597,
|
||||
AcceptFriend = 137,
|
||||
MessengerChat = 3567,
|
||||
DeclineFriend = 2890,
|
||||
FollowFriend = 3997,
|
||||
MessengerFriends = 1523,
|
||||
MessengerInit = 2781,
|
||||
MessengerRelationships = 2138,
|
||||
SetRelationshipStatus = 3768,
|
||||
RemoveFriend = 1689,
|
||||
RequestFriend = 3157,
|
||||
GetFriendRequests = 2448,
|
||||
SendRoomInvite = 1276,
|
||||
HabboSearch = 1210,
|
||||
FriendListUpdate = 1419,
|
||||
ModToolUserInfo = 3295,
|
||||
GetUserFlatCats = 3027,
|
||||
NavigatorInit = 2110,
|
||||
NavigatorSearch = 249,
|
||||
NavigatorSearchClose = 1834,
|
||||
NavigatorSearchOpen = 637,
|
||||
NavigatorSearchSave = 2226,
|
||||
GetUserEventCats = 1782,
|
||||
NavigatorSettingsSave = 3159,
|
||||
NavigatorCategoryListMode = 1202,
|
||||
NavigatorDeleteSavedSearch = 1954,
|
||||
PetInfo = 2934,
|
||||
PetPickup = 1581,
|
||||
PetPlace = 2647,
|
||||
PetRespect = 3202,
|
||||
PetRide = 1036,
|
||||
PetMove = 3449,
|
||||
PetOpenPackage = 3698,
|
||||
PetSelected = 549,
|
||||
PetsBreed = 1638,
|
||||
PetCancelBreeding = 2713,
|
||||
PetConfirmBreeding = 3382,
|
||||
GetPetTrainingPanel = 2161,
|
||||
RecyclerPrizes = 398,
|
||||
RecyclerStatus = 1342,
|
||||
RecyclerItems = 2771,
|
||||
ReleaseVersion = 4000,
|
||||
CallForHelp = 1691,
|
||||
RoomAmbassadorAlert = 2996,
|
||||
RoomBanGive = 1477,
|
||||
RoomBanList = 2267,
|
||||
RoomBanRemove = 992,
|
||||
RoomCreate = 2752,
|
||||
RoomDelete = 532,
|
||||
RoomDoorbell = 1644,
|
||||
RoomEnter = 2312,
|
||||
RoomFavorite = 3817,
|
||||
RoomFavoriteRemove = 309,
|
||||
CanCreateRoom = 2128,
|
||||
CancelRoomEvent = 2725,
|
||||
EditRoomEvent = 3991,
|
||||
CompetitionRoomSearch = 433,
|
||||
ForwardToRandomPromotedRoom = 10,
|
||||
ForwardToSomeRoom = 1703,
|
||||
GetCategoriesWithUserCount = 3782,
|
||||
GetGuestRoom = 2230,
|
||||
GetOfficialRooms = 1229,
|
||||
GetPopularRoomTags = 826,
|
||||
GuildBaseSearch = 2930,
|
||||
MyFavouriteRoomsSearch = 2578,
|
||||
MyFrequentRoomHistorySearch = 1002,
|
||||
MyFriendsRoomSearch = 2266,
|
||||
MyGuildBasesSearch = 39,
|
||||
MyRecommendedRooms = 2537,
|
||||
MyRoomHistorySearch = 2264,
|
||||
MyRoomRightsSearch = 272,
|
||||
MyRoomsSearch = 2277,
|
||||
PopularRoomsSearch = 2758,
|
||||
RoomAdEventTabClicked = 2412,
|
||||
RoomAdEventTabViewed = 2668,
|
||||
RoomAdSearch = 2809,
|
||||
RoomTextSearch = 3943,
|
||||
RoomsWhereMyFriendsAre = 1786,
|
||||
RoomsWithHighestScoreSearch = 2939,
|
||||
SetRoomSessionTags = 3305,
|
||||
UpdateRoomThumbnail = 2468,
|
||||
RoomKick = 1320,
|
||||
RoomLike = 3582,
|
||||
RoomModel = 2300,
|
||||
GetOccupiedTiles = 1687,
|
||||
GetRoomEntryTile = 3559,
|
||||
RoomModelSave = 875,
|
||||
RoomMute = 3637,
|
||||
RoomMuteUser = 3485,
|
||||
RoomRightsGive = 808,
|
||||
RoomRightsList = 3385,
|
||||
RoomRightsRemove = 2064,
|
||||
RoomRightsRemoveAll = 2683,
|
||||
RoomRightsRemoveOwn = 3182,
|
||||
RoomSettings = 3129,
|
||||
RoomSettingsSave = 1969,
|
||||
RoomSettingsUpdateRoomCategoryAndTrade = 1265,
|
||||
RoomStaffPick = 1918,
|
||||
RoomFilterWords = 1911,
|
||||
RoomFilterWordsModify = 3001,
|
||||
Mysteryboxwaitingcanceledmessage = 2012,
|
||||
MysteryboxOpenTrophy = 3074,
|
||||
SecurityMachine = 2490,
|
||||
SecurityTicket = 2419,
|
||||
Trade = 1481,
|
||||
TradeAccept = 3863,
|
||||
TradeCancel = 2341,
|
||||
TradeClose = 2551,
|
||||
TradeConfirm = 2760,
|
||||
TradeItem = 3107,
|
||||
TradeItemRemove = 3845,
|
||||
TradeItems = 1263,
|
||||
TradeUnaccept = 1444,
|
||||
UnitAction = 2456,
|
||||
UnitChat = 1314,
|
||||
UnitChatShout = 2085,
|
||||
UnitChatWhisper = 1543,
|
||||
UnitDance = 2080,
|
||||
UnitDropHandItem = 2814,
|
||||
UnitGiveHanditem = 2941,
|
||||
UnitLook = 3301,
|
||||
UnitPosture = 2235,
|
||||
UnitSign = 1975,
|
||||
UnitTyping = 1597,
|
||||
UnitTypingStop = 1474,
|
||||
UnitWalk = 3320,
|
||||
UserBadges = 2769,
|
||||
UserBadgesCurrent = 2091,
|
||||
UserBadgesCurrentUpdate = 644,
|
||||
UserBots = 3848,
|
||||
UserCurrency = 273,
|
||||
UserEffectActivate = 2959,
|
||||
UserEffectEnable = 1752,
|
||||
UserFigure = 2730,
|
||||
UserFurniture = 3150, // sent when in room
|
||||
Requestfurniinventorywhennotinroom = 3500, // sent when not in room
|
||||
UserHomeRoom = 1740,
|
||||
UserInfo = 357,
|
||||
UserMotto = 2228,
|
||||
UserIgnored = 3878,
|
||||
UserPets = 3095,
|
||||
UserProfile = 3265,
|
||||
UserProfileByName = 2249,
|
||||
UserRespect = 2694,
|
||||
GetSoundSettings = 2388,
|
||||
UserSettingsCamera = 1461,
|
||||
UserSettingsChatStyle = 1030,
|
||||
UserSettingsInvites = 1086,
|
||||
UserSettingsOldChat = 1262,
|
||||
UserSettingsVolume = 1367,
|
||||
UserSubscription = 3166,
|
||||
GetWardrobe = 2742,
|
||||
SaveWardrobeOutfit = 800,
|
||||
UserTags = 17,
|
||||
PeerUsersClassification = 1160,
|
||||
UserClassification = 2285,
|
||||
VisitUser = 2970,
|
||||
WiredActionSave = 2281,
|
||||
WiredApplySnapshot = 3373,
|
||||
WiredConditionSave = 3203,
|
||||
WiredOpen = 768,
|
||||
WiredTriggerSave = 1520,
|
||||
GetItemData = 3964,
|
||||
OneWayDoorClick = 2765,
|
||||
RemoveWallItem = 3336,
|
||||
SetItemData = 3666,
|
||||
CatalogRedeemVoucher = 339,
|
||||
RoomTonerApply = 2880,
|
||||
FriendFurniConfirmLock = 3775,
|
||||
MannequinSaveName = 2850,
|
||||
MannequinSaveLook = 2209,
|
||||
PresentOpenPresent = 3558,
|
||||
CatalogSelectVipGift = 2276,
|
||||
UserIgnoreId = 3314,
|
||||
UserIgnore = 1117,
|
||||
UserUnignore = 2061,
|
||||
ModtoolRequestRoomInfo = 707,
|
||||
ModtoolChangeRoomSettings = 3260,
|
||||
ModtoolRequestUserChatlog = 1391,
|
||||
ModtoolRequestRoomChatlog = 2587,
|
||||
ModtoolSanctionAlert = 229,
|
||||
ModtoolSanctionBan = 2766,
|
||||
ModtoolSanctionKick = 2582,
|
||||
ModtoolSanctionTradelock = 3742,
|
||||
ModtoolAlertevent = 1840,
|
||||
ModtoolSanctionMute = 1945,
|
||||
ModtoolRequestUserRooms = 3526,
|
||||
ModtoolRoomAlert = 3842,
|
||||
ModtoolPreferences = 31,
|
||||
CloseIssueDefaultAction = 2717,
|
||||
CloseIssues = 2067,
|
||||
DefaultSanction = 1681,
|
||||
GetCfhChatlog = 211,
|
||||
ModtoolSanction = 1392,
|
||||
PickIssues = 15,
|
||||
ReleaseIssues = 1572,
|
||||
ConvertGlobalRoomId = 314,
|
||||
RequestSellItem = 848,
|
||||
RequestMarketplaceItemStats = 3288,
|
||||
MarketplaceSellItem = 3447,
|
||||
MarketplaceRequestOwnItems = 2105,
|
||||
MarketplaceTakeBackItem = 434,
|
||||
MarketplaceRedeemCredits = 2650,
|
||||
MarketplaceRequestOffers = 2407,
|
||||
MarketplaceBuyOffer = 1603,
|
||||
MarketplaceBuyTokens = 1866,
|
||||
CatalogRequesetPetBreeds = 1756,
|
||||
ApproveName = 2109,
|
||||
UnitGiveHanditemPet = 2768,
|
||||
PetSupplement = 749,
|
||||
FurnitureGroupInfo = 2651,
|
||||
AchievementResolutionOpen = 359,
|
||||
UsePetProduct = 1328,
|
||||
RemovePetSaddle = 186,
|
||||
TogglePetRiding = 1472,
|
||||
TogglePetBreeding = 3379,
|
||||
UnseenResetCategory = 3493,
|
||||
UnseenResetItems = 2343,
|
||||
CommunityGoalVoteComposer = 3536,
|
||||
GetPromoArticles = 1827,
|
||||
AcceptQuest = 3604,
|
||||
ActivateQuest = 793,
|
||||
CancelQuest = 3133,
|
||||
FriendRequestQuestComplete = 1148,
|
||||
GetCommunityGoalEarnedPrizes = 2688,
|
||||
GetCommunityGoalHallOfFame = 2167,
|
||||
GetCommunityGoalProgress = 1145,
|
||||
GetConcurrentUsersGoalProgress = 1343,
|
||||
GetConcurrentUsersReward = 3872,
|
||||
GetDailyQuest = 2486,
|
||||
GetQuests = 3333,
|
||||
GetSeasonalQuestsOnly = 1190,
|
||||
OpenQuestTracker = 2750,
|
||||
RedeemCommunityGoalPrize = 90,
|
||||
RejectQuest = 2397,
|
||||
StartCampaign = 1697,
|
||||
GetBonusRareInfo = 957,
|
||||
Craft = 3591,
|
||||
CraftSecret = 1251,
|
||||
GetCraftableProducts = 633,
|
||||
GetCraftingRecipe = 1173,
|
||||
GetCraftingRecipesAvailable = 3086,
|
||||
PhotoCompetition = 3959,
|
||||
PublishPhoto = 2068,
|
||||
PurchasePhoto = 2408,
|
||||
RenderRoom = 3226,
|
||||
RenderRoomThumbnail = 1982,
|
||||
RequestCameraConfiguration = 796,
|
||||
AddJukeboxDisk = 753,
|
||||
GetJukeboxPlaylist = 1435,
|
||||
GetNowPlaying = 1325,
|
||||
GetOfficialSongId = 3189,
|
||||
GetSongInfo = 3082,
|
||||
GetSoundMachinePlaylist = 3498,
|
||||
GetUserSongDisks = 2304,
|
||||
RemoveJukeboxDisk = 3050,
|
||||
InterstitialShown = 1109,
|
||||
GetInterstitial = 2519,
|
||||
ChangeUsername = 2977,
|
||||
CheckUsername = 3950,
|
||||
OpenCampaignCalendarDoorStaff= 3889,
|
||||
OpenCampaignCalendarDoor = 2257,
|
||||
BuildersClubPlaceRoomItem = 1051,
|
||||
BuildersClubPlaceWallItem = 462,
|
||||
BuildersClubQueryFurniCount = 2529,
|
||||
GetCatalogPageExpiration = 742,
|
||||
GetCatalogPageWithEarliestExp = 3135,
|
||||
GetDirectClubBuyAvailable = 801,
|
||||
GetHabboBasicMembershipExtendOffer = 603,
|
||||
GetHabboClubExtendOffer = 2462,
|
||||
GetIsOfferGiftable = 1347,
|
||||
GetLimitedOfferAppearingNext = 410,
|
||||
GetNextTargetedOffer = 596,
|
||||
GetRoomAdPurchaseInfo = 1075,
|
||||
GetSeasonalCalendarDailyOffer = 3257,
|
||||
GetTargetedOffer = 2487,
|
||||
MarkCatalogNewAdditionsPageOpened = 2150,
|
||||
PurchaseBasicMembershipExtension = 2735,
|
||||
PurchaseRoomAd = 777,
|
||||
PurchaseTargetedOffer = 1826,
|
||||
PurchaseVipMembershipExtension = 3407,
|
||||
RoomAdPurchaseInitiated = 2283,
|
||||
SetTargettedOfferState = 2041,
|
||||
ShopTargetedOfferViewed = 3483,
|
||||
HelperTalentTrack = 196,
|
||||
TalentTrackGetLevel = 2127,
|
||||
ForwardToACompetitionRoom = 172,
|
||||
ForwardToASubmittableRoom = 1450,
|
||||
ForwardToRandomCompetitionRoom = 865,
|
||||
GetIsUserPartOfCompetition = 2077,
|
||||
GetSecondsUntil = 271,
|
||||
RoomCompetitionInit = 1334,
|
||||
SubmitRoomToCompetition = 2595,
|
||||
VoteForRoom = 143,
|
||||
GetGift = 2436,
|
||||
ResetPhoneNumberState = 2741,
|
||||
SetPhoneNumberVerificationStatus = 1379,
|
||||
TryPhoneNumber = 790,
|
||||
VerifyCode = 2721,
|
||||
ControlYoutubeDisplayPlayback = 3005,
|
||||
GetYoutubeDisplayStatus = 336,
|
||||
SetYoutubeDisplayPlaylist = 2069,
|
||||
GoToFlat = 685,
|
||||
ChangeQueue = 3093,
|
||||
CallForHelpFromForumMessage = 1412,
|
||||
CallForHelpFromForumThread = 534,
|
||||
CallForHelpFromIm = 2950,
|
||||
CallForHelpFromPhoto = 2492,
|
||||
CallForHelpFromSelfie = 2755,
|
||||
ChatReviewGuideDecides = 3365,
|
||||
ChatReviewGuideDetached = 2501,
|
||||
ChatReviewGuideVote = 3961,
|
||||
ChatReviewSessionCreate = 3060,
|
||||
DeletePendingCallsForHelp = 3605,
|
||||
GetCfhStatus = 2746,
|
||||
GetFaqCategory = 3445,
|
||||
GetFaqText = 1849,
|
||||
GetGuideReportingStatus = 3786,
|
||||
GetPendingCallsForHelp = 3267,
|
||||
GetQuizQuestions = 1296,
|
||||
GuideSessionCreate = 3338,
|
||||
GuideSessionFeedback = 477,
|
||||
GuideSessionGetRequesterRoom = 1052,
|
||||
GuideSessionGuideDecides = 1424,
|
||||
GuideSessionInviteRequester = 234,
|
||||
GuideSessionIsTyping = 519,
|
||||
GuideSessionMessage = 3899,
|
||||
GuideSessionOnDutyUpdate = 1922,
|
||||
GuideSessionReport = 3969,
|
||||
GuideSessionRequesterCancels = 291,
|
||||
GuideSessionResolved = 887,
|
||||
PostQuizAnswers = 3720,
|
||||
SearchFaqs = 2031,
|
||||
PollAnswer = 3505,
|
||||
PollReject = 1773,
|
||||
PollStart = 109,
|
||||
PollVoteCounter = 6200,
|
||||
Disconnect = 2445,
|
||||
ScrGetKickbackInfo = 869,
|
||||
CompostPlant = 3835,
|
||||
HarvestPet = 1521,
|
||||
SetClothingChangeData = 924,
|
||||
GroupUnfavorite = 1820,
|
||||
NewUserExperienceGetGifts = 1822,
|
||||
NewUserExperienceScriptProceed = 1299,
|
||||
HandshakeInitDiffie = 3110,
|
||||
HandshakeCompleteDiffie = 773,
|
||||
WelcomeOpenGift = 2638,
|
||||
WelcomeGiftChangeEmail = 66,
|
||||
EmailGetStatus = 2557,
|
||||
EmailChange = 3965,
|
||||
ApproveAllMembershipRequests = 882,
|
||||
RentableSpaceCancelRent = 1667,
|
||||
RentableSpaceRent = 2946,
|
||||
RentableSpaceStatus = 872,
|
||||
TrackingPerformanceLog = 3230,
|
||||
TrackingLagWarningReport = 3847,
|
||||
RoomDirectoryRoomNetworkOpenConnection = 3736,
|
||||
RentableExtendRentOrBuyoutStripItem = 2115,
|
||||
RentableExtendRentOrBuyoutFurni = 1071,
|
||||
RentableGetRentOrBuyoutOffer = 2518,
|
||||
TryLogin = 4,
|
||||
VersionCheck = 5,
|
||||
UniqueId = 6,
|
||||
GetInfo = 7,
|
||||
GetCredits = 8,
|
||||
Suserf = 16,
|
||||
CreateFlat = 29,
|
||||
GetPassword = 47,
|
||||
LangCheck = 58,
|
||||
Btcks = 105,
|
||||
Navigate = 150,
|
||||
GetUserFlatCats = 151,
|
||||
GetAvailableBadges = 157,
|
||||
GetSessionParameters = 181,
|
||||
Pong = 196,
|
||||
GenerateKey = 202,
|
||||
Sso = 204
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Inventory.Badges;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Inventory.Badges;
|
||||
|
||||
public class RequestBadgesEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
|
||||
public RequestBadgesEvent(IGameSessionManager gameSessionManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.UserBadges;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new BadgesComposer(gameSession.Habbo.Badges));
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.User.Data;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Inventory.Badges;
|
||||
|
||||
public class SetActivatedBadgesEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly IRepository<Badge> _badgeRepository;
|
||||
|
||||
public SetActivatedBadgesEvent(IGameSessionManager gameSessionManager, IRepository<Badge> badgeRepository)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_badgeRepository = badgeRepository;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.UserBadgesCurrentUpdate;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
var wearingBadges = new Collection<Badge>();
|
||||
var badgesToUpdate = new Dictionary<int, Badge>();
|
||||
var current = gameSession.Habbo.Badges.Where(b => b.Slot != 0);
|
||||
foreach (var currentBadge in current)
|
||||
{
|
||||
currentBadge.Slot = 0;
|
||||
badgesToUpdate.Add(currentBadge.Id, currentBadge);
|
||||
}
|
||||
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
var slotId = request.ReadInt32();
|
||||
var code = request.ReadString();
|
||||
|
||||
if (slotId is < 1 or > 5 || string.IsNullOrEmpty(code)) continue;
|
||||
|
||||
var badge = gameSession.Habbo.Badges.FirstOrDefault(b => b.Code == code);
|
||||
|
||||
if (badge == null) continue;
|
||||
|
||||
badge.Slot = slotId;
|
||||
wearingBadges.Add(badge);
|
||||
|
||||
badgesToUpdate.TryAdd(badge.Id, badge);
|
||||
}
|
||||
|
||||
await _badgeRepository.SaveManyAsync(badgesToUpdate.Values);
|
||||
await gameSession.SendComposerAsync(new UserCurrentBadgesComposer(gameSession.Habbo.Id, wearingBadges));
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Inventory.Currency;
|
||||
using Tiger.Communication.Messages.Outgoing.Notifications;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Inventory.Currency;
|
||||
|
||||
public class UserCurrencyEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
|
||||
public UserCurrencyEvent(IGameSessionManager gameSessionManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.UserCurrency;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new UserCreditsComposer(gameSession.Habbo.Credits));
|
||||
await gameSession.SendComposerAsync(new UserCurrencyComposer(gameSession.Habbo.Activitypoints.Values));
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Inventory.Subscription;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Achievements;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Inventory.Subscription;
|
||||
|
||||
public class UserSubscriptionEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly IAchievementManager _achievementManager;
|
||||
|
||||
public UserSubscriptionEvent(IGameSessionManager gameSessionManager, IAchievementManager achievementManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_achievementManager = achievementManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.UserSubscription;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
_achievementManager.UpdateAchievementAsync("ACH_HC", ((gameSession.Habbo.GetPastSubscriptionDays() / 31)), gameSession);
|
||||
|
||||
await gameSession.SendComposerAsync(new UserSubscriptionComposer(gameSession.Habbo.GetActiveSubscription(),
|
||||
gameSession.Habbo.GetPastSubscriptionDays()));
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Landingview;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.LandingView;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Landingview;
|
||||
|
||||
public class GetPromoArticlesEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly ILandingViewManager _landingViewManager;
|
||||
|
||||
public GetPromoArticlesEvent(IGameSessionManager gameSessionManager, ILandingViewManager landingViewManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_landingViewManager = landingViewManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.GetPromoArticles;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new PromoArticlesMessageComposer(_landingViewManager.PromoArticles));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Rooms;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Navigator;
|
||||
|
||||
public class CreateFlatEvent : IMessageEvent
|
||||
{
|
||||
private readonly IRepository<Room> _roomRepository;
|
||||
private readonly IRoomManager _roomManager;
|
||||
|
||||
public CreateFlatEvent(IRepository<Room> roomRepository, IRoomManager roomManager)
|
||||
{
|
||||
_roomRepository = roomRepository;
|
||||
_roomManager = roomManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.CreateFlat;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await gameSession.CloseAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
var name = request.ReadString();
|
||||
var roomModel = request.ReadString();
|
||||
var roomAccess = request.ReadString();
|
||||
var showOwner = request.ReadBoolean();
|
||||
|
||||
if (
|
||||
string.IsNullOrEmpty(name.Trim()) ||
|
||||
!roomModel.StartsWith("model_") ||
|
||||
(
|
||||
roomModel != "model_a" &&
|
||||
roomModel != "model_b" &&
|
||||
roomModel != "model_c" &&
|
||||
roomModel != "model_d" &&
|
||||
roomModel != "model_e" &&
|
||||
roomModel != "model_f" &&
|
||||
roomModel != "model_i" &&
|
||||
roomModel != "model_j" &&
|
||||
roomModel != "model_k" &&
|
||||
roomModel != "model_l" &&
|
||||
roomModel != "model_m" &&
|
||||
roomModel != "model_n"
|
||||
)
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_roomManager.Models.TryGetValue(roomModel, out var model))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var room = new Room()
|
||||
{
|
||||
Name = name,
|
||||
AccessType = Enum.Parse<RoomAccessType>(roomAccess, true),
|
||||
ModelId = model.Id,
|
||||
Model = model,
|
||||
Owner = gameSession.Habbo,
|
||||
ShowOwner = showOwner
|
||||
};
|
||||
await _roomRepository.SaveAsync(room);
|
||||
await gameSession.SendComposerAsync(new FlatCreatedComposer(room.Id, room.Name));
|
||||
}
|
||||
}
|
|
@ -1,20 +1,19 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Rooms;
|
||||
using Tiger.Game.Navigator;
|
||||
using Tiger.Game.Navigator.Nodes;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Navigator;
|
||||
|
||||
public class GetUserFlatCatsMessageEvent : IMessageEvent
|
||||
public class GetUserFlatCatsEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly IRoomManager _roomManager;
|
||||
private readonly INavigatorManager _navigatorManager;
|
||||
|
||||
public GetUserFlatCatsMessageEvent(IRoomManager roomManager, IGameSessionManager gameSessionManager)
|
||||
public GetUserFlatCatsEvent(INavigatorManager navigatorManager)
|
||||
{
|
||||
_roomManager = roomManager;
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_navigatorManager = navigatorManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.GetUserFlatCats;
|
||||
|
@ -22,11 +21,11 @@ public class GetUserFlatCatsMessageEvent : IMessageEvent
|
|||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
await gameSession.CloseAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new UserFlatCatsComposer(_roomManager.PrivateCategories.Values,
|
||||
gameSession.Habbo.Rank));
|
||||
await gameSession.SendComposerAsync(new UserFlatCatsComposer(_navigatorManager.NavigatorNodes.Values
|
||||
.Where(nn => nn.Type == NavigatorNodeType.Private && nn.RankFlatcat <= gameSession.Habbo.Rank).ToList()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Navigator;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Navigator;
|
||||
|
||||
public class NavigateEvent : IMessageEvent
|
||||
{
|
||||
private readonly INavigatorManager _navigatorManager;
|
||||
|
||||
public NavigateEvent(INavigatorManager navigatorManager)
|
||||
{
|
||||
_navigatorManager = navigatorManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.Navigate;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await gameSession.CloseAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
var nodeMask = request.ReadWire() == 1;
|
||||
var nodeId = request.ReadWire();
|
||||
|
||||
if (!_navigatorManager.NavigatorNodes.TryGetValue(nodeId, out var node))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new NavNodeInfoComposer(nodeMask, node));
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Navigator;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Navigator;
|
||||
|
||||
public class NavigatorInitEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly INavigatorManager _navigatorManager;
|
||||
|
||||
public NavigatorInitEvent(IGameSessionManager gameSessionManager, INavigatorManager navigatorManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_navigatorManager = navigatorManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.NavigatorInit;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new NavigatorMetadataComposer(_navigatorManager.NavigatorViews.Values));
|
||||
await gameSession.SendComposerAsync(new NavigatorCollapsedComposer());
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing;
|
||||
using Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Navigator;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Navigator;
|
||||
|
||||
public class NavigatorSearchEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly INavigatorManager _navigatorManager;
|
||||
|
||||
public NavigatorSearchEvent(IGameSessionManager gameSessionManager, INavigatorManager navigatorManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_navigatorManager = navigatorManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.NavigatorSearch;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_navigatorManager.NavigatorViews.TryGetValue(request.ReadString(), out var navigatorView)) return;
|
||||
var qry = request.ReadString();
|
||||
|
||||
var message = new ServerMessage((short)OutgoingHeaders.NavigatorSearch);
|
||||
message.AppendString(navigatorView.Code);
|
||||
message.AppendString(qry);
|
||||
await navigatorView.Compose(message, gameSession.Habbo, qry);
|
||||
await gameSession.SendMessageAsync(message);
|
||||
|
||||
// await gameSession.SendComposerAsync(new NavigatorSearchComposer(navigatorView, request.ReadString(), gameSession.Habbo));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
using FluentNHibernate.Conventions;
|
||||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Navigator;
|
||||
|
||||
public class SearchUserFlatsEvent : IMessageEvent
|
||||
{
|
||||
public IncomingHeaders Header => IncomingHeaders.Suserf;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await gameSession.CloseAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
if (gameSession.Habbo.Rooms.IsEmpty())
|
||||
{
|
||||
await gameSession.SendComposerAsync(new NoFlatsForUserComposer());
|
||||
}
|
||||
else
|
||||
{
|
||||
await gameSession.SendComposerAsync(
|
||||
new FlatResultsComposer(
|
||||
FlatResultsComposer.UserFlats,
|
||||
gameSession.Habbo.Rooms.OrderByDescending(r => r.UsersIn).ToList()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Purse;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Purse;
|
||||
|
||||
public class GetCreditsEvent : IMessageEvent
|
||||
{
|
||||
public IncomingHeaders Header => IncomingHeaders.GetCredits;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await gameSession.CloseAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new PurseComposer(gameSession.Habbo.Credits));
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.User.Data;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.User.Data;
|
||||
|
||||
public class UserCurrentBadgesEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly IRepository<Badge> _badgeRepository;
|
||||
|
||||
public UserCurrentBadgesEvent(IGameSessionManager gameSessionManager, IRepository<Badge> badgeRepository)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_badgeRepository = badgeRepository;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.UserBadgesCurrent;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
var habboId = request.ReadInt32();
|
||||
|
||||
var badges = await _badgeRepository.FindByAsync(b => b.Habbo.Id == habboId && b.Slot > 0);
|
||||
await gameSession.SendComposerAsync(new UserCurrentBadgesComposer(habboId, badges.ToList()));
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Avatar;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Achievements;
|
||||
using Tiger.Game.Figuredata;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.User.Data;
|
||||
|
||||
public class UserFigureEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly IFigureDataManager _figureDataManager;
|
||||
private readonly IRepository<Habbo> _habboRepository;
|
||||
private readonly IAchievementManager _achievementManager;
|
||||
|
||||
public UserFigureEvent(IGameSessionManager gameSessionManager, IFigureDataManager figureDataManager, IRepository<Habbo> habboRepository, IAchievementManager achievementManager)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_figureDataManager = figureDataManager;
|
||||
_habboRepository = habboRepository;
|
||||
_achievementManager = achievementManager;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.UserFigure;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||||
return;
|
||||
}
|
||||
|
||||
var gender = request.ReadString().ToUpper();
|
||||
var figure = request.ReadString();
|
||||
|
||||
if ((gender != "M" && gender != "F") || (figure == gameSession.Habbo.Figure && gender == gameSession.Habbo.Gender.ToUpper()) /*||
|
||||
!_figureDataManager.ValidateFigure(figure, gender, gameSession.Habbo)*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gameSession.Habbo.Figure = figure;
|
||||
gameSession.Habbo.Gender = gender;
|
||||
_habboRepository.SaveAsync(gameSession.Habbo);
|
||||
|
||||
_achievementManager.UpdateAchievementAsync("ACH_AvatarLooks", 1, gameSession);
|
||||
|
||||
await gameSession.SendComposerAsync(new FigureUpdateComposer(figure, gender));
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.User.Data;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.User.Data;
|
||||
|
||||
public class UserProfileEvent : IMessageEvent
|
||||
{
|
||||
private readonly IGameSessionManager _gameSessionManager;
|
||||
private readonly IRepository<Habbo> _habboRepository;
|
||||
|
||||
public UserProfileEvent(IGameSessionManager gameSessionManager, IRepository<Habbo> habboRepository)
|
||||
{
|
||||
_gameSessionManager = gameSessionManager;
|
||||
_habboRepository = habboRepository;
|
||||
}
|
||||
|
||||
public IncomingHeaders Header => IncomingHeaders.UserProfile;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
var habbo = await _habboRepository.FindAsync(request.ReadInt32());
|
||||
|
||||
if (habbo == null) return;
|
||||
|
||||
await gameSession.SendComposerAsync(new UserProfileComposer(habbo));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Outgoing.Users;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Communication.Messages.Incoming.Users;
|
||||
|
||||
public class GetInfoEvent : IMessageEvent
|
||||
{
|
||||
public IncomingHeaders Header => IncomingHeaders.GetInfo;
|
||||
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||||
{
|
||||
if (gameSession.Habbo == null)
|
||||
{
|
||||
await gameSession.CloseAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await gameSession.SendComposerAsync(new UserObjComposer(gameSession.Habbo));
|
||||
}
|
||||
}
|
|
@ -9,29 +9,24 @@ namespace Tiger.Communication.Messages;
|
|||
public class MessageHandler : IMessageHandler
|
||||
{
|
||||
private readonly ILogger<MessageHandler> _logger;
|
||||
private readonly IDictionary<short, IMessageEvent> _messageEvents;
|
||||
private readonly IDictionary<short, string> _messageNames;
|
||||
private readonly IDictionary<int, IMessageEvent> _messageEvents;
|
||||
private readonly IDictionary<int, string> _messageNames;
|
||||
|
||||
public MessageHandler(ILogger<MessageHandler> logger, IEnumerable<IMessageEvent> messageEvents)
|
||||
{
|
||||
_logger = logger;
|
||||
_messageEvents = messageEvents.ToDictionary(messageEvent => (short)messageEvent.Header);
|
||||
_messageEvents = messageEvents.ToDictionary(messageEvent => (int)messageEvent.Header);
|
||||
|
||||
_messageNames = new Dictionary<short, string>();
|
||||
_messageNames = new Dictionary<int, string>();
|
||||
|
||||
foreach (var name in Enum.GetNames(typeof(IncomingHeaders)))
|
||||
{
|
||||
_messageNames.Add((short)Enum.Parse(typeof(IncomingHeaders), name), name);
|
||||
_messageNames.Add((int)Enum.Parse(typeof(IncomingHeaders), name), name);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task TryHandleAsync(GameSession session, ClientMessage request)
|
||||
{
|
||||
if (request.Header == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_messageEvents.TryGetValue(request.Header, out var messageEvent))
|
||||
{
|
||||
_logger.LogInformation("Handling header ID {Header} on class {Class}", request.Header, messageEvent.GetType());
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Avatar;
|
||||
|
||||
public class FigureUpdateComposer : IMessageComposer
|
||||
{
|
||||
private readonly string _figure;
|
||||
private readonly string _gender;
|
||||
|
||||
public FigureUpdateComposer(string figure, string gender)
|
||||
{
|
||||
_figure = figure;
|
||||
_gender = gender;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserFigure;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendString(_figure);
|
||||
message.AppendString(_gender);
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Catalogue;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Catalog;
|
||||
|
||||
public class CatalogPageMessageComposer : IMessageComposer
|
||||
{
|
||||
private readonly CataloguePage _page;
|
||||
private readonly int _offerId;
|
||||
private readonly string _mode;
|
||||
private readonly ICollection<CatalogueFeaturedPage> _featuredPages;
|
||||
|
||||
public CatalogPageMessageComposer(CataloguePage page, int offerId, string mode,
|
||||
ICollection<CatalogueFeaturedPage> featuredPages)
|
||||
{
|
||||
_page = page;
|
||||
_offerId = offerId;
|
||||
_mode = mode;
|
||||
_featuredPages = featuredPages;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.CatalogPage;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_page.Id);
|
||||
message.AppendString(_mode);
|
||||
message.AppendString(_page.Layout);
|
||||
message.AppendInt32(_page.Images.Count);
|
||||
|
||||
foreach (var image in _page.Images)
|
||||
{
|
||||
message.AppendString(image);
|
||||
}
|
||||
|
||||
message.AppendInt32(_page.Texts.Count);
|
||||
|
||||
foreach (var text in _page.Texts)
|
||||
{
|
||||
message.AppendString(text);
|
||||
}
|
||||
|
||||
message.AppendInt32(0);
|
||||
message.AppendInt32(_offerId);
|
||||
message.AppendBoolean(_page.SeasonalCurrency);
|
||||
message.AppendInt32(_featuredPages.Count);
|
||||
|
||||
foreach (var featuredPage in _featuredPages)
|
||||
{
|
||||
message.AppendInt32(featuredPage.SlotId);
|
||||
message.AppendString(featuredPage.Caption);
|
||||
message.AppendString(featuredPage.Image);
|
||||
message.AppendInt32((int)featuredPage.Type);
|
||||
switch (featuredPage.Type)
|
||||
{
|
||||
default:
|
||||
case CatalogueFeaturedPageType.PageName:
|
||||
case CatalogueFeaturedPageType.ProductName:
|
||||
message.AppendString(featuredPage.Data);
|
||||
break;
|
||||
case CatalogueFeaturedPageType.PageId:
|
||||
message.AppendInt32(int.TryParse(featuredPage.Data, out var pageId) ? pageId : -1);
|
||||
break;
|
||||
}
|
||||
message.AppendInt32((int)(DateTime.Now - featuredPage.Expire).TotalSeconds);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Catalogue;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Catalog;
|
||||
|
||||
public class CatalogPagesListComposer : IMessageComposer
|
||||
{
|
||||
private readonly IEnumerable<CataloguePage> _pages;
|
||||
private readonly string _mode;
|
||||
|
||||
public CatalogPagesListComposer(IEnumerable<CataloguePage> pages, string mode)
|
||||
{
|
||||
_pages = pages;
|
||||
_mode = mode;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.CatalogPageList;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendBoolean(true);
|
||||
message.AppendInt32(0);
|
||||
message.AppendInt32(-1);
|
||||
message.AppendString("root");
|
||||
message.AppendString(string.Empty);
|
||||
message.AppendInt32(0);
|
||||
message.AppendInt32(_pages.Count());
|
||||
|
||||
foreach (var page in _pages)
|
||||
{
|
||||
SerializeNode(page, message);
|
||||
}
|
||||
|
||||
message.AppendBoolean(false);
|
||||
message.AppendString(_mode);
|
||||
}
|
||||
|
||||
private void SerializeNode(CataloguePage page, ServerMessage message)
|
||||
{
|
||||
message.AppendBoolean(page.Visible);
|
||||
message.AppendInt32(page.Icon);
|
||||
message.AppendInt32(page.Id);
|
||||
message.AppendString(page.InternalName);
|
||||
message.AppendString(page.Name);
|
||||
message.AppendInt32(0);
|
||||
message.AppendInt32(page.Children.Count);
|
||||
|
||||
foreach (var child in page.Children)
|
||||
{
|
||||
SerializeNode(child, message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Catalogue;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Catalog;
|
||||
|
||||
public class HabboClubOffersMessageComposer : IMessageComposer
|
||||
{
|
||||
private readonly ICollection<ClubOffer> _clubOffers;
|
||||
private readonly HabboSubscription? _habboSubscription;
|
||||
|
||||
public HabboClubOffersMessageComposer(ICollection<ClubOffer> clubOffers, HabboSubscription? habboSubscription)
|
||||
{
|
||||
_clubOffers = clubOffers;
|
||||
_habboSubscription = habboSubscription;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.ClubOffers;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_clubOffers.Count);
|
||||
|
||||
foreach (var clubOffer in _clubOffers)
|
||||
{
|
||||
var end = _habboSubscription is not null
|
||||
? _habboSubscription.Expires.AddDays(clubOffer.Days)
|
||||
: DateTime.Now.AddMonths(1);
|
||||
message.AppendInt32(clubOffer.Id);
|
||||
message.AppendString(clubOffer.Name);
|
||||
message.AppendBoolean(false); // does absolutely NOTHING
|
||||
message.AppendInt32(clubOffer.PriceCredits);
|
||||
message.AppendInt32(clubOffer.PriceActivitypoints);
|
||||
message.AppendInt32(clubOffer.ActivitypointsType);
|
||||
message.AppendBoolean(true); // always vip
|
||||
message.AppendInt32(0); // months
|
||||
message.AppendInt32(clubOffer.Days); // extra days
|
||||
message.AppendBoolean(true); // gift-able
|
||||
message.AppendInt32(0); // days left after purchase
|
||||
message.AppendInt32(end.Year);
|
||||
message.AppendInt32(end.Month);
|
||||
message.AppendInt32(end.Day);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Catalog;
|
||||
|
||||
public class NotEnoughBalanceMessageComposer : IMessageComposer
|
||||
{
|
||||
private readonly bool _notEnoughCredits;
|
||||
private readonly bool _notEnoughActivityPoints;
|
||||
private readonly int _activityPointsType;
|
||||
|
||||
public NotEnoughBalanceMessageComposer(bool notEnoughCredits, bool notEnoughActivityPoints, int activityPointsType)
|
||||
{
|
||||
_notEnoughCredits = notEnoughCredits;
|
||||
_notEnoughActivityPoints = notEnoughActivityPoints;
|
||||
_activityPointsType = activityPointsType;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.NotEnoughBalance;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendBoolean(_notEnoughCredits);
|
||||
message.AppendBoolean(_notEnoughActivityPoints);
|
||||
message.AppendInt32(_activityPointsType);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Handshake;
|
||||
|
||||
public class HelloComposer : IMessageComposer
|
||||
{
|
||||
public OutgoingHeaders Header => OutgoingHeaders.Hello;
|
||||
public void Compose(ServerMessage message)
|
||||
{;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Handshake;
|
||||
|
||||
public class LoginOkComposer : IMessageComposer
|
||||
{
|
||||
public OutgoingHeaders Header => OutgoingHeaders.LoginOk;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Handshake;
|
||||
|
||||
public class SecretKeyComposer : IMessageComposer
|
||||
{
|
||||
private readonly string _publicKey;
|
||||
|
||||
public SecretKeyComposer(string publicKey)
|
||||
{
|
||||
_publicKey = publicKey;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.SecretKey;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendString(_publicKey);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Handshake;
|
||||
|
||||
public class SessionParametersComposer : IMessageComposer
|
||||
{
|
||||
private readonly int _coppaType;
|
||||
private readonly bool _voucherEnabled;
|
||||
private readonly bool _parentEmailRequest;
|
||||
private readonly bool _parentEmailRequestRegistration;
|
||||
private readonly bool _allowDirectMail;
|
||||
private readonly string _dateFormat;
|
||||
|
||||
public SessionParametersComposer(int coppaType, bool voucherEnabled, bool parentEmailRequest,
|
||||
bool parentEmailRequestRegistration, bool allowDirectMail, string dateFormat)
|
||||
{
|
||||
_coppaType = coppaType;
|
||||
_voucherEnabled = voucherEnabled;
|
||||
_parentEmailRequest = parentEmailRequest;
|
||||
_parentEmailRequestRegistration = parentEmailRequestRegistration;
|
||||
_allowDirectMail = allowDirectMail;
|
||||
_dateFormat = dateFormat;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.SessionParameters;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendWire(6);
|
||||
|
||||
message.AppendWire(0);
|
||||
message.AppendWire(_coppaType);
|
||||
|
||||
message.AppendWire(1);
|
||||
message.AppendWire(_voucherEnabled);
|
||||
|
||||
message.AppendWire(2);
|
||||
message.AppendWire(_parentEmailRequest);
|
||||
|
||||
message.AppendWire(3);
|
||||
message.AppendWire(_parentEmailRequestRegistration);
|
||||
|
||||
message.AppendWire(4);
|
||||
message.AppendWire(_allowDirectMail);
|
||||
|
||||
message.AppendWire(5);
|
||||
message.AppendString(_dateFormat);
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Achievements;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Inventory.Achievements;
|
||||
|
||||
public class AchievementComposer : IMessageComposer
|
||||
{
|
||||
private readonly Achievement _achievement;
|
||||
private readonly HabboAchievement _habboAchievement;
|
||||
|
||||
public AchievementComposer(Achievement achievement, HabboAchievement habboAchievement)
|
||||
{
|
||||
_achievement = achievement;
|
||||
_habboAchievement = habboAchievement;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.AchievementProgressed;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
var targetLevel = _habboAchievement.Level == _achievement.Levels.Count
|
||||
? _habboAchievement.Level
|
||||
: _habboAchievement.Level + 1;
|
||||
|
||||
message.AppendInt32(_achievement.Id);
|
||||
message.AppendInt32(targetLevel);
|
||||
message.AppendString($"{_achievement.Badge}{targetLevel}");
|
||||
message.AppendInt32(_habboAchievement.Progress);
|
||||
message.AppendInt32(_achievement.Levels[targetLevel].ProgressNeeded);
|
||||
message.AppendInt32(_achievement.Levels[targetLevel].RewardAmount);
|
||||
message.AppendInt32(_achievement.Levels[targetLevel].RewardType);
|
||||
message.AppendInt32(_habboAchievement.Progress);
|
||||
message.AppendBoolean(_habboAchievement.Level >= _achievement.Levels.Count);
|
||||
message.AppendString(_achievement.Category);
|
||||
message.AppendString(string.Empty);
|
||||
message.AppendInt32(_achievement.Levels.Count);
|
||||
message.AppendInt32(_habboAchievement.Level >= _achievement.Levels.Count ? 1 : 0);
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Achievements;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Inventory.Achievements;
|
||||
|
||||
public class AchievementsComposer : IMessageComposer
|
||||
{
|
||||
private readonly ICollection<Achievement> _achievements;
|
||||
private readonly Habbo _habbo;
|
||||
|
||||
public AchievementsComposer(ICollection<Achievement> achievements, Habbo habbo)
|
||||
{
|
||||
_achievements = achievements;
|
||||
_habbo = habbo;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.AchievementList;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_achievements.Count);
|
||||
|
||||
foreach (var achievement in _achievements)
|
||||
{
|
||||
var targetLevel = 1;
|
||||
|
||||
if (_habbo.Achievements.TryGetValue(achievement.Id, out var habboAchievement))
|
||||
targetLevel = habboAchievement.Level == achievement.Levels.Count
|
||||
? habboAchievement.Level
|
||||
: habboAchievement.Level + 1;
|
||||
|
||||
message.AppendInt32(achievement.Id);
|
||||
message.AppendInt32(targetLevel);
|
||||
message.AppendString($"{achievement.Badge}{targetLevel}");
|
||||
message.AppendInt32(habboAchievement?.Progress ?? 0);
|
||||
message.AppendInt32(achievement.Levels[targetLevel].ProgressNeeded);
|
||||
message.AppendInt32(achievement.Levels[targetLevel].RewardAmount);
|
||||
message.AppendInt32(achievement.Levels[targetLevel].RewardType);
|
||||
message.AppendInt32(habboAchievement?.Progress ?? 0);
|
||||
message.AppendBoolean((habboAchievement?.Level ?? 0) >= achievement.Levels.Count);
|
||||
message.AppendString(achievement.Category);
|
||||
message.AppendString(string.Empty);
|
||||
message.AppendInt32(achievement.Levels.Count);
|
||||
message.AppendInt32((habboAchievement?.Level ?? 0) >= achievement.Levels.Count ? 1 : 0);
|
||||
}
|
||||
|
||||
message.AppendString(string.Empty);
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Inventory.Achievements;
|
||||
|
||||
public class AchievementsScoreComposer : IMessageComposer
|
||||
{
|
||||
private readonly int _score;
|
||||
|
||||
public AchievementsScoreComposer(int score)
|
||||
{
|
||||
_score = score;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserAchievementScore;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_score);
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Inventory.Badges;
|
||||
|
||||
public class BadgesComposer : IMessageComposer
|
||||
{
|
||||
private readonly IReadOnlyList<Badge> _badges;
|
||||
|
||||
public BadgesComposer(IEnumerable<Badge>? badges)
|
||||
{
|
||||
_badges = badges != null ? badges.ToList() : new List<Badge>();
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserBadges;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_badges.Count);
|
||||
|
||||
foreach (var badge in _badges)
|
||||
{
|
||||
message.AppendInt32(badge.Id);
|
||||
message.AppendString(badge.Code);
|
||||
}
|
||||
|
||||
var wearingBadges = _badges.Where(b => b.Slot > 0).ToList();
|
||||
|
||||
message.AppendInt32(wearingBadges.Count);
|
||||
|
||||
foreach (var wearingBadge in wearingBadges)
|
||||
{
|
||||
message.AppendInt32(wearingBadge.Slot);
|
||||
message.AppendString(wearingBadge.Code);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Inventory.Currency;
|
||||
|
||||
public class UserCreditsComposer : IMessageComposer
|
||||
{
|
||||
private readonly int _credits;
|
||||
|
||||
public UserCreditsComposer(int credits)
|
||||
{
|
||||
_credits = credits;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserCredits;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendString($"{_credits}.0");
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Inventory.Currency;
|
||||
|
||||
public class UserCurrencyComposer : IMessageComposer
|
||||
{
|
||||
private readonly ICollection<Activitypoints> _activitypoints;
|
||||
|
||||
public UserCurrencyComposer(ICollection<Activitypoints> activitypoints)
|
||||
{
|
||||
_activitypoints = activitypoints;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserCurrency;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_activitypoints.Count);
|
||||
|
||||
foreach (var activitypoint in _activitypoints)
|
||||
{
|
||||
message.AppendInt32(activitypoint.Type);
|
||||
message.AppendInt32(activitypoint.Amount);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Inventory.Subscription;
|
||||
|
||||
public class UserSubscriptionComposer : IMessageComposer
|
||||
{
|
||||
private readonly HabboSubscription? _habboSubscription;
|
||||
private readonly int _pastSubscriptionDays;
|
||||
|
||||
public UserSubscriptionComposer(HabboSubscription? habboSubscription, int pastSubscriptionDays)
|
||||
{
|
||||
_habboSubscription = habboSubscription;
|
||||
_pastSubscriptionDays = pastSubscriptionDays;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserSubscription;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendString(_habboSubscription?.SubscriptionType ?? string.Empty);
|
||||
message.AppendInt32(_habboSubscription?.DaysInMonthLeft ?? 0);
|
||||
message.AppendInt32(_habboSubscription?.MonthsLeft ?? 0);
|
||||
message.AppendInt32(0); // periods subscribed ahead but why is this different than above?
|
||||
message.AppendInt32(0); // response type
|
||||
message.AppendBoolean(_pastSubscriptionDays > 0);
|
||||
message.AppendBoolean(true); // vip but always vip?
|
||||
message.AppendInt32(0); // past club days but is always vip so below is used
|
||||
message.AppendInt32(_pastSubscriptionDays);
|
||||
message.AppendInt32((int)(_habboSubscription?.MinutesLeft ?? 0));
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.LandingView;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Landingview;
|
||||
|
||||
public class PromoArticlesMessageComposer : IMessageComposer
|
||||
{
|
||||
private readonly ICollection<PromoArticle> _promoArticles;
|
||||
|
||||
public PromoArticlesMessageComposer(ICollection<PromoArticle> promoArticles)
|
||||
{
|
||||
_promoArticles = promoArticles;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.PromoArticles;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_promoArticles.Count);
|
||||
|
||||
foreach (var promoArticle in _promoArticles)
|
||||
{
|
||||
message.AppendInt32(promoArticle.Id);
|
||||
message.AppendString(promoArticle.Title);
|
||||
message.AppendString(promoArticle.BodyText);
|
||||
message.AppendString(promoArticle.ButtonText);
|
||||
message.AppendInt32((int)promoArticle.LinkType);
|
||||
message.AppendString(promoArticle.LinkContent);
|
||||
message.AppendString(promoArticle.ImageUrl);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
|
||||
public class FlatCreatedComposer : IMessageComposer
|
||||
{
|
||||
private readonly int _roomId;
|
||||
private readonly string _name;
|
||||
|
||||
public FlatCreatedComposer(int roomId, string name)
|
||||
{
|
||||
_roomId = roomId;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.FlatCreated;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendWire(_roomId);
|
||||
message.AppendString(_name);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Rooms;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
|
||||
public class FlatResultsComposer : IMessageComposer
|
||||
{
|
||||
public const int UserFlats = 0;
|
||||
public const int Flats = 1;
|
||||
|
||||
private readonly int _flatResultType;
|
||||
private readonly ICollection<Room> _rooms;
|
||||
|
||||
public FlatResultsComposer(int flatResultType, ICollection<Room> rooms)
|
||||
{
|
||||
_flatResultType = flatResultType;
|
||||
_rooms = rooms;
|
||||
}
|
||||
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.FlatResults;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendWire(_flatResultType);
|
||||
message.AppendWire(_rooms.Count);
|
||||
|
||||
foreach (var room in _rooms)
|
||||
{
|
||||
room.ParseNode(message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Navigator.Nodes;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
|
||||
public class NavNodeInfoComposer : IMessageComposer
|
||||
{
|
||||
private readonly bool _nodeMask;
|
||||
private readonly NavigatorNode _node;
|
||||
|
||||
public NavNodeInfoComposer(bool nodeMask, NavigatorNode node)
|
||||
{
|
||||
_nodeMask = nodeMask;
|
||||
_node = node;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.NavNodeInfo;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendWire(_nodeMask);
|
||||
message.AppendWire(_node.Id);
|
||||
message.AppendWire((int)_node.Type);
|
||||
message.AppendString(_node.Name);
|
||||
message.AppendWire(0);
|
||||
message.AppendWire(0);
|
||||
message.AppendWire(_node.Parent?.Id ?? 0);
|
||||
|
||||
if (_node.Type == NavigatorNodeType.Private)
|
||||
{
|
||||
try
|
||||
{
|
||||
var rooms = _node.Rooms.OrderByDescending(r => r.UsersIn).Take(30).ToList();
|
||||
|
||||
message.AppendWire(rooms.Count);
|
||||
|
||||
foreach (var room in rooms)
|
||||
{
|
||||
room.ParseNode(message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var child in _node.Children.Where(nn => nn.Visible))
|
||||
{
|
||||
message.AppendWire(child.Id);
|
||||
message.AppendWire((int)child.Type);
|
||||
message.AppendString(child.Name);
|
||||
message.AppendWire(0); // TODO: percent filled (changes bar color)
|
||||
message.AppendWire(0);
|
||||
message.AppendWire(_node.Id);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Navigator.Views;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
|
||||
public class NavigatorMetadataComposer : IMessageComposer
|
||||
{
|
||||
private readonly ICollection<INavigatorView> _navigatorViews;
|
||||
|
||||
public NavigatorMetadataComposer(ICollection<INavigatorView> navigatorViews)
|
||||
{
|
||||
_navigatorViews = navigatorViews;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.NavigatorMetadata;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_navigatorViews.Count);
|
||||
|
||||
foreach (var navigatorView in _navigatorViews)
|
||||
{
|
||||
message.AppendString(navigatorView.Code);
|
||||
message.AppendInt32(0); // saved searches
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Game.Navigator.Views;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
|
||||
public class NavigatorSearchComposer : IMessageComposer
|
||||
{
|
||||
private readonly INavigatorView _navigatorView;
|
||||
private readonly string _query;
|
||||
private readonly Habbo _habbo;
|
||||
|
||||
public NavigatorSearchComposer(INavigatorView navigatorView, string query, Habbo habbo)
|
||||
{
|
||||
_navigatorView = navigatorView;
|
||||
_query = query;
|
||||
_habbo = habbo;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.NavigatorSearch;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendString(_navigatorView.Code);
|
||||
message.AppendString(_query);
|
||||
_navigatorView.Compose(message, _habbo, _query).Wait();
|
||||
}
|
||||
}
|
|
@ -3,12 +3,10 @@ using Tiger.Communication.Messages.Types;
|
|||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
|
||||
public class NavigatorCollapsedComposer : IMessageComposer
|
||||
public class NoFlatsForUserComposer : IMessageComposer
|
||||
{
|
||||
public OutgoingHeaders Header => OutgoingHeaders.NavigatorCollapsed;
|
||||
public OutgoingHeaders Header => OutgoingHeaders.NoFlatsForUser;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(1);
|
||||
message.AppendString("official");
|
||||
}
|
||||
}
|
|
@ -1,34 +1,27 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Rooms;
|
||||
using Tiger.Game.Navigator.Nodes;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Navigator;
|
||||
|
||||
public class UserFlatCatsComposer : IMessageComposer
|
||||
{
|
||||
private readonly ICollection<RoomPrivateCategory> _privateCategories;
|
||||
private readonly int _rank;
|
||||
private readonly ICollection<NavigatorNode> _flatCats;
|
||||
|
||||
public UserFlatCatsComposer(ICollection<RoomPrivateCategory> privateCategories, int rank)
|
||||
public UserFlatCatsComposer(ICollection<NavigatorNode> flatCats)
|
||||
{
|
||||
_privateCategories = privateCategories;
|
||||
_rank = rank;
|
||||
_flatCats = flatCats;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.NavigatorCategories;
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserFlatCats;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_privateCategories.Count);
|
||||
message.AppendWire(_flatCats.Count);
|
||||
|
||||
foreach (var privateCategory in _privateCategories)
|
||||
foreach (var flatCat in _flatCats)
|
||||
{
|
||||
message.AppendInt32(privateCategory.Id);
|
||||
message.AppendString(privateCategory.Name);
|
||||
message.AppendBoolean(privateCategory.MinRank <= _rank);
|
||||
message.AppendBoolean(true); // automatic?
|
||||
message.AppendString(""); // automatic category key?
|
||||
message.AppendString(""); // global category key?
|
||||
message.AppendBoolean(privateCategory.MinRank >= 4);
|
||||
message.AppendWire(flatCat.Id);
|
||||
message.AppendString(flatCat.Name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Notifications;
|
||||
|
||||
public class AchievementNotificationMessageComposer : IMessageComposer
|
||||
{
|
||||
private readonly HabboAchievement _habboAchievement;
|
||||
private readonly int _badgeId;
|
||||
|
||||
public AchievementNotificationMessageComposer(HabboAchievement habboAchievement, int badgeId)
|
||||
{
|
||||
_habboAchievement = habboAchievement;
|
||||
_badgeId = badgeId;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.AchievementNotification;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_habboAchievement.Achievement.Id);
|
||||
message.AppendInt32(_habboAchievement.Level);
|
||||
message.AppendInt32(_badgeId);
|
||||
message.AppendString($"{_habboAchievement.Achievement.Badge}{_habboAchievement.Level}");
|
||||
message.AppendInt32(0); // points?
|
||||
message.AppendInt32(_habboAchievement.Achievement.Levels[_habboAchievement.Level].RewardAmount);
|
||||
message.AppendInt32(_habboAchievement.Achievement.Levels[_habboAchievement.Level].RewardType);
|
||||
message.AppendInt32(_habboAchievement.Achievement.Levels[_habboAchievement.Level].Points);
|
||||
message.AppendInt32(_habboAchievement.Achievement.Id);
|
||||
message.AppendString(_habboAchievement.Level > 1 ? $"{_habboAchievement.Achievement.Badge}{_habboAchievement.Level - 1}" : string.Empty);
|
||||
message.AppendString(_habboAchievement.Achievement.Category);
|
||||
message.AppendBoolean(true);
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Notifications;
|
||||
|
||||
public class ActivityPointNotificationMessageComposer : IMessageComposer
|
||||
{
|
||||
private readonly int _amount;
|
||||
private readonly int _amountChanged;
|
||||
private readonly int _type;
|
||||
|
||||
public ActivityPointNotificationMessageComposer(int amount, int amountChanged, int type)
|
||||
{
|
||||
_amount = amount;
|
||||
_amountChanged = amountChanged;
|
||||
_type = type;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.ActivityPointNotification;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_amount);
|
||||
message.AppendInt32(_amountChanged);
|
||||
message.AppendInt32(_type);
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Notifications;
|
||||
|
||||
public class HabboBroadcastMessageComposer : IMessageComposer
|
||||
{
|
||||
private readonly string _welcomeMessage;
|
||||
|
||||
public HabboBroadcastMessageComposer(string welcomeMessage)
|
||||
{
|
||||
_welcomeMessage = welcomeMessage;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.GenericAlert;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendString(_welcomeMessage);
|
||||
}
|
||||
}
|
|
@ -2,474 +2,26 @@ namespace Tiger.Communication.Messages.Outgoing;
|
|||
|
||||
public enum OutgoingHeaders : short
|
||||
{
|
||||
AchievementList = 305,
|
||||
Authenticated = 2491,
|
||||
Authentication = -1,
|
||||
AvailabilityStatus = 2033,
|
||||
BuildersClubExpired = 1452,
|
||||
ClubOffers = 2405,
|
||||
CatalogPage = 804,
|
||||
CatalogPageList = 1032,
|
||||
CatalogPurchaseOk = 869,
|
||||
CatalogPurchaseError = 1404,
|
||||
CatalogPurchaseNotAllowed = 3770,
|
||||
ProductOffer = 3388,
|
||||
LimitedSoldOut = 377,
|
||||
CatalogPublished = 1866,
|
||||
CfhResultMessage = 3635,
|
||||
ClientLatency = 10,
|
||||
ClientPing = 3928,
|
||||
DesktopCampaign = 1745,
|
||||
DesktopNews = 286,
|
||||
DesktopView = 122,
|
||||
BundleDiscountRuleset = 2347,
|
||||
FirstLoginOfDay = 793,
|
||||
FurnitureAliases = 1723,
|
||||
FurnitureData = 2547,
|
||||
FurnitureFloor = 1778,
|
||||
FurnitureFloorAdd = 1534,
|
||||
FurnitureFloorRemove = 2703,
|
||||
FurnitureFloorUpdate = 3776,
|
||||
FurnitureItemdata = 2202,
|
||||
FurnitureState = 2376,
|
||||
FurnitureGroupContextMenuInfo = 3293,
|
||||
FurniturePostitStickyPoleOpen = 2366,
|
||||
GameCenterAchievements = 2265,
|
||||
GameCenterGameList = 222,
|
||||
GameCenterStatus = 2893,
|
||||
GameCenterInArenaQueue = 872,
|
||||
GameCenterStopCounter = 3191,
|
||||
GameCenterUserLeftGame = 3138,
|
||||
GameCenterDirectoryStatus = 2246,
|
||||
GameCenterStartingGameFailed = 2142,
|
||||
GameCenterJoiningFailed = 1730,
|
||||
Gamestatusmessage = 3805,
|
||||
Gameachievements = 1689,
|
||||
Gameinvite = 904,
|
||||
Joiningqueuefailed = 3035,
|
||||
Joinedqueuemessage = 2260,
|
||||
Leftqueue = 1477,
|
||||
LoadGameUrl = 2624,
|
||||
Loadgame = 3654,
|
||||
Unloadgame = 1715,
|
||||
Achievementresolutioncompleted = 740,
|
||||
Achievementresolutionprogress = 3370,
|
||||
Achievementresolutions = 66,
|
||||
GenericAlert = 3801,
|
||||
ModeratorMessage = 2030,
|
||||
GenericError = 1600,
|
||||
GiftWrapperConfig = 2234,
|
||||
GroupBadges = 2402,
|
||||
GroupCreateOptions = 2159,
|
||||
GroupForumData = 3011,
|
||||
GroupForumList = 3001,
|
||||
GroupForumThreads = 1073,
|
||||
GroupForumPost = 2049,
|
||||
GroupForumPostThread = 1862,
|
||||
GroupForumThreadMessages = 509,
|
||||
GroupForumUnreadCount = 2379,
|
||||
GroupForumUpdateMessage = 324,
|
||||
GroupForumUpdateThread = 2528,
|
||||
GroupInfo = 1702,
|
||||
GroupList = 420,
|
||||
GroupMember = 265,
|
||||
GroupMembers = 1200,
|
||||
GroupMembersRefresh = 2445,
|
||||
GroupMemberRemoveConfirm = 1876,
|
||||
GroupPurchased = 2808,
|
||||
GroupSettings = 3965,
|
||||
GroupBadgeParts = 2238,
|
||||
GroupMembershipRequested = 1180,
|
||||
GroupDetailsChanged = 1459,
|
||||
GroupHabboJoinFailed = 762,
|
||||
GuildEditFailed = 3988,
|
||||
GuildMemberMgmtFailed = 818,
|
||||
ItemDimmerSettings = 2710,
|
||||
ItemStackHelper = 2816,
|
||||
ItemWall = 1369,
|
||||
ItemWallAdd = 2187,
|
||||
ItemWallRemove = 3208,
|
||||
ItemWallUpdate = 2009,
|
||||
MarketplaceConfig = 1823,
|
||||
MessengerAcceptFriends = 896,
|
||||
MessengerChat = 1587,
|
||||
MessengerFindFriends = 1210,
|
||||
MessengerFollowFailed = 3048,
|
||||
MessengerFriendNotification = 3082,
|
||||
MessengerFriends = 3130,
|
||||
MessengerInit = 1605,
|
||||
MessengerInstanceMessageError = 3359,
|
||||
MessengerInvite = 3870,
|
||||
MessengerInviteError = 462,
|
||||
MessengerMessageError = 892,
|
||||
MessengerMinimailCount = 2803,
|
||||
MessengerMinimailNew = 1911,
|
||||
MessengerRelationships = 2016,
|
||||
MessengerRequest = 2219,
|
||||
MessengerRequestError = 892,
|
||||
MessengerRequests = 280,
|
||||
MessengerSearch = 973,
|
||||
MessengerUpdate = 2800,
|
||||
ModerationReportDisabled = 1651,
|
||||
ModerationTool = 2696,
|
||||
ModerationUserInfo = 2866,
|
||||
MotdMessages = 2035,
|
||||
NavigatorCategories = 1562,
|
||||
NavigatorCollapsed = 1543,
|
||||
NavigatorEventCategories = 3244,
|
||||
NavigatorLifted = 3104,
|
||||
NavigatorMetadata = 3052,
|
||||
NavigatorOpenRoomCreator = 2064,
|
||||
NavigatorSearch = 2690,
|
||||
NavigatorSearches = 3984,
|
||||
NavigatorSettings = 518,
|
||||
ThumbnailUpdateResult = 1927,
|
||||
CanCreateRoom = 378,
|
||||
CategoriesWithVisitorCount = 1455,
|
||||
CompetitionRoomsData = 3954,
|
||||
ConvertedRoomId = 1331,
|
||||
GuestRoomSearchResult = 52,
|
||||
NotificationList = 1992,
|
||||
NotificationOfferRewardDelivered = 2125,
|
||||
NotificationSimpleAlert = 5100,
|
||||
NotificationElementPointer = 1787,
|
||||
PetFigureUpdate = 1924,
|
||||
PetInfo = 2901,
|
||||
PetTrainingPanel = 1164,
|
||||
PetLevelUpdate = 2824,
|
||||
PetScratchFailed = 1130,
|
||||
PetOpenPackageRequested = 2380,
|
||||
PetOpenPackageResult = 546,
|
||||
PetBreeding = 1746,
|
||||
PetConfirmBreedingResult = 1625,
|
||||
PetGoToBreedingNestFailure = 2621,
|
||||
PetNestBreedingSuccess = 2527,
|
||||
PetConfirmBreedingRequest = 634,
|
||||
PetBreedingResult = 1553,
|
||||
RecyclerPrizes = 3164,
|
||||
RecyclerStatus = 3433,
|
||||
RecyclerFinished = 468,
|
||||
RoomBanList = 1869,
|
||||
RoomBanRemove = 3429,
|
||||
RoomCreated = 1304,
|
||||
RoomDoorbell = 2309,
|
||||
RoomDoorbellAccepted = 3783,
|
||||
RoomDoorbellRejected = 878,
|
||||
RoomEnter = 758,
|
||||
RoomEnterError = 899,
|
||||
RoomForward = 160,
|
||||
RoomHeightMap = 2753,
|
||||
RoomHeightMapUpdate = 558,
|
||||
RoomInfo = 687,
|
||||
RoomInfoOwner = 749,
|
||||
RoomModel = 1301,
|
||||
RoomModelBlockedTiles = 3990,
|
||||
RoomModelDoor = 1664,
|
||||
RoomModelName = 2031,
|
||||
RoomMuted = 2533,
|
||||
RoomMuteUser = 826,
|
||||
RoomPaint = 2454,
|
||||
RoomPromotion = 2274,
|
||||
RoomQueueStatus = 2208,
|
||||
RoomRights = 780,
|
||||
RoomRightsClear = 2392,
|
||||
RoomRightsList = 1284,
|
||||
RoomRightsListAdd = 2088,
|
||||
RoomRightsListRemove = 1327,
|
||||
RoomRightsOwner = 339,
|
||||
RoomRolling = 3207,
|
||||
RoomScore = 482,
|
||||
RoomSettings = 1498,
|
||||
RoomSettingsChat = 1191,
|
||||
RoomSettingsSave = 948,
|
||||
RoomSettingsSaveError = 1555,
|
||||
RoomInfoUpdated = 3297,
|
||||
RoomSpectator = 1033,
|
||||
RoomThickness = 3547,
|
||||
RoomGetFilterWords = 2937,
|
||||
RoomMessageNotification = 1634,
|
||||
RoomPopularTagsResult = 2012,
|
||||
InfoFeedEnable = 3284,
|
||||
SecurityMachine = 1488,
|
||||
MysteryBoxKeys = 2833,
|
||||
Gotmysteryboxprizemessage = 3712,
|
||||
Cancelmysteryboxwaitmessage = 596,
|
||||
Showmysteryboxwaitmessage = 3201,
|
||||
TradeAccepted = 2568,
|
||||
TradeClosed = 1373,
|
||||
TradeCompleted = 1001,
|
||||
TradeConfirmation = 2720,
|
||||
TradeListItem = 2024,
|
||||
TradeNotOpen = 3128,
|
||||
TradeOpen = 2505,
|
||||
TradeOpenFailed = 217,
|
||||
TradeOtherNotAllowed = 1254,
|
||||
TradeYouNotAllowed = 3058,
|
||||
TradeNoSuchItem = 2873,
|
||||
Unit = 374,
|
||||
UnitChangeName = 2182,
|
||||
UnitChat = 1446,
|
||||
UnitChatShout = 1036,
|
||||
UnitChatWhisper = 2704,
|
||||
UnitDance = 2233,
|
||||
UnitEffect = 1167,
|
||||
UnitExpression = 1631,
|
||||
UnitHandItem = 1474,
|
||||
UnitIdle = 1797,
|
||||
UnitInfo = 3920,
|
||||
UnitNumber = 2324,
|
||||
UnitRemove = 2661,
|
||||
UnitStatus = 1640,
|
||||
UnitTyping = 1717,
|
||||
UnseenItems = 2103,
|
||||
UserAchievementScore = 1968,
|
||||
UserBadges = 717,
|
||||
UserBadgesAdd = 2493,
|
||||
UserBadgesCurrent = 1087,
|
||||
UserBotRemove = 233,
|
||||
UserBots = 3086,
|
||||
UserChangeName = 118,
|
||||
UserClothing = 1450,
|
||||
UserCredits = 3475,
|
||||
UserCurrency = 2018,
|
||||
ActivityPointNotification = 2275,
|
||||
UserEffects = 340,
|
||||
UserFavoriteRoom = 2524,
|
||||
UserFavoriteRoomCount = 151,
|
||||
UserFigure = 2429,
|
||||
UserFurniture = 994,
|
||||
UserFurnitureAdd = 104,
|
||||
UserFurniturePostitPlaced = 1501,
|
||||
UserFurnitureRefresh = 3151,
|
||||
UserFurnitureRemove = 159,
|
||||
UserHomeRoom = 2875,
|
||||
RoomEventCancel = 3479,
|
||||
RoomEvent = 1840,
|
||||
UserIgnored = 126,
|
||||
UserIgnoredResult = 207,
|
||||
UserInfo = 2725,
|
||||
UserOutfits = 3315,
|
||||
UserPerks = 2586,
|
||||
UserPermissions = 411,
|
||||
UserPetAdd = 2101,
|
||||
UserPetRemove = 3253,
|
||||
UserPets = 3522,
|
||||
UserProfile = 3898,
|
||||
UserRespect = 2815,
|
||||
UserSanctionStatus = 3679,
|
||||
UserSettings = 513,
|
||||
UserSubscription = 954,
|
||||
UserWardrobePage = 3315,
|
||||
UserClassification = 966,
|
||||
GetUserTags = 1255,
|
||||
WiredAction = 1434,
|
||||
WiredCondition = 1108,
|
||||
WiredError = 156,
|
||||
WiredOpen = 1830,
|
||||
WiredReward = 178,
|
||||
WiredSave = 1155,
|
||||
WiredTrigger = 383,
|
||||
PlayingGame = 448,
|
||||
FurnitureState2 = 3431,
|
||||
RemoveBotFromInventory = 233,
|
||||
AddBotToInventory = 1352,
|
||||
AchievementProgressed = 2107,
|
||||
ModtoolRoomInfo = 1333,
|
||||
ModtoolUserChatlog = 3377,
|
||||
ModtoolRoomChatlog = 3434,
|
||||
ModtoolVisitedRoomsUser = 1752,
|
||||
ModeratorActionResult = 2335,
|
||||
IssueDeleted = 3192,
|
||||
IssueInfo = 3609,
|
||||
IssuePickFailed = 3150,
|
||||
CfhChatlog = 607,
|
||||
ModeratorToolPreferences = 1576,
|
||||
LovelockFurniStart = 3753,
|
||||
LovelockFurniFriendComfirmed = 382,
|
||||
LovelockFurniFinished = 770,
|
||||
GiftReceiverNotFound = 1517,
|
||||
GiftOpened = 56,
|
||||
FloodControl = 566,
|
||||
RemainingMute = 826,
|
||||
UserEffectList = 340,
|
||||
UserEffectListAdd = 2867,
|
||||
UserEffectListRemove = 2228,
|
||||
UserEffectActivate = 1959,
|
||||
AvatarEffectSelected = 3473,
|
||||
ClubGiftInfo = 619,
|
||||
RedeemVoucherError = 714,
|
||||
RedeemVoucherOk = 3336,
|
||||
InClientLink = 2023,
|
||||
BotCommandConfiguration = 1618,
|
||||
BotSkillListUpdate = 69,
|
||||
BotForceOpenContextMenu = 296,
|
||||
HandItemReceived = 354,
|
||||
PetPlacingError = 2913,
|
||||
BotError = 639,
|
||||
MarketplaceSellItem = 54,
|
||||
MarketplaceItemStats = 725,
|
||||
MarketplaceOwnItems = 3884,
|
||||
MarketplaceCancelSale = 3264,
|
||||
MarketplaceItemPosted = 1359,
|
||||
MarketplaceItemsSearched = 680,
|
||||
MarketplaceAfterOrderStatus = 2032,
|
||||
CatalogReceivePetBreeds = 3331,
|
||||
CatalogApproveNameResult = 1503,
|
||||
ObjectsDataUpdate = 1453,
|
||||
PetExperience = 2156,
|
||||
CommunityGoalVoteEvent = 1435,
|
||||
PromoArticles = 286,
|
||||
CommunityGoalEarnedPrizes = 3319,
|
||||
CommunityGoalProgress = 2525,
|
||||
ConcurrentUsersGoalProgress = 2737,
|
||||
QuestDaily = 1878,
|
||||
QuestCancelled = 3027,
|
||||
QuestCompleted = 949,
|
||||
CommunityGoalHallOfFame = 3005,
|
||||
EpicPopup = 3945,
|
||||
SeasonalQuests = 1122,
|
||||
Quests = 3625,
|
||||
Quest = 230,
|
||||
BonusRareInfo = 1533,
|
||||
CraftableProducts = 1000,
|
||||
CraftingRecipe = 2774,
|
||||
CraftingRecipesAvailable = 2124,
|
||||
CraftingResult = 618,
|
||||
CameraPublishStatus = 2057,
|
||||
CameraPurchaseOk = 2783,
|
||||
CameraStorageUrl = 3696,
|
||||
CameraSnapshot = 463,
|
||||
CompetitionStatus = 133,
|
||||
InitCamera = 3878,
|
||||
ThumbnailStatus = 3595,
|
||||
AchievementNotification = 806,
|
||||
ClubGiftNotification = 2188,
|
||||
InterstitialMessage = 1808,
|
||||
RoomAdError = 1759,
|
||||
AvailabilityTime = 600,
|
||||
HotelClosedAndOpens = 3728,
|
||||
HotelClosesAndOpensAt = 2771,
|
||||
HotelWillCloseMinutes = 1050,
|
||||
HotelMaintenance = 1350,
|
||||
JukeboxPlaylistFull = 105,
|
||||
JukeboxSongDisks = 34,
|
||||
NowPlaying = 469,
|
||||
OfficialSongId = 1381,
|
||||
Playlist = 1748,
|
||||
PlaylistSongAdded = 1140,
|
||||
TraxSongInfo = 3365,
|
||||
UserSongDisksInventory = 2602,
|
||||
CheckUserName = 563,
|
||||
CfhSanction = 2782,
|
||||
CfhTopics = 325,
|
||||
CfhSanctionStatus = 2221,
|
||||
CampaignCalendarData = 2531,
|
||||
CampaignCalendarDoorOpened = 2551,
|
||||
BuildersClubFurniCount = 3828,
|
||||
BuildersClubSubscription = 1452,
|
||||
CatalogPageExpiration = 2668,
|
||||
CatalogEarliestExpiry = 2515,
|
||||
ClubGiftSelected = 659,
|
||||
TargetOfferNotFound = 1237,
|
||||
TargetOffer = 119,
|
||||
DirectSmsClubBuy = 195,
|
||||
RoomAdPurchase = 2468,
|
||||
NotEnoughBalance = 3914,
|
||||
LimitedOfferAppearingNext = 44,
|
||||
IsOfferGiftable = 761,
|
||||
ClubExtendedOffer = 3964,
|
||||
SeasonalCalendarOffer = 1889,
|
||||
CompetitionEntrySubmit = 1177,
|
||||
CompetitionVotingInfo = 3506,
|
||||
CompetitionTimingCode = 1745,
|
||||
CompetitionUserPartOf = 3841,
|
||||
CompetitionNoOwnedRooms = 2064,
|
||||
CompetitionSecondsUntil = 3926,
|
||||
BadgePointLimits = 2501,
|
||||
BadgeRequestFulfilled = 2998,
|
||||
HelperTalentTrack = 3406,
|
||||
TalentTrackLevel = 1203,
|
||||
TalentTrackLevelUp = 638,
|
||||
UserBanned = 1683,
|
||||
BotReceived = 3684,
|
||||
PetLevelNotification = 859,
|
||||
PetReceived = 1111,
|
||||
ModerationCaution = 1890,
|
||||
YoutubeControlVideo = 1554,
|
||||
YoutubeDisplayPlaylists = 1112,
|
||||
YoutubeDisplayVideo = 1411,
|
||||
CfhDisabledNotify = 1651,
|
||||
Question = 2665,
|
||||
PollContents = 2997,
|
||||
PollError = 662,
|
||||
PollOffer = 3785,
|
||||
PollRoomResult = 5201,
|
||||
PollStartRoom = 5200,
|
||||
QuestionAnswered = 2589,
|
||||
QuestionFinished = 1066,
|
||||
CfhPendingCalls = 1121,
|
||||
GuideOnDutyStatus = 1548,
|
||||
GuideSessionAttached = 1591,
|
||||
GuideSessionDetached = 138,
|
||||
GuideSessionEnded = 1456,
|
||||
GuideSessionError = 673,
|
||||
GuideSessionInvitedToGuideRoom = 219,
|
||||
GuideSessionMessage = 841,
|
||||
GuideSessionPartnerIsTyping = 1016,
|
||||
GuideSessionRequesterRoom = 1847,
|
||||
GuideSessionStarted = 3209,
|
||||
GuideTicketCreationResult = 3285,
|
||||
GuideTicketResolution = 2674,
|
||||
GuideReportingStatus = 3463,
|
||||
HotelMergeNameChange = 1663,
|
||||
IssueCloseNotification = 934,
|
||||
QuizData = 2927,
|
||||
QuizResults = 2772,
|
||||
CfhPendingCallsDeleted = 77,
|
||||
CfhReply = 3796,
|
||||
ChatReviewSessionDetached = 30,
|
||||
ChatReviewSessionOfferedToGuide = 735,
|
||||
ChatReviewSessionResults = 3276,
|
||||
ChatReviewSessionStarted = 143,
|
||||
ChatReviewSessionVotingStatus = 1829,
|
||||
ScrSendKickbackInfo = 3277,
|
||||
PetStatus = 1907,
|
||||
GroupDeactivate = 3129,
|
||||
PetRespected = 2788,
|
||||
PetSupplement = 3441,
|
||||
NoobnessLevel = 3738,
|
||||
DisconnectReason = 4000,
|
||||
CanCreateRoomEvent = 2599,
|
||||
FavoriteGroupUdpate = 3403,
|
||||
NoSuchFlat = 84,
|
||||
RoomSettingsError = 2897,
|
||||
ShowEnforceRoomCategory = 3896,
|
||||
CustomUserNotification = 909,
|
||||
NewUserExperienceGiftOffer = 3575,
|
||||
RestoreClient = 426,
|
||||
FireworkChargeData = 5210,
|
||||
NewUserExperienceNotComplete = 3639,
|
||||
ConnectionError = 1004,
|
||||
AccountSafetyLockStatusChange = 1243,
|
||||
PhoneCollectionState = 2890,
|
||||
PhoneTryNumberResult = 800,
|
||||
PhoneTryVerificationCodeResult = 91,
|
||||
ExtendedProfileChanged = 876,
|
||||
WelcomeGiftChangeEmailResult = 2293,
|
||||
WelcomeGiftStatus = 2707,
|
||||
HandshakeInitDiffie = 1347,
|
||||
HandshakeCompleteDiffie = 3885,
|
||||
RentableSpaceRentOk = 2046,
|
||||
RentableSpaceStatus = 3559,
|
||||
RentableSpaceRentFailed = 1868,
|
||||
EmailStatus = 612,
|
||||
ChangeEmailResult = 1815,
|
||||
WeeklyGameReward = 2641,
|
||||
WeeklyGameRewardWinners = 3097,
|
||||
WeeklyCompetitiveLeaderboard = 3512,
|
||||
WeeklyCompetitiveFriendsLeaderboard = 3560,
|
||||
WeeklyGame2FriendsLeaderboard = 2270,
|
||||
WeeklyGame2Leaderboard = 2196,
|
||||
RentableFurniRentOrBuyoutOffer = 35,
|
||||
HandshakeIdentityAccount = 3523,
|
||||
Hello = 0,
|
||||
SecretKey = 1,
|
||||
Rights = 2,
|
||||
LoginOk = 3,
|
||||
UserObj = 5,
|
||||
Purse = 6,
|
||||
Err = 33,
|
||||
UserBanned = 35,
|
||||
Ping = 50,
|
||||
RegistrationOk = 51,
|
||||
EspNotify = 52,
|
||||
FlatResults = 55,
|
||||
NoFlatsForUser = 57,
|
||||
NoFlats = 58,
|
||||
FlatCreated = 59,
|
||||
SystemBroadcast = 139,
|
||||
CheckSum = 141,
|
||||
ModAlert = 161,
|
||||
NavNodeInfo = 220,
|
||||
UserFlatCats = 221,
|
||||
AvailableBadges = 229,
|
||||
SessionParameters = 257
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Purse;
|
||||
|
||||
public class PurseComposer : IMessageComposer
|
||||
{
|
||||
private readonly int _credits;
|
||||
|
||||
public PurseComposer(int credits)
|
||||
{
|
||||
_credits = credits;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.Purse;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendWire(_credits);
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Security;
|
||||
|
||||
public class AuthenticatedComposer : IMessageComposer
|
||||
{
|
||||
public OutgoingHeaders Header => OutgoingHeaders.Authenticated;
|
||||
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.User.Data;
|
||||
|
||||
public class UserCurrentBadgesComposer : IMessageComposer
|
||||
{
|
||||
private readonly int _habboId;
|
||||
private readonly ICollection<Badge> _badges;
|
||||
|
||||
public UserCurrentBadgesComposer(int habboId, ICollection<Badge> badges)
|
||||
{
|
||||
_habboId = habboId;
|
||||
_badges = badges;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserBadgesCurrent;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_habboId);
|
||||
message.AppendInt32(_badges.Count);
|
||||
|
||||
foreach (var badge in _badges)
|
||||
{
|
||||
message.AppendInt32(badge.Slot);
|
||||
message.AppendString(badge.Code);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
using System.Globalization;
|
||||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.User.Data;
|
||||
|
||||
public class UserInfoComposer : IMessageComposer
|
||||
{
|
||||
private readonly Habbo _habbo;
|
||||
|
||||
public UserInfoComposer(Habbo habbo)
|
||||
{
|
||||
_habbo = habbo;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserInfo;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_habbo.Id);
|
||||
message.AppendString(_habbo.Username);
|
||||
message.AppendString(_habbo.Figure);
|
||||
message.AppendString(_habbo.Gender);
|
||||
message.AppendString(_habbo.Motto);
|
||||
message.AppendString(string.Empty);
|
||||
message.AppendBoolean(false);
|
||||
message.AppendInt32(0); // respect received
|
||||
message.AppendInt32(0); // respect points to give
|
||||
message.AppendInt32(0); // scratch to give
|
||||
message.AppendBoolean(false);
|
||||
message.AppendString(_habbo.LastLogin?.ToString(CultureInfo.CurrentCulture) ?? string.Empty);
|
||||
message.AppendBoolean(false); // can change name
|
||||
message.AppendBoolean(false); // safety locked
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
using System.Globalization;
|
||||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.User.Data;
|
||||
|
||||
public class UserProfileComposer : IMessageComposer
|
||||
{
|
||||
private readonly Habbo _habbo;
|
||||
|
||||
public UserProfileComposer(Habbo habbo)
|
||||
{
|
||||
_habbo = habbo;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserProfile;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendInt32(_habbo.Id);
|
||||
message.AppendString(_habbo.Username);
|
||||
message.AppendString(_habbo.Figure);
|
||||
message.AppendString(_habbo.Motto);
|
||||
message.AppendString(_habbo.AccountCreated.ToString(CultureInfo.CurrentCulture));
|
||||
message.AppendInt32(_habbo.AchievementScore);
|
||||
message.AppendInt32(0); // friend count
|
||||
message.AppendBoolean(false); // is friend
|
||||
message.AppendBoolean(false); // friend request sent
|
||||
message.AppendBoolean(_habbo.Online);
|
||||
message.AppendInt32(0); // groups
|
||||
message.AppendInt32((int)(_habbo.LastLogin == null ? 0 : (DateTime.Now - _habbo.LastLogin.Value).TotalSeconds));
|
||||
message.AppendBoolean(true); // open but why would it not open?
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using Tiger.Communication.Messages.Interfaces;
|
||||
using Tiger.Communication.Messages.Types;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Communication.Messages.Outgoing.Users;
|
||||
|
||||
public class UserObjComposer : IMessageComposer
|
||||
{
|
||||
private readonly Habbo _habbo;
|
||||
|
||||
public UserObjComposer(Habbo habbo)
|
||||
{
|
||||
_habbo = habbo;
|
||||
}
|
||||
|
||||
public OutgoingHeaders Header => OutgoingHeaders.UserObj;
|
||||
public void Compose(ServerMessage message)
|
||||
{
|
||||
message.AppendString(_habbo.Username);
|
||||
message.AppendString(_habbo.Figure);
|
||||
message.AppendString(_habbo.Gender);
|
||||
message.AppendString(_habbo.Motto);
|
||||
message.AppendWire(0); // ph_tickets
|
||||
message.AppendString(string.Empty); // ph_figure
|
||||
message.AppendWire(0); // photo_film
|
||||
message.AppendWire(0); // direct_mail
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
using System.Text;
|
||||
using Tiger.Utils;
|
||||
using HabboEncoding;
|
||||
|
||||
namespace Tiger.Communication.Messages.Types;
|
||||
|
||||
|
@ -8,51 +8,48 @@ public class ClientMessage
|
|||
private readonly byte[] _packet;
|
||||
private int _readerIndex;
|
||||
|
||||
public short Header { get; }
|
||||
public int Header { get; }
|
||||
|
||||
public ClientMessage(byte[] packet)
|
||||
{
|
||||
_packet = packet;
|
||||
_readerIndex = 0;
|
||||
Header = ReadInt16();
|
||||
Header = ReadB64();
|
||||
}
|
||||
|
||||
public short ReadInt16()
|
||||
public int ReadB64()
|
||||
{
|
||||
var raw = ReadBytes(2);
|
||||
|
||||
if (raw.Length != 2) return -1;
|
||||
|
||||
return ByteUtils.GetInt16(raw);
|
||||
return Base64Encoding.DecodeInt32(ReadBytes(2));
|
||||
}
|
||||
|
||||
public int ReadInt32()
|
||||
public int ReadWire()
|
||||
{
|
||||
var raw = ReadBytes(4);
|
||||
|
||||
if (raw.Length != 4) return -1;
|
||||
|
||||
return ByteUtils.GetInt32(raw);
|
||||
}
|
||||
|
||||
public bool ReadBoolean()
|
||||
{
|
||||
if (_packet.Length - _readerIndex == 0) return false;
|
||||
|
||||
var result = _packet[_readerIndex];
|
||||
_readerIndex++;
|
||||
return result == 1;
|
||||
var value = VL64Encoding.DecodeInt32(GetRemainingBytes(VL64Encoding.MaxIntegerByteAmount), out var totalBytes);
|
||||
_readerIndex += totalBytes;
|
||||
return value;
|
||||
}
|
||||
|
||||
public string ReadString()
|
||||
{
|
||||
var strlen = ReadInt16();
|
||||
var strlen = ReadB64();
|
||||
return Encoding.UTF8.GetString(ReadBytes(strlen));
|
||||
}
|
||||
|
||||
public bool ReadBoolean()
|
||||
{
|
||||
return ReadByte() == Base64Encoding.Positive;
|
||||
}
|
||||
|
||||
if (strlen == -1) return string.Empty;
|
||||
private byte ReadByte()
|
||||
{
|
||||
if (_packet.Length - _readerIndex < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var raw = ReadBytes(strlen);
|
||||
|
||||
return raw.Length != strlen ? string.Empty : Encoding.UTF8.GetString(raw);
|
||||
var value = _packet[_readerIndex];
|
||||
_readerIndex++;
|
||||
return value;
|
||||
}
|
||||
|
||||
private byte[] ReadBytes(int amount)
|
||||
|
@ -67,4 +64,23 @@ public class ClientMessage
|
|||
_readerIndex += amount;
|
||||
return data;
|
||||
}
|
||||
|
||||
private byte[] GetRemainingBytes(int max)
|
||||
{
|
||||
var data = new byte[max];
|
||||
for (var i = 0; i < max; i++)
|
||||
{
|
||||
if (_readerIndex + i >= _packet.Length)
|
||||
break;
|
||||
|
||||
data[i] = _packet[_readerIndex + i];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Encoding.UTF8.GetString(_packet);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
using System.Text;
|
||||
using Tiger.Utils;
|
||||
using HabboEncoding;
|
||||
|
||||
namespace Tiger.Communication.Messages.Types;
|
||||
|
||||
|
@ -9,35 +9,35 @@ public class ServerMessage
|
|||
|
||||
public ServerMessage(short header)
|
||||
{
|
||||
AppendInt16(header);
|
||||
AppendB64(header);
|
||||
}
|
||||
|
||||
public void AppendInt16(short value)
|
||||
public void AppendB64(int value)
|
||||
{
|
||||
_packet.AddRange(ByteUtils.Int16ToArray(value));
|
||||
_packet.AddRange(Base64Encoding.EncodeInt32(value));
|
||||
}
|
||||
|
||||
public void AppendInt32(int value)
|
||||
public void AppendWire(int value)
|
||||
{
|
||||
_packet.AddRange(ByteUtils.Int32ToArray(value));
|
||||
_packet.AddRange(VL64Encoding.EncodeInt32(value));
|
||||
}
|
||||
|
||||
public void AppendWire(bool value)
|
||||
{
|
||||
_packet.AddRange(VL64Encoding.EncodeInt32(value ? 1 : 0));
|
||||
}
|
||||
|
||||
public void AppendBoolean(bool value)
|
||||
public void AppendString(string value, byte delim = 2)
|
||||
{
|
||||
_packet.Add((byte)(value ? 1 : 0));
|
||||
}
|
||||
|
||||
public void AppendString(string value)
|
||||
{
|
||||
AppendInt16((short)value.Length);
|
||||
_packet.AddRange(Encoding.UTF8.GetBytes(value));
|
||||
_packet.Add(delim);
|
||||
}
|
||||
|
||||
public byte[] ToArray()
|
||||
{
|
||||
var finalizedPacket = new List<byte>();
|
||||
finalizedPacket.AddRange(ByteUtils.Int32ToArray(_packet.Count));
|
||||
finalizedPacket.AddRange(_packet);
|
||||
finalizedPacket.Add(1);
|
||||
return finalizedPacket.ToArray();
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -1,9 +0,0 @@
|
|||
namespace Tiger.Game.Achievements;
|
||||
|
||||
public class Achievement
|
||||
{
|
||||
public virtual int Id { get; set; }
|
||||
public virtual string Badge { get; set; } = null!;
|
||||
public virtual string Category { get; set; } = null!;
|
||||
public virtual IDictionary<int, AchievementLevel> Levels { get; set; } = new Dictionary<int, AchievementLevel>();
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
namespace Tiger.Game.Achievements;
|
||||
|
||||
public class AchievementLevel
|
||||
{
|
||||
public virtual Achievement Achievement { get; set; } = null!;
|
||||
public virtual int Level { get; set; }
|
||||
public virtual int RewardAmount { get; set; }
|
||||
public virtual int RewardType { get; set; }
|
||||
public virtual int Points { get; set; }
|
||||
public virtual int ProgressNeeded { get; set; }
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is not AchievementLevel other)
|
||||
return false;
|
||||
|
||||
return Achievement.Id == other.Achievement.Id && Level == other.Level;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hash = 17;
|
||||
hash = hash * 23 + Achievement.Id.GetHashCode();
|
||||
hash = hash * 23 + Level.GetHashCode();
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Tiger.Game.Achievements;
|
||||
|
||||
public class AchievementLevelMap : ClassMap<AchievementLevel>
|
||||
{
|
||||
public AchievementLevelMap()
|
||||
{
|
||||
Table("achievement_levels");
|
||||
LazyLoad();
|
||||
CompositeId()
|
||||
.KeyProperty(al => al.Level, "level")
|
||||
.KeyReference(al => al.Achievement, "achievement_id");
|
||||
Map(al => al.RewardAmount).Column("reward_amount").Not.Nullable();
|
||||
Map(al => al.RewardType).Column("reward_type").Not.Nullable();
|
||||
Map(al => al.ProgressNeeded).Column("progress_needed").Not.Nullable();
|
||||
Map(al => al.Points).Column("points").Not.Nullable();
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Tiger.Communication.Messages.Outgoing.Inventory.Achievements;
|
||||
using Tiger.Communication.Messages.Outgoing.Notifications;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Game.Achievements;
|
||||
|
||||
public class AchievementManager : IAchievementManager
|
||||
{
|
||||
private readonly IRepository<Achievement> _achievementRepository;
|
||||
private readonly ILogger<IAchievementManager> _logger;
|
||||
private readonly IRepository<Badge> _badgesRepository;
|
||||
private readonly IRepository<Habbo> _habboRepository;
|
||||
|
||||
public AchievementManager(IRepository<Achievement> achievementRepository, ILogger<IAchievementManager> logger, IRepository<Badge> badgesRepository, IRepository<Habbo> habboRepository)
|
||||
{
|
||||
_achievementRepository = achievementRepository;
|
||||
_logger = logger;
|
||||
_badgesRepository = badgesRepository;
|
||||
_habboRepository = habboRepository;
|
||||
}
|
||||
|
||||
public IDictionary<string, Achievement> Achievements { get; private set; } = new Dictionary<string, Achievement>();
|
||||
|
||||
public async Task LoadAchievementsAsync()
|
||||
{
|
||||
Achievements = (await _achievementRepository.FindByAsync()).ToDictionary(a => a.Badge, a => a);
|
||||
|
||||
_logger.LogInformation("Loaded {Count} Achievements", Achievements.Count);
|
||||
}
|
||||
|
||||
public async Task UpdateAchievementAsync(string achievementName, int progress, GameSession session)
|
||||
{
|
||||
if (session.Habbo is null) return;
|
||||
|
||||
if (!Achievements.TryGetValue(achievementName, out var achievement)) return;
|
||||
|
||||
if (progress == 0) return;
|
||||
|
||||
if (!session.Habbo.Achievements.TryGetValue(achievement.Id, out var habboAchievement))
|
||||
{
|
||||
habboAchievement = new HabboAchievement()
|
||||
{
|
||||
Level = 0,
|
||||
Progress = 0,
|
||||
Achievement = achievement,
|
||||
Habbo = session.Habbo
|
||||
};
|
||||
|
||||
session.Habbo.Achievements.Add(achievement.Id, habboAchievement);
|
||||
}
|
||||
|
||||
if (habboAchievement.Level == achievement.Levels.Count) return;
|
||||
|
||||
var targetLevel = habboAchievement.Level + 1;
|
||||
var achievementLevel = achievement.Levels[targetLevel];
|
||||
|
||||
habboAchievement.Progress += progress;
|
||||
|
||||
if (habboAchievement.Progress >= achievementLevel.ProgressNeeded)
|
||||
{
|
||||
habboAchievement.Level++;
|
||||
|
||||
Badge badge;
|
||||
|
||||
if (habboAchievement.Level == 1)
|
||||
{
|
||||
badge = new Badge
|
||||
{
|
||||
Habbo = session.Habbo,
|
||||
Code = $"{achievement.Badge}1"
|
||||
};
|
||||
session.Habbo.Badges.Add(badge);
|
||||
}
|
||||
else
|
||||
{
|
||||
var currentBadge =
|
||||
session.Habbo.Badges.SingleOrDefault(b =>
|
||||
b.Code == $"{achievement.Badge}{habboAchievement.Level - 1}");
|
||||
|
||||
if (currentBadge != null)
|
||||
{
|
||||
currentBadge.Code = $"{achievement.Badge}{habboAchievement.Level - 1}";
|
||||
badge = currentBadge;
|
||||
}
|
||||
else
|
||||
{
|
||||
badge = new Badge
|
||||
{
|
||||
Habbo = session.Habbo,
|
||||
Code = $"{achievement.Badge}1"
|
||||
};
|
||||
session.Habbo.Badges.Add(badge);
|
||||
}
|
||||
}
|
||||
|
||||
session.Habbo.AchievementScore += achievementLevel.Points;
|
||||
|
||||
if (achievementLevel.RewardAmount > 0)
|
||||
{
|
||||
session.Habbo.UpdateCurrency(achievementLevel.RewardType, achievementLevel.RewardAmount);
|
||||
session.SendComposerAsync(new ActivityPointNotificationMessageComposer(session.Habbo.Activitypoints[achievementLevel.RewardType].Amount, achievementLevel.RewardAmount, achievementLevel.RewardType));
|
||||
}
|
||||
|
||||
// session.CurrentRoom?.SendMessage(new UserChangeMessageComposer(session.RoomUser.VirtualId, session.User));
|
||||
|
||||
session.SendComposerAsync(new AchievementsScoreComposer(session.Habbo.AchievementScore));
|
||||
session.SendComposerAsync(new AchievementNotificationMessageComposer(habboAchievement, badge.Id));
|
||||
}
|
||||
|
||||
_habboRepository.SaveAsync(session.Habbo);
|
||||
|
||||
await session.SendComposerAsync(new AchievementComposer(achievement, habboAchievement));
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Tiger.Game.Achievements;
|
||||
|
||||
public class AchievementMap : ClassMap<Achievement>
|
||||
{
|
||||
public AchievementMap()
|
||||
{
|
||||
Table("achievements");
|
||||
LazyLoad();
|
||||
Id(a => a.Id).Column("id").GeneratedBy.Identity();
|
||||
Map(a => a.Badge).Column("badge").Not.Nullable();
|
||||
Map(a => a.Category).Column("category").Not.Nullable();
|
||||
HasMany(a => a.Levels).AsMap(al => al.Level).Cascade.All();
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Game.Achievements;
|
||||
|
||||
public interface IAchievementManager
|
||||
{
|
||||
IDictionary<string, Achievement> Achievements { get; }
|
||||
Task LoadAchievementsAsync();
|
||||
Task UpdateAchievementAsync(string achievementName, int progress, GameSession session);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public class CatalogueFeaturedPage
|
||||
{
|
||||
public virtual int SlotId { get; set; }
|
||||
public virtual string Image { get; set; } = null!;
|
||||
public virtual string Caption { get; set; } = null!;
|
||||
public virtual CatalogueFeaturedPageType Type { get; set; }
|
||||
public virtual DateTime Expire { get; set; }
|
||||
public virtual string Data { get; set; } = null!;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public class CatalogueFeaturedPageMap : ClassMap<CatalogueFeaturedPage>
|
||||
{
|
||||
public CatalogueFeaturedPageMap()
|
||||
{
|
||||
Table("catalogue_featured_pages");
|
||||
Id(fp => fp.SlotId).Column("slot_id").GeneratedBy.Identity();
|
||||
Map(fp => fp.Image).Column("image").Not.Nullable();
|
||||
Map(fp => fp.Caption).Column("caption").Not.Nullable();
|
||||
Map(fp => fp.Type).CustomType<int>().Column("type").Not.Nullable();
|
||||
Map(fp => fp.Expire).Column("expire").Not.Nullable();
|
||||
Map(fp => fp.Data).Column("data").Not.Nullable();
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public enum CatalogueFeaturedPageType
|
||||
{
|
||||
PageName,
|
||||
PageId,
|
||||
ProductName
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Tiger.Communication.Messages.Outgoing.Catalog;
|
||||
using Tiger.Communication.Messages.Outgoing.Inventory.Currency;
|
||||
using Tiger.Communication.Messages.Outgoing.Inventory.Subscription;
|
||||
using Tiger.Communication.Messages.Outgoing.Notifications;
|
||||
using Tiger.Game.Achievements;
|
||||
using Tiger.Game.Habbos;
|
||||
using Tiger.Networking.Game.Sessions;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public class CatalogueManager : ICatalogueManager
|
||||
{
|
||||
private readonly IRepository<CataloguePage> _pagesRepository;
|
||||
private readonly ILogger<ICatalogueManager> _logger;
|
||||
private readonly IRepository<CatalogueFeaturedPage> _featuredPagesRepository;
|
||||
private readonly IRepository<ClubOffer> _clubOfferRepository;
|
||||
private readonly IRepository<HabboSubscription> _habboSubscriptionRepository;
|
||||
private readonly IAchievementManager _achievementManager;
|
||||
|
||||
public IDictionary<int, CataloguePage> Pages { get; private set; }
|
||||
public IDictionary<int, CatalogueFeaturedPage> FeaturedPages { get; private set; }
|
||||
public IDictionary<int, ClubOffer> ClubOffers { get; private set; }
|
||||
|
||||
public CatalogueManager(IRepository<CataloguePage> pagesRepository, ILogger<ICatalogueManager> logger,
|
||||
IRepository<CatalogueFeaturedPage> featuredPagesRepository, IRepository<ClubOffer> clubOfferRepository,
|
||||
IRepository<HabboSubscription> habboSubscriptionRepository, IAchievementManager achievementManager)
|
||||
{
|
||||
_pagesRepository = pagesRepository;
|
||||
_logger = logger;
|
||||
_featuredPagesRepository = featuredPagesRepository;
|
||||
_clubOfferRepository = clubOfferRepository;
|
||||
_habboSubscriptionRepository = habboSubscriptionRepository;
|
||||
_achievementManager = achievementManager;
|
||||
Pages = new Dictionary<int, CataloguePage>();
|
||||
FeaturedPages = new Dictionary<int, CatalogueFeaturedPage>();
|
||||
ClubOffers = new Dictionary<int, ClubOffer>();
|
||||
}
|
||||
|
||||
public async Task LoadPagesAsync()
|
||||
{
|
||||
Pages = (await _pagesRepository.FindByAsync()).ToDictionary(p => p.Id, p => p);
|
||||
|
||||
_logger.LogInformation("Loaded {Count} catalogue pages", Pages.Count);
|
||||
}
|
||||
|
||||
public async Task LoadFeaturedPagesAsync()
|
||||
{
|
||||
FeaturedPages = (await _featuredPagesRepository.FindByAsync())
|
||||
.ToDictionary(p => p.SlotId, p => p);
|
||||
|
||||
_logger.LogInformation("Loaded {Count} catalogue featured pages", FeaturedPages.Count);
|
||||
}
|
||||
|
||||
public async Task LoadClubOffersAsync()
|
||||
{
|
||||
ClubOffers = (await _clubOfferRepository.FindByAsync())
|
||||
.ToDictionary(co => co.Id);
|
||||
|
||||
_logger.LogInformation("Loaded {Count} club offers", ClubOffers.Count);
|
||||
}
|
||||
|
||||
public async Task PurchaseClubOffer(int offerId, GameSession gameSession)
|
||||
{
|
||||
if (!ClubOffers.TryGetValue(offerId, out var clubOffer) || gameSession.Habbo == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tooShortOnCoins = clubOffer.PriceCredits > 0 && clubOffer.PriceCredits > gameSession.Habbo.Credits;
|
||||
var tooShortOnActivityPoints = clubOffer.PriceActivitypoints > 0 && clubOffer.PriceActivitypoints >
|
||||
gameSession.Habbo.GetActivityPoints(clubOffer.ActivitypointsType);
|
||||
|
||||
if (tooShortOnCoins || tooShortOnActivityPoints)
|
||||
{
|
||||
await gameSession.SendComposerAsync(new NotEnoughBalanceMessageComposer(tooShortOnCoins,
|
||||
tooShortOnActivityPoints, clubOffer.ActivitypointsType));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clubOffer.PriceCredits > 0)
|
||||
{
|
||||
gameSession.Habbo.Credits -= clubOffer.PriceCredits;
|
||||
gameSession.SendComposerAsync(new UserCreditsComposer(gameSession.Habbo.Credits));
|
||||
}
|
||||
|
||||
if (clubOffer.PriceActivitypoints > 0)
|
||||
{
|
||||
gameSession.Habbo.UpdateCurrency(clubOffer.ActivitypointsType, -clubOffer.PriceActivitypoints);
|
||||
gameSession.SendComposerAsync(new ActivityPointNotificationMessageComposer(
|
||||
gameSession.Habbo.GetActivityPoints(clubOffer.ActivitypointsType), -clubOffer.PriceActivitypoints,
|
||||
clubOffer.ActivitypointsType));
|
||||
}
|
||||
|
||||
var currentSubscription = gameSession.Habbo.GetActiveSubscription();
|
||||
|
||||
if (currentSubscription != null)
|
||||
{
|
||||
currentSubscription.Expires = currentSubscription.Expires.AddDays(clubOffer.Days);
|
||||
currentSubscription.Habbo.Credits -= clubOffer.PriceCredits;
|
||||
currentSubscription.Habbo.UpdateCurrency(clubOffer.ActivitypointsType, -clubOffer.PriceActivitypoints);
|
||||
_habboSubscriptionRepository.SaveAsync(currentSubscription);
|
||||
gameSession.SendComposerAsync(new UserSubscriptionComposer(currentSubscription,
|
||||
gameSession.Habbo.GetPastSubscriptionDays()));
|
||||
}
|
||||
else
|
||||
{
|
||||
var subscription = new HabboSubscription
|
||||
{
|
||||
Expires = DateTime.Now.AddDays(clubOffer.Days),
|
||||
SubscriptionType = "habbo_club",
|
||||
Started = DateTime.Now,
|
||||
Habbo = gameSession.Habbo
|
||||
};
|
||||
_habboSubscriptionRepository.SaveAsync(subscription);
|
||||
gameSession.SendComposerAsync(new UserSubscriptionComposer(subscription,
|
||||
gameSession.Habbo.GetPastSubscriptionDays()));
|
||||
_achievementManager.UpdateAchievementAsync("ACH_HC", 1, gameSession);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public class CataloguePage
|
||||
{
|
||||
public virtual int Id { get; set; }
|
||||
public virtual string Name { get; set; } = null!;
|
||||
public virtual string InternalName { get; set; } = null!;
|
||||
public virtual string Layout { get; set; } = null!;
|
||||
public virtual bool Visible { get; set; }
|
||||
public virtual bool Enabled { get; set; }
|
||||
public virtual int Icon { get; set; }
|
||||
public virtual int MinRank { get; set; }
|
||||
public virtual CataloguePage? Parent { get; set; }
|
||||
public virtual IList<CataloguePage> Children { get; set; } = new List<CataloguePage>();
|
||||
public virtual IList<string> Images { get; set; } = new List<string>();
|
||||
public virtual IList<string> Texts { get; set; } = new List<string>();
|
||||
public virtual bool SeasonalCurrency { get; set; }
|
||||
public virtual IList<string> Modes { get; set; } = new List<string>();
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using FluentNHibernate.Mapping;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public class CataloguePageMap : ClassMap<CataloguePage>
|
||||
{
|
||||
public CataloguePageMap()
|
||||
{
|
||||
Table("catalogue_pages");
|
||||
LazyLoad();
|
||||
Id(c => c.Id).Column("id").GeneratedBy.Identity();
|
||||
Map(c => c.Name).Column("name").Not.Nullable();
|
||||
Map(c => c.InternalName).Column("internal_name").Not.Nullable();
|
||||
Map(c => c.Layout).Column("layout").Not.Nullable();
|
||||
Map(c => c.Visible).Column("visible").Not.Nullable();
|
||||
Map(c => c.Enabled).Column("enabled").Not.Nullable();
|
||||
Map(c => c.Icon).Column("icon").Not.Nullable();
|
||||
Map(c => c.MinRank).Column("min_rank").Not.Nullable();
|
||||
References(x => x.Parent).Column("parent_id").Nullable();
|
||||
HasMany(x => x.Children).KeyColumn("parent_id").Inverse().Cascade.AllDeleteOrphan();
|
||||
Map(c => c.Images).CustomType<StringListTypeConverter>();
|
||||
Map(c => c.Texts).CustomType<StringListTypeConverter>();
|
||||
Map(c => c.SeasonalCurrency).Column("seasonal_currency").Not.Nullable();
|
||||
Map(c => c.Modes).CustomType<StringListTypeConverter>();
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public class ClubOffer
|
||||
{
|
||||
public virtual int Id { get; set; }
|
||||
public virtual string Name { get; set; } = null!;
|
||||
public virtual int PriceCredits { get; set; }
|
||||
public virtual int PriceActivitypoints { get; set; }
|
||||
public virtual int ActivitypointsType { get; set; }
|
||||
public virtual int Days { get; set; }
|
||||
public virtual bool DiscountExtension { get; set; }
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public class ClubOfferMap : ClassMap<ClubOffer>
|
||||
{
|
||||
public ClubOfferMap()
|
||||
{
|
||||
Table("catalogue_club_offers");
|
||||
Id(co => co.Id).Column("id").GeneratedBy.Identity();
|
||||
Map(co => co.Name).Column("name").Not.Nullable();
|
||||
Map(co => co.PriceCredits).Column("price_credits").Not.Nullable();
|
||||
Map(co => co.PriceActivitypoints).Column("price_activitypoints").Not.Nullable();
|
||||
Map(co => co.ActivitypointsType).Column("activitypoints_type").Not.Nullable();
|
||||
Map(co => co.Days).Column("days").Not.Nullable();
|
||||
Map(co => co.DiscountExtension).Column("discount_extension").Not.Nullable();
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
using Tiger.Networking.Game.Sessions;
|
||||
|
||||
namespace Tiger.Game.Catalogue;
|
||||
|
||||
public interface ICatalogueManager
|
||||
{
|
||||
public IDictionary<int, CataloguePage> Pages { get; }
|
||||
public IDictionary<int, CatalogueFeaturedPage> FeaturedPages { get; }
|
||||
public IDictionary<int, ClubOffer> ClubOffers { get; }
|
||||
Task LoadPagesAsync();
|
||||
Task LoadFeaturedPagesAsync();
|
||||
Task LoadClubOffersAsync();
|
||||
Task PurchaseClubOffer(int offerId, GameSession gameSession);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
namespace Tiger.Game.Figuredata;
|
||||
|
||||
public class Color
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Index { get; set; }
|
||||
public int Club { get; set; }
|
||||
public bool Selectable { get; set; }
|
||||
public string HexCode { get; set; } = null!;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
namespace Tiger.Game.Figuredata;
|
||||
|
||||
public class Figuredata
|
||||
{
|
||||
public List<Palette> Palettes { get; set; } = new();
|
||||
public List<SetType> SetTypes { get; set; } = new();
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Game.Figuredata;
|
||||
|
||||
public class FiguredataManager : IFigureDataManager
|
||||
{
|
||||
private readonly Figuredata? _figuredata;
|
||||
|
||||
public FiguredataManager()
|
||||
{
|
||||
try
|
||||
{
|
||||
_figuredata = JsonConvert.DeserializeObject<Figuredata>(File.ReadAllText("FigureData.json"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateFigure(string newFigure, string newGender, Habbo habbo)
|
||||
{
|
||||
if (_figuredata is null)
|
||||
return false;
|
||||
|
||||
var parts = newFigure.Split('.');
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
if (!part.Contains('-'))
|
||||
return false;
|
||||
|
||||
var subParts = part.Split('-');
|
||||
var setType = _figuredata.SetTypes.SingleOrDefault(st => st.Type == subParts[0]);
|
||||
|
||||
if (setType is null)
|
||||
return false;
|
||||
|
||||
var palette = _figuredata.Palettes.SingleOrDefault(p => p.Id == setType.PaletteId);
|
||||
|
||||
if (palette is null)
|
||||
return false;
|
||||
|
||||
var set = setType.Sets.SingleOrDefault(s => s.Id == int.Parse(subParts.Length >= 2 ? subParts[1] : "-1"));
|
||||
|
||||
if (set is null)
|
||||
return false;
|
||||
|
||||
// TODO: Check if is club
|
||||
// TODO: Check for buyable clothes
|
||||
|
||||
if (set.Gender.ToUpper() != newGender)
|
||||
return false;
|
||||
|
||||
if (set.Colorable && subParts.Length < 3)
|
||||
return false;
|
||||
|
||||
if (!set.Colorable) continue;
|
||||
|
||||
var paletteColor1 = palette.Colors.SingleOrDefault(c => c.Id == int.Parse(subParts[2]));
|
||||
|
||||
if (paletteColor1 is null)
|
||||
return false;
|
||||
|
||||
if (subParts.Length == 3) continue;
|
||||
|
||||
var paletteColor2 = palette.Colors.SingleOrDefault(c => c.Id == int.Parse(subParts[3]));
|
||||
|
||||
if (paletteColor2 is null)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
using Tiger.Game.Habbos;
|
||||
|
||||
namespace Tiger.Game.Figuredata;
|
||||
|
||||
public interface IFigureDataManager
|
||||
{
|
||||
bool ValidateFigure(string newFigure, string newGender, Habbo habbo);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
namespace Tiger.Game.Figuredata;
|
||||
|
||||
public class Palette
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public List<Color> Colors { get; set; } = new();
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
namespace Tiger.Game.Figuredata;
|
||||
|
||||
public class Part
|
||||
{
|
||||
public bool Colorable { get; set; }
|
||||
public int ColorIndex { get; set; }
|
||||
public uint Id { get; set; }
|
||||
public int Index { get; set; }
|
||||
public string Type { get; set; } = null!;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
namespace Tiger.Game.Figuredata;
|
||||
|
||||
public class Set
|
||||
{
|
||||
public int Club { get; set; }
|
||||
public bool Colorable { get; set; }
|
||||
public string Gender { get; set; } = null!;
|
||||
public int Id { get; set; }
|
||||
public bool Preselectable { get; set; }
|
||||
public bool Selectable { get; set; }
|
||||
public bool Sellable { get; set; }
|
||||
public List<Part> Parts { get; set; } = new();
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Tiger.Game.Figuredata;
|
||||
|
||||
public class SetType
|
||||
{
|
||||
public string Type { get; set; } = null!;
|
||||
[JsonProperty("mandatory_f_0")]
|
||||
public bool MandatoryF0 { get; set; }
|
||||
[JsonProperty("mandatory_f_1")]
|
||||
public bool MandatoryF1 { get; set; }
|
||||
[JsonProperty("mandatory_m_0")]
|
||||
public bool MandatoryM0 { get; set; }
|
||||
[JsonProperty("mandatory_m_1")]
|
||||
public bool MandatoryM1 { get; set; }
|
||||
public int PaletteId { get; set; }
|
||||
public List<Set> Sets { get; set; } = new();
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
namespace Tiger.Game.Habbos;
|
||||
|
||||
public class Activitypoints
|
||||
{
|
||||
public virtual Habbo Habbo { get; set; } = null!;
|
||||
public virtual int Type { get; set; }
|
||||
public virtual int Amount { get; set; }
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is not Activitypoints other)
|
||||
return false;
|
||||
|
||||
return Habbo.Id == other.Habbo.Id && Type == other.Type;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hash = 17;
|
||||
hash = hash * 23 + Habbo.Id.GetHashCode();
|
||||
hash = hash * 23 + Type.GetHashCode();
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Tiger.Game.Habbos;
|
||||
|
||||
public class ActivitypointsMap : ClassMap<Activitypoints>
|
||||
{
|
||||
public ActivitypointsMap()
|
||||
{
|
||||
Table("habbo_activitypoints");
|
||||
LazyLoad();
|
||||
CompositeId()
|
||||
.KeyProperty(h => h.Type, "type")
|
||||
.KeyReference(h => h.Habbo, "habbo_id");
|
||||
Map(h => h.Amount).Column("amount").Not.Nullable();
|
||||
}
|
||||
}
|
|
@ -5,5 +5,4 @@ public class Badge
|
|||
public virtual int Id { get; set; }
|
||||
public virtual Habbo Habbo { get; set; } = null!;
|
||||
public virtual string Code { get; set; } = null!;
|
||||
public virtual int Slot { get; set; }
|
||||
}
|
|
@ -11,6 +11,5 @@ public class BadgeMap : ClassMap<Badge>
|
|||
Id(b => b.Id).Column("id").GeneratedBy.Identity();
|
||||
References(b => b.Habbo).Column("habbo_id").Not.Nullable();
|
||||
Map(b => b.Code).Column("code").Not.Nullable();
|
||||
Map(b => b.Slot).Column("slot").Not.Nullable();
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
using Tiger.Game.Rooms;
|
||||
|
||||
namespace Tiger.Game.Habbos;
|
||||
|
||||
public class Habbo
|
||||
|
@ -13,36 +15,13 @@ public class Habbo
|
|||
public virtual int Rank { get; set; }
|
||||
public virtual int Credits { get; set; }
|
||||
public virtual bool Online { get; set; }
|
||||
public virtual int HomeRoom { get; set; }
|
||||
public virtual int AchievementScore { get; set; }
|
||||
public virtual int? GroupId { get; set; }
|
||||
public virtual string? SsoTicket { get; set; }
|
||||
public virtual IDictionary<int, Activitypoints> Activitypoints { get; set; } = new Dictionary<int, Activitypoints>();
|
||||
public virtual Badge? CurrentBadge { get; set; }
|
||||
public virtual bool BadgeActive { get; set; }
|
||||
public virtual ICollection<Badge> Badges { get; set; } = new List<Badge>();
|
||||
|
||||
public virtual IDictionary<int, HabboAchievement> Achievements { get; set; } = new Dictionary<int, HabboAchievement>();
|
||||
public virtual ICollection<HabboSubscription> Subscriptions { get; set; } = new List<HabboSubscription>();
|
||||
public virtual ICollection<Room> Rooms { get; set; } = new List<Room>();
|
||||
|
||||
public virtual int GetActivityPoints(int type)
|
||||
{
|
||||
return Activitypoints.TryGetValue(type, out var activityPoints) ? activityPoints.Amount : 0;
|
||||
}
|
||||
public virtual void UpdateCurrency(int type, int amount)
|
||||
{
|
||||
if (!Activitypoints.ContainsKey(type))
|
||||
{
|
||||
Activitypoints.Add(type, new Activitypoints
|
||||
{
|
||||
Habbo = this,
|
||||
Amount = amount,
|
||||
Type = type
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Activitypoints[type].Amount += amount;
|
||||
}
|
||||
|
||||
public virtual HabboSubscription? GetActiveSubscription()
|
||||
{
|
||||
return Subscriptions.Where(s => s.Expires > DateTime.Now).MaxBy(s => s.Expires);
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
using Tiger.Game.Achievements;
|
||||
|
||||
namespace Tiger.Game.Habbos;
|
||||
|
||||
public class HabboAchievement
|
||||
{
|
||||
public virtual Habbo Habbo { get; set; } = null!;
|
||||
public virtual Achievement Achievement { get; set; } = null!;
|
||||
public virtual int Level { get; set; }
|
||||
public virtual int Progress { get; set; }
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is not HabboAchievement other)
|
||||
return false;
|
||||
|
||||
return Habbo.Id == other.Habbo.Id && Achievement.Id == other.Achievement.Id;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hash = 17;
|
||||
hash = hash * 23 + Habbo.Id.GetHashCode();
|
||||
hash = hash * 23 + Achievement.Id.GetHashCode();
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Tiger.Game.Habbos;
|
||||
|
||||
public class HabboAchievementMap : ClassMap<HabboAchievement>
|
||||
{
|
||||
public HabboAchievementMap()
|
||||
{
|
||||
Table("habbo_achievements");
|
||||
LazyLoad();
|
||||
CompositeId()
|
||||
.KeyReference(ha => ha.Habbo, "habbo_id")
|
||||
.KeyReference(ha => ha.Achievement, "achievement_id");
|
||||
Map(ha => ha.Level).Column("level").Not.Nullable();
|
||||
Map(ha => ha.Progress).Column("progress").Not.Nullable();
|
||||
}
|
||||
}
|
|
@ -19,22 +19,11 @@ public class HabboMap : ClassMap<Habbo>
|
|||
Map(h => h.Rank).Column("rank").Not.Nullable();
|
||||
Map(h => h.Credits).Column("credits").Not.Nullable();
|
||||
Map(h => h.Online).Column("online").Not.Nullable();
|
||||
Map(h => h.HomeRoom).Column("home_room").Not.Nullable();
|
||||
Map(h => h.AchievementScore).Column("achievement_score").Not.Nullable();
|
||||
Map(h => h.GroupId).Column("group_id").Nullable();
|
||||
Map(h => h.SsoTicket).Column("sso_ticket").Nullable();
|
||||
HasMany(h => h.Activitypoints).AsMap(a => a.Type).Inverse().Cascade.All();
|
||||
References(h => h.CurrentBadge).Column("current_badge").Nullable();
|
||||
Map(h => h.BadgeActive).Column("badge_active").Not.Nullable();
|
||||
HasMany(h => h.Badges).Inverse().Cascade.All();
|
||||
HasMany(x => x.Achievements)
|
||||
.Table("habbo_achievements")
|
||||
.KeyColumn("habbo_id")
|
||||
.Component(comp =>
|
||||
{
|
||||
comp.Map(x => x.Level);
|
||||
comp.Map(x => x.Progress);
|
||||
})
|
||||
.AsMap("achievement_id")
|
||||
.Cascade.All();
|
||||
HasMany(h => h.Subscriptions).Cascade.All().Inverse();
|
||||
HasMany(h => h.Rooms).Inverse().Cascade.All();
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
namespace Tiger.Game.LandingView;
|
||||
|
||||
public interface ILandingViewManager
|
||||
{
|
||||
ICollection<PromoArticle> PromoArticles { get; }
|
||||
Task LoadPromoArticlesAsync();
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Tiger.Storage;
|
||||
|
||||
namespace Tiger.Game.LandingView;
|
||||
|
||||
public class LandingViewManager : ILandingViewManager
|
||||
{
|
||||
private readonly IRepository<PromoArticle> _promoArticleRepository;
|
||||
private readonly ILogger<ILandingViewManager> _logger;
|
||||
|
||||
public LandingViewManager(IRepository<PromoArticle> promoArticleRepository, ILogger<ILandingViewManager> logger)
|
||||
{
|
||||
_promoArticleRepository = promoArticleRepository;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public ICollection<PromoArticle> PromoArticles { get; private set; } = new List<PromoArticle>();
|
||||
|
||||
public async Task LoadPromoArticlesAsync()
|
||||
{
|
||||
PromoArticles = (await _promoArticleRepository.FindByAsync()).ToList();
|
||||
|
||||
_logger.LogInformation("Loaded {Count} promo articles", PromoArticles.Count);
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
namespace Tiger.Game.LandingView;
|
||||
|
||||
public class PromoArticle
|
||||
{
|
||||
public virtual int Id { get; set; }
|
||||
public virtual string Title { get; set; } = null!;
|
||||
public virtual string BodyText { get; set; } = null!;
|
||||
public virtual string ButtonText { get; set; } = null!;
|
||||
public virtual PromoArticleLinkType LinkType { get; set; }
|
||||
public virtual string LinkContent { get; set; } = null!;
|
||||
public virtual string ImageUrl { get; set; } = null!;
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
namespace Tiger.Game.LandingView;
|
||||
|
||||
public enum PromoArticleLinkType
|
||||
{
|
||||
LinkTypeUrl = 0,
|
||||
LinkTypeInternal = 1,
|
||||
LinkTypeNoLink = 2
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue