namespace Supercell.Laser.Logic.Home { using System; using System.Collections.Generic; using System.Numerics; using System.Text.Json.Serialization; using Supercell.Laser.Logic.Command.Home; using Supercell.Laser.Logic.Data; using Supercell.Laser.Logic.Data.Helper; using Supercell.Laser.Logic.Helper; using Supercell.Laser.Logic.Home.Gatcha; using Supercell.Laser.Logic.Home.Items; using Supercell.Laser.Logic.Home.Quest; using Supercell.Laser.Logic.Home.Structures; using Supercell.Laser.Logic.Message.Home; using Supercell.Laser.Titan.DataStream; using Supercell.Laser.Logic.Battle.Structures; using System.Collections.Immutable; using System.Text.RegularExpressions; using System.Xml.Linq; using static System.Collections.Specialized.BitVector32; using System.Text.Json; public class ClientHome { public const int DAILYOFFERS_COUNT = 6; public static readonly int[] GoldPacksPrice = new int[] { 20, 50, 140, 280 }; public static readonly int[] GoldPacksAmount = new int[] { 150, 400, 1200, 2600 }; public long HomeId; public int ThumbnailId; public int NameColorId; public int CharacterId; public List OfferBundles; public List OfferBundles1; public int TrophiesReward; public int TokenReward; public int StarTokenReward; public int StarPointsGained; public int PowerPlayTrophiesReward; public BigInteger BrawlPassProgress; public BigInteger PremiumPassProgress; public int BrawlPassTokens; public bool HasPremiumPass; public List UnlockedEmotes; public int Experience; public int TokenDoublers; public int TrophyRoadProgress; public Quests Quests; public NotificationFactory NotificationFactory; public BattleLog BattleLogs; public List UnlockedSkins; //public int[] SelectedSkins; public Dictionary SelectedSkins; public int PowerPlayGamesPlayed; public int PowerPlayScore; public int PowerPlayHighestScore; public int BattleTokens; public DateTime BattleTokensRefreshStart; public DateTime PremiumEndTime; public DateTime ChatBanEndTime; public DateTime BanEndTime; public List ReportsIds; public bool BlockFriendRequests; public string IpAddress; public string Device; public List OffersClaimed; [JsonIgnore] public EventData[] Events; [JsonIgnore] public PlayerThumbnailData Thumbnail => DataTables.Get(DataType.PlayerThumbnail).GetDataByGlobalId(ThumbnailId); [JsonIgnore] public NameColorData NameColor => DataTables.Get(DataType.NameColor).GetDataByGlobalId(NameColorId); [JsonIgnore] public CharacterData Character => DataTables.Get(DataType.Character).GetDataByGlobalId(CharacterId); [JsonIgnore] public HomeMode HomeMode; public DateTime LastVisitHomeTime; public DateTime LastRotateDate; [JsonIgnore] public bool ShouldUpdateDay; public int BrawlPassSeason = 6; //бп с баззом уоу public Dictionary PlayerSelectedEmotes = new Dictionary(); public List SentNotifications = new(); public int RankedSoloRank; public int RankedSoloMaxRank; public int RankedTrioRank; public int RankedTrioMaxRank; public int RankedSoloProgress; public int RankedTrioProgress; public int RankedSoloMaxProgress; public int RankedTrioMaxProgress; [JsonIgnore] public string PathToOffers = "/root/36.218/Supercell.Laser.Server/offers.json"; [JsonIgnore] public List UnlockedThumbnails; public DateTime AccountCreatedTime; public ClientHome() { ThumbnailId = GlobalId.CreateGlobalId(28, 0); NameColorId = GlobalId.CreateGlobalId(43, 0); CharacterId = GlobalId.CreateGlobalId(16, 0); SelectedSkins = new Dictionary(); OfferBundles = new List(); OffersClaimed = new List(); ReportsIds = new List(); UnlockedSkins = new List(); LastVisitHomeTime = DateTime.UnixEpoch; TrophyRoadProgress = 1; BrawlPassProgress = 1; PremiumPassProgress = 1; UnlockedEmotes = new List(); UnlockedThumbnails = new List(); BattleTokens = 200; BattleTokensRefreshStart = new(); if (OffersClaimed == null) OffersClaimed = new List(); if (BattleLogs == null) { BattleLogs = new BattleLog(); } if (NotificationFactory == null) { NotificationFactory = new NotificationFactory(); } PlayerSelectedEmotes.Add(1, 99); PlayerSelectedEmotes.Add(2, 99); PlayerSelectedEmotes.Add(3, 99); PlayerSelectedEmotes.Add(4, 156); PlayerSelectedEmotes.Add(5, 81); } public void HomeVisited() { try { NotificationFactory.Remove(68); // SendNotification("rauz", 81, "Привет это рауз"); //SendNotification("rauz1", 89, "Пока это рауз", 1337); // SendNotification("bpt2estп_п1", 68); RotateShopContent(DateTime.UtcNow, OfferBundles.Count == 0); LastVisitHomeTime = DateTime.UtcNow; if (Quests == null && TrophyRoadProgress >= 11) { Quests = new Quests(); Quests.AddRandomQuests(HomeMode.Avatar.Heroes, 6); } RankedInit(); InitCosmetics(); } catch (Exception ex) { Console.WriteLine("[HOME VISITED ERROR]"); Console.WriteLine(ex.ToString()); } } public void RankedInit() { //if (ClaimedRankedQuestsIds == null) ClaimedRankedQuestsIds = new List(); // CheckAndGiveRankedRewards(); if (RankedSoloRank <= 0) RankedSoloRank = 1; if (RankedTrioRank <= 0) RankedTrioRank = 1; if (RankedSoloProgress <= 0) RankedSoloProgress = 0; if (RankedTrioProgress <= 0) RankedTrioProgress = 0; if (RankedSoloMaxProgress <= 0) RankedSoloMaxProgress = RankedSoloProgress; if (RankedTrioMaxProgress <= 0) RankedTrioMaxProgress = RankedTrioProgress; RankedSoloRank = (RankedSoloProgress / 1000) + 1; RankedTrioRank = (RankedTrioProgress / 1000) + 1; if (RankedSoloRank > 19) RankedSoloRank = 19; if (RankedTrioRank > 19) RankedTrioRank = 19; if (RankedSoloRank > RankedSoloMaxRank) RankedSoloMaxRank = RankedSoloRank; if (RankedTrioRank > RankedTrioMaxRank) RankedTrioMaxRank = RankedTrioRank; if (RankedSoloProgress > RankedSoloMaxProgress) RankedSoloMaxProgress = RankedSoloProgress; if (RankedTrioProgress > RankedTrioMaxProgress) RankedTrioMaxProgress = RankedTrioProgress; if (HomeMode?.Avatar != null) { int highRank = Math.Max(RankedSoloRank, RankedTrioRank); HomeMode.Avatar.RankedRank = highRank <= 0 ? 1 : highRank; if (RankedSoloRank < 0) { RankedSoloRank = 1; RankedSoloMaxRank = 1; RankedSoloProgress = 0; RankedSoloMaxProgress = 0; RankedTrioRank = 1; RankedTrioMaxRank = 1; RankedTrioProgress = 0; RankedTrioMaxProgress = 0; HomeMode.Avatar.RankedRank = 1; } else { } } } public void InitCosmetics() { if (PlayerSelectedEmotes == null) { PlayerSelectedEmotes = new Dictionary(); PlayerSelectedEmotes.Add(1, 99); PlayerSelectedEmotes.Add(2, 99); PlayerSelectedEmotes.Add(3, 99); PlayerSelectedEmotes.Add(4, 156); PlayerSelectedEmotes.Add(5, 81); } } /*public void Tick() { LastVisitHomeTime = DateTime.UtcNow; TokenReward = 0; TrophiesReward = 0; StarTokenReward = 0; StarPointsGained = 0; PowerPlayTrophiesReward = 0; }*/ public void Tick() { LastVisitHomeTime = DateTime.UtcNow; while (ShouldAddTokens()) { BattleTokensRefreshStart = BattleTokensRefreshStart.AddMinutes(30); BattleTokens = Math.Min(200, BattleTokens + 30); if (BattleTokens == 200) { BattleTokensRefreshStart = new(); break; } } RotateShopContent(DateTime.UtcNow, OfferBundles.Count == 0); } public void SendNotification(string notificationKey, int notificationId, string message = null, int donationCount = 0, int brawlerId = 0, int skinId = 0, int pinId = 0, int iconId = 0, int resourceId = 0, int resourceCount = 0, int type = 0, int rewardGold = 0, int rewardGems = 0, int rewardHeroGlobalId = 0, int rewardSkinGlobalId = 0) { try { if (!SentNotifications.Contains(notificationKey)) { SentNotifications.Add(notificationKey); Supercell.Laser.Logic.Home.Items.Notification notification = new Supercell.Laser.Logic.Home.Items.Notification { Id = notificationId, MessageEntry = message, DonationCount = donationCount, BrawlerID = brawlerId, SkinID = skinId, PinID = pinId, IconID = iconId, ResourceID = resourceId, ResourceCount = resourceCount, Type = type, RewardGold = rewardGold, RewardGems = rewardGems, RewardHeroGlobalId = rewardHeroGlobalId, RewardSkinGlobalId = rewardSkinGlobalId, IsViewed = false }; NotificationFactory.Add(notification); if (HomeMode != null) { var cmd = new LogicAddNotificationCommand(); cmd.Notification = notification; cmd.Execute(HomeMode); var msg = new AvailableServerCommandMessage(); msg.Command = cmd; HomeMode.GameListener.SendMessage(msg); } } } catch (Exception ex) { Console.WriteLine("{ex}"); } } public int GetbattleTokensRefreshSeconds() { if (BattleTokensRefreshStart == new DateTime()) { return -1; } return (int)BattleTokensRefreshStart.AddMinutes(30).Subtract(DateTime.UtcNow).TotalSeconds; } public bool ShouldAddTokens() { if (BattleTokensRefreshStart == new DateTime()) { return false; } return GetbattleTokensRefreshSeconds() < 1; } public void PurchaseOffer(int index) { if (index < 0 || index >= OfferBundles.Count) return; OfferBundle bundle = OfferBundles[index]; if (bundle.Purchased) return; if (bundle.Currency == 0) { if (!HomeMode.Avatar.UseDiamonds(bundle.Cost)) return; } else if (bundle.Currency == 1) { if (!HomeMode.Avatar.UseGold(bundle.Cost)) return; } else if (bundle.Currency == 3) { if (!HomeMode.Avatar.UseStarPoints(bundle.Cost)) return; } if (bundle.Claim == "debug") { ; } else { OffersClaimed.Add(bundle.Claim); } bundle.Purchased = true; LogicGiveDeliveryItemsCommand command = new LogicGiveDeliveryItemsCommand(); Random rand = new Random(); foreach (Offer offer in bundle.Items) { if (offer.Type == ShopItem.BrawlBox || offer.Type == ShopItem.FreeBox) { for (int x = 0; x < offer.Count; x++) { DeliveryUnit unit = new DeliveryUnit(10); HomeMode.SimulateGatcha(unit); if (x + 1 != offer.Count) { command.Execute(HomeMode); } command.DeliveryUnits.Add(unit); } } else if (offer.Type == ShopItem.HeroPower) { DeliveryUnit unit = new DeliveryUnit(100); GatchaDrop reward = new GatchaDrop(6); reward.DataGlobalId = offer.ItemDataId; reward.Count = offer.Count; unit.AddDrop(reward); command.DeliveryUnits.Add(unit); } else if (offer.Type == ShopItem.BigBox) { for (int x = 0; x < offer.Count; x++) { DeliveryUnit unit = new DeliveryUnit(12); HomeMode.SimulateGatcha(unit); if (x + 1 != offer.Count) { command.Execute(HomeMode); } command.DeliveryUnits.Add(unit); } } else if (offer.Type == ShopItem.MegaBox) { for (int x = 0; x < offer.Count; x++) { DeliveryUnit unit = new DeliveryUnit(11); HomeMode.SimulateGatcha(unit); if (x + 1 != offer.Count) { command.Execute(HomeMode); } command.DeliveryUnits.Add(unit); } } else if (offer.Type == ShopItem.Skin) { DeliveryUnit unit = new DeliveryUnit(100); GatchaDrop reward = new GatchaDrop(9); reward.SkinGlobalId = GlobalId.CreateGlobalId(29, offer.SkinDataId); unit.AddDrop(reward); command.DeliveryUnits.Add(unit); } else if (offer.Type == ShopItem.Emote) { DeliveryUnit unit = new DeliveryUnit(100); GatchaDrop reward = new GatchaDrop(11); reward.PinGlobalId = GlobalId.CreateGlobalId(52, offer.SkinDataId); reward.DataGlobalId = GlobalId.CreateGlobalId(52, offer.SkinDataId); unit.AddDrop(reward); command.DeliveryUnits.Add(unit); } else if (offer.Type == ShopItem.PlayerThumbnail) { DeliveryUnit unit = new DeliveryUnit(100); GatchaDrop reward = new GatchaDrop(11); reward.SkinGlobalId = GlobalId.CreateGlobalId(28, offer.SkinDataId); reward.DataGlobalId = GlobalId.CreateGlobalId(28, offer.SkinDataId); unit.AddDrop(reward); command.DeliveryUnits.Add(unit); } else if (offer.Type == ShopItem.Gems) { DeliveryUnit unit = new DeliveryUnit(100); GatchaDrop reward = new GatchaDrop(8); reward.Count = offer.Count; unit.AddDrop(reward); command.DeliveryUnits.Add(unit); } else if (offer.Type == ShopItem.Coin) { DeliveryUnit unit = new DeliveryUnit(100); GatchaDrop reward = new GatchaDrop(7); reward.Count = offer.Count; unit.AddDrop(reward); command.DeliveryUnits.Add(unit); } else if (offer.Type == ShopItem.CoinDoubler) { DeliveryUnit unit = new DeliveryUnit(100); GatchaDrop reward = new GatchaDrop(2); reward.Count = offer.Count; unit.AddDrop(reward); command.DeliveryUnits.Add(unit); } else if (offer.Type == ShopItem.RandomEmotes) { HomeMode.ProcessPinPack(command.DeliveryUnits, 0, 0); } else if (offer.Type == ShopItem.RandomEmotesPackOfRarity) { HomeMode.ProcessPinPack(command.DeliveryUnits, 1, offer.SkinDataId); } else { // todo... } command.Execute(HomeMode); } AvailableServerCommandMessage message = new AvailableServerCommandMessage(); message.Command = command; HomeMode.GameListener.SendMessage(message); } public void GenerateShopOffers() { GenerateOffer( new DateTime(2000, 4, 20, 12, 0, 0), new DateTime(2030, 4, 20, 12, 0, 0), 1, 999, 0, ShopItem.Gems, 0, 9999, 0, "offer1", "АКЦИЯ", "offer_gems" ); } private void RotateShopContent(DateTime time, bool isNewAcc) { /*if (OfferBundles.Select(bundle => bundle.IsDailyDeals).ToArray().Length > 6) { OfferBundles.RemoveAll(bundle => bundle.IsDailyDeals); }*/ bool IsUpdated = false; int offLen = OfferBundles.Count; OfferBundles.RemoveAll(offer => (!offer.IsDailyDeals && !offer.IsDailySkinOffer) || (offer.IsDailyDeals || offer.IsDailySkinOffer) && offer.EndTime <= time); GenerateShopOffers(); try { string json = File.ReadAllText(Path.Combine(PathToOffers)); var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, IncludeFields = true, Converters = { new JsonStringEnumConverter() } }; List bundlesFromJson = JsonSerializer.Deserialize>(json, options); foreach (var bundle in bundlesFromJson) { if (!string.IsNullOrEmpty(bundle.Claim) && OffersClaimed.Contains(bundle.Claim)) { continue; } if (bundle.EndTime <= time) { continue; } if (bundle.StartTime.HasValue && bundle.StartTime > time) { continue; } if (bundle.AllowedAccountIds != null && bundle.AllowedAccountIds.Count > 0 && !bundle.AllowedAccountIds.Contains(HomeMode.Avatar.AccountId)) { continue; } var existingBundle = OfferBundles.FirstOrDefault(existing => existing.Claim == bundle.Claim); if (bundle.Purchased && existingBundle != null) { OfferBundles.Remove(existingBundle); } else if (existingBundle == null) { OfferBundles.Add(bundle); IsUpdated = true; } foreach (var item in bundle.Items) { try { if (item.Type == ShopItem.Skin) { SkinData skinData = DataTables.Get(DataType.Skin).GetDataByGlobalId(item.SkinDataId + 16000000); SkinConfData skinConfData = DataTables.Get(DataType.SkinConf).GetData(skinData.Name); CharacterData characterData = DataTables.Get(DataType.Character).GetData(skinConfData.Character); if (HomeMode.Home.UnlockedSkins.Contains(item.SkinDataId + 29000000)) { bundle.Purchased = true; break; } if (HomeMode.Avatar.HasHero(characterData.GetGlobalId())) { } else { bundle.Purchased = false; break; } } if(item.Type == ShopItem.GuaranteedHero) { CharacterData characterData = DataTables.Get(DataType.Character).GetDataByGlobalId(item.ItemDataId); if (HomeMode.Avatar.HasHero(item.ItemDataId)) { bundle.Purchased = true; break; } } } catch (Exception e) { Console.WriteLine("item error: " + e.Message); } } } } catch (Exception ex) { Console.WriteLine($"Error of loading offers.json: {ex}"); } IsUpdated = OfferBundles.Count != offLen; if (isNewAcc || DateTime.UtcNow.Hour >= -8) // Daily deals refresh at 08:00 AM UTC { //LastRotateDate = new DateTime(); if (LastRotateDate < DateTime.UtcNow.Date) { IsUpdated = true; OfferBundles.RemoveAll(offer => offer.IsDailyDeals); LastRotateDate = DateTime.UtcNow.Date; UpdateDailyOfferBundles(); UpdateDailySkins(); PowerPlayGamesPlayed = 0; ReportsIds = new List(); if (Quests != null) { Quests.QuestList.RemoveAll(bundle => bundle.IsDailyQuest); Quests.AddRandomQuests(HomeMode.Avatar.Heroes, Quests.QuestList.Count >= 18 ? 8 : 10); } } } if (OfferBundles == null) { UpdateDailyOfferBundles(); IsUpdated = true; } else if (OfferBundles.Count == 0) { UpdateDailyOfferBundles(); IsUpdated = true; } if (IsUpdated) { LogicDayChangedCommand newday = new() { Home = this }; newday.Home.Events = Events; AvailableServerCommandMessage eventupdated = new() { Command = newday, }; HomeMode.GameListener.SendMessage(eventupdated); } } public void GenerateOffer( DateTime OfferStart, DateTime OfferEnd, int Count, int BrawlerID, int Extra, ShopItem Item, int Cost, int OldCost, int Currency, string Claim, string Title, string BGR ){ OfferBundle bundle = new OfferBundle(); bundle.IsDailyDeals = false; //bundle.IsTrue = true; bundle.EndTime = OfferEnd; bundle.Cost = Cost; bundle.OldCost = OldCost; bundle.Currency = Currency; bundle.Claim = Claim; bundle.Title = Title; bundle.BackgroundExportName = BGR; if (OffersClaimed.Contains(bundle.Claim)) { bundle.Purchased = true; } if (DateTime.UtcNow < OfferStart || DateTime.UtcNow >= OfferEnd) { bundle.Purchased = true; } if (HomeMode.Avatar.HasHero(BrawlerID)) { bundle.Purchased = true; } Offer offer = new Offer(Item, Count, (16000000 + BrawlerID), Extra); bundle.Items.Add(offer); OfferBundles.Add(bundle); } public void GenerateOffer2( DateTime OfferStart, DateTime OfferEnd, int Count, int BrawlerID, int Extra, ShopItem Item, int Count2, int BrawlerID2, int Extra2, ShopItem Item2, int Cost, int OldCost, int Currency, string Claim, string Title, string BGR ){ OfferBundle bundle = new OfferBundle(); bundle.IsDailyDeals = false; //bundle.IsTrue = true; bundle.EndTime = OfferEnd; bundle.Cost = Cost; bundle.OldCost = OldCost; bundle.Currency = Currency; bundle.Claim = Claim; bundle.Title = Title; bundle.BackgroundExportName = BGR; if (OffersClaimed.Contains(bundle.Claim)) { bundle.Purchased = true; } if (DateTime.UtcNow < OfferStart || DateTime.UtcNow >= OfferEnd) { bundle.Purchased = true; } if (HomeMode.Avatar.HasHero(BrawlerID)) { bundle.Purchased = true; } Offer offer = new Offer(Item, Count, (16000000 + BrawlerID), Extra); bundle.Items.Add(offer); Offer offer2 = new Offer(Item2, Count2, (16000000 + BrawlerID2), Extra2); bundle.Items.Add(offer2); OfferBundles.Add(bundle); } public void GenerateOffer3( DateTime OfferStart, DateTime OfferEnd, int Count, int BrawlerID, int Extra, ShopItem Item, int Count2, int BrawlerID2, int Extra2, ShopItem Item2, int Count3, int BrawlerID3, int Extra3, ShopItem Item3, int Cost, int OldCost, int Currency, string Claim, string Title, string BGR ){ OfferBundle bundle = new OfferBundle(); bundle.IsDailyDeals = false; //bundle.IsTrue = true; bundle.EndTime = OfferEnd; bundle.Cost = Cost; bundle.OldCost = OldCost; bundle.Currency = Currency; bundle.Claim = Claim; bundle.Title = Title; bundle.BackgroundExportName = BGR; if (OffersClaimed.Contains(bundle.Claim)) { bundle.Purchased = true; } if (DateTime.UtcNow < OfferStart || DateTime.UtcNow >= OfferEnd) { bundle.Purchased = true; } if (HomeMode.Avatar.HasHero(BrawlerID)) { bundle.Purchased = true; } Offer offer = new Offer(Item, Count, (16000000 + BrawlerID), Extra); bundle.Items.Add(offer); Offer offer2 = new Offer(Item2, Count2, (16000000 + BrawlerID2), Extra2); bundle.Items.Add(offer2); Offer offer3 = new Offer(Item3, Count3, (16000000 + BrawlerID3), Extra3); bundle.Items.Add(offer3); OfferBundles.Add(bundle); } private void UpdateDailySkins() { List skins = new() { "GunSlingerRockstar", "RocketGirlBeach", "CactusPink", "ShamanPanda", "CrowWhite", "BullGuyHair", "LuchadorRudo", "BanditGirlBandita", "LuchadorRey", "MechanicKnight", "FrankCaveman", "MechanicSummer", "CrowPheonix", "UndertakerGreaser", "TntGuySanta", "TntGuyChef", "RocketGirlBoombox", "BarkeepWizard", "ShamanReindeer", "ArtilleryGalElf", "UndertakerHat", "BullGuyFootbull", "ShamanBearReindeer", "TrickshotPopcorn", "GunSlingerHanbok", "BarrelbotCny", "PocoValentine", "RocketGirlCny", "UndertakerNightwitch", "ShamanShiba", "ArtilleryGalBunny", "BarkeepMs", "RocketGirlHotrod", "BarkeepMaple", "WhirlwindRR", "BoMecha", "CrowMecha", "Cactusmecha", "TntDudeMecha", "BowDudeMechaWhite", "CrowMechaNight", "BullDudeFootbullBlue", "GunslingerOutlaw", "WhirlwindHogrider", "SniperPink", "ArcadeClassic", "NinjaShark", "BlackHoleBlue", "BarkeepWizardRed", "HookPirate", "Sandstormsleepy", "Sniperrose", "ShotgunGirlWitch", "MechanicKnightDark", "HammerDudeDJ", "NinjaWolf", "LuchadorBrown", "TrickshotDudeTotal", "NinjaSally", "WhirlwindLeonard", "WhirlwindPirate", "GunslingerPirate", "SpeedyGT", "BeeSniperLadyBug", "PocoPirate", "ArcadeVirus", "BlackHoleStreetNinja", "SniperValentines", "ShamanKoala", "SpawnerDudeAgentP", "BarrelBotFootball", "ShotgunGirlFootball", "TntDudeFootball", "MechanicTanuki", "BowDudeHorus", "ArtilleryDudeDarkBunny", "MummyCollege", "TrickshotDudeBazaar", "HookDudeBazaar", "UndertakerBazaar", "MechanicRedDragon", "DrillerConstructor", "WallyHawaii", "BullDudeBarbking", "MinigunDudeSummer", "BlowerTrader", "BeeSniperMonster", "DrillerMonster", "ClusterBombMonster", "ControllerRetro", "RocketGirlRanger", "SpeedyTracksuit", "PowerLevelerKnight", "CactusMask", "MummyGiftShop", "SandstormGiftShop", "WallyMoon", "PercenterTrixie", "LuchadorAtomic", "PocoStarr", "RosaRosaBrawloween", "BowDudeDemonic", "GunslingerPlayer", "SpeedyLine", "ControllerLine", "SniperLine", "TntDudeSnowtel", "IceDudeKing", "BlowerNutcracker", "RocketGirlOg", "ClusterBombDudeSnowman", "HammerDudeXmas", "BowDudeWarrior", "BullDudeOx", "CactusLord", "BarrelBotLaser", "IceDudeCrooner", "WhirlwindDarkTide", "RuffsRonin", "PercenterCrew", "ArtilleryDudeSmuggler", "TntDudePsg", "RollerWhite", "FireDudeMasked", "EnragerDuel", "BlackHoleMisfortune", "ArcadePiano", "BeeSniperCat", "RuffsMarshall", "SandstormLantern", "BeeSniperArchvillain", "PowerLevelerDIY", "ElectroSniperBoss", "GunslingerBadass", "IceDudeBurger", "DrillerJetski", "WhirlwindSurfer", "RosaCoco", "SpeedyHermes", "UndertakerBeach", "NinjaDino", "TntDudeFlamengo", "TntDudeLduQuito", "TntDudeChivas", "LuchadorUniversitario", "LuchadorClubNacional", "LuchadorCorinthians", "ShotgunGirlBocaJuniors", "ShotgunGirlAmerica", "ShotgunGirlUDeChile", "GunSlingerRiverPlate", "GunSlingerCerroPorteno", "GunSlingerAtlNacional", "GunslingerClubAmerica", "DeadMariachiPunk", "RollerPunk", "ShamanSummer", "BarrelBotMegabox" }; List skis = new(); List starss = new(); foreach (Hero h in HomeMode.Avatar.Heroes) { CharacterData c = DataTables.Get(DataType.Character).GetDataByGlobalId(h.CharacterId); string cn = c.Name; foreach (string name in skins) { SkinConfData skinConf = DataTables.Get(DataType.SkinConf).GetData(name); if (skinConf == null) continue; if (skinConf.Character == cn) { SkinData skin = DataTables.Get(DataType.Skin).GetData(skinConf.Name); if (skin == null) continue; if (UnlockedSkins.Contains(skin.GetGlobalId())) continue; if (skin.Name.EndsWith("Default")) continue; if (skin.Name == "RocketGirlRanger") continue; if (skin.Name == "PowerLevelerKnight") continue; if (skin.Name == "BlowerTrader") continue; if (!skin.Name.EndsWith("Gold")) { skis.Add(skin.GetGlobalId()); } } } } Random random = new Random(); int[] selectedElements = new int[Math.Min(skis.Count, 8)]; for (int i = 0; i < Math.Min(skis.Count, 8); i++) { int randomIndex; do { randomIndex = random.Next(0, skis.Count); } while (selectedElements.Contains(skis[randomIndex])); selectedElements[i] = skis[randomIndex]; } foreach (int bbbbbb in selectedElements) { SkinData skin = DataTables.Get(DataType.Skin).GetDataByGlobalId(bbbbbb); OfferBundle bundle = new OfferBundle(); bundle.IsDailyDeals = false; bundle.IsDailySkinOffer = true; bundle.EndTime = DateTime.UtcNow.Date.AddDays(1).AddHours(8); // tomorrow at 8:00 utc (11:00 MSK) Console.WriteLine(skin.CostGems); if (skin.CostGems > 0) { bundle.Currency = 0; bundle.Cost = (skin.CostGems); } else { continue; } Offer offer = new Offer(ShopItem.Skin, 1); offer.SkinDataId = GlobalId.GetInstanceId(bbbbbb); bundle.Items.Add(offer); OfferBundles.Add(bundle); } int[] selectedStElements = new int[Math.Min(starss.Count, 3)]; for (int i = 0; i < Math.Min(starss.Count, 3); i++) { int randomIndex; do { randomIndex = random.Next(0, starss.Count); } while (selectedStElements.Contains(starss[randomIndex])); selectedStElements[i] = starss[randomIndex]; } } private void UpdateDailyOfferBundles() { OfferBundles = new List(); OfferBundles.Add(GenerateDailyGift()); List unlockedHeroes = HomeMode.Avatar.Heroes; List PossibleHeroes = new(); foreach (Hero h in unlockedHeroes) { if (h.PowerLevel == 8) continue; if (h.PowerPoints >= 1410) continue; PossibleHeroes.Add(h); } Random random = new Random(); bool shouldPowerPoints = true; bool hasMG = false; int offcount = 0; for (int i = 1; i < DAILYOFFERS_COUNT; i++) { if (PossibleHeroes.Count == 0) break; offcount++; if (!hasMG && (random.Next(0, 100) > 33)) { i++; offcount++; hasMG = true; OfferBundle a = GenerateDailyOffer(false, null); if (a != null) { OfferBundles.Add(a); } } int inds = random.Next(0, PossibleHeroes.Count); Hero brawler = PossibleHeroes[inds]; PossibleHeroes.Remove(PossibleHeroes[inds]); OfferBundle dailyOffer = GenerateDailyOffer(shouldPowerPoints, brawler); if (dailyOffer != null) { if (!shouldPowerPoints) shouldPowerPoints = dailyOffer.Items[0].Type != ShopItem.HeroPower; OfferBundles.Add(dailyOffer); } } if (offcount < 5 && !hasMG) { OfferBundle dailyOffer = GenerateDailyOffer(false, null); if (dailyOffer != null) { OfferBundles.Add(dailyOffer); } } } private OfferBundle GenerateDailyGift() { OfferBundle bundle = new OfferBundle(); bundle.IsDailyDeals = true; bundle.EndTime = DateTime.UtcNow.Date.AddDays(1).AddHours(8); // tomorrow at 8:00 utc (11:00 MSK) bundle.Cost = 0; Offer offer = new Offer(ShopItem.FreeBox, 1); bundle.Items.Add(offer); return bundle; } private OfferBundle GenerateDailyOffer(bool shouldPowerPoints, Hero brawler) { OfferBundle bundle = new OfferBundle(); bundle.IsDailyDeals = true; bundle.EndTime = DateTime.UtcNow.Date.AddDays(1).AddHours(8); // tomorrow at 8:00 utc (11:00 MSK) Random random = new Random(); int type = shouldPowerPoints ? 0 : 1; // getting a type switch (type) { case 0: // Power points //for (int i = 0; i < Math.Min(PossibleHeroes.Count, 5)) int count = random.Next(15, 100) + 1; Offer offer = new Offer(ShopItem.HeroPower, count, brawler.CharacterId); bundle.Items.Add(offer); bundle.Cost = count * 2; bundle.Currency = 1; break; case 1: // mega box Offer megaBoxOffer = new Offer(ShopItem.MegaBox, 1); bundle.Items.Add(megaBoxOffer); bundle.Cost = 40; bundle.OldCost = 80; bundle.Currency = 0; break; } return bundle; } public void LogicDailyData(ByteStream encoder, DateTime utcNow) { encoder.WriteVInt(utcNow.Year * 1000 + utcNow.DayOfYear); // 0x78d4b8 encoder.WriteVInt(utcNow.Hour * 3600 + utcNow.Minute * 60 + utcNow.Second); // 0x78d4cc encoder.WriteVInt(HomeMode.Avatar.Trophies); // 0x78d4e0 encoder.WriteVInt(HomeMode.Avatar.HighestTrophies); // 0x78d4f4 encoder.WriteVInt(HomeMode.Avatar.HighestTrophies); // highest trophy again? encoder.WriteVInt(TrophyRoadProgress); // encoder.WriteVInt(100); encoder.WriteVInt(Experience + 13377); // experience try { ByteStreamHelper.WriteDataReference(encoder, Thumbnail); ByteStreamHelper.WriteDataReference(encoder, NameColorId); } catch { ThumbnailId = GlobalId.CreateGlobalId(28, 0); NameColorId = GlobalId.CreateGlobalId(43, 0); } encoder.WriteVInt(27);//played gamemodes(dont shouw battle hint) for (int i = 0; i < 27; i++) encoder.WriteVInt(i); int skins = 0; foreach (Hero hero in HomeMode.Avatar.Heroes) { if (hero.SelectedSkinId != 0) skins++; } encoder.WriteVInt(skins); // Selected Skins foreach (Hero hero in HomeMode.Avatar.Heroes) { if (hero.SelectedSkinId != 0) { ByteStreamHelper.WriteDataReference(encoder, GlobalId.CreateGlobalId(29, hero.SelectedSkinId)); } } encoder.WriteVInt(0); //хз encoder.WriteVInt(UnlockedSkins.Count); // Played game modes foreach (int s in UnlockedSkins) { ByteStreamHelper.WriteDataReference(encoder, s); } encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(HomeMode.Avatar.HighestTrophies); // 122 encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteBoolean(true); encoder.WriteVInt(TokenDoublers); encoder.WriteVInt(0); // token doubler encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteBoolean(false); encoder.WriteBoolean(false); encoder.WriteBoolean(false); encoder.WriteVInt(2); encoder.WriteVInt(2); encoder.WriteVInt(2); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(OfferBundles.Count); // Shop offers at 0x78e0c4 foreach (OfferBundle offerBundle in OfferBundles) { offerBundle.Encode(encoder); } /* encoder.WriteVInt(1); //offers count encoder.WriteVInt(1); //items count encoder.WriteVInt(16); //global // encoder.WriteVInt(10); encoder.WriteVInt(1); //count ByteStreamHelper.WriteDataReference(encoder, 16000000); encoder.WriteVInt(0);//skinid encoder.WriteVInt(0);//gems, coin, starpoint... encoder.WriteVInt(0); //cost encoder.WriteVInt(11); //time end encoder.WriteVInt(0); //state encoder.WriteVInt(0);//unk encoder.WriteBoolean(false);//purch encoder.WriteVInt(0);//unk encoder.WriteVInt(0);//unk encoder.WriteBoolean(false);//daily encoder.WriteVInt(0);//oldcost encoder.WriteVInt(0); // csv title or custom encoder.WriteString("net"); // title encoder.WriteVInt(0); // byteStream.WriteVInt(confirmPurchase); encoder.WriteString("offer_chromatic"); encoder.WriteVInt(0); encoder.WriteBoolean(false);//donateoffer encoder.WriteVInt(0);//unk encoder.WriteVInt(0);//unk*/ encoder.WriteVInt(0); encoder.WriteVInt(BattleTokens); // 0x78e228 encoder.WriteVInt(GetbattleTokensRefreshSeconds()); // 0x78e23c encoder.WriteVInt(0); // 0x78e250 encoder.WriteVInt(0); // 0x78e3a4 encoder.WriteVInt(0); // 0x78e3a4 ByteStreamHelper.WriteDataReference(encoder, Character); encoder.WriteString("RU"); encoder.WriteString("t.me/aimbrawl"); encoder.WriteVInt(6); { encoder.WriteInt(3); encoder.WriteInt(TokenReward); // tokens encoder.WriteInt(4); encoder.WriteInt(TrophiesReward); // trophies encoder.WriteInt(8); encoder.WriteInt(StarPointsGained); // trophies encoder.WriteInt(7); encoder.WriteInt(HomeMode.Avatar.DoNotDisturb ? 1 : 0); // trophies encoder.WriteInt(9); encoder.WriteInt(1); // trophies encoder.WriteInt(10); encoder.WriteInt(PowerPlayTrophiesReward); // trophies } TokenReward = 0; TrophiesReward = 0; StarTokenReward = 0; StarPointsGained = 0; PowerPlayTrophiesReward = 0; encoder.WriteVInt(0); // array encoder.WriteVInt(1); // BrawlPassSeasonData { encoder.WriteVInt(BrawlPassSeason); encoder.WriteVInt(BrawlPassTokens); //encoder.WriteVInt(PremiumPassProgress); encoder.WriteBoolean(HasPremiumPass); encoder.WriteVInt(0); encoder.WriteBoolean(false); // что ето if (encoder.WriteBoolean(true)) // Track 9 { encoder.WriteLongLong128(PremiumPassProgress); } if (encoder.WriteBoolean(true)) // Track 10 { encoder.WriteLongLong128(BrawlPassProgress); } } encoder.WriteVInt(0); { // encoder.WriteVInt(2); // encoder.WriteVInt(0); } if (Quests != null) { encoder.WriteBoolean(true); Quests.Encode(encoder); // Console.WriteLine("quests"); } else { encoder.WriteBoolean(true); encoder.WriteVInt(0); } encoder.WriteBoolean(true); // VanityItems::encode encoder.WriteVInt(UnlockedEmotes.Count + UnlockedThumbnails.Count); foreach (int Emote in UnlockedEmotes) { ByteStreamHelper.WriteDataReference(encoder, Emote); encoder.WriteVInt(-1); // encoder.WriteVInt(1); // encoder.WriteVInt(1); } /* EmoteData emoteData = DataTables.Get(DataType.Emote).GetDataWithId(emoteId); CharacterData characterData = DataTables.Get(DataType.Character).GetData(emoteData.Character); ByteStreamHelper.WriteDataReference(encoder, emoteId); if (emoteData.Character != null && characterData != null) { Hero hero = HomeMode.Avatar.GetHero(characterData.GetGlobalId()) ?? null; int emoteIndx = 0; for (int emoteIndex = 1; emoteIndex < hero.Emotes.Count + 1; emoteIndex++) { if (hero.Emotes[emoteIndex] == emoteId - 52000000) { Console.WriteLine(emoteId); emoteIndx = emoteIndex; } } encoder.WriteVInt(1); encoder.WriteVInt(1); encoder.WriteVInt(3); } else { encoder.WriteVInt(-1); }*/ foreach (int Thumbnail in UnlockedThumbnails) { ByteStreamHelper.WriteDataReference(encoder, Thumbnail); encoder.WriteVInt(-1); } /* self.writeBoolean(True) # Power League Array # Power League Data Array Start # self.writeVInt(3) # Season self.writeVInt(19) # Rank Solo League self.writeVInt(3) # Season self.writeVInt(19) # Rank Team League self.writeVInt(0) self.writeVInt(0) self.writeVInt(0) self.writeVInt(0) self.writeVInt(0) self.writeVInt(0) self.writeVInt(0) self.writeVInt(0) # Power League Data Array End # */ /* if (stream.WriteBoolean(true)) { if (RankedSoloProgress <= 0) RankedSoloProgress = 100; if (RankedTrioProgress <= 0) RankedTrioProgress = 100; int soloRank = RankedSoloRank <= 0 ? 1 : RankedSoloRank; int trioRank = RankedTrioRank <= 0 ? 1 : RankedTrioRank; int soloMaxRank = RankedSoloMaxRank < soloRank ? soloRank : RankedSoloMaxRank; int trioMaxRank = RankedTrioMaxRank < trioRank ? trioRank : RankedTrioMaxRank; int soloPoints = Math.Clamp(RankedSoloProgress - (soloRank - 1) * 1000, 0, 999); int trioPoints = Math.Clamp(RankedTrioProgress - (trioRank - 1) * 1000, 0, 999); int soloMaxProgress = 1000; int trioMaxProgress = 1000; // Console.WriteLine($"[Ranked Encode] SoloRank={soloRank}/{soloMaxRank} ({RankedSoloProgress}/{soloMaxProgress}), TrioRank={trioRank}/{trioMaxRank} ({RankedTrioProgress}/{trioMaxProgress})"); stream.WriteVInt(1); // Season (идентификатор сезона ранговой лиги) stream.WriteVInt(soloRank); stream.WriteVInt(soloPoints); stream.WriteVInt(trioRank); stream.WriteVInt(trioPoints); stream.WriteVInt(soloMaxRank); stream.WriteVInt(soloMaxProgress); stream.WriteVInt(trioMaxRank); stream.WriteVInt(trioMaxProgress); stream.WriteVInt(0); // лидерборды stream.WriteVInt(0); // количество наград stream.WriteVInt(1); // reward count??? if (stream.WriteBoolean(true)) //LogicPlayerRewardData::encode { if (stream.WriteBoolean(true)) { stream.WriteVInt(1); // тип награды stream.WriteVInt(1); // количество } if (stream.WriteBoolean(false)) { } } stream.WriteVInt(1); // тип сезона stream.WriteBoolean(true); // активен } */ encoder.WriteBoolean(true);//pw if (RankedSoloProgress <= 0) RankedSoloProgress = 100; if (RankedTrioProgress <= 0) RankedTrioProgress = 100; int soloRank = RankedSoloRank <= 0 ? 1 : RankedSoloRank; int trioRank = RankedTrioRank <= 0 ? 1 : RankedTrioRank; int soloMaxRank = RankedSoloMaxRank < soloRank ? soloRank : RankedSoloMaxRank; int trioMaxRank = RankedTrioMaxRank < trioRank ? trioRank : RankedTrioMaxRank; int soloPoints = Math.Clamp(RankedSoloProgress, 0, 999); int trioPoints = Math.Clamp(RankedTrioProgress, 0, 999); int soloMaxProgress = RankedSoloMaxProgress; int trioMaxProgress = RankedTrioMaxProgress; encoder.WriteVInt(3); //se encoder.WriteVInt(soloRank); encoder.WriteVInt(soloPoints); encoder.WriteVInt(trioRank); encoder.WriteVInt(trioPoints); encoder.WriteVInt(soloMaxRank); encoder.WriteVInt(soloMaxProgress); encoder.WriteVInt(trioMaxRank); encoder.WriteVInt(trioMaxProgress); encoder.WriteVInt(0);//лидерборды encoder.WriteVInt(0); encoder.WriteVInt(0); //pw end encoder.WriteInt(0); } public void LogicConfData(ByteStream encoder, DateTime utcNow) { encoder.WriteVInt(0); encoder.WriteVInt(27); for (int i = 1; i <= 27; i++) encoder.WriteVInt(i); encoder.WriteVInt(Events.Length); foreach (EventData data in Events) { // data.IsSecondary = false; data.Encode(encoder); } encoder.WriteVInt(0);//what??? encoder.WriteVInt(8); { encoder.WriteVInt(20); encoder.WriteVInt(35); encoder.WriteVInt(75); encoder.WriteVInt(140); encoder.WriteVInt(290); encoder.WriteVInt(480); encoder.WriteVInt(800); encoder.WriteVInt(1250); } ByteStreamHelper.WriteIntList(encoder, GoldPacksPrice); ByteStreamHelper.WriteIntList(encoder, GoldPacksAmount); encoder.WriteBoolean(true); encoder.WriteVInt(0); // Array | this dont work { // ByteStreamHelper.WriteDataReference(encoder, 16000049); // encoder.WriteInt((int)(new DateTime(2027, 12, 15, 8, 0, 0) - DateTime.UtcNow).TotalSeconds); // encoder.WriteInt((int)(new DateTime(2029, 12, 15, 8, 0, 0) - DateTime.UtcNow).TotalSeconds); } int[] LogicConfData = new int[] { 1,41000026, 50, 1 }; encoder.WriteVInt(LogicConfData.Length / 2); // IntValueEntry for (int i = 0; i < LogicConfData.Length / 2; i++) { encoder.WriteInt(LogicConfData[i * 2]); encoder.WriteInt(LogicConfData[i * 2 + 1]); } encoder.WriteVInt(0); encoder.WriteVInt(0); } public void Encode(ByteStream encoder) { DateTime utcNow = DateTime.UtcNow; LogicDailyData(encoder, utcNow); LogicConfData(encoder, utcNow); encoder.WriteLong(HomeId); NotificationFactory.Encode(encoder); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteBoolean(false); encoder.WriteVInt(0); } //32 /* public void LogicDailyData(ByteStream encoder, DateTime utcNow) { encoder.WriteVInt(utcNow.Year * 1000 + utcNow.DayOfYear); // 0x78d4b8 encoder.WriteVInt(utcNow.Hour * 3600 + utcNow.Minute * 60 + utcNow.Second); // 0x78d4cc encoder.WriteVInt(HomeMode.Avatar.Trophies); // 0x78d4e0 encoder.WriteVInt(HomeMode.Avatar.HighestTrophies); // 0x78d4f4 encoder.WriteVInt(HomeMode.Avatar.HighestTrophies); // highest trophy again? encoder.WriteVInt(TrophyRoadProgress); encoder.WriteVInt(Experience + 1000); // experience try { ByteStreamHelper.WriteDataReference(encoder, Thumbnail); ByteStreamHelper.WriteDataReference(encoder, NameColorId); } catch { ThumbnailId = GlobalId.CreateGlobalId(28, 0); NameColorId = GlobalId.CreateGlobalId(43, 0); } encoder.WriteVInt(18); // Played game modes for (int i = 0; i < 18; i++) { encoder.WriteVInt(i); } encoder.WriteVInt(43); // Selected Skins Dictionary for (int i = 0; i < 43; i++) { encoder.WriteVInt(29); try { encoder.WriteVInt(SelectedSkins[i]); } catch { encoder.WriteVInt(0); SelectedSkins = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; } } encoder.WriteVInt(UnlockedSkins.Count); // Played game modes foreach (int s in UnlockedSkins) { ByteStreamHelper.WriteDataReference(encoder, s); } encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(HomeMode.Avatar.HighestTrophies); // 122 encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteBoolean(true); encoder.WriteVInt(TokenDoublers); encoder.WriteVInt(0); // token doubler encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteBoolean(false); encoder.WriteBoolean(false); encoder.WriteBoolean(true); encoder.WriteBoolean(false); encoder.WriteVInt(2); encoder.WriteVInt(2); encoder.WriteVInt(2); encoder.WriteVInt(0); encoder.WriteVInt(0); encoder.WriteVInt(OfferBundles.Count); // Shop offers at 0x78e0c4 foreach (OfferBundle offerBundle in OfferBundles) { offerBundle.Encode(encoder); } encoder.WriteVInt(0); encoder.WriteVInt(BattleTokens); // 0x78e228 encoder.WriteVInt(GetbattleTokensRefreshSeconds()); // 0x78e23c encoder.WriteVInt(0); // 0x78e250 encoder.WriteVInt(0); // 0x78e3a4 encoder.WriteVInt(0); // 0x78e3a4 ByteStreamHelper.WriteDataReference(encoder, Character); encoder.WriteString("RU"); encoder.WriteString(null); encoder.WriteVInt(6); { encoder.WriteInt(3); encoder.WriteInt(TokenReward); // tokens encoder.WriteInt(4); encoder.WriteInt(TrophiesReward); // trophies encoder.WriteInt(8); encoder.WriteInt(StarPointsGained); // trophies encoder.WriteInt(7); encoder.WriteInt(HomeMode.Avatar.DoNotDisturb ? 1 : 0); // trophies encoder.WriteInt(9); encoder.WriteInt(1); // trophies encoder.WriteInt(10); encoder.WriteInt(PowerPlayTrophiesReward); // trophies } TokenReward = 0; TrophiesReward = 0; StarTokenReward = 0; StarPointsGained = 0; PowerPlayTrophiesReward = 0; encoder.WriteVInt(0); // array encoder.WriteVInt(1); // BrawlPassSeasonData { encoder.WriteVInt(3); encoder.WriteVInt(BrawlPassTokens); encoder.WriteBoolean(HasPremiumPass); encoder.WriteVInt(0); encoder.WriteBoolean(true); if (encoder.WriteBoolean(true)) // Track 9 { encoder.WriteLongLong128(PremiumPassProgress); } if (encoder.WriteBoolean(true)) // Track 10 { encoder.WriteLongLong128(BrawlPassProgress); } } encoder.WriteVInt(1); { encoder.WriteVInt(2); encoder.WriteVInt(PowerPlayScore); } if (Quests != null) { encoder.WriteBoolean(true); Quests.Encode(encoder); } else { encoder.WriteBoolean(true); encoder.WriteVInt(0); } encoder.WriteBoolean(true); // VanityItems::encode encoder.WriteVInt(UnlockedEmotes.Count); foreach (int emoteId in UnlockedEmotes) { ByteStreamHelper.WriteDataReference(encoder, emoteId); encoder.WriteVInt(-1); EmoteData emoteData = DataTables.Get(DataType.Emote).GetDataWithId(emoteId); CharacterData characterData = DataTables.Get(DataType.Character).GetData(emoteData.Character); ByteStreamHelper.WriteDataReference(encoder, emoteId); if (emoteData.Character != null && characterData != null) { Hero hero = HomeMode.Avatar.GetHero(characterData.GetGlobalId()) ?? null; int emoteIndx = 0; for (int emoteIndex = 1; emoteIndex < hero.Emotes.Count + 1; emoteIndex++) { if (hero.Emotes[emoteIndex] == emoteId - 52000000) { Console.WriteLine(emoteId); emoteIndx = emoteIndex; } } encoder.WriteVInt(1); encoder.WriteVInt(1); encoder.WriteVInt(3); } else { encoder.WriteVInt(-1); } } CharacterData characterData = DataTables.Get(DataType.Character).GetDataByGlobalId(hero.CharacterId); hero.Emotes = new Dictionary(); if(HomeMode.Avatar.GetDefaultEmoteForCharacter(characterData.Name, "DEFAULT") != null) hero.Emotes.Add(1, HomeMode.Avatar.GetDefaultEmoteForCharacter(characterData.Name, "DEFAULT").GetInstanceId()); hero.Emotes.Add(2, 137 - 3); hero.Emotes.Add(3, 148 - 3); }*/ /* public void LogicConfData(ByteStream encoder, DateTime utcNow) { encoder.WriteVInt(999900); encoder.WriteVInt(0); // Array encoder.WriteVInt(9); for (int i = 1; i <= 9; i++) encoder.WriteVInt(i); encoder.WriteVInt(Events.Length); foreach (EventData data in Events) { data.IsSecondary = false; data.Encode(encoder); } encoder.WriteVInt(Events.Length); foreach (EventData data in Events) { data.IsSecondary = true; data.EndTime.AddSeconds((int)(data.EndTime - DateTime.Now).TotalSeconds); data.Encode(encoder); } encoder.WriteVInt(8); { encoder.WriteVInt(20); encoder.WriteVInt(35); encoder.WriteVInt(75); encoder.WriteVInt(140); encoder.WriteVInt(290); encoder.WriteVInt(480); encoder.WriteVInt(800); encoder.WriteVInt(1250); } encoder.WriteVInt(8); { encoder.WriteVInt(1); encoder.WriteVInt(2); encoder.WriteVInt(3); encoder.WriteVInt(4); encoder.WriteVInt(5); encoder.WriteVInt(10); encoder.WriteVInt(15); encoder.WriteVInt(20); } ByteStreamHelper.WriteIntList(encoder, GoldPacksPrice); ByteStreamHelper.WriteIntList(encoder, GoldPacksAmount); encoder.WriteBoolean(true); encoder.WriteVInt(1); // Array { ByteStreamHelper.WriteDataReference(encoder, 16000040); encoder.WriteInt((int)(new DateTime(2025, 12, 15, 8, 0, 0) - DateTime.UtcNow).TotalSeconds); encoder.WriteInt((int)(new DateTime(2025, 12, 15, 8, 0, 0) - DateTime.UtcNow).TotalSeconds); } int[] LogicConfData = new int[] { 1,41000020, 16000004,1, 16000014,1, 16000022,1, 16000029,1, 16000031,1, 16000037,1, 50, 1 }; encoder.WriteVInt(LogicConfData.Length / 2); // IntValueEntry for (int i = 0; i < LogicConfData.Length / 2; i++) { encoder.WriteInt(LogicConfData[i * 2]); encoder.WriteInt(LogicConfData[i * 2 + 1]); } encoder.WriteVInt(0); encoder.WriteVInt(0); } public void Encode(ByteStream encoder) { DateTime utcNow = DateTime.UtcNow; LogicDailyData(encoder, utcNow); LogicConfData(encoder, utcNow); encoder.WriteLong(HomeId); NotificationFactory.Encode(encoder); encoder.WriteVInt(0); encoder.WriteBoolean(false); encoder.WriteVInt(0); encoder.WriteVInt(0); }*/ } }