Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/isida/3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliyS <vitaliy@root.ua>2013-11-27 18:19:21 +0400
committerVitaliyS <vitaliy@root.ua>2013-11-27 18:19:21 +0400
commit18a01eeda9ff63bb65bdb5568182c5888b74183f (patch)
tree89c7dd31fec72ae3a63fa59879111f4125c80469
parentc5e5e6191078bb09d398b142c5e4504c0a2de8e3 (diff)
upd: wot.py - update armor rating
-rw-r--r--data/locales/ru.txt13
-rw-r--r--data/locales/ua.txt13
-rw-r--r--plugins/wot.py51
3 files changed, 62 insertions, 15 deletions
diff --git a/data/locales/ru.txt b/data/locales/ru.txt
index 8b2521e..112014c 100644
--- a/data/locales/ru.txt
+++ b/data/locales/ru.txt
@@ -1372,6 +1372,15 @@ Impossible to get tanks' statistics Невозможно получить ста
- unicum - уникум
\nWN6 rating: %s (XVM: %s) \nРейтинг WN6: %s (XVM: %s)
\nArmor-rating: %s \nРейтинг Бронесайта: %s
+ - virtuoso - виртуоз
+ - master tanker - мастер-танкист
+ - tanker 1st class - танкист 1-го класса
+ - tanker 2nd class - танкист 2-го класса
+ - tanker 3rd class - танкист 3-го класса
+ - deerhead 3rd class - оленевод 3-го класса
+ - deerhead 2nd class - оленевод 2-го класса
+ - deerhead 1st class - оленевод 1-го класса
+ - master deerhead - мастер-оленевод
Impossible to get statistics Невозможно получить статистику
Query error Ошибка запроса
Player not found Игрок не найден
@@ -1811,5 +1820,5 @@ Youtube settings Настройки youtube
API settings Настройки API
# write locale file: ru.txt
-# total: 1483
-# missed translations: 6
+# total: 1492
+# missed translations: 9
diff --git a/data/locales/ua.txt b/data/locales/ua.txt
index 5bcd2bc..2b1f0dd 100644
--- a/data/locales/ua.txt
+++ b/data/locales/ua.txt
@@ -1372,6 +1372,15 @@ Impossible to get tanks' statistics Неможливо отримати стат
- unicum - унікум
\nWN6 rating: %s (XVM: %s) \nРейтинг WN6: %s (XVM: %s)
\nArmor-rating: %s \nРейтинг Бронесайту: %s
+ - virtuoso - віртуоз
+ - master tanker - майстер-танкіст
+ - tanker 1st class - танкіст 1-го класу
+ - tanker 2nd class - танкіст 2-го класу
+ - tanker 3rd class - танкіст 3-го класу
+ - deerhead 3rd class - оленевід 3-го класу
+ - deerhead 2nd class - оленевід 2-го класу
+ - deerhead 1st class - оленевід 1-го класу
+ - master deerhead - майстер-оленевід
Impossible to get statistics Неможливо отримати статистику
Query error Помилка запиту
Player not found Гравця не знайдено
@@ -1811,5 +1820,5 @@ Youtube settings Налаштування Youtube
API settings Налаштування API
# write locale file: ua.txt
-# total: 1483
-# missed translations: 6
+# total: 1492
+# missed translations: 9
diff --git a/plugins/wot.py b/plugins/wot.py
index 9a08a9f..72b7ebb 100644
--- a/plugins/wot.py
+++ b/plugins/wot.py
@@ -60,8 +60,9 @@ def wot(type, jid, nick, text):
data = load_page('%s/2.0/account/tanks/?application_id=%s&account_id=%s&fields=statistics,tank_id,mark_of_mastery' % (API_ADDR, APP_ID, player_id))
vdata = json.loads(data)
- data = load_page('%s/2.0/account/info/?application_id=%s&account_id=%s&fields=clan,nickname,statistics.all' % (API_ADDR, APP_ID, player_id))
+ data = load_page('%s/2.0/account/info/?application_id=%s&account_id=%s&fields=clan,nickname,statistics' % (API_ADDR, APP_ID, player_id))
pdata = json.loads(data)
+ stat = pdata['data'][player_id]['statistics']
if pdata['data'][player_id]['clan']:
clan_id = str(pdata['data'][player_id]['clan']['clan_id'])
@@ -97,8 +98,8 @@ def wot(type, jid, nick, text):
msg = L('Impossible to get tanks\' statistics','%s/%s'%(jid,nick))
else:
- wins = pdata['data'][player_id]['statistics']['all']['wins']
- battles = pdata['data'][player_id]['statistics']['all']['battles']
+ wins = stat['all']['wins']
+ battles = stat['all']['battles']
if not battles:
msg = '%s: %s/%s' % (wotname, wins, battles)
@@ -115,18 +116,18 @@ def wot(type, jid, nick, text):
msg += L('\nUp to %s%% win left: %s battles', '%s/%s'%(jid,nick)) % (np, np_int)
msg += L('\nUp to %s%% win left: %s battles', '%s/%s'%(jid,nick)) % (np05, np_round)
-
- avg_exp = pdata['data'][player_id]['statistics']['all']['battle_avg_xp']
- DAMAGE = pdata['data'][player_id]['statistics']['all']['damage_dealt'] / float(battles)
+ avg_exp = stat['all']['battle_avg_xp']
+
+ DAMAGE = stat['all']['damage_dealt'] / float(battles)
msg += L('\nAv. damage: %s','%s/%s'%(jid,nick)) % int(round(DAMAGE))
- FRAGS = pdata['data'][player_id]['statistics']['all']['frags'] / float(battles)
+ FRAGS = stat['all']['frags'] / float(battles)
msg += L('\nAv. destroyed: %s','%s/%s'%(jid,nick)) % round(FRAGS, 2)
- SPOT = pdata['data'][player_id]['statistics']['all']['spotted'] / float(battles)
+ SPOT = stat['all']['spotted'] / float(battles)
msg += L('\nAv. spotted: %s','%s/%s'%(jid,nick)) % round(SPOT, 2)
- CAP = pdata['data'][player_id]['statistics']['all']['capture_points'] / float(battles)
+ CAP = stat['all']['capture_points'] / float(battles)
msg += L('\nAv. captured points: %s','%s/%s'%(jid,nick)) % round(CAP, 2)
- DEF = pdata['data'][player_id]['statistics']['all']['dropped_capture_points'] / float(battles)
+ DEF = stat['all']['dropped_capture_points'] / float(battles)
msg += L('\nAv. defense points: %s','%s/%s'%(jid,nick)) % round(DEF, 2)
@@ -182,9 +183,37 @@ def wot(type, jid, nick, text):
elif wn6 >= 1885:
msg += L(' - unicum','%s/%s'%(jid,nick))
- armor = math.log(battles) / 10 * (avg_exp + DAMAGE * (WINRATE * 2 + FRAGS * 0.9 + (SPOT + CAP + DEF) * 0.5))
+ stat_rnd = lambda x: stat['all'][x] - stat['clan'][x] - stat['company'][x]
+ armor = math.log(stat_rnd('battles')) / 10 * (stat_rnd('xp')/float(stat_rnd('battles')) + stat_rnd('damage_dealt')/float(stat_rnd('battles')) * (stat_rnd('wins') * 2 + stat_rnd('frags') * 0.9 + (stat_rnd('spotted') + stat_rnd('capture_points') + stat_rnd('dropped_capture_points')) * 0.5)/float(stat_rnd('battles')))
+
msg += L('\nArmor-rating: %s','%s/%s'%(jid,nick)) % int(round(armor))
+
+ try:
+ data = load_page('http://armor.kiev.ua/wot/api.php?version=iSida3')
+ armor_limits = json.loads(data)
+
+ if armor > armor_limits['classRatings']['cv']:
+ msg += L(' - virtuoso','%s/%s'%(jid,nick))
+ elif armor > armor_limits['classRatings']['cm']:
+ msg += L(' - master tanker','%s/%s'%(jid,nick))
+ elif armor > armor_limits['classRatings']['c1']:
+ msg += L(' - tanker 1st class','%s/%s'%(jid,nick))
+ elif armor > armor_limits['classRatings']['c2']:
+ msg += L(' - tanker 2nd class','%s/%s'%(jid,nick))
+ elif armor > armor_limits['classRatings']['c3']:
+ msg += L(' - tanker 3rd class','%s/%s'%(jid,nick))
+ elif armor > armor_limits['classRatings']['d3']:
+ msg += L(' - deerhead 3rd class','%s/%s'%(jid,nick))
+ elif armor > armor_limits['classRatings']['d2']:
+ msg += L(' - deerhead 2nd class','%s/%s'%(jid,nick))
+ elif armor > armor_limits['classRatings']['d1']:
+ msg += L(' - deerhead 1st class','%s/%s'%(jid,nick))
+ else: #['dm']
+ msg += L(' - master deerhead','%s/%s'%(jid,nick))
+ except:
+ pass
+
except:
msg = L('Impossible to get statistics','%s/%s'%(jid,nick))
elif not pdata['status']: