matthileo

Untitled

Aug 11th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $$ user.status = function()
  2. {  
  3.     args = quoteArgs(Array.from(arguments));
  4.    
  5.     var charName = getNext("-character",user.currentCharacter);
  6.     character = user.characters[charName];
  7.    
  8.     var hpAdj = getNext("-hp");
  9.     if (hpAdj == "reset") character.sheet.hp = character.sheet.maxHP;
  10.     else if (hpAdj) character.sheet.hp = parseInt(character.sheet.hp) + parseInt(hpAdj);
  11.  
  12.     var spellName = getNext("-spell");
  13.     if (spellName) character.status.concentration.spellname = spellName;
  14.    
  15.     var effect = getNext("-effect");
  16.     if (effect) character.status.concentration.effect = effect;
  17.     var target = getNext("-target");
  18.     if (target) character.status.concentration.target = target;
  19.     var ends = getNext("-ends");
  20.     if (ends) character.status.concentration.ends = ends;
  21.    
  22.     var condition = getNext("-condition");
  23.     if (condition) character.status.condition = condition;
  24.     var conditionEnds = getNext("-conditionends");
  25.     if (conditionEnds) character.status.conditionEnds = conditionEnds;
  26.    
  27.     var stealth = getNext("-stealth");
  28.     if (stealth) character.status.stealth = stealth;
  29.  
  30.     var pos = getNext("-pos");
  31.     if (pos) character.status.position = pos;
  32.    
  33.     if (inArguments(args,"clear"))
  34.     {
  35.         if (inArguments(args,"spell"))
  36.         {
  37.             character.status.concentration.spellname = "none";
  38.             character.status.concentration.effect = "none";
  39.             character.status.concentration.target = "none";
  40.             character.status.concentration.ends = "none";
  41.         }
  42.        
  43.         if (inArguments(args,"condition"))
  44.         {
  45.             character.status.condition = "none";
  46.             character.status.conditionEnds = "none";
  47.         }
  48.        
  49.         character.status.stealth = 0;
  50.         character.status.position = "Outside Combat";
  51.     }
  52.    
  53.     if (!inArguments(args,"silent"))
  54.     {
  55.         displayStatus();
  56.     }
  57. }
  58.  
  59. $$ user.displayStatus = function()
  60. {
  61.     echo("```"+character.sheet.name+"'s Status```");
  62.     echo("**Hit Points: **" + character.sheet.hp + "/" + character.sheet.maxHP + "\n");
  63.     echo("**Position: **" + character.status.position + "\n");
  64.     if (character.status.condition!="none")
  65.     {
  66.         conditionString = character.status.condition;
  67.         if (character.status.conditionEnds!="none")
  68.         {
  69.             conditionString += " (Ends " + character.status.conditionEnds + ")";
  70.         }
  71.         echo("**Condition: **" + conditionString + "\n");
  72.     }
  73.     if (character.status.stealth!=0)
  74.     {
  75.         echo("**Stealth: **" + character.status.stealth + "\n");
  76.     }
  77.     if (character.status.concentration.spellname!="none")
  78.     {
  79.         spellstring = "**Concentration: **" + character.status.concentration.spellname;
  80.         if (character.status.concentration.effect!="none")
  81.         {
  82.             spellstring+= " [" + character.status.concentration.effect + "]";
  83.         }
  84.         if (character.status.concentration.target!="none")
  85.         {
  86.             spellstring+= " on " + character.status.concentration.target;
  87.         }
  88.         if (character.status.concentration.ends!="none")
  89.         {
  90.             spellstring+= " (Ends " + character.status.concentration.ends + ")";
  91.         }
  92.         echo(spellstring + "\n");
  93.     }
  94.     if (inArguments(args,"end"))
  95.     {
  96.         echo("```END TURN```");
  97.     }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment