Jump to content

War API


Dr Rush
 Share

Recommended Posts

  • Wiki Mod

Yes please. Although if this format is used, control could just be one of the participant's name/id, instead of unnecessarily listing it twice.

Can you clarify what you mean here please?

 

 

23:38 Skable that's why we don't want Rose involved, so we can take the m all for ourselves

23:39 [] but Mensa is the cute girl at the school dance and she's only dancing with us right now to get our friend jealous

23:39 [] If Rose comes in and gives Mensa what she wants, she'll just toss us aside and forget we ever existed

23:39 zombie_lanae yeah I do hope we can keep having them all to ourselves

23:40 zombie_lanae I know it's selfish but I want all their love

 

 

6:55 PM <+Isolatar> Praise Dio

Pubstomper|BNC [20:01:55] Rose wouldn't plan a hit on Mensa because it would be &#33;@#&#036;ing stupid

Link to comment
Share on other sites

Can you clarify what you mean here please?

Instead of

{
  attacker: {
    control: {
      <type>: <boolean>
    }
    ...
  }
  defender: {
    control: {
      <type>: <boolean>
    }
    ...
  }
  ...
}

just do

{
  attacker {...}
  defender {...}
  control: {
    <type>: <attacker|defender|none> //The actual value could be their name or id or even just "attacker" or "defender"
  }
  ...
}

because only one nation can have control at a time, so listing a set of booleans twice is redundant (if one is true, the other is guaranteed to be false, and therefore doesn't need to be listed). And the case where neither has control can be easily dealt with using a null value, which is also shorter than two sets that both say false.

RollSheepy.png

Link to comment
Share on other sites

Instead of

{
  attacker: {
    control: {
      <type>: <boolean>
    }
    ...
  }
  defender: {
    control: {
      <type>: <boolean>
    }
    ...
  }
  ...
}

just do

{
  attacker {...}
  defender {...}
  control: {
    <type>: <attacker|defender|none> //The actual value could be their name or id or even just "attacker" or "defender"
  }
  ...
}

because only one nation can have control at a time, so listing a set of booleans twice is redundant (if one is true, the other is guaranteed to be false, and therefore doesn't need to be listed). And the case where neither has control can be easily dealt with using a null value, which is also shorter than two sets that both say false.

 

Yeah, agreed. That would be a better way to do it.

[22:37:51] <&Yosodog> Problem is, everyone is too busy deciding which top gun character they are that no decision has been made

 

BK in a nutshell

Link to comment
Share on other sites

  • Wiki Mod

Yeah, agreed. That would be a better way to do it.

Agreed, my personal preference for values is attacker/defender/null.

 

As thats always consistent & thus easier to program using. 

 

Another question would be whether these should be top level properties or part of a 'controls' object.

Edited by Dr Rush

 

 

23:38 Skable that's why we don't want Rose involved, so we can take the m all for ourselves

23:39 [] but Mensa is the cute girl at the school dance and she's only dancing with us right now to get our friend jealous

23:39 [] If Rose comes in and gives Mensa what she wants, she'll just toss us aside and forget we ever existed

23:39 zombie_lanae yeah I do hope we can keep having them all to ourselves

23:40 zombie_lanae I know it's selfish but I want all their love

 

 

6:55 PM <+Isolatar> Praise Dio

Pubstomper|BNC [20:01:55] Rose wouldn't plan a hit on Mensa because it would be &#33;@#&#036;ing stupid

Link to comment
Share on other sites

  • Wiki Mod

Updated to a single independent control object. Ground ITs are listed separately as two pieces of info were needed & thus an object & I don't want to tree those to deeply.

 

 

23:38 Skable that's why we don't want Rose involved, so we can take the m all for ourselves

23:39 [] but Mensa is the cute girl at the school dance and she's only dancing with us right now to get our friend jealous

23:39 [] If Rose comes in and gives Mensa what she wants, she'll just toss us aside and forget we ever existed

23:39 zombie_lanae yeah I do hope we can keep having them all to ourselves

23:40 zombie_lanae I know it's selfish but I want all their love

 

 

6:55 PM <+Isolatar> Praise Dio

Pubstomper|BNC [20:01:55] Rose wouldn't plan a hit on Mensa because it would be &#33;@#&#036;ing stupid

Link to comment
Share on other sites

  • 2 weeks later...
  • Wiki Mod

Also have a listing of wars for a particular nation available, as I've defined in my previous suggestion.

 

https://politicsandwar.com/forums/index.php?/topic/11365-nation-api-layout-suggestion/

Would be simpler to just add an array to the nation api.

 

 

23:38 Skable that's why we don't want Rose involved, so we can take the m all for ourselves

23:39 [] but Mensa is the cute girl at the school dance and she's only dancing with us right now to get our friend jealous

23:39 [] If Rose comes in and gives Mensa what she wants, she'll just toss us aside and forget we ever existed

23:39 zombie_lanae yeah I do hope we can keep having them all to ourselves

23:40 zombie_lanae I know it's selfish but I want all their love

 

 

6:55 PM <+Isolatar> Praise Dio

Pubstomper|BNC [20:01:55] Rose wouldn't plan a hit on Mensa because it would be &#33;@#&#036;ing stupid

Link to comment
Share on other sites

  • Administrators

You can check out http://alex.politicsandwar.com/api/wars.php

 

Will be up on the live server under the same directory after the next patch. Shows the latest 1,500 wars.

Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest It

Forums Rules | Game Link

Link to comment
Share on other sites

  • Administrators

It should be up on the live server now, https://politicsandwar.com/api/wars.php

 

Do you need last 1,500 records? Kind of an arbitrary limit, but we keep war data in the DB for the last month, but that's a lot of records on the live server. I wouldn't mind shrinking that amount to lighten server load, but if you'd need to look at potentially that many records, I can leave it as-is.

Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest It

Forums Rules | Game Link

Link to comment
Share on other sites

The date string should be changed to something that is standards-compliant. Not all programming languages support parsing dates in the format they are currently given, but pretty much every language (that has date parsing capabilities) should support the standard.

 

Also, the link should be /wars/ instead of /wars.php because consistency.

Edited by Roll Sheepy
RollSheepy.png

Link to comment
Share on other sites

The date string should be changed to something that is standards-compliant. Not all programming languages support parsing dates in the format they are currently given, but pretty much every language (that has date parsing capabilities) should support the standard.

 

Also, the link should be /wars/ instead of /wars.php because consistency.

 

The date string is probably how it's stored in the database. It's in the typical SQL datetime format.

 

I know a thing we can &#33;@#&#036; about now, and individual war API :P

 

It should be up on the live server now, https://politicsandwar.com/api/wars.php

 

Do you need last 1,500 records? Kind of an arbitrary limit, but we keep war data in the DB for the last month, but that's a lot of records on the live server. I wouldn't mind shrinking that amount to lighten server load, but if you'd need to look at potentially that many records, I can leave it as-is.

 

1500 might not be enough depending on how big a war is. iirc, last war BK alone had 500+ wars alongside tS and Mensa wasn't far behind. I guess I'll bug you next war if we start getting close to 1500.

[22:37:51] <&Yosodog> Problem is, everyone is too busy deciding which top gun character they are that no decision has been made

 

BK in a nutshell

Link to comment
Share on other sites

  • Administrators

You can now use https://politicsandwar.com/api/war/

It now defaults to show only the last 100 rows. If you want to see more, you can enter in the number of wars you want to see, up to 2,000 like so:

 

https://politicsandwar.com/api/war/2000

 

Also updated the date format to be how you want it :P


 

I know a thing we can &#33;@#&#036; about now, and individual war API :P

 

Haven't gotten to this yet. The wars API was easier and I was bored in class the other day so I threw it together quick.

Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest It

Forums Rules | Game Link

Link to comment
Share on other sites

You can now use https://politicsandwar.com/api/war/

It now defaults to show only the last 100 rows. If you want to see more, you can enter in the number of wars you want to see, up to 2,000 like so:

 

https://politicsandwar.com/api/war/2000

 

Also updated the date format to be how you want it :P

 

Haven't gotten to this yet. The wars API was easier and I was bored in class the other day so I threw it together quick.

 

All good, I'm happy with any kind of attention the API gets. The link appears to be broken though.

[22:37:51] <&Yosodog> Problem is, everyone is too busy deciding which top gun character they are that no decision has been made

 

BK in a nutshell

Link to comment
Share on other sites

  • Administrators

All good, I'm happy with any kind of attention the API gets. The link appears to be broken though.

 

Ah, I meant /wars/ not /war/

 

https://politicsandwar.com/api/wars/

https://politicsandwar.com/api/wars/2000

Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest It

Forums Rules | Game Link

Link to comment
Share on other sites

 

Is there some kind of limit on this? 1,999 looks like it shows 1,999 but when I put 2,000+ it seems the default 100.

[22:37:51] <&Yosodog> Problem is, everyone is too busy deciding which top gun character they are that no decision has been made

 

BK in a nutshell

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and the Guidelines of the game and community.