fortnite-replay-analysis 1.1.4 → 1.1.5

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.
Files changed (2) hide show
  1. package/index.js +10 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -25,11 +25,14 @@ function ReplayAnalysis(inputPath, { bot = false, sort = true } = {}) { // Fortn
25
25
  try {
26
26
  const stat = fs.statSync(inputPath);
27
27
  if (stat.isDirectory()) {
28
- const replayFiles = fs.readdirSync(inputPath).filter(f => f.endsWith('.replay'));
29
- if (replayFiles.length === 0) {
28
+ const files = fs.readdirSync(inputPath)
29
+ .filter(f => f.endsWith('.replay'))
30
+ .map(f => ({ f, t: fs.statSync(path.join(inputPath, f)).mtimeMs }))
31
+ .sort((a, b) => b.t - a.t); // 新しい順
32
+ if (files.length === 0) {
30
33
  return reject(new Error(`No .replay files found in directory: ${inputPath}`));
31
34
  }
32
- replayFilePath = path.join(inputPath, replayFiles[0]);
35
+ replayFilePath = path.join(inputPath, files[0].f);
33
36
  } else if (stat.isFile()) {
34
37
  replayFilePath = inputPath;
35
38
  } else {
@@ -145,6 +148,7 @@ async function calculateScore({ matchData, points, killCountUpperLimit = null, k
145
148
  partyNumber: player.partyNumber,
146
149
  partyKills: limitedKills,
147
150
  partyKillsNoLimit: player.TeamKills || 0,
151
+ partyKillPoints: (limitedKills) * killPointMultiplier,
148
152
  partyScore: (points[player.Placement] ?? 0) + ((limitedKills) * killPointMultiplier),
149
153
  partyPoint: points[player.Placement] ?? 0,
150
154
  partyVictoryRoyale: player.Placement === 1,
@@ -181,6 +185,7 @@ function mergeScores(scoreArrays) { // 複数マッチの結果をマージし
181
185
  partyPoint: p.partyPoint,
182
186
  partyKills: p.partyKills,
183
187
  partyKillsNoLimit: p.partyKillsNoLimit,
188
+ partyKillPoints: p.partyKillPoints,
184
189
  partyVictoryRoyaleCount: p.partyVictoryRoyale ? 1 : 0,
185
190
  matchList: [p.matchName],
186
191
  partyMemberList: [...p.partyMemberList],
@@ -198,6 +203,7 @@ function mergeScores(scoreArrays) { // 複数マッチの結果をマージし
198
203
  ex.partyPoint += p.partyPoint;
199
204
  ex.partyKills += p.partyKills;
200
205
  ex.partyKillsNoLimit += p.partyKillsNoLimit;
206
+ ex.partyKillPoints += p.partyKillPoints;
201
207
  ex.partyVictoryRoyaleCount += p.partyVictoryRoyale ? 1 : 0;
202
208
  ex.matchList.push(p.matchName);
203
209
  ex.partyAliveTimeByMatch.push({
@@ -253,7 +259,7 @@ function sortScores(arr) { // 公式準拠のスコアソート関数
253
259
  }
254
260
 
255
261
  // 4. 平均順位(小さいほうが上位)
256
- const cmpAvgPlacement = b.summary.avgPlacement.comparedTo(a.summary.avgPlacement);
262
+ const cmpAvgPlacement = a.summary.avgPlacement.comparedTo(b.summary.avgPlacement);
257
263
  if (cmpAvgPlacement !== 0) {
258
264
  return cmpAvgPlacement;
259
265
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fortnite-replay-analysis",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Fortnite replay analysis tool (Node.js用Fortniteリプレイ解析バイナリラッパー)",
5
5
  "repository": {
6
6
  "type": "git",