Commit 302b5d5d authored by nanahira's avatar nanahira

refas

parent f7c5bf94
...@@ -39,6 +39,7 @@ export class Client { ...@@ -39,6 +39,7 @@ export class Client {
// in handshake // in handshake
ip = ''; ip = '';
isLocal = false; isLocal = false;
isInternal = false;
private logger = this.ctx.createLogger(this.constructor.name); private logger = this.ctx.createLogger(this.constructor.name);
private disconnectSubject = new Subject<void>(); private disconnectSubject = new Subject<void>();
......
...@@ -116,7 +116,12 @@ export class IpResolver { ...@@ -116,7 +116,12 @@ export class IpResolver {
); );
let connectCount = this.connectedIpCount.get(newIp) || 0; let connectCount = this.connectedIpCount.get(newIp) || 0;
if (!noConnectCountLimit && !isLocal && !this.isTrustedProxy(newIp)) { if (
!noConnectCountLimit &&
!isLocal &&
!client.isInternal &&
!this.isTrustedProxy(newIp)
) {
connectCount++; connectCount++;
this.connectedIpCount.set(newIp, connectCount); this.connectedIpCount.set(newIp, connectCount);
} else { } else {
......
...@@ -1232,7 +1232,7 @@ export class Room { ...@@ -1232,7 +1232,7 @@ export class Room {
await this.dispatchGameMsg(watcherMsg.msg); await this.dispatchGameMsg(watcherMsg.msg);
await this.ctx.dispatch( await this.ctx.dispatch(
new OnRoomDuelStart(this), new OnRoomDuelStart(this),
this.gatIngameOperatingPlayer(this.turnIngamePos), this.getIngameOperatingPlayer(this.turnIngamePos),
); );
await Promise.all([ await Promise.all([
...@@ -1267,7 +1267,7 @@ export class Room { ...@@ -1267,7 +1267,7 @@ export class Room {
this.phase = phase; this.phase = phase;
} }
gatIngameOperatingPlayer(ingameDuelPos: number): Client | undefined { getIngameOperatingPlayer(ingameDuelPos: number): Client | undefined {
const players = this.getIngameDuelPosPlayers(ingameDuelPos); const players = this.getIngameDuelPosPlayers(ingameDuelPos);
if (!this.isTag) { if (!this.isTag) {
return players[0]; return players[0];
...@@ -1292,7 +1292,7 @@ export class Room { ...@@ -1292,7 +1292,7 @@ export class Room {
return players[0]; return players[0];
} }
private async refreshLocations( async refreshLocations(
refresh: RequireQueryLocation, refresh: RequireQueryLocation,
options: { queryFlag?: number; sendToClient?: MayBeArray<Client> } = {}, options: { queryFlag?: number; sendToClient?: MayBeArray<Client> } = {},
) { ) {
...@@ -1318,7 +1318,7 @@ export class Room { ...@@ -1318,7 +1318,7 @@ export class Room {
} }
} }
private async refreshSingle( async refreshSingle(
refresh: RequireQueryCardLocation, refresh: RequireQueryCardLocation,
options: { queryFlag?: number; sendToClient?: MayBeArray<Client> } = {}, options: { queryFlag?: number; sendToClient?: MayBeArray<Client> } = {},
) { ) {
...@@ -1366,7 +1366,7 @@ export class Room { ...@@ -1366,7 +1366,7 @@ export class Room {
} }
private async sendWaitingToNonOperator(ingameDuelPos: number) { private async sendWaitingToNonOperator(ingameDuelPos: number) {
const operatingPlayer = this.gatIngameOperatingPlayer(ingameDuelPos); const operatingPlayer = this.getIngameOperatingPlayer(ingameDuelPos);
const noOps = this.playingPlayers.filter((p) => p !== operatingPlayer); const noOps = this.playingPlayers.filter((p) => p !== operatingPlayer);
await Promise.all( await Promise.all(
noOps.map((p) => noOps.map((p) =>
...@@ -1414,7 +1414,7 @@ export class Room { ...@@ -1414,7 +1414,7 @@ export class Room {
} }
const duelPos = this.getIngameDuelPos(c); const duelPos = this.getIngameDuelPos(c);
const playerView = message.playerView(duelPos); const playerView = message.playerView(duelPos);
const operatingPlayer = this.gatIngameOperatingPlayer(duelPos); const operatingPlayer = this.getIngameOperatingPlayer(duelPos);
return sendGameMsg( return sendGameMsg(
c, c,
c === operatingPlayer ? playerView : playerView.teammateView(), c === operatingPlayer ? playerView : playerView.teammateView(),
...@@ -1466,7 +1466,7 @@ export class Room { ...@@ -1466,7 +1466,7 @@ export class Room {
message = await this.localGameMsgDispatcher.dispatch(message); message = await this.localGameMsgDispatcher.dispatch(message);
message = await this.ctx.dispatch( message = await this.ctx.dispatch(
message, message,
this.gatIngameOperatingPlayer(this.turnIngamePos), this.getIngameOperatingPlayer(this.turnIngamePos),
); );
} }
if (options.route) { if (options.route) {
...@@ -1513,7 +1513,7 @@ export class Room { ...@@ -1513,7 +1513,7 @@ export class Room {
}) })
.middleware(YGOProMsgRetry, async (message, next) => { .middleware(YGOProMsgRetry, async (message, next) => {
if (this.responsePos != null) { if (this.responsePos != null) {
const op = this.gatIngameOperatingPlayer( const op = this.getIngameOperatingPlayer(
this.getIngameDuelPosByDuelPos(this.responsePos), this.getIngameDuelPosByDuelPos(this.responsePos),
); );
await op.send( await op.send(
...@@ -1582,7 +1582,7 @@ export class Room { ...@@ -1582,7 +1582,7 @@ export class Room {
} }
if ( if (
client !== client !==
this.gatIngameOperatingPlayer( this.getIngameOperatingPlayer(
this.getIngameDuelPosByDuelPos(this.responsePos), this.getIngameDuelPosByDuelPos(this.responsePos),
) )
) { ) {
...@@ -1617,7 +1617,7 @@ export class Room { ...@@ -1617,7 +1617,7 @@ export class Room {
if ( if (
this.responsePos == null || this.responsePos == null ||
client !== client !==
this.gatIngameOperatingPlayer( this.getIngameOperatingPlayer(
this.getIngameDuelPosByDuelPos(this.responsePos), this.getIngameDuelPosByDuelPos(this.responsePos),
) || ) ||
!this.ocgcore !this.ocgcore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment