fortnite-replay-analysis 1.1.4 → 1.1.6

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 +12 -5
  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,
@@ -152,6 +156,7 @@ async function calculateScore({ matchData, points, killCountUpperLimit = null, k
152
156
  partyAliveTimeList: [],
153
157
  partyMemberList: [],
154
158
  partyMemberIdList: [],
159
+ partyDiscordInfo: null
155
160
  };
156
161
  }
157
162
 
@@ -181,10 +186,11 @@ function mergeScores(scoreArrays) { // 複数マッチの結果をマージし
181
186
  partyPoint: p.partyPoint,
182
187
  partyKills: p.partyKills,
183
188
  partyKillsNoLimit: p.partyKillsNoLimit,
189
+ partyKillPoints: p.partyKillPoints,
184
190
  partyVictoryRoyaleCount: p.partyVictoryRoyale ? 1 : 0,
185
191
  matchList: [p.matchName],
186
192
  partyMemberList: [...p.partyMemberList],
187
- partyDiscordInfo: p.partyDiscordInfo ? { ...p.partyDiscordInfo } : undefined,
193
+ partyDiscordInfo: p.partyDiscordInfo ? [ ...p.partyDiscordInfo ] : undefined,
188
194
  partyAliveTimeByMatch: [
189
195
  { match: p.matchName, times: [...(p.partyAliveTimeList || [])] }
190
196
  ],
@@ -198,6 +204,7 @@ function mergeScores(scoreArrays) { // 複数マッチの結果をマージし
198
204
  ex.partyPoint += p.partyPoint;
199
205
  ex.partyKills += p.partyKills;
200
206
  ex.partyKillsNoLimit += p.partyKillsNoLimit;
207
+ ex.partyKillPoints += p.partyKillPoints;
201
208
  ex.partyVictoryRoyaleCount += p.partyVictoryRoyale ? 1 : 0;
202
209
  ex.matchList.push(p.matchName);
203
210
  ex.partyAliveTimeByMatch.push({
@@ -253,7 +260,7 @@ function sortScores(arr) { // 公式準拠のスコアソート関数
253
260
  }
254
261
 
255
262
  // 4. 平均順位(小さいほうが上位)
256
- const cmpAvgPlacement = b.summary.avgPlacement.comparedTo(a.summary.avgPlacement);
263
+ const cmpAvgPlacement = a.summary.avgPlacement.comparedTo(b.summary.avgPlacement);
257
264
  if (cmpAvgPlacement !== 0) {
258
265
  return cmpAvgPlacement;
259
266
  }
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.6",
4
4
  "description": "Fortnite replay analysis tool (Node.js用Fortniteリプレイ解析バイナリラッパー)",
5
5
  "repository": {
6
6
  "type": "git",