Ejemplo n.º 1
0
        private void ISetPlayer()
        {
            pnCli2Vault_PlayerSetRequest req = new pnCli2Vault_PlayerSetRequest();
            req.Read(fStream);

            pnVault2Cli_PlayerSetReply reply = new pnVault2Cli_PlayerSetReply();
            reply.fTransID = req.fTransID;

            // Make sure that player is on this account
            try {
                pnSqlSelectStatement selAcctIdx = new pnSqlSelectStatement();
                selAcctIdx.AddColumn("Idx");
                selAcctIdx.AddColumn("Permissions");
                selAcctIdx.AddWhere("Guid", req.fAcctGuid);
                selAcctIdx.Table = "Accounts";

                IDataReader rAcctIdx = selAcctIdx.Execute(fDb);
                if (rAcctIdx.Read()) {
                    uint acctIdx = Convert.ToUInt32(rAcctIdx["Idx"]);
                    int perms = Convert.ToInt32(rAcctIdx["Permissions"]);
                    rAcctIdx.Close();

                    pnSqlSelectStatement selPlayer = new pnSqlSelectStatement();
                    selPlayer.AddColumn("COUNT(*)");
                    selPlayer.AddWhere("AcctIdx", acctIdx);
                    selPlayer.Table = "Players"; ;

                    IDataReader rPlayer = selPlayer.Execute(fDb);
                    if (rPlayer.Read())
                        reply.fResult = ENetError.kNetSuccess;
                    else
                        reply.fResult = ENetError.kNetErrPlayerNotFound;
                    rPlayer.Close();
                } else {
                    reply.fResult = ENetError.kNetErrPlayerNotFound;
                    rAcctIdx.Close();
                }
            } catch (pnDbException e) {
                reply.fResult = ENetError.kNetErrInternalError;
                Error(e, "SetActivePlayer Failed");
            }

            reply.Send(fStream);
        }
Ejemplo n.º 2
0
        public void SetPlayer(uint playerID, Guid acct, pnCallback cb = null)
        {
            pnCli2Vault_PlayerSetRequest req = new pnCli2Vault_PlayerSetRequest();
            req.fAcctGuid = acct;
            req.fPlayerID = playerID;
            req.fTransID = GetTransID();

            lock (fStream) {
                if (cb != null)
                    fCallbacks.Add(req.fTransID, cb);
                req.Send(fStream);
            }
        }