koishipro-core.js 1.0.7 → 1.0.8
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/dist/index.cjs +48 -3
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +46 -2
- package/dist/index.mjs.map +4 -4
- package/dist/src/adapters/script-readers.d.ts +1 -1
- package/dist/src/ocgcore-wrapper.d.ts +3 -5
- package/dist/src/sqljs-card-reader.d.ts +1 -1
- package/dist/src/test-card.d.ts +7 -0
- package/dist/src/types/callback.d.ts +6 -0
- package/dist/src/types/card-data.d.ts +0 -1
- package/dist/src/types/index.d.ts +1 -1
- package/index.ts +1 -0
- package/package.json +1 -1
- package/dist/src/types/ocgcore-readers.d.ts +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1042,7 +1042,7 @@ var OcgcoreWrapper = class {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
this.ocgcoreModule._get_log_message(duelPtr, this.logBufferPtr);
|
|
1044
1044
|
const message = this.getUTF8String(this.logBufferPtr);
|
|
1045
|
-
const type = messageType ===
|
|
1045
|
+
const type = messageType === 2 ? "DebugMessage" /* DebugMessage */ : "ScriptError" /* ScriptError */;
|
|
1046
1046
|
const duel = this.getOrCreateDuel(duelPtr);
|
|
1047
1047
|
for (const handler of this.messageHandlers) {
|
|
1048
1048
|
try {
|
|
@@ -2457,6 +2457,49 @@ var playYrp = (ocgcoreWrapper, yrpInput) => {
|
|
|
2457
2457
|
return messages;
|
|
2458
2458
|
};
|
|
2459
2459
|
|
|
2460
|
+
// src/test-card.ts
|
|
2461
|
+
var { LOCATION_DECK: LOCATION_DECK2, POS_FACEUP_ATTACK } = OcgcoreScriptConstants;
|
|
2462
|
+
function testCard(ocgcoreWrapper, ...ids) {
|
|
2463
|
+
const logs = [];
|
|
2464
|
+
const duel = ocgcoreWrapper.createDuelV2(
|
|
2465
|
+
Array.from(
|
|
2466
|
+
{ length: 8 },
|
|
2467
|
+
() => Math.floor(Math.random() * 4294967295) >>> 0
|
|
2468
|
+
)
|
|
2469
|
+
);
|
|
2470
|
+
ocgcoreWrapper.setMessageHandler((_duel, message, type) => {
|
|
2471
|
+
if (duel.duelPtr !== _duel.duelPtr) return;
|
|
2472
|
+
logs.push({ type, message });
|
|
2473
|
+
});
|
|
2474
|
+
duel.preloadScript("./script/special.lua");
|
|
2475
|
+
duel.preloadScript("./script/init.lua");
|
|
2476
|
+
duel.setPlayerInfo({ playerId: 0, lp: 8e3, startCount: 5, drawCount: 1 });
|
|
2477
|
+
duel.setPlayerInfo({ playerId: 1, lp: 8e3, startCount: 5, drawCount: 1 });
|
|
2478
|
+
for (const code of ids) {
|
|
2479
|
+
duel.newCard({
|
|
2480
|
+
code,
|
|
2481
|
+
owner: 0,
|
|
2482
|
+
playerId: 0,
|
|
2483
|
+
location: LOCATION_DECK2,
|
|
2484
|
+
sequence: 0,
|
|
2485
|
+
position: POS_FACEUP_ATTACK
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2488
|
+
duel.startDuel(0);
|
|
2489
|
+
while (true) {
|
|
2490
|
+
const { status, raw } = duel.process();
|
|
2491
|
+
if (raw.length > 0 && raw[0] === OcgcoreCommonConstants.MSG_RETRY) {
|
|
2492
|
+
break;
|
|
2493
|
+
}
|
|
2494
|
+
if (status === 0) {
|
|
2495
|
+
continue;
|
|
2496
|
+
}
|
|
2497
|
+
break;
|
|
2498
|
+
}
|
|
2499
|
+
duel.endDuel();
|
|
2500
|
+
return logs;
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2460
2503
|
// index.ts
|
|
2461
2504
|
if (typeof globalThis !== "undefined" && !globalThis.Buffer) {
|
|
2462
2505
|
globalThis.Buffer = Buffer2;
|
|
@@ -2487,6 +2530,7 @@ export {
|
|
|
2487
2530
|
parseFieldInfo,
|
|
2488
2531
|
parseRegistryDump,
|
|
2489
2532
|
parseRegistryKeys,
|
|
2490
|
-
playYrp
|
|
2533
|
+
playYrp,
|
|
2534
|
+
testCard
|
|
2491
2535
|
};
|
|
2492
2536
|
//# sourceMappingURL=index.mjs.map
|