diff --git a/public/index.html b/public/index.html index 888771c..98f4881 100644 --- a/public/index.html +++ b/public/index.html @@ -19,7 +19,7 @@
diff --git a/src/app-habitica/assets/pixel.eot b/src/app-habitica/assets/pixel.eot new file mode 100644 index 0000000..0fabd13 Binary files /dev/null and b/src/app-habitica/assets/pixel.eot differ diff --git a/src/app-habitica/assets/pixel.svg b/src/app-habitica/assets/pixel.svg new file mode 100644 index 0000000..f6bf000 --- /dev/null +++ b/src/app-habitica/assets/pixel.svg @@ -0,0 +1,238 @@ + + + + +Created by FontForge 20170731 at Sun Nov 15 10:51:20 2009 + By Aleksey,,, +by devil-man-josh & mirz123 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app-habitica/assets/pixel.ttf b/src/app-habitica/assets/pixel.ttf new file mode 100644 index 0000000..38e2013 Binary files /dev/null and b/src/app-habitica/assets/pixel.ttf differ diff --git a/src/app-habitica/assets/pixel.woff b/src/app-habitica/assets/pixel.woff new file mode 100644 index 0000000..9683f75 Binary files /dev/null and b/src/app-habitica/assets/pixel.woff differ diff --git a/src/app-habitica/assets/pixel.woff2 b/src/app-habitica/assets/pixel.woff2 new file mode 100644 index 0000000..2687a03 Binary files /dev/null and b/src/app-habitica/assets/pixel.woff2 differ diff --git a/src/app-habitica/stores/habitica.js b/src/app-habitica/stores/habitica.js new file mode 100644 index 0000000..90b994f --- /dev/null +++ b/src/app-habitica/stores/habitica.js @@ -0,0 +1,133 @@ +import axios from 'axios'; + +const name = 'Habitica'; + +const store = { + namespaced: true, + state: { + css: null, + js: null, + quest: null, + members: [], + }, + mutations: { + clear(state) { + state.css = null; + state.js = null; + state.quest = null; + state.members = []; + }, + updateQuest: (state, { quest, members, css, js }) => { + if (!quest) { + state.members = []; + state.quest = null; + + return; + } + + state.css = css; + state.js = js; + + let pending = 0; + + state.members = members.map((member) => { + pending += member.party.quest.progress.up; + + return { + id: member.id, + items: member.items, + stats: member.stats, + preferences: member.preferences, + username: member.profile.name, + mount: member.items.currentMount, + pet: member.items.currentPet, + pendingAttack: member.party.quest.progress.up, + hp: member.stats.hp, + hpMax: member.stats.maxHealth, + level: member.stats.lvl, + }; + }); + + state.quest = { + key: quest.key, + hp: quest.progress.hp, + hpMax: quest.progress.hpMax, + pending, + }; + }, + }, + actions: { + async reload({ commit, state }, payload) { + const { config } = payload; + + const axiosInstance = axios.create({ + headers: { + 'x-api-user': config['api-user'], + 'x-api-key': config['api-key'], + }, + }); + + const party = await axiosInstance.get('https://habitica.com/api/v4/groups/party'); + const partyData = party && party.data && party.data.data || null; + + let quest = null; + let members = null; + + if (partyData && partyData.quest && partyData.quest.active) { + quest = partyData.quest; + + members = await axiosInstance.get( + `https://habitica.com/api/v4/groups/${config.group}/members?includeAllPublicFields=true` + ); + + members = members.data.data; + } + + let css = null; + let js = null; + + if (quest && (!state.css || !state.js)) { + const page = await axiosInstance.get('https://habitica.com'); + + if (!state.css) { + const url = page.data.match(/ +
+
+
+ +
{{ member.username }}
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+ + + + + diff --git a/src/apps/views/App.vue b/src/apps/views/App.vue index 9309159..8a96c1a 100644 --- a/src/apps/views/App.vue +++ b/src/apps/views/App.vue @@ -16,6 +16,7 @@ import AppGithubPulls from '@/app-github-pulls/views/AppGithubPulls'; import AppTimeline from '@/app-timeline/views/AppTimeline'; import AppFrame from '@/app-frame/views/AppFrame.vue'; import AppPages from '@/app-pages/views/AppPages.vue'; +import AppHabitica from '@/app-habitica/views/AppHabitica.vue'; export default { name: 'app', @@ -26,6 +27,7 @@ export default { AppTimeline, AppFrame, AppPages, + AppHabitica, }, mounted() { this.routeUpdated();