mc5-api-client 1.0.3__py3-none-any.whl → 1.0.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mc5_api_client/client.py CHANGED
@@ -38,6 +38,7 @@ class MC5Client:
38
38
  BASE_URLS = {
39
39
  "auth": "https://eur-janus.gameloft.com:443",
40
40
  "osiris": "https://eur-osiris.gameloft.com:443",
41
+ "janus": "https://eur-janus.gameloft.com",
41
42
  "olympus": "https://eur-olympus.gameloft.com:443",
42
43
  "iris": "https://eur-iris.gameloft.com:443",
43
44
  "hermes": "https://eur-hermes.gameloft.com",
@@ -1724,6 +1725,183 @@ class MC5Client:
1724
1725
 
1725
1726
  return config_data
1726
1727
 
1728
+ # Batch Operations
1729
+
1730
+ def get_batch_profiles(self, credentials: List[str], include_fields: List[str] = None) -> Dict[str, Any]:
1731
+ """
1732
+ Get batch player profiles with detailed statistics and game save data.
1733
+
1734
+ Args:
1735
+ credentials: List of player credentials to fetch
1736
+ include_fields: List of fields to include (default: ['_game_save', 'inventory'])
1737
+
1738
+ Returns:
1739
+ Dictionary with player profiles containing detailed statistics
1740
+ """
1741
+ if include_fields is None:
1742
+ include_fields = ['_game_save', 'inventory']
1743
+
1744
+ url = "https://app-468561b3-9ecd-4d21-8241-30ed288f4d8b.gold0009.gameloft.com/1875/windows/09/public/OfficialScripts/mc5Portal.wsgi"
1745
+
1746
+ data = {
1747
+ 'op_code': 'get_batch_profiles',
1748
+ 'client_id': self.client_id,
1749
+ 'credentials': ','.join(credentials),
1750
+ 'pandora': f"https://vgold-eur.gameloft.com/{self.client_id}",
1751
+ 'include_fields': ','.join(include_fields)
1752
+ }
1753
+
1754
+ headers = {
1755
+ 'Accept': '*/*',
1756
+ 'Content-Type': 'application/x-www-form-urlencoded',
1757
+ 'accept-encoding': 'identity'
1758
+ }
1759
+
1760
+ return self._make_request("POST", url, data=data, headers=headers)
1761
+
1762
+ def get_player_stats_by_dogtag(self, dogtag: str) -> Dict[str, Any]:
1763
+ """
1764
+ Get detailed player statistics using their dogtag (in-game ID).
1765
+
1766
+ Args:
1767
+ dogtag: Player's dogtag in XXXX format (hexadecimal)
1768
+
1769
+ Returns:
1770
+ Player statistics and profile information
1771
+ """
1772
+ # Convert dogtag to alias for API lookup
1773
+ alias = self.convert_dogtag_to_alias(dogtag)
1774
+
1775
+ # Get player info using alias
1776
+ player_info = self.get_alias_info(alias)
1777
+ if not player_info.get('credential'):
1778
+ return {'error': f'Player not found for dogtag: {dogtag}', 'alias': alias}
1779
+
1780
+ # Get detailed stats using the credential
1781
+ try:
1782
+ stats = self.get_batch_profiles([player_info['credential']])
1783
+
1784
+ # Add dogtag and alias info to the response
1785
+ if player_info['credential'] in stats:
1786
+ stats[player_info['credential']]['dogtag'] = dogtag
1787
+ stats[player_info['credential']]['alias'] = alias
1788
+ stats[player_info['credential']]['player_info'] = player_info
1789
+
1790
+ return stats
1791
+
1792
+ except Exception as e:
1793
+ return {
1794
+ 'error': f'Failed to get stats for dogtag {dogtag}: {e}',
1795
+ 'dogtag': dogtag,
1796
+ 'alias': alias,
1797
+ 'player_info': player_info
1798
+ }
1799
+
1800
+ def search_player_by_dogtag(self, dogtag: str) -> Dict[str, Any]:
1801
+ """
1802
+ Search for a player using their dogtag and return their profile information.
1803
+
1804
+ Args:
1805
+ dogtag: Player's dogtag in XXXX format (hexadecimal)
1806
+
1807
+ Returns:
1808
+ Complete player information including stats if found
1809
+ """
1810
+ return self.get_player_stats_by_dogtag(dogtag)
1811
+
1812
+ def get_player_detailed_stats(self, credential: str) -> Dict[str, Any]:
1813
+ """
1814
+ Get detailed player statistics including game save and inventory.
1815
+
1816
+ Args:
1817
+ credential: Player's credential
1818
+
1819
+ Returns:
1820
+ Detailed player statistics and game data
1821
+ """
1822
+ return self.get_batch_profiles([credential])
1823
+
1824
+ def parse_player_stats(self, stats_data: Dict[str, Any]) -> Dict[str, Any]:
1825
+ """
1826
+ Parse and structure player statistics for easier consumption.
1827
+
1828
+ Args:
1829
+ stats_data: Raw stats data from get_batch_profiles
1830
+
1831
+ Returns:
1832
+ Structured player statistics
1833
+ """
1834
+ if not stats_data or not isinstance(stats_data, dict):
1835
+ return {'error': 'Invalid stats data'}
1836
+
1837
+ # Get the first (and likely only) player's data
1838
+ player_credential = list(stats_data.keys())[0] if stats_data else None
1839
+ if not player_credential or player_credential not in stats_data:
1840
+ return {'error': 'No player data found'}
1841
+
1842
+ player_data = stats_data[player_credential]
1843
+
1844
+ # Extract game save data
1845
+ game_save = player_data.get('_game_save', {})
1846
+ inventory = player_data.get('inventory', {})
1847
+
1848
+ # Parse statistics
1849
+ parsed_stats = {
1850
+ 'credential': player_credential,
1851
+ 'rating': game_save.get('rating', 0),
1852
+ 'rating_duel': game_save.get('rating_duel', 0),
1853
+ 'rating_last': game_save.get('rating_last', 0),
1854
+ 'current_skill': game_save.get('current_skill', 'unknown'),
1855
+ 'current_weapon': game_save.get('current_weapon', 'unknown'),
1856
+ 'current_loadout': game_save.get('current_loadout', 0),
1857
+ 'kill_signature': game_save.get('killsig', {}),
1858
+ 'progress': game_save.get('progress', []),
1859
+ 'loadouts': game_save.get('loadouts', []),
1860
+ 'statistics': game_save.get('statistics', {}),
1861
+ 'inventory': inventory,
1862
+ 'xp': inventory.get('xp', 0),
1863
+ 'vip_points': inventory.get('vip_points', 0)
1864
+ }
1865
+
1866
+ # Parse weapon statistics
1867
+ weapons = inventory.get('weapons', {})
1868
+ weapon_stats = []
1869
+
1870
+ for weapon_id, weapon_data in weapons.items():
1871
+ if isinstance(weapon_data, dict):
1872
+ weapon_stats.append({
1873
+ 'id': weapon_id,
1874
+ 'kills': weapon_data.get('kills', 0),
1875
+ 'shots': weapon_data.get('shots', 0),
1876
+ 'hits': weapon_data.get('hits', 0),
1877
+ 'score': weapon_data.get('score', 0),
1878
+ 'time_used': weapon_data.get('time_used', 0)
1879
+ })
1880
+
1881
+ # Sort by kills
1882
+ weapon_stats.sort(key=lambda x: x['kills'], reverse=True)
1883
+ parsed_stats['weapon_stats'] = weapon_stats
1884
+
1885
+ # Parse overall statistics
1886
+ stats = game_save.get('statistics', {})
1887
+ if stats:
1888
+ sp_stats = stats.get('sp', {})
1889
+ mp_stats = stats.get('mp', {})
1890
+
1891
+ parsed_stats['overall_stats'] = {
1892
+ 'total_kills': sp_stats.get('kill.total', 0) + mp_stats.get('kill.total', 0),
1893
+ 'total_deaths': sp_stats.get('death.total', 0) + mp_stats.get('death.total', 0),
1894
+ 'total_headshots': sp_stats.get('kill.headshots', 0) + mp_stats.get('kill.headshots', 0),
1895
+ 'total_assists': sp_stats.get('kill.assists', 0) + mp_stats.get('kill.assists', 0),
1896
+ 'total_time_played': sp_stats.get('time.played', 0) + mp_stats.get('time.played', 0),
1897
+ 'sp_kills': sp_stats.get('kill.total', 0),
1898
+ 'mp_kills': mp_stats.get('kill.total', 0),
1899
+ 'sp_headshots': sp_stats.get('kill.headshots', 0),
1900
+ 'mp_headshots': mp_stats.get('kill.headshots', 0)
1901
+ }
1902
+
1903
+ return parsed_stats
1904
+
1727
1905
  def __enter__(self):
1728
1906
  """Context manager entry."""
1729
1907
  return self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mc5-api-client
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: A comprehensive Python library for interacting with the Modern Combat 5 API
5
5
  Home-page: https://pypi.org/project/mc5-api-client/
6
6
  Author: Chizoba
@@ -132,68 +132,6 @@ pip install .
132
132
  ✅ **PyPI URL**: https://pypi.org/project/mc5_api_client/
133
133
  ✅ **Installation**: `pip install mc5_api_client`
134
134
  ✅ **CLI Command**: `mc5 --help`
135
-
136
- ### 📦 Package Files
137
-
138
- ✅ **Source Distribution**: `dist/mc5_api_client-1.0.1.tar.gz`
139
- ✅ **Wheel Distribution**: `dist/mc5_api_client-1.0.1-py3-none-any.whl`
140
-
141
- ### 🔧 Build Status
142
-
143
-
144
- ### Step 1: Install the Library
145
-
146
- Just run this in your terminal (Command Prompt/PowerShell):
147
-
148
- ```bash
149
- pip install mc5_api_client
150
- ```
151
-
152
- ### Step 2: Verify Installation
153
-
154
- ```bash
155
- # Check the CLI
156
- mc5 --help
157
- mc5 version
158
-
159
- # Test in Python
160
- python -c "import mc5_api_client; print('✅ MC5 API Client ready!')"
161
- ```
162
-
163
- ### Step 3: Your First Program
164
-
165
- Copy and paste this simple example to get started:
166
-
167
- ```python
168
- # Save this as my_mc5_script.py
169
- from mc5_api_client import MC5Client
170
-
171
- # Replace with your actual credentials
172
- username = "YOUR_USERNAME_HERE"
173
- password = "YOUR_PASSWORD_HERE"
174
-
175
- # Create client and login
176
- client = MC5Client(username=username, password=password)
177
-
178
- # See what's happening in the game
179
- events = client.get_events()
180
- print(f"There are {len(events)} active events right now!")
181
-
182
- # Don't forget to close the connection
183
- client.close()
184
- ```
185
-
186
- **What just happened?**
187
- - We imported the MC5 client
188
- - We logged in with your credentials (replace with yours!)
189
- - We got your profile info
190
- - We checked what events are active
191
- - We cleaned up properly
192
-
193
- ### Step 3: Try the Cool CLI Tool
194
-
195
- The library comes with an awesome command-line tool! Check this out:
196
-
197
135
  ```bash
198
136
  # Generate a token (your login key)
199
137
  mc5 generate-token --username "anonymous:your_credential" --password "your_password" --save
@@ -960,6 +898,7 @@ The library comes with comprehensive examples to get you started:
960
898
  - `examples/private_messaging.py` - Private messaging and inbox management
961
899
  - `examples/message_management.py` - Advanced message management and bulk deletion
962
900
  - `examples/advanced_features.py` - Events, account management, alias system, game config
901
+ - `examples/player_stats.py` - Player statistics, batch profiles, dogtag search
963
902
 
964
903
  ### 🚀 Advanced Examples
965
904
  - Squad management bot with automated updates
@@ -1028,14 +967,44 @@ The library comes with comprehensive examples to get you started:
1028
967
  - ✅ Support for cross-platform data transfer
1029
968
  - ✅ Account verification and validation
1030
969
 
1031
- ### 🏷️ Alias/Dogtags System (4+ Methods)
1032
- - ✅ Convert dogtags to alias format
1033
- - Convert aliases back to dogtags
1034
- - ✅ Get player information using alias/dogtag
1035
- - ✅ Search for players by alias
1036
- - Support for hexadecimal player IDs
1037
- - Automatic format detection
1038
- - Mathematical conversion algorithms
970
+ ### 📊 Player Statistics & Batch Profiles
971
+
972
+ Get detailed player statistics using dogtags (in-game IDs) or credentials:
973
+
974
+ ```python
975
+ # Search player by their in-game dogtag
976
+ player_stats = client.get_player_stats_by_dogtag("f55f")
977
+ print(f"Player found: {player_stats.get('player_info', {}).get('account', 'Unknown')}")
978
+
979
+ # Parse and analyze statistics
980
+ parsed = client.parse_player_stats(player_stats)
981
+ print(f"Rating: {parsed.get('rating', 0)}")
982
+ print(f"K/D Ratio: {parsed.get('overall_stats', {}).get('total_kills', 0) / max(parsed.get('overall_stats', {}).get('total_deaths', 1), 1):.2f}")
983
+
984
+ # Get detailed stats for multiple players
985
+ credentials = ["player1_cred", "player2_cred", "player3_cred"]
986
+ batch_stats = client.get_batch_profiles(credentials)
987
+
988
+ # Search players using dogtags
989
+ for dogtag in ["f55f", "ff11", "g6765"]:
990
+ player = client.search_player_by_dogtag(dogtag)
991
+ if 'error' not in player:
992
+ print(f"Found: {player.get('player_info', {}).get('account')}")
993
+ ```
994
+
995
+ ### 📊 Player Statistics & Batch Profiles (6+ Methods)
996
+ - ✅ Get batch player profiles with detailed statistics
997
+ - ✅ Search players by dogtag (in-game ID)
998
+ - ✅ Get detailed player statistics using credentials
999
+ - ✅ Parse and structure player statistics
1000
+ - ✅ Convert dogtags to aliases for API lookup
1001
+ - ✅ Combine alias lookup with stats retrieval
1002
+ - ✅ Support for multiple player batch operations
1003
+ - ✅ Detailed game save and inventory data access
1004
+ - ✅ Weapon statistics and performance analysis
1005
+ - ✅ Campaign progress tracking
1006
+ - ✅ Overall statistics calculation (K/D, accuracy, etc.)
1007
+ - ✅ Player performance analysis tools
1039
1008
 
1040
1009
  ### ⚙️ Game Configuration (4+ Methods)
1041
1010
  - ✅ Get asset hash metadata
@@ -1,12 +1,12 @@
1
1
  mc5_api_client/__init__.py,sha256=VtZ8P-CwnjHSq6VmSuBwVttNXIK3qoOrFuNxXMVeaMc,1021
2
2
  mc5_api_client/auth.py,sha256=Yj_6s8KmtbswWbR6q816d8soIirUF2aD_KWxg-jNqR0,9978
3
3
  mc5_api_client/cli.py,sha256=KegNTxwq28gu_vrffc_cXcALrHzUBDHd-5DqKyYp4p0,17284
4
- mc5_api_client/client.py,sha256=JJxXvPZMJh_Gfp_tO-X2cBmLlbWb-V3zp5RgDT71hsI,58264
4
+ mc5_api_client/client.py,sha256=Ha9BMIsNpabd7-SPCqcIl5beeuyQnLPEJB8AVCg472k,65520
5
5
  mc5_api_client/exceptions.py,sha256=o7od4GrEIlgq6xSNUjZdh74xoDTytF3PLcMq5ewRiJw,2683
6
6
  mc5_api_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- mc5_api_client-1.0.3.dist-info/LICENSE,sha256=M0UBQ4B3pB9XcV54_jhVP681xyauF8GB6YK_rKmuXzk,1064
8
- mc5_api_client-1.0.3.dist-info/METADATA,sha256=Z6-UrwQ13kJ4n0RmEkWIbbOb6aaZvkFDaY5E9VU_URo,35719
9
- mc5_api_client-1.0.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
10
- mc5_api_client-1.0.3.dist-info/entry_points.txt,sha256=2kruOpleFYK3Jl1MoQwGyqCd-Pj4kQWngXmIjnXx_gE,48
11
- mc5_api_client-1.0.3.dist-info/top_level.txt,sha256=eYJe4ue9j1ig_jFY5Z05mDqpizUEV7TYpk5lBXVd4kA,15
12
- mc5_api_client-1.0.3.dist-info/RECORD,,
7
+ mc5_api_client-1.0.5.dist-info/LICENSE,sha256=M0UBQ4B3pB9XcV54_jhVP681xyauF8GB6YK_rKmuXzk,1064
8
+ mc5_api_client-1.0.5.dist-info/METADATA,sha256=KMtXbEbXHSuGOIfPTigMVZdRdGvLXT9GZGLsun6sJos,35725
9
+ mc5_api_client-1.0.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
10
+ mc5_api_client-1.0.5.dist-info/entry_points.txt,sha256=2kruOpleFYK3Jl1MoQwGyqCd-Pj4kQWngXmIjnXx_gE,48
11
+ mc5_api_client-1.0.5.dist-info/top_level.txt,sha256=eYJe4ue9j1ig_jFY5Z05mDqpizUEV7TYpk5lBXVd4kA,15
12
+ mc5_api_client-1.0.5.dist-info/RECORD,,