Evolution/Skill Tree/load/doc

From Portals of Phereon Wiki
Revision as of 03:30, 24 December 2021 by Kozd (talk | contribs) (Created page with "Pre-script preparation: Find \r\n and replace with (empty) in regex mode (text mode) Script operation: #Open web console #Set the file text, type and copy the text inside the single quotes for each skill tree #:<syntaxhighlight lang="javascript"> let skillText = { "Centaur": TEXT FROM SKILL FILE HERE, "PlantGirl": 'TEXT FROM SKILL FILE HERE', "Mermaid": 'TEXT FROM SKILL FILE HERE', "LavaGirl": 'TEXT FROM SKILL FILE HERE', "Lymean": 'TEXT FROM SKILL FILE HERE'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Pre-script preparation:

Find \r\n and replace with (empty) in regex mode (text mode)

Script operation:

  1. Open web console
  2. Set the file text, type and copy the text inside the single quotes for each skill tree
    let skillText = {
      "Centaur": TEXT FROM SKILL FILE HERE,
      "PlantGirl": 'TEXT FROM SKILL FILE HERE',
      "Mermaid": 'TEXT FROM SKILL FILE HERE',
      "LavaGirl": 'TEXT FROM SKILL FILE HERE',
      "Lymean": 'TEXT FROM SKILL FILE HERE',
      "Succubus": 'TEXT FROM SKILL FILE HERE',
      "Harpy": 'TEXT FROM SKILL FILE HERE',
      "LizardGirl": 'TEXT FROM SKILL FILE HERE',
      "InsectGirl": 'TEXT FROM SKILL FILE HERE',
      "BeastGirl": 'TEXT FROM SKILL FILE HERE',
      "Shadow": 'TEXT FROM SKILL FILE HERE',
      "Tanid": 'TEXT FROM SKILL FILE HERE'
    };
    
  3. Run this script:
    let json = {},outputText = "";
    function createEntry(node) {
      let outObj = {};
      outObj.name = node.name;
      outObj.count = node.amountPossible;
      outObj.costPrimary = node.pointCostPrimary;
      if (node.pointCostSecondary > 0) {
        outObj.costSecondary = node.pointCostSecondary;
        outObj.speciesSecondary = node.secondarySpeciesPoints;
      }
      outObj.type = node.nodeType;
      outObj.connectionRight = node.connectionRight;
      outObj.connectionBottom = node.connectionBottom;
      return outObj;
    }
    json = JSON.parse(skillText);
    for (const prop in skillText) {
      if (skillText.hasOwnProperty(prop)) {
        for (var i = 0; i < skillText[prop].length; i++) { 
          skillText[prop][i] = createEntry(skillText[prop][i]);
        }
      }
    }
    outputText += JSON.stringify(skillText);
    outputText += "{{Documentation}}";
    outputText;
    
  4. Replace all the text in Evolution/Skill_Tree/load with the output, remove any " before and after the output