Ejemplo n.º 1
0
        public static TLPlayerStats GetPlayerStats(Client client)
        {
            TLMongoDatabase db = new TLMongoDatabase();

            if (!client.HasData("ID"))
            {
                return(null);
            }

            TLPlayerStats playerStats;
            ObjectId      client_id = client.GetData("ID");

            var query = db.GetListById <TLPlayerStats>(client_id).Result;

            if (query.Count == 0)
            {
                playerStats    = new TLPlayerStats();
                playerStats.Id = client_id;
                db.Insert <TLPlayerStats>(playerStats);
            }
            else
            {
                playerStats = query[0];
            }

            return(playerStats);
        }
Ejemplo n.º 2
0
        public static void FinishLogin(Client client)
        {
            TLMongoDatabase db        = new TLMongoDatabase();
            ObjectId        client_id = client.GetData("ID");
            TLPlayerStats   playerStats;

            var query = db.GetListById <TLPlayerStats>(client_id).Result;

            if (query.Count == 0)
            {
                playerStats    = new TLPlayerStats();
                playerStats.Id = client_id;
                db.Insert <TLPlayerStats>(playerStats);
            }
            else
            {
                playerStats = query[0];
            }

            client.Position = playerStats.GetLastPosition();

            NAPI.Entity.SetEntityTransparency(client, 255);
            NAPI.Entity.SetEntityInvincible(client, false);
            NAPI.ClientEvent.TriggerClientEvent(client, "playerLoggedIn");
            NAPI.ClientEvent.TriggerClientEvent(client, "LoginResult", 1);
            NAPI.ClientEvent.TriggerClientEvent(client, "moveSkyCamera", client, "down", 1, true);

            UpdateMoneyEvent.Update_Money(client);
        }