Skip to main content

Client package for the download of Legion TD 2 game data.

Project description

pyltd2

Client package for the download of Legion TD 2 game data.

Data structure

The object stores the data into five separate objects, regarding separate information about each match:

  1. The fighters the player built during each wave and their position(_id, playerId, wave, fighter, x, y, seq_num)
  2. The actions (Placed/Sold/Upgraded) the player made during each wave (alternative to the previous one, makes the file smaller but requires re-building the data)(_id, playerId, wave, fighter, x, y, action, seq_num)
  3. The fighters the player had(_id, playerId, fighter_1, fighter_2, ..., fighter_30)
  4. The king's hp at the end of the wave(_id, wave, left_hp, right_hp)
  5. The king's upgrades bought by each player during each wave(_id, playerId, wave, upgrade, seq_num)
  6. The leaks a player had during each wave(_id, playerId, wave, unit, seq_num)
  7. The match itself(_id, version, date, queueType, endingWave, gameLength, gameElo, playerCount, humanCount, kingSpell, side_won)
  8. The mercenaries the player received or sent during a wave(_id, playerId, received, wave, mercenary, seq_num)
  9. The party members of each match(_id, member_1, member_2, member_3, member_4, member_5, member_6, member_7, member_8)
  10. The players of the match(_id, playerId, playerName, playerSlot, legion, workers, value, cross, overallElo, stayedUntilEnd, chosenSpell, partySize, legionSpecificElo, mvpScore, leekValue, leaksCaughtValue, leftAtSeconds)
  11. The player's economy during each wave(_id, playerId, wave, workers, income, networth)
  12. The spell upgrades available in the match(_id, choice_1, choice_2, choice_3)

Dependencies

pyltd2 requires:

  • numpy ()>= 1.14.6)
  • pandas (>= 1.4.3)
  • tqdm (>= 4.64.0)

Examples

The following example shows how to get the details of the next 50 matches, starting from the first match played (2018-08-03T15:39:00Z) and returning the data as a DataFrame object.

fetcher = LTD2ApiFetcher("your_api_token")
fetcher.get(return_as_df=True)

The object uses the getMatchesByFilter API command to fetch a maximum of 50 matches, starting from the date_after datetime provided.

To download data for the period of time between date_after-date_before and save them to a csv file, you can use the ExhaustiveFetcher object. The following example downloads matches from 2018-08-03T15:39:00Z until 2019-12-25T22:03:40Z and saves the data to csv files inside the data folder.

from datetime import datetime
from data_acquisition import LTD2Fetcher, ExhaustiveFetcher

fetcher = LTD2Fetcher(
    "your_api_token", 
    date_after=datetime(2018, 8, 3, 15, 39, 00), 
    date_before=datetime(2019, 12, 25, 22, 3, 40)
)
api2csv = ExhaustiveFetcher("./data", fetcher=fetcher)
api2csv.start_fetching()

You can get your own api token by registering here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyltd2-1.0.0rc0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyltd2-1.0.0rc0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file pyltd2-1.0.0rc0.tar.gz.

File metadata

  • Download URL: pyltd2-1.0.0rc0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.8.6 Windows/10

File hashes

Hashes for pyltd2-1.0.0rc0.tar.gz
Algorithm Hash digest
SHA256 cfbc86811d67620ea4c0b6dec0992c081c0441b7cd2fe27a96c7bd76a22c197b
MD5 41c08dd49770bab57a25979fa719d213
BLAKE2b-256 779cc5c8814a1e7b24a2c03cc639b64d59e723aefdccb9c1f867672f42c33047

See more details on using hashes here.

File details

Details for the file pyltd2-1.0.0rc0-py3-none-any.whl.

File metadata

  • Download URL: pyltd2-1.0.0rc0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.8.6 Windows/10

File hashes

Hashes for pyltd2-1.0.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 92e566f4043595fad15a004542c265b60f0db86b1a0251454b93cbad42a308a8
MD5 f564244771aa95439b3e8289d377055a
BLAKE2b-256 318b4c2703f629fea67b8877a02ca4fa85c88793eab025d4febfbd1445d95e37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page