diff options
author | raylu <raylu@gridium.com> | 2013-10-25 01:51:28 -0700 |
---|---|---|
committer | raylu <raylu@gridium.com> | 2013-10-25 01:51:28 -0700 |
commit | 050dc6915bfe71547129e5f253543c25a4b45e07 (patch) | |
tree | db2ec6565fc7d7dbaad7ceeff4286e35410db648 | |
parent | 4072a99b40a2782092af9efabefa8f6f79d621a9 (diff) | |
download | ykill-050dc6915bfe71547129e5f253543c25a4b45e07.tar.xz |
handle golden pod
-rwxr-xr-x | update_costs.py | 25 | ||||
-rw-r--r-- | web/static/js/kill.js | 6 |
2 files changed, 23 insertions, 8 deletions
diff --git a/update_costs.py b/update_costs.py index 088fb45..53abb31 100755 --- a/update_costs.py +++ b/update_costs.py @@ -36,19 +36,22 @@ def query(type_id): value = tree.getroot().find('marketstat').find('type').find('sell').find('percentile').text return int(Decimal(value) * 100) +au79_cost = None def update_kill(kill_id): with db.conn.cursor() as c: c.execute(''' - SELECT cost FROM characters - JOIN item_costs ON ship_type_id = item_costs.type_id + SELECT ship_type_id, cost FROM characters + LEFT JOIN item_costs ON ship_type_id = item_costs.type_id WHERE kill_id = ? AND victim ''', (kill_id,)) r = c.fetchone() - if r: - cost = r[0] - c.nextset() + if r[1] is not None: + cost = r[1] else: cost = 0 + c.nextset() + if r[0] == 33328: # Capsule - Genolution 'Auroral' 197-variant + cost -= au79_cost # singleton is 0 normally and for BPOs and 2 for BPCs # we want to divide by 1 for BPOs and by 1000 for BPCs c.execute(''' @@ -59,7 +62,10 @@ def update_kill(kill_id): r = c.fetchone() c.nextset() if r[0]: - cost += r[0] + cost += int(r[0]) + if cost < 0: + cost += au79_cost + print('goddamnit CCP', kill_id) c.execute('UPDATE kill_costs SET cost = ? WHERE kill_id = ?', (cost, kill_id)) def main(): @@ -77,8 +83,13 @@ def main(): ON DUPLICATE KEY UPDATE cost = ? ''', parambatch) + c.execute('SELECT cost FROM item_costs WHERE type_id = 33329') # Genolution 'Auroral' AU-79 + global au79_cost + au79_cost = c.fetchone()[0] + c.nextset() + print('getting kills') - c.execute('SELECT kill_id from kills') + c.execute('SELECT kill_id FROM kills') print('updating kills') while True: diff --git a/web/static/js/kill.js b/web/static/js/kill.js index 57d33fc..5fe2173 100644 --- a/web/static/js/kill.js +++ b/web/static/js/kill.js @@ -142,6 +142,10 @@ window.addEvent('domready', function() { item_name += ' (copy)'; cost /= 1000; } + if (item['type_id'] == 33329 && item['flag'] == 89) // Genolution 'Auroral' AU-79 in implant slot + cost = 'n/a'; + else + cost = ykill.format_isk(cost); table.grab(new Element('tr').adopt( new Element('td').grab( new Element('img', { @@ -151,7 +155,7 @@ window.addEvent('domready', function() { ), new Element('td', {'html': item_name}), new Element('td', {'html': count, 'class': item_class}), - new Element('td', {'html': ykill.format_isk(cost)}) + new Element('td', {'html': cost}) )); }); }); |