diff options
author | raylu <raylu@gridium.com> | 2013-10-25 00:47:06 -0700 |
---|---|---|
committer | raylu <raylu@gridium.com> | 2013-10-25 00:47:06 -0700 |
commit | 4072a99b40a2782092af9efabefa8f6f79d621a9 (patch) | |
tree | 36c875f4c75e411a51ef36968e1773611a88ceca | |
parent | 4fb8abde07e94889ba1acfc86e0b36319c136b97 (diff) | |
download | ykill-4072a99b40a2782092af9efabefa8f6f79d621a9.tar.xz |
fix BPC costs
-rw-r--r-- | db/queries.py | 4 | ||||
-rwxr-xr-x | update_costs.py | 5 | ||||
-rw-r--r-- | web/static/css/kill.ccss | 4 | ||||
-rw-r--r-- | web/static/js/kill.js | 10 |
4 files changed, 17 insertions, 6 deletions
diff --git a/db/queries.py b/db/queries.py index b998132..435f4dc 100644 --- a/db/queries.py +++ b/db/queries.py @@ -112,13 +112,15 @@ def kill(kill_id): except db.NoRowsException: victim['ship_cost'] = 0 + # see update_costs for an explanation of the ORDER BY item_rows = db.query(c, ''' SELECT items.type_id, flag, dropped, destroyed, singleton, cost, typeName AS item_name, capacity FROM items JOIN item_costs ON item_costs.type_id = items.type_id JOIN eve.invTypes ON items.type_id = typeID - WHERE kill_id = ? ORDER BY flag ASC + WHERE kill_id = ? + ORDER BY (cost * (dropped + destroyed) / (singleton * 499.5 + 1)) DESC ''', kill_id) items = defaultdict(list) for item in item_rows: diff --git a/update_costs.py b/update_costs.py index b2ab85f..088fb45 100755 --- a/update_costs.py +++ b/update_costs.py @@ -49,8 +49,11 @@ def update_kill(kill_id): c.nextset() else: cost = 0 + # 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(''' - SELECT SUM(cost * (dropped + destroyed)) FROM items AS i + SELECT SUM(cost * (dropped + destroyed) / (singleton * 499.5 + 1)) + FROM items AS i JOIN item_costs AS ic ON i.type_id = ic.type_id WHERE kill_id = ? ''', (kill_id,)) r = c.fetchone() diff --git a/web/static/css/kill.ccss b/web/static/css/kill.ccss index 9b29093..3cb64db 100644 --- a/web/static/css/kill.ccss +++ b/web/static/css/kill.ccss @@ -117,9 +117,9 @@ table#items: th:nth-child(1): width: 33px th:nth-child(2): - width: 300px + width: 285px th:nth-child(3): - width: 50px + width: 65px th:nth-child(4): width: 117px diff --git a/web/static/js/kill.js b/web/static/js/kill.js index e1e601a..57d33fc 100644 --- a/web/static/js/kill.js +++ b/web/static/js/kill.js @@ -134,8 +134,14 @@ window.addEvent('domready', function() { } items[slot].each(function(item) { var type_id = item['type_id']; + var item_name = item['item_name']; var item_class = item['dropped'] ? 'dropped' : 'destroyed'; var count = item[item_class]; + var cost = item['cost'] * count; + if (item['singleton'] == 2) { + item_name += ' (copy)'; + cost /= 1000; + } table.grab(new Element('tr').adopt( new Element('td').grab( new Element('img', { @@ -143,9 +149,9 @@ window.addEvent('domready', function() { 'alt': item['item_name'], }) ), - new Element('td', {'html': item['item_name']}), + new Element('td', {'html': item_name}), new Element('td', {'html': count, 'class': item_class}), - new Element('td', {'html': ykill.format_isk(item['cost'])}) + new Element('td', {'html': ykill.format_isk(cost)}) )); }); }); |