mirror of
				https://github.com/em-squared/5e-drs.git
				synced 2025-10-30 21:24:18 +00:00 
			
		
		
		
	outils de création de sorts/monstres/objets
This commit is contained in:
		
							parent
							
								
									6237f0e6a2
								
							
						
					
					
						commit
						a6986c42c6
					
				
					 48 changed files with 2743 additions and 259 deletions
				
			
		|  | @ -5,6 +5,10 @@ import spellFilters from './modules/spellFilters' | |||
| import magicItemFilters from './modules/magicItemFilters' | ||||
| import monsterFilters from './modules/monsterFilters' | ||||
| 
 | ||||
| import mySpells from './modules/mySpells' | ||||
| import myMonsters from './modules/myMonsters' | ||||
| import myMagicItems from './modules/myMagicItems' | ||||
| 
 | ||||
| Vue.use(Vuex) | ||||
| 
 | ||||
| import Cookies from 'js-cookie' | ||||
|  | @ -13,7 +17,10 @@ export default new Vuex.Store({ | |||
|   modules: { | ||||
|     spellFilters, | ||||
|     magicItemFilters, | ||||
|     monsterFilters | ||||
|     monsterFilters, | ||||
|     mySpells, | ||||
|     myMonsters, | ||||
|     myMagicItems | ||||
|   }, | ||||
| 
 | ||||
|   state: { | ||||
|  |  | |||
							
								
								
									
										63
									
								
								docs/.vuepress/store/modules/myMagicItems.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								docs/.vuepress/store/modules/myMagicItems.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,63 @@ | |||
| import {sortByString} from '@theme/util/filterHelpers' | ||||
| 
 | ||||
| export default { | ||||
|   namespaced: true, | ||||
| 
 | ||||
|   state: { | ||||
|     magicItems: [], | ||||
|   }, | ||||
| 
 | ||||
|   getters: { | ||||
|     magicItems: state => state.magicItems, | ||||
|   }, | ||||
| 
 | ||||
|   actions: { | ||||
|     reset: ({ commit }) => { | ||||
|       commit('resetMagicItems') | ||||
|     }, | ||||
|     updateMagicItems: ({ commit }, payload) => { | ||||
|       commit('setMagicItems', payload) | ||||
|     }, | ||||
|     addMagicItem: ({ commit }, payload) => { | ||||
|       commit('addMagicItem', payload) | ||||
|     }, | ||||
|     removeMagicItem: ({ commit }, payload) => { | ||||
|       commit('removeMagicItem', payload) | ||||
|     }, | ||||
|   }, | ||||
| 
 | ||||
|   mutations: { | ||||
|     initialiseStore (state) { | ||||
| 			// Récupération des données utilisateurs depuis le navigateur
 | ||||
| 			if(localStorage.getItem('myMagicItems') && localStorage.getItem('myMagicItems') !== undefined) { | ||||
|         let localStorageData = JSON.parse(localStorage.getItem('myMagicItems')) | ||||
|         state.magicItems = localStorageData.magicItems | ||||
| 			} | ||||
| 		}, | ||||
|     setMagicItems: (state, payload) => { | ||||
|       state.magicItems = payload | ||||
|     }, | ||||
|     resetMagicItems: (state) => { | ||||
|       state.magicItems = [] | ||||
|     }, | ||||
|     addMagicItem: (state, payload) => { | ||||
|       state.magicItems.push(payload) | ||||
|       state.magicItems.sort((a, b) => { return sortByString(a.title, b.title) }) | ||||
|     }, | ||||
|     updateMagicItem: (state, payload) => { | ||||
|       state.magicItems.forEach((magicItem, idx) => { | ||||
|         if (magicItem.key == payload.key) { | ||||
|           state.magicItems[idx] = payload | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     removeMagicItem: (state, payload) => { | ||||
|       state.magicItems.forEach((magicItem, idx) => { | ||||
|         if (magicItem.key == payload.key) { | ||||
|           state.magicItems.splice(idx, 1) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|   } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										63
									
								
								docs/.vuepress/store/modules/myMonsters.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								docs/.vuepress/store/modules/myMonsters.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,63 @@ | |||
| import {sortByString} from '@theme/util/filterHelpers' | ||||
| 
 | ||||
| export default { | ||||
|   namespaced: true, | ||||
| 
 | ||||
|   state: { | ||||
|     monsters: [], | ||||
|   }, | ||||
| 
 | ||||
|   getters: { | ||||
|     monsters: state => state.monsters, | ||||
|   }, | ||||
| 
 | ||||
|   actions: { | ||||
|     reset: ({ commit }) => { | ||||
|       commit('resetMonsters') | ||||
|     }, | ||||
|     updateMonsters: ({ commit }, payload) => { | ||||
|       commit('setMonsters', payload) | ||||
|     }, | ||||
|     addMonster: ({ commit }, payload) => { | ||||
|       commit('addMonster', payload) | ||||
|     }, | ||||
|     removeMonster: ({ commit }, payload) => { | ||||
|       commit('removeMonster', payload) | ||||
|     }, | ||||
|   }, | ||||
| 
 | ||||
|   mutations: { | ||||
|     initialiseStore (state) { | ||||
| 			// Récupération des données utilisateurs depuis le navigateur
 | ||||
| 			if(localStorage.getItem('myMonsters') && localStorage.getItem('myMonsters') !== undefined) { | ||||
|         let localStorageData = JSON.parse(localStorage.getItem('myMonsters')) | ||||
|         state.monsters = localStorageData.monsters | ||||
| 			} | ||||
| 		}, | ||||
|     setMonsters: (state, payload) => { | ||||
|       state.monsters = payload | ||||
|     }, | ||||
|     resetMonsters: (state) => { | ||||
|       state.monsters = [] | ||||
|     }, | ||||
|     addMonster: (state, payload) => { | ||||
|       state.monsters.push(payload) | ||||
|       state.monsters.sort((a, b) => { return sortByString(a.title, b.title) }) | ||||
|     }, | ||||
|     updateMonster: (state, payload) => { | ||||
|       state.monsters.forEach((monster, idx) => { | ||||
|         if (monster.key == payload.key) { | ||||
|           state.monsters[idx] = payload | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     removeMonster: (state, payload) => { | ||||
|       state.monsters.forEach((monster, idx) => { | ||||
|         if (monster.key == payload.key) { | ||||
|           state.monsters.splice(idx, 1) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|   } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										63
									
								
								docs/.vuepress/store/modules/mySpells.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								docs/.vuepress/store/modules/mySpells.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,63 @@ | |||
| import {sortByString} from '@theme/util/filterHelpers' | ||||
| 
 | ||||
| export default { | ||||
|   namespaced: true, | ||||
| 
 | ||||
|   state: { | ||||
|     spells: [], | ||||
|   }, | ||||
| 
 | ||||
|   getters: { | ||||
|     spells: state => state.spells, | ||||
|   }, | ||||
| 
 | ||||
|   actions: { | ||||
|     reset: ({ commit }) => { | ||||
|       commit('resetSpells') | ||||
|     }, | ||||
|     updateSpells: ({ commit }, payload) => { | ||||
|       commit('setSpells', payload) | ||||
|     }, | ||||
|     addSpell: ({ commit }, payload) => { | ||||
|       commit('addSpell', payload) | ||||
|     }, | ||||
|     removeSpell: ({ commit }, payload) => { | ||||
|       commit('removeSpell', payload) | ||||
|     }, | ||||
|   }, | ||||
| 
 | ||||
|   mutations: { | ||||
|     initialiseStore (state) { | ||||
| 			// Récupération des données utilisateurs depuis le navigateur
 | ||||
| 			if(localStorage.getItem('mySpells') && localStorage.getItem('mySpells') !== undefined) { | ||||
|         let localStorageData = JSON.parse(localStorage.getItem('mySpells')) | ||||
|         state.spells = localStorageData.spells | ||||
| 			} | ||||
| 		}, | ||||
|     setSpells: (state, payload) => { | ||||
|       state.spells = payload | ||||
|     }, | ||||
|     resetSpells: (state) => { | ||||
|       state.spells = [] | ||||
|     }, | ||||
|     addSpell: (state, payload) => { | ||||
|       state.spells.push(payload) | ||||
|       state.spells.sort((a, b) => { return sortByString(a.title, b.title) }) | ||||
|     }, | ||||
|     updateSpell: (state, payload) => { | ||||
|       state.spells.forEach((spell, idx) => { | ||||
|         if (spell.key == payload.key) { | ||||
|           state.spells[idx] = payload | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     removeSpell: (state, payload) => { | ||||
|       state.spells.forEach((spell, idx) => { | ||||
|         if (spell.key == payload.key) { | ||||
|           state.spells.splice(idx, 1) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|   } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Maxime Moraine
						Maxime Moraine