Esempio n. 1
0
        private void GameEnter() //TODO move this to player class
        {
            CharacterChoosePacket ccp = (CharacterChoosePacket)ReadPacket(new CharacterChoosePacket());

            _log.Info(ccp.Index.ToString(CultureInfo.InvariantCulture));

            //TODO Save characters in class
            CharacterDAO chrMgr    = new CharacterDAO(Server.ServerInstance.Database);
            AccountDAO   accMgr    = new AccountDAO(Server.ServerInstance.Database);
            int          accountID = accMgr.GetAccountID(AccountName);

            Character[]         chars = chrMgr.GetCharactersByAccount(accountID);
            CharacterListPacket clp   = new CharacterListPacket(chars,
                                                                accMgr.GetAccountEmpire(accountID));


            //TODO Everything wrong down here

            //inventario ->
            SendPacket(new InventoryItemsPacket());

            //stats
            SendPacket(new CharacterStatsPacket(chars[ccp.Index])); //TODO Check index

            //unknown 1
            ReadBuffer(8);

            //entity spawn
            SendPacket(new EntitySpawnPacket(chars[ccp.Index]));

            LauncherNamePacket lnp = new LauncherNamePacket();

            ReadPacket(lnp);
        }
Esempio n. 2
0
        private void VerifyAuth()
        {
            GameAuthorizationPacket gap = (GameAuthorizationPacket)ReadPacket(new GameAuthorizationPacket());

            _log.Info(gap.Username);
            _log.Info(gap.SessionID.ToString(CultureInfo.InvariantCulture));
            if (AuthService.CheckSession(gap.Username, gap.SessionID))
            {
                AccountName = gap.Username;
                AuthService.SendSessionAction(gap.Username, SessionAction.Login);

                //TODO Save characters in class
                CharacterDAO        chrMgr    = new CharacterDAO(Server.ServerInstance.Database);
                AccountDAO          accMgr    = new AccountDAO(Server.ServerInstance.Database);
                int                 accountID = accMgr.GetAccountID(gap.Username);
                CharacterListPacket clp       = new CharacterListPacket(chrMgr.GetCharactersByAccount(accountID),
                                                                        accMgr.GetAccountEmpire(accountID));
                SendPacket(clp);
            }
            else
            {
                Disconnect("Invalid session");
            }
        }