Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
amadanmath committed Nov 20, 2017
2 parents d9c4586 + 5ec0ab4 commit d392a59
Show file tree
Hide file tree
Showing 14 changed files with 531 additions and 325 deletions.
53 changes: 52 additions & 1 deletion analyser/analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,49 @@ class Elite(IntEnum):
HEART_OF_THORNS = 1
PATH_OF_FIRE = 2

class Profession(IntEnum):
GUARDIAN = 1
WARRIOR = 2
ENGINEER = 3
RANGER = 4
THIEF = 5
ELEMENTALIST = 6
MESMER = 7
NECROMANCER = 8
REVENANT = 9

SPECIALISATIONS = {
(Profession.GUARDIAN, 0): "Guardian",
(Profession.WARRIOR, 0): "Warrior",
(Profession.ENGINEER, 0): "Engineer",
(Profession.RANGER, 0): "Ranger",
(Profession.THIEF, 0): "Thief",
(Profession.ELEMENTALIST, 0): "Elementalist",
(Profession.MESMER, 0): "Mesmer",
(Profession.NECROMANCER, 0): "Necromancer",
(Profession.REVENANT, 0): "Revenant",

(Profession.GUARDIAN, 1): 'Dragonhunter',
(Profession.WARRIOR, 1): 'Berserker',
(Profession.ENGINEER, 1): 'Scrapper',
(Profession.RANGER, 1): 'Druid',
(Profession.THIEF, 1): 'Daredevil',
(Profession.ELEMENTALIST, 1): 'Tempest',
(Profession.MESMER, 1): 'Chronomancer',
(Profession.NECROMANCER, 1): 'Reaper',
(Profession.REVENANT, 1): 'Herald',

(Profession.GUARDIAN, 2): 'Firebrand',
(Profession.WARRIOR, 2): 'Spellbreaker',
(Profession.ENGINEER, 2): 'Holosmith',
(Profession.RANGER, 2): 'Soulbeast',
(Profession.THIEF, 2): 'Deadeye',
(Profession.ELEMENTALIST, 2): 'Weaver',
(Profession.MESMER, 2): 'Mirage',
(Profession.NECROMANCER, 2): 'Scourge',
(Profession.REVENANT, 2): 'Renegade',
}

class Specialization(IntEnum):
NONE = 0
DRUID = 5
Expand Down Expand Up @@ -106,7 +149,7 @@ def create_mapping(df, column):
return unique_names(df.to_dict()[column])

def filter_damage_events(events):
damage_events = events[(events.type == LogType.POWER) |(events.type == LogType.CONDI)]
damage_events = events[(events.state_change == 0)&((events.type == LogType.POWER)|(events.type == LogType.CONDI))]
damage_events = damage_events.assign(damage =
np.where(damage_events.type == LogType.POWER,
damage_events['value'],
Expand Down Expand Up @@ -159,6 +202,11 @@ def preprocess_agents(self, agents, collector, events):
return agents, players, bosses, final_bosses

def preprocess_events(self, events):
#prevent log start event shenanigans
events.loc[events.state_change == 9, 'ult_src_instid'] = -1
events.loc[events.state_change == 9, 'src_instid'] = -1
events.loc[events.state_change == 9, 'src_master_instid'] = -1

#experimental phase calculations
events['ult_src_instid'] = events.src_master_instid.where(
events.src_master_instid != 0, events.src_instid)
Expand Down Expand Up @@ -217,6 +265,9 @@ def print_phase(phase):
self.phases = [a for (a,i) in zip(all_phases, self.boss_info.phases) if i.important]
print("Important phases:")
list(map(print_phase, self.phases))

if len(all_phases) > 1 and all_phases[0][2] - all_phases[0][1] == 0:
raise EvtcAnalysisException("Initial phase missing or skipped")

return player_src_events, player_dst_events, from_boss_events, from_final_boss_events, health_updates

Expand Down
202 changes: 112 additions & 90 deletions analyser/bosses.py

Large diffs are not rendered by default.

18 changes: 3 additions & 15 deletions raidar/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib import admin
from django.utils.html import format_html

from .models import Era, Category, Area, Account, Character, Encounter, Participation, UserProfile
from .models import Era, Category, Area, Account, Encounter, Participation, UserProfile


# XXX HACK https://stackoverflow.com/q/46460800/240443
Expand Down Expand Up @@ -71,15 +71,15 @@ class ParticipationInline(admin.TabularInline):
model = Participation
extra = 10
max_num = 10
readonly_fields = ('character', 'elite', 'party')
readonly_fields = ('account', 'elite', 'party')

class EncounterAdmin(QuotedSearchModelAdmin):
def url_id_link(self, obj):
# HACK but works
return format_html("<a href='../../../encounter/{url_id}'>{url_id}</a>", url_id=obj.url_id)
url_id_link.short_description = "Link"

search_fields = ('=url_id', '=filename', '^area__name', '=characters__name', '^characters__account__name', '=characters__account__user__username', '=tags__name', '=category__name')
search_fields = ('=url_id', '=filename', '^area__name', '=participations__character', '^account__name', '=account__user__username', '=tags__name', '=category__name')
list_display = ('filename', 'url_id_link', 'area', 'success', 'category', 'started_at', 'duration', 'uploaded_at', 'uploaded_by')
list_select_related = ('category', 'uploaded_by', 'area')
inlines = (ParticipationInline,)
Expand All @@ -89,20 +89,9 @@ def url_id_link(self, obj):
class Media:
css = { 'all' : ('raidar/hide_admin_original.css',) }

class CharacterAdmin(QuotedSearchModelAdmin):
search_fields = ('=name', '^account__name', '=account__user__username')
list_display = ('name', 'profession', 'account')
readonly_fields = ('account', 'name', 'profession')

class CharacterInline(admin.TabularInline):
model = Character
readonly_fields = ('name', 'profession')
extra = 1

class AccountAdmin(QuotedSearchModelAdmin):
search_fields = ('^name', '=user__username')
list_display = ('name', 'user')
inlines = (CharacterInline,)
readonly_fields = ('name',)

# hack, but... ugly otherwise
Expand All @@ -114,6 +103,5 @@ class Media:
admin.site.register(Era, EraAdmin)
admin.site.register(Category, CategoryAdmin)
admin.site.register(Account, AccountAdmin)
admin.site.register(Character, CharacterAdmin)
admin.site.register(Encounter, EncounterAdmin)
admin.site.register(UserProfile)
10 changes: 3 additions & 7 deletions raidar/management/commands/process_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,12 @@ def analyse_upload(self, upload):
for name, player in status_for.items():
account, _ = Account.objects.get_or_create(
name=player['account'])
character, _ = Character.objects.get_or_create(
name=name, account=account,
defaults={
'profession': player['profession']
}
)
participation, _ = Participation.objects.update_or_create(
character=character, encounter=encounter,
account=account, encounter=encounter,
defaults={
'character': name,
'archetype': player['archetype'],
'profession': player['profession'],
'party': player['party'],
'elite': player['elite']
}
Expand Down
Loading

0 comments on commit d392a59

Please sign in to comment.