#!/bin/bash
source $HOME/.gamerc

AREA=$1

case "${AREA}" in
    ASIA|asia)
        ssh ACCOUNTDB "psql -U postgres N1Account -Atqc \"SELECT id FROM worlds WHERE maxnum_user > 0 AND id/1000 = 1 ORDER BY id;\""
        ;;
    US|us)
        ssh ACCOUNTDB "psql -U postgres N1Account -Atqc \"SELECT id FROM worlds WHERE maxnum_user > 0 AND id/1000 = 2 ORDER BY id;\""
        ;;
    EU|eu)
        ssh ACCOUNTDB "psql -U postgres N1Account -Atqc \"SELECT id FROM worlds WHERE maxnum_user > 0 AND id/1000 = 3 ORDER BY id;\""
        ;;
    *)
        ssh ACCOUNTDB "psql -U postgres N1Account -Atqc \"SELECT id FROM worlds WHERE maxnum_user > 0 ORDER BY id;\""
        ;;
esac
