Skip to content
TORNLIFE More

War Base details from API

Started by AllMight [1878147] on in API Development.

19 replies · 506 views · thread synced · 5 days ago · View on torn.com
About this thread

Posts archived: 20 / 20 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
20
Discussion span
→
People posting
9
Likes on archived posts
20
Posts by staff, officers and moderators
2
Authority score
74 / 100
Historical score
29 / 100
Story score
41 / 100
Engagement score
66 / 100

Most-liked replies

AllMight [1878147]

I would like to get war base details - like list of all members in a faction we are in a war with and their status.

As of now, I need to call for each member to check his status - which means i cant get all the members of a single faction in one call.

Is there a way to get the status of the members with the faction details?
Wolverine [1971836]

to get the status of 100 players in faction you would need 101 API calls, but that would lock your api key because you would exceed its usage within 1 minute.

sorry, it can't be done for large factions without locking your api key.
AAW [1525734]

its not really 101 calls a minute, because you could make it timed so every 5 attacks it grabs a new user so not really
saeed [1826888]

Every 5 attacks? Do you mean every 5 seconds? I'm on my phone so I could be missing something but I don't see anything about attacks. All though now I think of it a method of getting war base factions + members would be checking any incoming hits that have a respect value and then get that users faction and blah from there.
Winged_Cougar [1993598]

Wrong. The rules state the type of scraping which is prohibited is to scrape a page *that you're not currently viewing*. If you're looking at the warbase, and you're scraping it, you're totally within the rules.
saeed [1826888]

Theoretically, yes. That is true.



However, the post states nothing about being on the page. It's unlikely that you want to refresh the faction page every few seconds to collect data.



I took it out of context and likelihood of scenario.
Winged_Cougar [1993598]

While I don't refresh the faction page every few seconds, I do refresh it probably every 3 or 4 minutes. We burn through filler too quickly, and so it gets to the point that I'm looking at burnt targets that are still displaying "Okay".

The only reason this doesn't help solve OP's problem is because it seems as though he's talking about tracking target status in real time, which is kind of silly. I'd be much more interested in sorting the warbase by scraping the page, but Warbase Extended 2 already does that. I do hope someone comes out with a replacement for WarBase Extended 2 though, one which allows local use of the player's own API key to pull personal stats to fill in the Xanax, Refills, and SEs used, since those are all available via the API. As it stands, the part of it that checks player's personal stats by going to the pages and scraping them without loading them into a browser is a dangerous thing to have loaded, even if you're not using it at all.

In any case, refreshing the warbase every few minutes works fine, you just have to adapt as you find targets already hospitalized. Not sure why the real time tracking would be desired, or useful.
GamingAnonymous [1761543]

Hey, currently I am running a personally modified version of war base and I think the idea to show drugs is a good one.

EDITED:

Misread something!

EDIT #2:

Can you tell me what field the drugs stats are under in the API?

EDIT #3:

So to make sure its clear, you want a modified War Base (or similar) to be able to retrieve the number of specific drugs that faction enemies have used and perhaps display it in their section?



For future reference, my version currently has a filter by level, an option to hide the faction headers where all of its members are hidden as well as making the difficulty tag colours adjustable with colour pickers.

All help is appreciated,

Thanks.
IceBlueFire [776] Officer Officer

You're probably looking for things like "xanused" or "vicused", etc...To get a total drugs used, you gotta do a little math. It's all under personal stats.

That said, how many calls is this burning up? I can't imagine how to do this efficiently with 500 people in your warbase...
GamingAnonymous [1761543]

Its a good question. It would indeed burn enough requests to immediately lock an API key.

The approach I was thinking is to only get these stats for players that are not hidden by the filter and only for a specific faction.

e.g. Lets say that due to the filter there are 20 players visible in one faction and 15 in another. I could put a button just above the faction which says "Retrieve Drug Stats". It would then get those for all visible players of that faction and cache them.

You can clear the cache at any point and update those stats.

I dont know if this would be the "correct" approach but IMO I think it seems the most viable.



Any suggestions are appreciated.



EDIT:

A warning box could definitely be created btw so that people know the risk of that many API calls.

EDIT #2:

Or perhaps get the stats of an individual player. This way it only consumes 1 api call and can be cached for as long as you need.

EDIT #3:

It would be useful to know how many people are till view-able when using your preferred filter with War Base
AllMight [1878147]

Well i thought of doing it on demand... like i am interested in this enemy - tell me more data about him and decide if to attack or not.
IceBlueFire [776] Officer Officer

But you're also going to be wanting to know the status of the player, right? Whether they're attackable or not? Which means you need a way to retrieve/know that information as well...(Which can be grouped with the personal stats selection, but still). The limit seems to be the biggest enemy in this idea...
Winged_Cougar [1993598]

So, the previous "best case" for what you're trying to do was WarBase Extended 2 by Vinkuun. Now, he has a different script out which works with/by Torn Stats to get the pertinent information displayed via API from the personalstats of the target, but that script does so on each profile page(saves you having to also open the personal stats page). I've written a few guides on what to retrieve for this and why it's pertinent, but I'm not going to reiterate all that here. In answer to a few questions since I last posted here:

You wouldn't really want to retrieve all drugs. The three you really care about are Xanax, LSD, and Ecstasy. Xanax because it's 250 E potentially trained in the gym for each. LSD similarly, but only 50 E. Ecstasy because if you have a target who has taken less than 100 total(50 each) Xanax/Ecstasy, they probably have the SSL open, and if they're also fairly old with a relatively high activity/logins, then they're probably beast. None of the other drugs really have any bearing on combat.

As far as the actual data retrieval goes, WBE2 was scraping the actual personal stats pages of each potential target. When the warbase was full up with 500+ targets this could take almost half an hour to complete. Now, you have up to 100 API calls per minute, with each call returning almost everything you care to know about each target. So, optimally, if you're not using your API key for anything else, you've got ~6 minutes to retrieve all the data you want on all those targets, so with API it's not only presumably a lot less load on the server, but also gets you done in a fraction of the time.

Now we see why scraping pages in this fashion was made illegal. That said, you can still scrape the war base itself for things like job, hospital time, travelling, fed, etc.

Good luck on your version!

Right now I'm just using the original Warbase Extended from pastebin.