+
-
+
\ No newline at end of file
diff --git a/frontend/pages/dashboard/characters/edit.vue b/frontend/pages/dashboard/characters/edit.vue
new file mode 100644
index 0000000..a34ee85
--- /dev/null
+++ b/frontend/pages/dashboard/characters/edit.vue
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/pages/dashboard/characters/index.vue b/frontend/pages/dashboard/characters/index.vue
new file mode 100644
index 0000000..b3c96f8
--- /dev/null
+++ b/frontend/pages/dashboard/characters/index.vue
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/routes/dashboard/account.ts b/frontend/routes/dashboard/account.ts
index bde5ae8..1b9181c 100644
--- a/frontend/routes/dashboard/account.ts
+++ b/frontend/routes/dashboard/account.ts
@@ -1,9 +1,18 @@
-import Accounts from '@/pages/dashboard/accounts.vue'
+import Accounts from '~/pages/dashboard/accounts/accounts.vue'
+import Edit from '~/pages/dashboard/accounts/edit.vue'
export default [
{
path: '/dashboard/accounts',
component: Accounts,
+ name: 'Dashboard - Find Account',
+ meta: {
+ name: 'dashboard-find-account'
+ }
+ },
+ {
+ path: '/dashboard/account/:name',
+ component: Edit,
name: 'Dashboard - Account',
meta: {
name: 'dashboard-account'
diff --git a/frontend/routes/dashboard/character.ts b/frontend/routes/dashboard/character.ts
new file mode 100644
index 0000000..bae0c86
--- /dev/null
+++ b/frontend/routes/dashboard/character.ts
@@ -0,0 +1,21 @@
+import Character from '~/pages/dashboard/characters/index.vue'
+import Edit from '~/pages/dashboard/characters/edit.vue'
+
+export default [
+ {
+ path: '/dashboard/characters',
+ component: Character,
+ name: 'Dashboard - Find Character',
+ meta: {
+ name: 'dashboard-find-character'
+ }
+ },
+ {
+ path: '/dashboard/character/:name',
+ component: Edit,
+ name: 'Dashboard - Character',
+ meta: {
+ name: 'dashboard-character'
+ }
+ },
+]
\ No newline at end of file
diff --git a/frontend/routes/dashboard/index.ts b/frontend/routes/dashboard/index.ts
index ed034b3..20e6de2 100644
--- a/frontend/routes/dashboard/index.ts
+++ b/frontend/routes/dashboard/index.ts
@@ -1,5 +1,6 @@
import Dashboard from '~/pages/dashboard/index.vue'
import Accounts from '~/routes/dashboard/account'
+import Characters from '~/routes/dashboard/character'
import News from '~/routes/dashboard/news'
export default [
@@ -12,5 +13,6 @@ export default [
}
},
...Accounts,
+ ...Characters,
...News
]
\ No newline at end of file
diff --git a/frontend/store/accounts/account.ts b/frontend/store/accounts/account.ts
index 406a1d2..394c02f 100644
--- a/frontend/store/accounts/account.ts
+++ b/frontend/store/accounts/account.ts
@@ -134,7 +134,7 @@ export default class Account extends VuexModule {
@Action
public async getChangeNameStatus() {
try {
- await $axios.$get('accounts/change-character-name')
+ await $axios.$get('player/change-name')
.then((response) => {
if (!response)
throw new Error("Failed to get status to change name");
@@ -163,7 +163,7 @@ export default class Account extends VuexModule {
@Action
public async changeNameCharacter(payload: UpdatePayload) {
- const status = await $axios.$post('accounts/change-character-name', payload)
+ const status = await $axios.$post('player/change-name', payload)
.then(( response ) => {
if (response.status !== 200)
throw new Error("Failed to change name character");
@@ -180,7 +180,7 @@ export default class Account extends VuexModule {
@Action
public async deleteCharacter(payload: DeletePayload) {
- const status = await $axios.$post('accounts/delete-character', payload)
+ const status = await $axios.$post('player/delete', payload)
.then(( response ) => {
if (response.status !== 200)
throw new Error("Failed to delete character");
diff --git a/frontend/store/dashboard/accounts.ts b/frontend/store/dashboard/accounts.ts
new file mode 100644
index 0000000..76ba64e
--- /dev/null
+++ b/frontend/store/dashboard/accounts.ts
@@ -0,0 +1,123 @@
+import {
+ Module,
+ VuexModule,
+ Mutation,
+ Action
+} from 'vuex-module-decorators'
+
+import { $axios } from '@/utils/nuxt-instance'
+
+interface UpdatePayload {
+ id?: number,
+ name?: string,
+ premdays?: number,
+ email?: string,
+ group_id?: number,
+ web_flags?: number,
+ premium_points?: number,
+ key?: string
+}
+
+interface CharactersPayload {
+ id: number,
+ level: number,
+ name: string,
+ vocation: number
+}
+
+@Module({
+ name: 'dashboard/accounts',
+ stateFactory: true,
+ namespaced: true
+})
+
+export default class Accounts extends VuexModule {
+ private account = {
+ id: undefined,
+ name: undefined,
+ premdays: undefined,
+ email: undefined,
+ group_id: undefined,
+ web_flags: undefined,
+ premium_points: undefined,
+ key: undefined
+ }
+
+ private characters = [];
+
+ public get $account() {
+ return this.account;
+ }
+
+ public get $characters() {
+ return this.characters;
+ }
+
+ @Mutation
+ private UPDATE_ACCOUNT(this: any, payload: UpdatePayload) {
+ this.account = Object.assign(this.account, payload);
+ }
+
+ @Mutation
+ private UPDATE_CHARACTERS(this: any, payload: CharactersPayload[]) {
+ this.characters = payload;
+ }
+
+ @Action
+ public async find(name: string) {
+ try {
+ return await $axios.$get(`dashboard/account/${name}`)
+ .then((response) => {
+ if (response.status !== 200)
+ throw new Error(response);
+
+ this.context.commit('UPDATE_ACCOUNT', {
+ id: response.result.account[0].id,
+ name: response.result.account[0].name,
+ premdays: response.result.account[0].premdays,
+ email: response.result.account[0].email,
+ group_id: response.result.account[0].group_id,
+ web_flags: response.result.account[0].web_flags,
+ premium_points: response.result.account[0].premium_points,
+ key: response.result.account[0].key
+ });
+
+ this.context.commit('UPDATE_CHARACTERS', response.result.characters);
+
+ return {
+ status: response.status,
+ data: response.result.account
+ };
+ })
+ .catch(({ response }) => {
+ return {
+ data: [],
+ status: response
+ };
+ });
+ } catch(err) {
+ return err;
+ }
+ }
+
+ @Action
+ public async update(payload: UpdatePayload) {
+ try {
+ return await $axios.$post('dashboard/account', payload)
+ .then((response) => {
+ if (!response)
+ throw new Error(response);
+
+ return response;
+ })
+ .catch(({ response }) => {
+ return {
+ data: response,
+ status: response.status
+ };
+ });
+ } catch(err) {
+ return err;
+ }
+ }
+}
diff --git a/frontend/store/dashboard/character.ts b/frontend/store/dashboard/character.ts
new file mode 100644
index 0000000..b107a5b
--- /dev/null
+++ b/frontend/store/dashboard/character.ts
@@ -0,0 +1,177 @@
+import {
+ Module,
+ VuexModule,
+ Mutation,
+ Action
+} from 'vuex-module-decorators'
+
+import { $axios } from '@/utils/nuxt-instance'
+import { Character, CharacterSkills } from '@/models'
+
+@Module({
+ name: 'dashboard/character',
+ stateFactory: true,
+ namespaced: true
+})
+
+export default class Characters extends VuexModule {
+ private character = {
+ id: undefined,
+ name: undefined,
+ world_id: undefined,
+ group_id: undefined,
+ account_id: undefined,
+ level: undefined,
+ vocation: undefined,
+ health: undefined,
+ healthmax: undefined,
+ experience: undefined,
+ lookbody: undefined,
+ lookfeet: undefined,
+ lookhead: undefined,
+ looklegs: undefined,
+ looktype: undefined,
+ lookaddons: undefined,
+ maglevel: undefined,
+ mana: undefined,
+ manamax: undefined,
+ manaspent: undefined,
+ soul: undefined,
+ town_id: undefined,
+ posx: undefined,
+ posy: undefined,
+ posz: undefined,
+ cap: undefined,
+ sex: undefined,
+ lastlogin: undefined,
+ lastip: undefined,
+ save: undefined,
+ skull: undefined,
+ skulltime: undefined,
+ rank_id: undefined,
+ guildnick: undefined,
+ lastlogout: undefined,
+ blessings: undefined,
+ pvp_blessing: undefined,
+ balance: undefined,
+ stamina: undefined,
+ direction: undefined,
+ loss_experience: undefined,
+ loss_mana: undefined,
+ loss_skills: undefined,
+ loss_containers: undefined,
+ loss_items: undefined,
+ premend: undefined,
+ online: undefined,
+ marriage: undefined,
+ marrystatus: undefined,
+ promotion: undefined,
+ deleted: undefined,
+ description: undefined,
+ created: undefined,
+ nick_verify: undefined,
+ old_name: undefined,
+ hidden: undefined,
+ worldtransfer: undefined,
+ comment: undefined,
+ show_outfit: undefined,
+ show_eq: undefined,
+ show_bars: undefined,
+ show_skills: undefined,
+ show_quests: undefined,
+ exphist_lastexp: undefined,
+ exphist1: undefined,
+ exphist2: undefined,
+ exphist3: undefined,
+ exphist4: undefined,
+ exphist5: undefined,
+ exphist6: undefined,
+ exphist7: undefined,
+ onlinetimetoday: undefined,
+ onlinetime1: undefined,
+ onlinetime2: undefined,
+ onlinetime3: undefined,
+ onlinetime4: undefined,
+ onlinetime5: undefined,
+ onlinetime6: undefined,
+ onlinetime7: undefined,
+ onlinetimeall: undefined,
+ ip: undefined,
+ cast: undefined,
+ castViewers: undefined,
+ castDescription: null,
+ frags: undefined,
+ offlinetraining_time: undefined,
+ offlinetraining_skill: undefined,
+ broadcasting: undefined,
+ viewers: undefined
+ } as unknown as Character;
+
+ private skills: CharacterSkills[] = [];
+
+ public get $character(): Character {
+ return this.character;
+ }
+
+ public get $skills(): CharacterSkills[] {
+ return this.skills;
+ }
+
+ @Mutation
+ private UPDATE_CHARACTERS(this: any, payload: Character) {
+ this.character = Object.assign(this.character, payload);
+ }
+
+ @Mutation
+ private UPDATE_SKILLS(this: any, payload: CharacterSkills) {
+ this.skills = Object.assign(this.skills, payload);
+ }
+
+ @Action
+ public async find(name: String) {
+ try {
+ return await $axios.$get(`dashboard/character/${name}`)
+ .then((response) => {
+ if (response.status !== 200)
+ throw new Error(response);
+
+ this.context.commit('UPDATE_CHARACTERS', response.result);
+ // this.context.commit('UPDATE_SKILLS', response.result.skills);
+
+ return {
+ status: response.status,
+ data: response.result
+ };
+ })
+ .catch(({ response }) => {
+ return {
+ data: [],
+ status: response
+ };
+ });
+ } catch(err) {
+ return err;
+ }
+ }
+
+ @Action
+ public async update(payload: Character) {
+ try {
+ return await $axios.$post('dashboard/character', payload)
+ .then((response) => {
+ if (!response)
+ throw new Error(response);
+
+ return response;
+ })
+ .catch(({ response }) => {
+ return {
+ data: response,
+ status: response.status
+ };
+ });
+ } catch(err) {
+ return err;
+ }
+ }
+}
diff --git a/frontend/store/dashboard/characterSkills.ts b/frontend/store/dashboard/characterSkills.ts
new file mode 100644
index 0000000..d42b409
--- /dev/null
+++ b/frontend/store/dashboard/characterSkills.ts
@@ -0,0 +1,80 @@
+import {
+ Module,
+ VuexModule,
+ Mutation,
+ Action
+} from 'vuex-module-decorators'
+
+import { $axios } from '@/utils/nuxt-instance'
+import { CharacterSkills } from '@/models'
+
+interface UpdatePayload {
+ id: number,
+ skills: CharacterSkills[]
+}
+
+@Module({
+ name: 'dashboard/characterSkills',
+ stateFactory: true,
+ namespaced: true
+})
+
+export default class CharacterSkill extends VuexModule {
+ private skills: CharacterSkills[] = [];
+
+ public get $skills(): CharacterSkills[] {
+ return this.skills;
+ }
+
+ @Mutation
+ private UPDATE_SKILLS(this: any, payload: CharacterSkills) {
+ this.skills = Object.assign(this.skills, payload);
+ }
+
+ @Action
+ public async find(id: Number) {
+ try {
+ return await $axios.$get(`dashboard/character-skills/${id}`)
+ .then((response) => {
+ if (response.status !== 200)
+ throw new Error(response);
+
+ this.context.commit('UPDATE_SKILLS', response.result);
+
+ return {
+ status: response.status,
+ data: response.result
+ };
+ })
+ .catch(({ response }) => {
+ return {
+ data: [],
+ status: response
+ };
+ });
+ } catch(err) {
+ return err;
+ }
+ }
+
+ @Action
+ public async update(payload: UpdatePayload) {
+ try {
+ return await $axios.$post('dashboard/character-skills', payload)
+ .then((response) => {
+ if (!response)
+ throw new Error(response);
+
+ return response;
+ })
+ .catch(({ response }) => {
+ return {
+ data: response,
+ status: response.status
+ };
+ });
+ } catch(err) {
+ return err;
+ }
+ }
+}
diff --git a/frontend/store/dashboard/index.ts b/frontend/store/dashboard/index.ts
index ff5604f..5d517c4 100644
--- a/frontend/store/dashboard/index.ts
+++ b/frontend/store/dashboard/index.ts
@@ -1,2 +1,5 @@
export { default as Home } from './home';
-export { default as News } from './news';
\ No newline at end of file
+export { default as News } from './news';
+export { default as Accounts } from './accounts';
+export { default as Character } from './character';
+export { default as CharacterSkills } from './characterSkills';
\ No newline at end of file
diff --git a/frontend/store/highscores/ranking.ts b/frontend/store/highscores/ranking.ts
index d8d8862..ff0c6e0 100644
--- a/frontend/store/highscores/ranking.ts
+++ b/frontend/store/highscores/ranking.ts
@@ -14,10 +14,26 @@ import { Paginate } from '@/models'
})
export default class Ranking extends VuexModule {
+ private type = "";
+
+ public get $type() {
+ return this.type;
+ }
+
+ @Mutation
+ private UPDATE_TYPE(type: string) {
+ this.type = type;
+ }
+
+ @Action
+ public setType(type: string) {
+ this.context.commit('UPDATE_TYPE', type);
+ }
+
@Action
- public async getTopRank(payload: Paginate) {
+ public async getTopRank(payload: { page: number, limit: number, type: string}) {
try {
- return await $axios.$get(`highscores/${payload.page}/${payload.limit}`)
+ return await $axios.$get(`highscores/${payload.page}/${payload.limit}/${payload.type || "Experience"}`)
.then((response) => {
if (!response)
throw new Error(response);
diff --git a/frontend/utils/enum.ts b/frontend/utils/enum.ts
index 5388e78..2a3fc9e 100644
--- a/frontend/utils/enum.ts
+++ b/frontend/utils/enum.ts
@@ -62,77 +62,25 @@ export const sex = [
{ value: 1, text: "Female" }
]
-export const routesCommunity = [
- {
- text: "Who is online?",
- to: "/online"
- },
- {
- text: "Lastkills",
- to: "/lastkills"
- },
+export const skulls = [
+ { value: 0, text: "None" },
+ { value: 1, text: "Yellow" },
+ { value: 2, text: "Green" },
+ { value: 3, text: "White" },
+ { value: 4, text: "Red" },
+ { value: 5, text: "Black" },
]
-export const routesAccount = [
- {
- text: "Manage account",
- to: "/accounts"
- },
- {
- text: "Create Character",
- to: "/accounts/create-character"
- },
+export const accountGroups = [
+ { value: 1, text: "Player" },
+ { value: 6, text: "Admin" },
]
-export const routesDashboard = [
- {
- icon: 'mdi-home',
- title: 'Home',
- to: '/dashboard',
- },
- {
- icon: 'mdi-view-dashboard-outline',
- title: 'Customize',
- to: '/dashboard/customize'
- },
- {
- icon: 'mdi-newspaper',
- title: 'News',
- to: '/dashboard/news'
- },
- {
- icon: 'mdi-account-multiple',
- title: 'Accounts',
- to: '/dashboard/accounts'
- },
- {
- icon: 'mdi-account-cowboy-hat',
- title: 'Players',
- to: '/dashboard/players'
- },
- {
- icon: 'mdi-khanda',
- title: 'Guilds',
- to: '/dashboard/guilds'
- },
- {
- icon: 'mdi-axe',
- title: 'Items',
- to: '/dashboard/items'
- },
- {
- icon: 'mdi-rodent',
- title: 'Monsters',
- to: '/dashboard/monsters'
- },
- {
- icon: 'mdi-cart',
- title: 'Shop',
- to: '/dashboard/shop'
- },
- {
- icon: 'mdi-text-box-outline',
- title: 'Logs',
- to: '/dashboard/logs'
- },
-];
\ No newline at end of file
+export const characterGroups = [
+ { value: 1, text: "Player" },
+ { value: 2, text: "Tutor" },
+ { value: 3, text: "Senior Tutor" },
+ { value: 4, text: "GM" },
+ { value: 5, text: "CM" },
+ { value: 6, text: "Admin" },
+]
\ No newline at end of file
diff --git a/frontend/utils/routes.ts b/frontend/utils/routes.ts
new file mode 100644
index 0000000..d1c8182
--- /dev/null
+++ b/frontend/utils/routes.ts
@@ -0,0 +1,76 @@
+export const routesAccount = [
+ {
+ text: "Manage account",
+ to: "/accounts"
+ },
+ {
+ text: "Create Character",
+ to: "/accounts/create-character"
+ },
+]
+
+export const routesCommunity = [
+ {
+ icon: 'mdi-human-queue',
+ text: "Who is online?",
+ to: "/online"
+ },
+ {
+ icon: 'mdi-skull-outline',
+ text: "Lastkills",
+ to: "/lastkills"
+ },
+]
+
+export const routesDashboard = [
+ {
+ icon: 'mdi-home',
+ title: 'Home',
+ to: '/dashboard',
+ },
+ {
+ icon: 'mdi-view-dashboard-outline',
+ title: 'Customize',
+ to: '/dashboard/customize'
+ },
+ {
+ icon: 'mdi-newspaper',
+ title: 'News',
+ to: '/dashboard/news'
+ },
+ {
+ icon: 'mdi-account-multiple',
+ title: 'Accounts',
+ to: '/dashboard/accounts'
+ },
+ {
+ icon: 'mdi-account-cowboy-hat',
+ title: 'Players',
+ to: '/dashboard/characters'
+ },
+ {
+ icon: 'mdi-khanda',
+ title: 'Guilds',
+ to: '/dashboard/guilds'
+ },
+ {
+ icon: 'mdi-axe',
+ title: 'Items',
+ to: '/dashboard/items'
+ },
+ {
+ icon: 'mdi-rodent',
+ title: 'Monsters',
+ to: '/dashboard/monsters'
+ },
+ {
+ icon: 'mdi-cart',
+ title: 'Shop',
+ to: '/dashboard/shop'
+ },
+ {
+ icon: 'mdi-text-box-outline',
+ title: 'Logs',
+ to: '/dashboard/logs'
+ },
+];
\ No newline at end of file
diff --git a/frontend/utils/store-util.ts b/frontend/utils/store-util.ts
index 57f1a4f..1cd7465 100644
--- a/frontend/utils/store-util.ts
+++ b/frontend/utils/store-util.ts
@@ -5,7 +5,10 @@ import Auth from '@/store/auth';
import {
Home as DashboardHome,
- News as DashboardNews
+ News as DashboardNews,
+ Accounts as DashboardAccounts,
+ Character as DashboardCharacters,
+ CharacterSkills as DashboardCharacterSkills
} from '@/store/dashboard'
import {
@@ -45,6 +48,9 @@ let auth: Auth;
let dashboardHome: DashboardHome;
let dashboardNews: DashboardNews;
+let dashboardAccounts: DashboardAccounts;
+let dashboardCharacters: DashboardCharacters;
+let dashboardCharacterSkills: DashboardCharacterSkills;
let news: News;
@@ -71,6 +77,9 @@ const initializeStores = (store: Store
) => {
// Store Dashboard
dashboardHome = getModule(DashboardHome, store);
dashboardNews = getModule(DashboardNews, store);
+ dashboardAccounts = getModule(DashboardAccounts, store);
+ dashboardCharacters = getModule(DashboardCharacters, store);
+ dashboardCharacterSkills = getModule(DashboardCharacterSkills, store);
// Store News
news = getModule(News, store);
@@ -104,6 +113,9 @@ export {
dashboardHome,
dashboardNews,
+ dashboardAccounts,
+ dashboardCharacters,
+ dashboardCharacterSkills,
auth,