Skip to content

Commit 538a0a9

Browse files
committed
Earthdawn v3.3301
1 parent 5caf9f0 commit 538a0a9

File tree

1 file changed

+28
-20
lines changed
  • Earthdawn (FASA Official) character sheet companion/03.330

1 file changed

+28
-20
lines changed

Earthdawn (FASA Official) character sheet companion/03.330/Earthdawn.js

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,11 +2051,12 @@ Earthdawn.timeStamp = function () {
20512051
Earthdawn.tokenRefresh = function ( obj ) { // token object
20522052
'use strict';
20532053
try {
2054-
if( obj && obj.get( "name" )) { // Ignore any token without a name (probably not a real token.
2054+
// if( obj && obj.get( "name" )) { // Ignore any token without a name (probably not a real token. Don't do this. name is often blank.
2055+
if( obj && obj.get( "_subtype" ) === "token") {
20552056
//log( "refreshing token " + obj.get("name"));
20562057
let rep = obj.get( "represents" );
20572058
if( rep && rep != "" ) {
2058-
let ch = getObj( "character", rep)
2059+
let ch = getObj( "character", rep );
20592060
if( ch ) {
20602061
let ED = new Earthdawn.EDclass();
20612062
let edParse = new ED.ParseObj( ED );
@@ -10283,23 +10284,24 @@ log("Record Obsolete code. If you see this except on an 1879 sheet, please repor
1028310284
else {
1028410285
let ci = bi3[ i ].split( "," ), // typically of the form: "Cast, pre" or "Cast, code, Rid"
1028510286
code, rid, pre;
10286-
if( ci[ 1 ].trim().startsWith( "repeating_" ) ) { // we have a pre
10287-
pre = ci[ 1 ];
10288-
rid = Earthdawn.repeatSection( 2, ci [ 1 ]);
10289-
code = Earthdawn.repeatSection( 3, ci[ 1 ]);
10290-
} else if( ci[ 1 ] === "noRid" ) { // This is just to keep it from going into the else.
10291-
pre = code = rid = undefined;
10292-
} else if( Earthdawn.codeToName( ci[ 1 ], true ) && ci.length > 2 ) { // we have a code, and a rid
10293-
code = ci[ 1 ];
10294-
rid = ci[ 2 ];
10295-
pre = Earthdawn.buildPre( code, rid);
10296-
} else { // we probably just have a rid so assume "T"
10297-
code = "T";
10298-
rid = ci[ 1 ];
10299-
pre = Earthdawn.buildPre( code, rid);
10300-
}
10287+
if( ci.length > 1 ) {
10288+
if( Earthdawn.safeString( ci[ 1 ] ).trim().startsWith( "repeating_" ) ) { // we have a pre
10289+
pre = ci[ 1 ];
10290+
rid = Earthdawn.repeatSection( 2, ci [ 1 ]);
10291+
code = Earthdawn.repeatSection( 3, ci[ 1 ]);
10292+
} else if( ci[ 1 ] === "noRid" ) { // This is just to keep it from going into the else.
10293+
pre = code = rid = undefined;
10294+
} else if( Earthdawn.codeToName( ci[ 1 ], true ) && ci.length > 2 ) { // we have a code, and a rid
10295+
code = ci[ 1 ];
10296+
rid = ci[ 2 ];
10297+
pre = Earthdawn.buildPre( code, rid);
10298+
} else { // we probably just have a rid so assume "T"
10299+
code = "T";
10300+
rid = ci[ 1 ];
10301+
pre = Earthdawn.buildPre( code, rid);
10302+
} }
1030110303
let sendon = (code === "T") ? rid : pre; // if it is a talent, just send the rowID, otherwise send on the entire pre from which the code and rid can be derived.
10302-
switch( ci[ 0 ].trim() ) {
10304+
switch( Earthdawn.safeString( ci[ 0 ] ).trim() ) {
1030310305
case "Cast":
1030410306
t += Earthdawn.makeButton( Earthdawn.getAttrBN( po.charID, pre + "Name", "")
1030510307
, "!Earthdawn~ charID: " + po.charID + "~ Target:" + spellseq.spelldata.Casting + "~ ForEach: inmt~ " + getKask( pre )
@@ -10339,6 +10341,10 @@ log("Record Obsolete code. If you see this except on an 1879 sheet, please repor
1033910341
case "RankMissing":
1034010342
t += "Spellcasting Talent Missing!";
1034110343
break;
10344+
case "reset": // We might get a reset inside a txt.
10345+
t += Earthdawn.makeButton( "Reset", "!Earthdawn~ charID: " + po.charID + "~ ForEach: inmt~ Spell: " + ssa[ 1 ] + ": Reset: " + ssa[ ssa.length -1 ],
10346+
"Press this button to Reset the Spell Sequence.", "param2");
10347+
break;
1034210348
case "Weave":
1034310349
t += Earthdawn.makeButton( Earthdawn.getAttrBN( po.charID, pre + "Name", ""), "!Earthdawn~ charID: " + po.charID + "~ ForEach: inmt~ " + getKask( pre )
1034410350
+ " Spell: " + ssa[ 1 ] + ": Weave: " + sendon + ": "+ssa[ ssa.length -1 ], "Weave using this Talent." + sp2, "param");
@@ -10352,6 +10358,8 @@ log("Record Obsolete code. If you see this except on an 1879 sheet, please repor
1035210358
t += Earthdawn.makeButton( Earthdawn.getAttrBN( po.charID, pre + "Name", ""), "!Earthdawn~ charID: " + po.charID + "~ ForEach: inmt~ " + getKask( pre )
1035310359
+ "Spell: " + ssa[ 1 ] + ": Effect: " + sendon + ": " + ssa[ ssa.length -1 ], "Effect Test using this Talent, or directly with WIL." + sp2, "param");
1035410360
break;
10361+
default:
10362+
t += Earthdawn.safeString( ci[ 0 ] ).trim() + ": ";
1035510363
} } }
1035610364
break; // end wv, cst, fx.
1035710365
// continuing switch (what)
@@ -10500,10 +10508,10 @@ Range : 20 yards"
1050010508
case "Circle": txtfx = addit( txtfx, "CircleMissing" ); break;
1050110509
case "Rank": txtfx = addit( txtfx, "RankMissing" ); break;
1050210510
case "Wil": txtfx = addit( txtfx, wilselect ); break;
10503-
default: txtfx = Earthdawn.getAttrBN( po.charID, presp + "Effect", "None") + " " + addit( txtfx, "reset" );
10511+
default: txtfx = addit( txtfx, Earthdawn.getAttrBN( po.charID, presp + "Effect", "None") );
10512+
txtfx = addit( txtfx, "reset" ); break;
1050410513
}
1050510514

10506-
1050710515
// Main Spell() switch statement.
1050810516
switch( ssa[ 2 ] ) {
1050910517
case "Sequence": { //This is the master sequence... Where the magic happens

0 commit comments

Comments
 (0)