1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

API "Gold": 0, automatically to 1 [Request]

Discussion in 'Community Dev Corner' started by Mazey, Oct 4, 2013.

Mods: Downburst, Mazey
  1. Mazey

    Mazey Haxor Global Moderator Forum Moderator Staff Alumni Donator Official Server Admin

    Messages:
    1,914
    In beta, all servers are gold.
    It'd make it a lot more easier to automatically change it, because it'd give problems when filtering the api.
    For instance, loading https://api.kag2d.com/servers/current/1/gold/0 will show all the non-gold servers from classic and all the servers which put sv_gold = 0; in their server config, it would show there too although it eventually is gold (as it is in KAG Beta).
    For instance, I'd need to do this is Javascript:
    PHP:
    // aServer is a server (json decoded) by jquery earlier in the script
    if( ( aServer.gold -- && aServer.build <= 590 /* Check if build is from classic server and if gold */) || (aServer.build 590 /* check if build is from beta server */ ) ) {
    alert('server is gold!');
    else {
    alert('non-gold server!');
    }
    Instead of:
    PHP:
    // aServer is a server (json decoded) by jquery earlier in the script
    if( aServer.gold == ) {
    alert('server is gold!');
    else {
    alert('non-gold server!');
    }
    If there is any other solution or I looked over something, please tell me.

    Please change this FLAB or any other dev, I would appreciate it!
     
  2. Shadlington

    Shadlington THD Team THD Team Administrator Global Moderator

    Messages:
    1,562
    Use gid/0 to specify classic and gid/1 to specify beta.
     
Mods: Downburst, Mazey