33<meta charset="UTF-8">
44
55<!--
6- v3.49 20250803
6+ v3.50 20251116
77
88
99Character Sheet For Earthdawn Developped by JBF (Discord/Facebook Jiboux Faure) v2.
43914391 <span class="sheet-HideIfNotCloseChecked">
43924392 <input name="attr_T_LinksGetValue" class="sheet-hidden sheet-testCloseChecked" type="checkbox" checked value="">
43934393 <span class="sheet-HideIfCloseChecked sheet-stepSpan sheet-bordered-bottom"> <!--Free Talent, Link Existing, Rank is readonly-->
4394- <input name="attr_T_LinkValue " readonly value="0" min="0" class="sheet-Big sheet-numShorter sheet-HideSpinners" title="@{repeating_talents_X_T_LinkValue}: Characters Base Rank in this talent." type="number" >
4394+ <input name="attr_T_Rank " readonly value="0" min="0" class="sheet-Big sheet-numShorter sheet-HideSpinners" title="@{repeating_talents_X_T_LinkValue}: Characters Base Rank in this talent." type="number" >
43954395 <span title="@{repeating_talents_X_T_Rank-Adjust}: Adjustments to the use of this talent that increases effective rank like Thread Items.">
43964396 <input name="attr_T_Rank-Adjust" type="hidden" class="sheet-redGreen" value="0">
43974397 <b class="sheet-buffSignRight sheet-buffSmall">+</b>
1343413434<!-- WORKERS -->
1343513435<script type="text/worker">
1343613436
13437- var SheetVersion=3.49 ;
13437+ var SheetVersion=3.50 ;
1343813438
1343913439// This is Test code to see if worker threads are active (working). If wt-test1 changes, change wt-test2. if wt-test2 does not update, sheetworkers are not working.
1344013440on("change:wt-test1", function ocwttest1() {
1569115691 let link = 0, link2 = 0, vals = {}, val;
1569215692 for ( let i = 0; i < linkInArray.length; ++i ) {
1569315693 if( repeatSection( 3, linkInArray[ i ]).toUpperCase() == "DSP" && values[ strog ] == "Free" )
15694- link2 += getInt(values2, linkInArray [ i ]); //for Free Talents Discipline links are summed in the Rank, not in the LinkedValue
15694+ link2 += getInt(values2, linkInArray [ i ]); //for Free Talents Discipline links are summed in the Rank, not in the LinkValue
1569515695 else
1569615696 link += getInt(values2, linkInArray [ i ]);
1569715697 };
@@ -17325,12 +17325,17 @@
1732517325 on("clicked:newday", fn(function ocNewDay() {
1732617326 'use strict';
1732717327 try{
17328- getAttrs([ "Karma_max","Karma", "Recovery-Tests","Recovery-Tests_max", "Misc-KarmaRitual", "working-Circle","Karma-Modifier" ,"KarmaRitual-Rank","DP","DP_max","IsQuestor","Misc-DPRitual"], function(values) {
17328+ getAttrs([ "Karma_max","Karma", "Recovery-Tests","Recovery-Tests_max", "Misc-KarmaRitual", "working-Circle","Karma-Modifier" ,"KarmaRitual-Rank","DP","DP_max","IsQuestor","Misc-DPRitual","Wounds","Damage","Misc-NewDayRecoveryOffset","Misc-NewDayKarmaOffset" ], function(values) {
1732917329 let vals = {};
1733017330 let ritual =getInt(values, "Misc-KarmaRitual"),
17331- dpritual=getInt(values, "Misc-DPRitual");
17332- //Function Refills Recovery Tests to Max
17333- vals["Recovery-Tests"] = Math.max (getInt(values,"Recovery-Tests"),getInt(values,"Recovery-Tests_max"));
17331+ dpritual=getInt(values, "Misc-DPRitual"),
17332+ curewound=(getInt(values,"Damage")<=0 && getInt(values,"Wounds")>0);
17333+ //Function Refills Recovery Tests to Max with Offset and taking into account curing a Wound
17334+ vals["Recovery-Tests"] = Math.max (getInt(values,"Recovery-Tests"),getInt(values,"Recovery-Tests_max")) -getInt(values,"Misc-NewDayRecoveryOffset");
17335+ if(curewound){
17336+ vals["Recovery-Tests"]-=1;
17337+ vals["Wounds"]=getInt(values,"Wounds")-1;
17338+ }
1733417339 switch( dpritual )
1733517340 {
1733617341 case 0 : break; // 0 : No DP with NewDay Ritual
1734917354 case -4 : vals["Karma"] = Math.min (getInt(values,"Karma_max"),getInt(values,"Karma")+getInt(values,"KarmaRitual-Rank")); break; //For ED3, Create a Karma Ritual Talent (with T_Type)
1735017355 default : vals["Karma"] = Math.min (getInt(values,"Karma_max"),getInt(values,"Karma")+getInt(values,"Misc-KarmaRitual")); //Homerule : refill fixed per day
1735117356 }
17357+ vals["Karma"]-=getInt(values,"Misc-NewDayKarmaOffset");
1735217358 setAttrsLog(vals);
1735317359 });
1735417360 } catch( err ) { errlog( "Earthdawn:ocNewDay() error caught: " + err ); }
2012820134
2012920135} // End ver 3.49
2013020136
20137+ else if( fromSheetVersion < 3.50 ) {
20138+ toSheetVersion = 3.50;
20139+
20140+ var newNotes = "Earthdawn by FASA Character Sheet version: " + toSheetVersion + " by Chris Dickey and JB Faure .\n"
20141+ // Note: Put update stuff here.
20142+ + "Access the WIKI by pressing the red '?' button at the top right of the character name. "
20143+ + "New Day is now curing your wounds ( As RAW : 1 per Newday, If Damage=0 , Costs 1 Recovery) .\n"
20144+ + "Your Creation Ranks are now saved in the Journal for future reference .\n"
20145+ //+ "A new function to import from Steps. Thanks Lars !!!.\n"
20146+
20147+
20148+ + notes;
20149+ // Comment this line out if not to change tab to force release notes visible.
20150+ showNotes = (showNotes === -1) ? -1 : 1;
20151+
20152+
20153+ let i,pre,newflags="";
20154+ let getV=[];
20155+
20156+
20157+ getAttrs( getV , function gaUpdateCharacterSheet(values) {
20158+ 'use strict';
20159+
20160+
20161+
20162+ if( Object.keys(vals).length > 0 ) // If the code above just changed some values, do those before making the recursive call.
20163+ setAttrsLog( vals, undefined , function fnUpdateCharactersheetSetAttrsLog( vals ) {
20164+ 'use strict';
20165+ updateCharactersheet( newSheetVersion, toSheetVersion, origSheetVersion, recurse + 1, values, showNotes, newNotes, newflags); // Recursively call this routine to do any subsequent updates.
20166+ });
20167+ else{
20168+ updateCharactersheet( newSheetVersion, toSheetVersion, origSheetVersion, recurse + 1, values, showNotes, newNotes, newflags); // Recursively call this routine to do any subsequent updates.
20169+ }
20170+ });
20171+
20172+ } // End ver 3.50
20173+
20174+
2013120175 else {
2013220176
2013320177 vals[ "edition_max" ] = newSheetVersion.toString();
2149921543
2150021544on("clicked:endcreation_post", fn(function ocEndAndPost() {
2150121545 'use strict';
21502- getAttrs([ "Per-Step","LP-Calc", "Spells-Costs", "NPC" ,"Karma_max" , "Recovery-Tests_max" , "DP_max"], function(values) {
21546+ getAttrs([ "Per-Step","LP-Calc", "Spells-Costs", "NPC" ,"Karma_max" , "Recovery-Tests_max" , "DP_max", "LP-Summary","record-journal" ], function(values) {
2150321547 let vals = {};
2150421548 // vals["show_tips"] = values["NPC"]=="0"? "1" :"0";
2150521549 vals[ "tab" ] = values["NPC"]=="0"? "11" :"1";
2151321557 vals["Damage"]=0;
2151421558 vals["Wounds"]=0;
2151521559 vals["Wounds_max"]=8;
21560+ vals["record-journal"]=values["record-journal"] + "\n*********************** Ranks at Creation stored in the Creation Offset ***********\n" + values["LP-Summary"];
2151621561
2151721562 vals["Recovery-Tests"]=values["Recovery-Tests_max"];
2151821563 setAttrsLog(vals);
@@ -21522,11 +21567,12 @@
2152221567
2152321568on("clicked:set_lp_offset", fn(function ocSetLPOffset() {
2152421569 'use strict';
21525- getAttrs([ "LP-Current","LP-Total", "LP-Calc"], function(values) {
21570+ getAttrs([ "LP-Current","LP-Total", "LP-Calc", "LP-Summary","record-journal" ], function(values) {
2152621571 let vals = {};
2152721572
2152821573 vals["LP-CreationOffset"]=getInt(values,"LP-Current")-getInt(values,"LP-Total")+getInt(values,"LP-Calc");
2152921574 vals["LP-CreationOffset-Spells"]=0;
21575+ vals["record-journal"]=values["record-journal"] +"\n*********************** Ranks at Creation stored in the Creation Offset ***********\n" + values["LP-Summary"];
2153021576 setAttrsLog(vals);
2153121577 });
2153221578})); //End ocEndCreationAndPost
2509125137 for( let i = 0; i < tarray.length; i++) {
2509225138 attarray.push( buildPre( "T", tarray[ i ] ) + "Rank");
2509325139 attarray.push( buildPre( "T", tarray[ i ] ) + "Type");
25094- attarray.push( buildPre( "T", tarray[ i ] ) + "LinkedValue ");
25140+ attarray.push( buildPre( "T", tarray[ i ] ) + "LinkValue ");
2509525141 attarray.push( buildPre( "T", tarray[ i ] ) + "Name");
2509625142 }
2509725143 getSectionIDsOrdered("repeating_discipline", function gsIdRepeatingTalents(darray) {
2518425230
2518525231 for( let i = 0; i < tarray.length; i++){
2518625232 pre=buildPre( "T", tarray[ i ] );
25187- let rk= ((values[ pre + "Type"] =="Free") ? values[ pre + "LinkedValue"] : values[ pre + "Rank"])||"0";
25233+ // let rk= ((values[ pre + "Type"] =="Free") ? values[ pre + "LinkValue"] : values[ pre + "Rank"])||"0";
25234+ let rk= getInt(values,pre+"Rank");
25235+
2518825236 entry={ "name": safeString( values[pre + "Name"] ).replace(/[\(\[].*[\)\]]/g,"").trim().replace("\'","’")||"" , "rank" : rk };
2518925237 charray.push(entry);
2519025238 let ty=values[pre+"Type"];
0 commit comments