Bonjour j'ai dans ma feuille de personnage un système (basique) d'expérience pour chaque compétence. je les donc répéter pour chacune d'entre elle. Serait-t'il possible d'avoir une petite portion de code qui s'appliquerait pour tout les compétence? Voici mon code actuelle: Merci a vous! Hello I have in my character sheet a system (basic) of experience for each skill. I repeat them for each of them. Would it be possible to have a small portion of code that would apply for all skill?
Here is my code: Thank you! EDIT: Thanks for this G G work perfectly
<script type="text/worker">
on("change:xpl_maniementépée", function() {
getAttrs(["xpl_maniementépée","xpl_maniementépée_max","lv_maniementépée"], function(values) {
const xpl = parseInt(values.xpl_maniementépée);
const xplmax = parseInt(values.xpl_maniementépée_max);
const lv = parseInt(values.lv_maniementépée);
if (xpl >= xplmax) {
setAttrs({
xpl_Maniementépée: xpl - xplmax,
lv_Maniementépée: lv + 1,
xpl_Maniementépée_max: (lv*200) + 100 // lv is still the old level
});
};
});
});
on("change:xpl_constitution", function() {
getAttrs(["xpl_constitution","xpl_constitution_max","lv_constitution"], function(values) {
const xpl = parseInt(values.xpl_constitution);
const xplmax = parseInt(values.xpl_constitution_max);
const lv = parseInt(values.lv_constitution);
if(xpl >= xplmax){
setAttrs({
xpl_constitution: xpl - xplmax,
lv_constitution: lv + 1,
xpl_constitution_max: (lv*200) + 100
});
};
});
});
on("change:xpl_diplomatie", function() {
getAttrs(["xpl_diplomatie","xpl_diplomatie_max","lv_diplomatie"], function(values) {
const xpl = parseInt(values.xpl_diplomatie);
const xplmax = parseInt(values.xpl_diplomatie_max);
const lv = parseInt(values.lv_diplomatie);
if(xpl >= xplmax){
setAttrs({
xpl_diplomatie: xpl - xplmax,
lv_diplomatie: lv + 1,
xpl_diplomatie_max: (lv*200) + 100
});
};
});
});
on("change:xpl_acrobatie", function() {
getAttrs(["xpl_acrobatie","xpl_acrobatie_max","lv_acrobatie"], function(values) {
const xpl = parseInt(values.xpl_acrobatie);
const xplmax = parseInt(values.xpl_acrobatie_max);
const lv = parseInt(values.lv_acrobatie);
if(xpl >= xplmax){
setAttrs({
xpl_acrobatie: xpl - xplmax,
lv_acrobatie:lv + 1,
xpl_acrobatie_max:(lv*100) + 100
});
};
});
});
on("change:xpl_force", function() {
getAttrs (["xpl_force","xpl_force_max","lv_force"], function(values){
const xpl = parseInt(values.xpl_force);
const xplmax = parseInt(values.xpl_force_max);
const lv = parseInt(values.lv_force);
if(xpl >= xplmax){
setAttrs({
xpl_force: xpl - xplmax,
lv_force:lv + 1,
xpl_force_max:(lv*100) + 100
});
};
});
});
on("change:xpl_sensaiguise", function() {
getAttrs (["xpl_sensaiguise","xpl_sensaiguise_max","lv_sensaiguise"], function(values){
const xpl = parseInt(values.xpl_sensaiguise);
const xplmax = parseInt(values.xpl_sensaiguise_max);
const lv = parseInt(values.lv_sensaiguise);
if(xpl >= xplmax){
setAttrs({
xpl_sensaiguise: xpl - xplmax,
lv_sensaiguise:lv + 1,
xpl_sensaiguise_max:(lv*100) + 100
});
};
});
});
on("change:xpl_apprentissagetechnologie", function() {
getAttrs (["xpl_apprentissagetechnologie","xpl_apprentissagetechnologie_max","lv_apprentissagetechnologie"], function(values){
const xpl = parseInt(values.xpl_apprentissagetechnologie);
const xplmax = parseInt(values.xpl_apprentissagetechnologie_max);
const lv = parseInt(values.lv_apprentissagetechnologie);
if(xpl >= xplmax){
setAttrs({
xpl_apprentissagetechnologie: xpl - xplmax,
lv_apprentissagetechnologie:lv + 1,
xpl_apprentissagetechnologie_max:(lv*100) + 100
});
};
});
});
on("change:xpl_forgearmure",function() {
getAttrs (["xpl_forgearmure","xpl_forgearmure_max","lv_forgearmure"], function(values){
const xpl = parseInt(values.xpl_forgearmure);
const xplmax = parseInt(values.xpl_forgearmure_max);
const lv = parseInt(values.lv_forgearmure);
if(xpl >= xplmax){
setAttrs({
xpl_forgearmure: xpl - xplmax,
lv_forgearmure:lv + 1,
xpl_forgearmure_max:(lv*100) + 100
});
};
});
});
on("change:xpl_estimation", function() {
getAttrs (["xpl_estimation","xpl_estimation_max","lv_estimation"], function(values){
const xpl = parseInt(values.xpl_estimation);
const xplmax = parseInt(values.xpl_estimation_max);
const lv = parseInt(values.lv_estimation);
if(xpl >= xplmax){
setAttrs({
xpl_estimation: xpl - xplmax,
lv_estimation:lv + 1,
xpl_estimation_max:(lv*100) + 100
});
};
});
});
on("change:xpl_connaissancecode", function() {
getAttrs (["xpl_connaissancecode","xpl_connaissancecode_max","lv_connaissancecode"], function(values){
const xpl = parseInt(values.xpl_connaissancecode);
const xplmax = parseInt(values.xpl_connaissancecode_max);
const lv = parseInt(values.lv_connaissancecode);
if(xpl >= xplmax){
setAttrs({
xpl_connaissancecode: xpl - xplmax,
lv_connaissancecode:lv + 1,
xpl_connaissancecode_max:(lv*100) + 100
});
};
});
});
on("change:xpl_dex", function() {
getAttrs (["xpl_dex","xpl_dex_max","lv_dex"], function(values){
const xpl = parseInt(values.xpl_dex);
const xplmax = parseInt(values.xpl_dex_max);
const lv = parseInt(values.lv_dex);
if(xpl >= xplmax){
setAttrs({
xpl_dex: xpl - xplmax,
lv_dex:lv + 1,
xpl_dex_max:(lv*100) + 100
});
};
});
});
on("change:xpl_multitache", function() {
getAttrs (["xpl_multitache","xpl_multitache_max","lv_multitache"], function(values){
const xpl = parseInt(values.xpl_multitache);
const xplmax = parseInt(values.xpl_multitache_max);
const lv = parseInt(values.lv_multitache);
if(xpl >= xplmax){
setAttrs({
xpl_multitache: xpl - xplmax,
lv_multitache:lv + 1,
xpl_multitache_max:(lv*100) + 100
});
};
});
});
</script>