BigBrother: Add percentages.
This commit is contained in:
parent
59ecbec22d
commit
6e127fe839
2 changed files with 40 additions and 5 deletions
|
@ -5,6 +5,7 @@ Dragonslayer:
|
|||
color: "e20a00"
|
||||
ids:
|
||||
- 22888
|
||||
required: false
|
||||
classes:
|
||||
- ALL
|
||||
|
||||
|
@ -12,6 +13,7 @@ Zandalar:
|
|||
color: "41ca46"
|
||||
ids:
|
||||
- 24425
|
||||
required: false
|
||||
classes:
|
||||
- ALL
|
||||
|
||||
|
@ -21,6 +23,7 @@ DM:T:
|
|||
- 22817 # Fengus' Ferocity
|
||||
- 22820 # Slip'kik's Savvy
|
||||
- 22818 # Mol'dar's Moxie
|
||||
required: false
|
||||
classes:
|
||||
- ALL
|
||||
|
||||
|
@ -30,9 +33,11 @@ Zanza:
|
|||
- 24382 # Spirit of Zanza
|
||||
- 20081 # Swiftness of Zanza
|
||||
- 20080 # Sheen of Zanza
|
||||
required: false
|
||||
classes:
|
||||
- Druid
|
||||
- Priest
|
||||
- Warrior
|
||||
|
||||
|
||||
Alcohol:
|
||||
|
@ -41,6 +46,7 @@ Alcohol:
|
|||
- 22790 # Kreeg's Stout Beatdown
|
||||
- 22789 # Gordok Green Grog
|
||||
- 25804 # Rumsey Rum Black Label
|
||||
required: false
|
||||
classes:
|
||||
- Druid
|
||||
- Priest
|
||||
|
@ -55,6 +61,8 @@ Food:
|
|||
- 18125 # Blessed Sunfruit
|
||||
- 19710 # Tender Wolf Steak
|
||||
- 22730 # Runn Tum Tuber Surprise
|
||||
- 25661 # Dirge's Kickin' Chimaerok Chops
|
||||
required: true
|
||||
classes:
|
||||
- ALL
|
||||
|
||||
|
@ -62,6 +70,7 @@ Mageblood:
|
|||
color: "550c65"
|
||||
ids:
|
||||
- 24363
|
||||
required: true
|
||||
classes:
|
||||
- Balance Druid
|
||||
- Druid
|
||||
|
@ -73,6 +82,7 @@ Strength:
|
|||
ids:
|
||||
- 11405 # Elixir of the Giants
|
||||
- 16323 # Juju Power
|
||||
required: true
|
||||
classes:
|
||||
- Feral Druid
|
||||
- Retribution Paladin
|
||||
|
@ -85,6 +95,7 @@ Mongoose:
|
|||
ids:
|
||||
- 17538 # Elixir of the Mongoose
|
||||
- 11334 # Greater Agility
|
||||
required: true
|
||||
classes:
|
||||
- Feral Druid
|
||||
- Hunter
|
||||
|
@ -98,6 +109,7 @@ Arcane:
|
|||
ids:
|
||||
- 17539 # Greater Arcane Elixir
|
||||
#- 11390 # Arcane Elixir
|
||||
required: true
|
||||
classes:
|
||||
- Balance Druid
|
||||
- Mage
|
||||
|
@ -108,6 +120,7 @@ Shadow:
|
|||
color: "510164"
|
||||
ids:
|
||||
- 11474
|
||||
required: true
|
||||
classes:
|
||||
- Shadow Priest
|
||||
- Warlock
|
||||
|
@ -117,6 +130,7 @@ Frost/Fire:
|
|||
ids:
|
||||
- 21920 # Frost Power
|
||||
- 26276 # Greater Firepower
|
||||
required: true
|
||||
classes:
|
||||
- Mage
|
||||
|
||||
|
@ -124,6 +138,7 @@ Frost/Fire:
|
|||
# color: "2bddc7"
|
||||
# ids:
|
||||
# - 11374
|
||||
# required: true
|
||||
# classes:
|
||||
# - Tank Warrior
|
||||
|
||||
|
@ -131,5 +146,6 @@ Defense:
|
|||
color: "0a0a0a"
|
||||
ids:
|
||||
- 11348
|
||||
required: true
|
||||
classes:
|
||||
- Tank Warrior
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import base64
|
||||
import io
|
||||
from collections import defaultdict
|
||||
from collections import defaultdict, Counter
|
||||
from contextlib import suppress
|
||||
from datetime import datetime, timedelta
|
||||
from typing import List
|
||||
|
@ -11,6 +11,7 @@ from . import config
|
|||
|
||||
|
||||
def graph(raid: List[dict]) -> None:
|
||||
# TODO: This entire function is shit.
|
||||
figs = []
|
||||
buff_ids = {
|
||||
buff_id: buff_name
|
||||
|
@ -18,6 +19,7 @@ def graph(raid: List[dict]) -> None:
|
|||
for buff_id in buff_data["ids"]
|
||||
}
|
||||
classes = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))
|
||||
player_buff_counts = defaultdict(Counter)
|
||||
xticks = []
|
||||
first_encounter_date = None
|
||||
last_encounter_date = None
|
||||
|
@ -33,24 +35,32 @@ def graph(raid: List[dict]) -> None:
|
|||
for player_name, buffs in sorted(players.items()):
|
||||
real_class_name = config.class_overrides.get(player_name, str.title(class_name))
|
||||
classes[real_class_name][player_name] # ensure player is added, irregardless if they have any buffs
|
||||
player_buff_names = set()
|
||||
for buff_id in buffs:
|
||||
with suppress(KeyError): # KeyError on buff_id => buff not tracked
|
||||
buff_name = buff_ids[buff_id]
|
||||
player_buff_names.add(buff_name)
|
||||
classes[real_class_name][player_name][buff_name].append(
|
||||
(previous_encounter_date, (encounter_date - previous_encounter_date))
|
||||
)
|
||||
player_buff_counts[player_name].update(player_buff_names)
|
||||
previous_encounter_date = encounter_date
|
||||
|
||||
for class_name, players in sorted(classes.items()):
|
||||
fig, ax = plt.subplots()
|
||||
required_class_buffs = {
|
||||
class_buffs = {
|
||||
buff_name: buff_data
|
||||
for buff_name, buff_data in config.buffs.items()
|
||||
if any(x in buff_data["classes"] for x in ("ALL", class_name))
|
||||
}
|
||||
required_class_buffs = {
|
||||
buff_name: buff_data
|
||||
for buff_name, buff_data in class_buffs.items()
|
||||
if buff_data["required"]
|
||||
}
|
||||
#legend_handles = []
|
||||
bar_width = 1 / (len(required_class_buffs) + 1)
|
||||
for b, (buff_name, buff) in enumerate(required_class_buffs.items()):
|
||||
bar_width = 1 / (len(class_buffs) + 1)
|
||||
for b, (buff_name, buff) in enumerate(class_buffs.items()):
|
||||
bar_color = "#{color}".format(**buff)
|
||||
#legend_handles.append(Patch(label=buff_name, color=bar_color))
|
||||
for y0, (player_name, player_buffs) in enumerate(players.items()):
|
||||
|
@ -78,9 +88,18 @@ def graph(raid: List[dict]) -> None:
|
|||
ax.axhline(y=y0, linewidth=1.0, color="black")
|
||||
|
||||
plt.xticks(*zip(*xticks), rotation=30, ha="right")
|
||||
required_buff_fraction = {
|
||||
p: sum(
|
||||
c
|
||||
for b, c in player_buff_counts[p].items()
|
||||
if b in required_class_buffs
|
||||
) / (len(raid) * len(required_class_buffs))
|
||||
for p in players
|
||||
}
|
||||
plt.yticks(
|
||||
list(range(len(players))),
|
||||
players
|
||||
[f"{p}\n{required_buff_fraction[p]:.0%}" for p in players],
|
||||
verticalalignment="top"
|
||||
)
|
||||
ax.invert_yaxis()
|
||||
ax.grid(axis="x", linestyle="--")
|
||||
|
|
Loading…
Reference in a new issue