forked from public/foundryvtt-reve-de-dragon
		
	Recherche TMR par coordonnées
This commit is contained in:
		| @@ -162,7 +162,7 @@ export class RdDCommands { | |||||||
|     if (rollMode === "blindroll") msg["blind"] = true; |     if (rollMode === "blindroll") msg["blind"] = true; | ||||||
|     msg["type"] = 0; |     msg["type"] = 0; | ||||||
|  |  | ||||||
|     let command = commandLine[0]; |     let command = commandLine[0].toLowerCase(); | ||||||
|     let params = commandLine.slice(1); |     let params = commandLine.slice(1); | ||||||
|  |  | ||||||
|     return this.process(command, params, content, msg); |     return this.process(command, params, content, msg); | ||||||
| @@ -317,12 +317,12 @@ export class RdDCommands { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async findTMR(msg, params) { |   async findTMR(msg, params) { | ||||||
|     const flat = Grammar.toLowerCaseNoAccent(Misc.join(params)); |     const search = Misc.join(params, ' '); | ||||||
|     const found = TMRUtility.findTMR(flat); |     const found = TMRUtility.findTMR(search); | ||||||
|     if (found?.length > 0) { |     if (found?.length > 0) { | ||||||
|       return RdDCommands._chatAnswer(msg, `Les TMRs correspondant à '${flat}' sont:` + Misc.join(found.map(it => `<br>${it.coord}: ${it.label}`))); |       return RdDCommands._chatAnswer(msg, `Les TMRs correspondant à '${search}' sont:` + Misc.join(found.map(it => `<br>${it.coord}: ${it.label}`))); | ||||||
|     } |     } | ||||||
|     return RdDCommands._chatAnswer(msg, 'Aucune TMR correspondant à ' + flat); |     return RdDCommands._chatAnswer(msg, 'Aucune TMR correspondant à ' + search); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   | |||||||
| @@ -300,7 +300,7 @@ Hooks.once('diceSoNiceReady', (dice3d) => RdDDice.diceSoNiceReady(dice3d)); | |||||||
| Hooks.on("chatMessage", (html, content, msg) => { | Hooks.on("chatMessage", (html, content, msg) => { | ||||||
|   if (content[0] == '/') { |   if (content[0] == '/') { | ||||||
|     let regExp = /(\S+)/g; |     let regExp = /(\S+)/g; | ||||||
|     let commands = content.toLowerCase().match(regExp); |     let commands = content.match(regExp); | ||||||
|     if (game.system.rdd.commands.processChatCommand(commands, content, msg)) { |     if (game.system.rdd.commands.processChatCommand(commands, content, msg)) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -425,7 +425,8 @@ export class TMRUtility { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   static findTMR(search) { |   static findTMR(search) { | ||||||
|     return TMRUtility.filterTMR(it => Grammar.toLowerCaseNoAccentNoSpace(it.label).match(search)); |     const labelSearch = Grammar.toLowerCaseNoAccent(search) | ||||||
|  |     return TMRUtility.filterTMR(it => Grammar.toLowerCaseNoAccent(it.label).match(labelSearch) || it.coord == search); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   static filterTMRCoord(filter) { |   static filterTMRCoord(filter) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user