|
|
|
import { initialWeapon, initialArmor, initialNeck, initialRing, i18n, archive_name, audio_mp3 } from '@/config';
|
|
|
|
import { conisOfsell } from '@/tool';
|
|
|
|
import { Base64 } from 'js-base64';
|
|
|
|
|
|
|
|
const backgound = new Audio(audio_mp3.background);
|
|
|
|
backgound.loop = true;
|
|
|
|
backgound.volume = 0.2;
|
|
|
|
const battle = new Audio(audio_mp3.battle);
|
|
|
|
battle.loop = true;
|
|
|
|
battle.volume = 0.2;
|
|
|
|
const music = {
|
|
|
|
backgound: backgound,
|
|
|
|
battle: battle,
|
|
|
|
};
|
|
|
|
|
|
|
|
const { t } = i18n;
|
|
|
|
|
|
|
|
export const play_music = (store, type) => {
|
|
|
|
Object.keys(music).forEach((key) => {
|
|
|
|
const audio = music[key];
|
|
|
|
if (key == type) {
|
|
|
|
audio.play();
|
|
|
|
} else {
|
|
|
|
audio.pause();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export const set_music_muted = (store, muted) => {
|
|
|
|
Object.keys(music).forEach((key) => {
|
|
|
|
music[key].muted = muted;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export const set_music_volume = (store, volume) => {
|
|
|
|
Object.keys(music).forEach((key) => {
|
|
|
|
music[key].volume = volume;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export const reset_player_equi = ({ commit }) => {
|
|
|
|
const equips = [initialWeapon(), initialArmor(), initialNeck(), initialRing()];
|
|
|
|
commit('set_player_equips', equips);
|
|
|
|
commit('set_player_lv', 1);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const sell_equip = ({ state, commit }, index) => {
|
|
|
|
const item = state.grid[index];
|
|
|
|
if (item.locked) {
|
|
|
|
commit('set_sys_info', { msg: t('sellLocked'), type: 'warning' });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const coins = conisOfsell(item);
|
|
|
|
const tmp = state.grid;
|
|
|
|
tmp[index] = null;
|
|
|
|
commit('add_player_coins', coins);
|
|
|
|
commit('set_backpack', tmp);
|
|
|
|
commit('set_sys_info', { msg: `${t('sellEquip')}${coins}`, type: 'booty' });
|
|
|
|
};
|
|
|
|
|
|
|
|
export const useEquip = ({ state, commit }, index) => {
|
|
|
|
const grid = state.grid;
|
|
|
|
const tmp = grid[index];
|
|
|
|
const type = tmp.type;
|
|
|
|
grid[index] = state.playerAttribute[type];
|
|
|
|
commit('set_player_equips', [tmp]);
|
|
|
|
commit('set_backpack', grid);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const saveGame = ({ state, commit }) => {
|
N多功能新增与调整
1.新增装备属性:伤害加成,伤害减免,暴击避免,爆伤减免,移动速度,转生属性副本行进速度更改为移动速度
2.新增装备类型:饰品,裤子,鞋子,护腕
3.新增装备品质:多彩,多彩品质装备拥有独特的主被动技能
4.新增部分多彩品质装备(暂无产出途径)
5.调整战斗逻辑,适配新增属性和技能
6.调整护甲减伤比例(调低)
7.调整格挡属性数值(调低)
8.调整暴击率和暴击伤害数值随装备等级线性增长(1级为原来一半,100级与原来相等)
9.调整转生点对移动速度的加成(调低)
10.新增装备图标资源
11.装备图鉴显示方式调整
3 months ago
|
|
|
const player = state.playerAttribute;
|
|
|
|
const data = {
|
N多功能新增与调整
1.新增装备属性:伤害加成,伤害减免,暴击避免,爆伤减免,移动速度,转生属性副本行进速度更改为移动速度
2.新增装备类型:饰品,裤子,鞋子,护腕
3.新增装备品质:多彩,多彩品质装备拥有独特的主被动技能
4.新增部分多彩品质装备(暂无产出途径)
5.调整战斗逻辑,适配新增属性和技能
6.调整护甲减伤比例(调低)
7.调整格挡属性数值(调低)
8.调整暴击率和暴击伤害数值随装备等级线性增长(1级为原来一半,100级与原来相等)
9.调整转生点对移动速度的加成(调低)
10.新增装备图标资源
11.装备图鉴显示方式调整
3 months ago
|
|
|
equips: [player.weapon, player.armor, player.ring, player.neck, player.jewelry, player.pants, player.shoes, player.bracers],
|
|
|
|
lv: player.lv,
|
|
|
|
coins: player.coins,
|
|
|
|
backpack: state.grid,
|
|
|
|
autoSell: state.autoSell,
|
|
|
|
shop: state.shop,
|
|
|
|
reborn: state.rebornPoints,
|
|
|
|
};
|
|
|
|
var saveData = Base64.encode(Base64.encode(JSON.stringify(data)));
|
|
|
|
localStorage.setItem(archive_name, saveData);
|
|
|
|
commit('set_sys_info', { msg: t('saveGame.2'), type: 'win' });
|
|
|
|
};
|
|
|
|
|
|
|
|
export const loadGame = ({ commit }, data?) => {
|
|
|
|
if (!data) {
|
|
|
|
try {
|
|
|
|
const archive = localStorage.getItem(archive_name) || '';
|
|
|
|
data = JSON.parse(Base64.decode(Base64.decode(archive)));
|
|
|
|
} catch (error) {}
|
|
|
|
}
|
|
|
|
if (!data) {
|
|
|
|
commit('set_sys_info', { msg: t('loadEmpty'), type: 'warning' });
|
|
|
|
} else if (data == 'undfind') {
|
|
|
|
commit('set_sys_info', { msg: t('loadError'), type: 'warning' });
|
|
|
|
} else {
|
|
|
|
commit('set_player_equips', data.equips);
|
|
|
|
commit('set_player_lv', data.lv || 1);
|
|
|
|
commit('set_player_coins', data.coins || 0);
|
|
|
|
commit('set_backpack', data.backpack);
|
|
|
|
commit('set_auto_sell', data.autoSell);
|
|
|
|
commit('set_shop', data.shop);
|
|
|
|
data.reborn && (data.reborn.recoverSpeed = 0);
|
|
|
|
commit('set_reborn_points', data.reborn);
|
|
|
|
commit('set_sys_info', { msg: t('loadSuccess'), type: 'win' });
|
|
|
|
}
|
|
|
|
commit('call_player_attribute');
|
|
|
|
};
|