pf2e-sage-stats 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@ import path from 'path';
6
6
 
7
7
  import pack from '../package.json';
8
8
 
9
- import { formatCommand, formatJSON, formatTSV, fromatMap, valueNameMap, flatMap, parseJSON, parseStatblock, stub, valueMap, diceMap, diceNameMap, adjustmentMap, prediceateMap, formatTable, formatHP } from './app';
9
+ import { sortFolder, formatCommand, formatJSON, formatTSV, fromatMap, parseJSON, parseStatblock, stub, adjustmentMap, prediceateMap, formatTable, formatHP } from './app';
10
10
 
11
11
  const program = new Command(pack.name);
12
12
 
@@ -37,9 +37,9 @@ program.command('table')
37
37
  .option('-p, --players <string>', 'players')
38
38
  .action(async (argument, option) => {
39
39
  if (option.output) {
40
- await fs.writeFile(option.output, formatTable(Number(option.table ?? 1), Number(option.season ?? 1), Number(option.scenario ?? 1), argument, option.gm ?? '@lammonaaf', option.players ?? '<players>'), { encoding: 'utf-8' })
40
+ await fs.writeFile(option.output, formatTable(option.table ?? '1', option.season ?? '1', option.scenario ?? '1', argument, option.gm ?? '@lammonaaf', option.players ?? '<players>'), { encoding: 'utf-8' })
41
41
  } else {
42
- console.log(formatTable(Number(option.table ?? 1), Number(option.season ?? 1), Number(option.scenario ?? 1), argument, option.gm ?? '@lammonaaf', option.players ?? '<players>'));
42
+ console.log(formatTable(option.table ?? '1', option.season ?? '1', option.scenario ?? '1', argument, option.gm ?? '@lammonaaf', option.players ?? '<players>'));
43
43
  }
44
44
  });
45
45
 
@@ -50,65 +50,21 @@ program.command('hp')
50
50
  console.log(formatHP(argument));
51
51
  });
52
52
 
53
- program.command('flat')
54
- .description('Generte a special flat npc tsv')
55
- .option('-n, --name <string>', 'npc name')
56
- .option('-o, --output <file>', 'output json')
57
- .option('-s, --short', 'omit explosion')
58
- .action(async (option) => {
59
- if (option.output) {
60
- await fs.writeFile(option.output, fromatMap(option.name ?? 'flat', option.short ? prediceateMap : flatMap), { encoding: 'utf-8' })
61
- } else {
62
- console.log(fromatMap(option.name ?? 'flat', option.short ? prediceateMap : flatMap));
63
- }
64
- });
65
-
66
- program.command('valuename')
67
- .description('Generte a special value name npc tsv')
68
- .option('-n, --name <string>', 'npc name')
69
- .option('-t, --tag <string>', 'name tag')
70
- .option('-o, --output <file>', 'output json')
71
- .action(async (option) => {
72
- if (option.output) {
73
- await fs.writeFile(option.output, fromatMap(option.name ?? 'valuename', valueNameMap(option.tag ?? null)), { encoding: 'utf-8' })
74
- } else {
75
- console.log(fromatMap(option.name ?? 'valuename', valueNameMap(option.tag ?? null)));
76
- }
77
- });
78
-
79
- program.command('value')
80
- .description('Generte a special value npc tsv')
81
- .option('-n, --name <string>', 'npc name')
82
- .option('-o, --output <file>', 'output json')
83
- .action(async (option) => {
84
- if (option.output) {
85
- await fs.writeFile(option.output, fromatMap(option.name ?? 'value', valueMap()), { encoding: 'utf-8' })
86
- } else {
87
- console.log(fromatMap(option.name ?? 'value', valueMap()));
88
- }
53
+ program.command('sort')
54
+ .description('Sorts log file folder and renames files')
55
+ .action(async () => {
56
+ console.log(await sortFolder());
89
57
  });
90
58
 
91
- program.command('dicename')
92
- .description('Generte a special dice npc tsv')
93
- .option('-n, --name <string>', 'npc name')
94
- .option('-o, --output <file>', 'output json')
95
- .action(async (option) => {
96
- if (option.output) {
97
- await fs.writeFile(option.output, fromatMap(option.name ?? 'dicename', diceNameMap()), { encoding: 'utf-8' })
98
- } else {
99
- console.log(fromatMap(option.name ?? 'dicename', valueMap()));
100
- }
101
- });
102
-
103
- program.command('dice')
104
- .description('Generte a special dicemod npc tsv')
59
+ program.command('flat')
60
+ .description('Generte a special flat npc tsv')
105
61
  .option('-n, --name <string>', 'npc name')
106
62
  .option('-o, --output <file>', 'output json')
107
63
  .action(async (option) => {
108
64
  if (option.output) {
109
- await fs.writeFile(option.output, fromatMap(option.name ?? 'dice', diceMap()), { encoding: 'utf-8' })
65
+ await fs.writeFile(option.output, fromatMap(option.name ?? 'flat', prediceateMap), { encoding: 'utf-8' })
110
66
  } else {
111
- console.log(fromatMap(option.name ?? 'dice', valueMap()));
67
+ console.log(fromatMap(option.name ?? 'flat', prediceateMap));
112
68
  }
113
69
  });
114
70
 
@@ -134,7 +90,6 @@ program.command('statblock')
134
90
  .option('-c, --command', 'output directly to txt')
135
91
  .option('-s, --secretDC', 'produce secret DCs (tsv only)')
136
92
  .option('-d, --defaultSkills', 'produce values for untrained skills (tsv only)')
137
- .option('-e, --desc', 'produce verbose desc fields (tsv only)')
138
93
  .option('-o, --output <file>', 'output file name')
139
94
  .action(async (argument, option) => {
140
95
  const file = await fs.readFile(argument, { encoding: 'utf-8' });
@@ -146,11 +101,11 @@ program.command('statblock')
146
101
  if (option.tsv) {
147
102
  const output = option.output ? option.output : path.join(path.parse(argument).dir, stats.alias + '.tsv');
148
103
 
149
- await fs.writeFile(output, formatTSV(stats, option.secretDC, option.defaultSkills, option.desc), { encoding: 'utf-8' });
104
+ await fs.writeFile(output, formatTSV(stats, option.secretDC, option.defaultSkills), { encoding: 'utf-8' });
150
105
  } else if (option.command) {
151
106
  const output = option.output ? option.output : path.join(path.parse(argument).dir, stats.alias + '-command.txt');
152
107
 
153
- await fs.writeFile(output, formatCommand(stats, option.secretDC, option.defaultSkills, option.desc), { encoding: 'utf-8' });
108
+ await fs.writeFile(output, formatCommand(stats, option.secretDC, option.defaultSkills), { encoding: 'utf-8' });
154
109
  } else {
155
110
  const output = option.output ? option.output : path.join(path.parse(argument).dir, stats.alias + '.json');
156
111
 
@@ -165,7 +120,6 @@ program.command('tsv')
165
120
  .option('-s, --secretDC', 'produce secret DCs')
166
121
  .option('-r, --recallDC', 'produce recall DCs')
167
122
  .option('-d, --defaultSkills', 'produce values for untrained skills')
168
- .option('-e, --desc', 'produce verbose desc fields')
169
123
  .action(async (argument, option) => {
170
124
  const file = await fs.readFile(argument, { encoding: 'utf-8' });
171
125
 
@@ -173,7 +127,7 @@ program.command('tsv')
173
127
 
174
128
  const output = option.output ? option.output : path.join(path.parse(argument).dir, path.parse(argument).name + '.tsv');
175
129
 
176
- await fs.writeFile(output, formatTSV(stats, option.secretDC, option.defaultSkills, option.recallDC, option.desc), { encoding: 'utf-8' });
130
+ await fs.writeFile(output, formatTSV(stats, option.secretDC, option.defaultSkills, option.recallDC), { encoding: 'utf-8' });
177
131
  });
178
132
 
179
133
  program.command('command')
@@ -183,7 +137,6 @@ program.command('command')
183
137
  .option('-s, --secretDC', 'produce secret DCs')
184
138
  .option('-r, --recallDC', 'produce recall DCs')
185
139
  .option('-d, --defaultSkills', 'produce values for untrained skills')
186
- .option('-e, --desc', 'produce verbose desc fields')
187
140
  .action(async (argument, option) => {
188
141
  const file = await fs.readFile(argument, { encoding: 'utf-8' });
189
142
 
@@ -191,7 +144,7 @@ program.command('command')
191
144
 
192
145
  const output = option.output ? option.output : path.join(path.parse(argument).dir, path.parse(argument).name + '-command.txt');
193
146
 
194
- await fs.writeFile(output, formatCommand(stats, option.secretDC, option.defaultSkills, option.recallDC, option.desc), { encoding: 'utf-8' });
147
+ await fs.writeFile(output, formatCommand(stats, option.secretDC, option.defaultSkills, option.recallDC), { encoding: 'utf-8' });
195
148
  });
196
149
 
197
150