Exemple #1
0
        private byte[] OnGetAccountInfo(GameSession session, byte[] body)
        {
            GetAccountInfo request = new GetAccountInfo();
            using(Stream stream = new MemoryStream(body)) {
                request.Deserialize(stream);
            }

            Debug.WriteLine("LOG " + request.Request_);

            if(request.Request_ == GetAccountInfo.Request.CAMPAIGN_INFO) {
                ProfileProgress response = new ProfileProgress() {
                    Progress = 6,
                    BestForge = 0
                };

                return response.EncodeResponse(233);
            }

            if(request.Request_ == GetAccountInfo.Request.BOOSTERS) {
                BoosterList response = new BoosterList();

                response.List.Add(new BoosterInfo() {
                    Type = (int)BoosterType.Classic,
                    Count = 10
                });

                response.List.Add(new BoosterInfo() {
                    Type = (int)BoosterType.GvG,
                    Count = 10
                });

                response.List.Add(new BoosterInfo() {
                    Type = (int)BoosterType.TGT,
                    Count = 10
                });

                return response.EncodeResponse(224);
            }

            if(request.Request_ == GetAccountInfo.Request.FEATURES) {
                GuardianVars response = new GuardianVars() {
                    ShowUserUI = 1
                };

                return response.EncodeResponse(264);
            }

            if(request.Request_ == GetAccountInfo.Request.MEDAL_INFO) {
                MedalInfo response = new MedalInfo() {
                    SeasonWins = 0,
                    Stars = 0,
                    Streak = 0,
                    StarLevel = 1,
                    LevelStart = 1,
                    LevelEnd = 3,
                    CanLose = false
                };

                return response.EncodeResponse(232);
            }

            if(request.Request_ == GetAccountInfo.Request.NOTICES) {
                ProfileNotices response = new ProfileNotices();
                return response.EncodeResponse(212);
            }

            if(request.Request_ == GetAccountInfo.Request.DECK_LIST) {
                DeckList response = new DeckList();

                foreach(Deck deck in session.Server.Database.Table<Deck>().Where(d => d.DeckType == DeckType.PRECON_DECK)) {
                    response.Decks.Add(deck.ToDeckInfo());
                }

                foreach(Deck deck in session.Server.Database.Table<Deck>().Where(d => d.DeckType == DeckType.NORMAL_DECK && d.AccountID == session.Account.ID)) {
                    response.Decks.Add(deck.ToDeckInfo());
                }

                return response.EncodeResponse(202);
            }

            if(request.Request_ == GetAccountInfo.Request.COLLECTION) {
                Collection response = new Collection();

                foreach(DbfCard card in session.Server.Database.Table<DbfCard>().Where(c => c.Collectible)) {
                    response.Stacks.Add(new CardStack() {
                        LatestInsertDate = DateTime.Now.ToPegasusDate(),
                        NumSeen = 2,
                        Count = 2,
                        CardDef = new PegasusShared.CardDef() {
                            Asset = card.ID,
                            Premium = 0
                        }
                    });
                }

                return response.EncodeResponse(207);
            }

            if(request.Request_ == GetAccountInfo.Request.DECK_LIMIT) {
                ProfileDeckLimit response = new ProfileDeckLimit() {
                    DeckLimit = 9
                };

                return response.EncodeResponse(231);
            }

            if(request.Request_ == GetAccountInfo.Request.CARD_VALUES) {
                CardValues response = new CardValues() {
                    CardNerfIndex = 0
                };

                return response.EncodeResponse(260);
            }

            if(request.Request_ == GetAccountInfo.Request.ARCANE_DUST_BALANCE) {
                ArcaneDustBalance response = new ArcaneDustBalance() {
                    Balance = 10000
                };

                return response.EncodeResponse(262);
            }

            if(request.Request_ == GetAccountInfo.Request.NOT_SO_MASSIVE_LOGIN) {
                NotSoMassiveLoginReply response = new NotSoMassiveLoginReply();
                return response.EncodeResponse(300);
            }

            if(request.Request_ == GetAccountInfo.Request.REWARD_PROGRESS) {
                RewardProgress response = new RewardProgress() {
                    SeasonEnd = new DateTime(DateTime.UtcNow.AddMonths(1).Year, DateTime.UtcNow.AddMonths(1).Month, 1, 7, 0, 0).ToPegasusDate(),
                    WinsPerGold = 3,
                    GoldPerReward = 10,
                    MaxGoldPerDay = 100,
                    SeasonNumber = 1,
                    XpSoloLimit = 60,
                    MaxHeroLevel = 60,
                    NextQuestCancel = DateTime.UtcNow.ToPegasusDate(),
                    EventTimingMod = 0.291667f
                };

                return response.EncodeResponse(271);
            }

            if(request.Request_ == GetAccountInfo.Request.GOLD_BALANCE) {
                GoldBalance response = new GoldBalance() {
                    Cap = 999999,
                    CapWarning = 2000,
                    CappedBalance = 9999,
                    BonusBalance = 0
                };

                return response.EncodeResponse(278);
            }

            if(request.Request_ == GetAccountInfo.Request.HERO_XP) {
                HeroXP response = new HeroXP();

                for(int i = 2; i < 11; i++) {
                    response.XpInfos.Add(new HeroXPInfo() {
                        ClassId = i,
                        Level = 30,
                        CurrXp = 420,
                        MaxXp = 840
                    });
                }

                return response.EncodeResponse(283);
            }

            if(request.Request_ == GetAccountInfo.Request.PLAYER_RECORD) {
                PlayerRecords response = new PlayerRecords();
                return response.EncodeResponse(270);
            }

            if(request.Request_ == GetAccountInfo.Request.CARD_BACKS) {
                CardBacks response = new CardBacks() {
                    DefaultCardBack = 0
                };

                foreach(DbfCardBack cardBack in session.Server.Database.Table<DbfCardBack>()) {
                    response.CardBacks_.Add(cardBack.ID);
                }

                return response.EncodeResponse(236);
            }

            if(request.Request_ == GetAccountInfo.Request.FAVORITE_HEROES) {
                FavoriteHeroesResponse response = new FavoriteHeroesResponse();

                foreach(FavoriteHero hero in session.Server.Database.Table<FavoriteHero>().Where(h => h.AccountID == session.Account.ID)) {
                    response.FavoriteHeroes.Add(new PegasusShared.FavoriteHero() {
                        ClassId = hero.ClassID,
                        Hero = new PegasusShared.CardDef() {
                            Asset = hero.CardID,
                            Premium = hero.Premium,
                        }
                    });
                }

                return response.EncodeResponse(318);
            }

            if(request.Request_ == GetAccountInfo.Request.ACCOUNT_LICENSES) {
                AccountLicensesInfoResponse response = new AccountLicensesInfoResponse();
                return response.EncodeResponse(325);
            }

            if(request.Request_ == GetAccountInfo.Request.BOOSTER_TALLY) {
                BoosterTallyList response = new BoosterTallyList();
                return response.EncodeResponse(313);
            }

            if(request.Request_ == GetAccountInfo.Request.MEDAL_HISTORY) {
                MedalHistory response = new MedalHistory();

                response.Medals.Add(new MedalHistoryInfo() {
                    LegendRank = 1,
                    LevelEnd = 0,
                    LevelStart = 0,
                    Season = 1,
                    StarLevel = 0,
                    Stars = 0,
                    When = new DateTime(DateTime.UtcNow.AddMonths(-1).Year, DateTime.UtcNow.AddMonths(-1).Month, 1, 7, 0, 0).ToPegasusDate()
                });

                return response.EncodeResponse(234);
            }

            if(request.Request_ == GetAccountInfo.Request.PVP_QUEUE) {
                PlayQueue response = new PlayQueue() {
                    Queue = new PlayQueueInfo() {
                        GameType = BnetGameType.BGT_NORMAL
                    }
                };

                return response.EncodeResponse(286);
            }

            Debug.WriteLine("ERR AccountHandler.OnGetAccountInfo missing " + request.Request_);
            return null;
        }