misskey icon indicating copy to clipboard operation
misskey copied to clipboard

feat: 麻雀

Open syuilo opened this issue 1 year ago • 11 comments

What

#1876

Why

Resolve #1876

Additional info (optional)

TODO

  • [ ] 各種役
  • [ ] AIのロジックを別クラスに切り出す
  • [ ] 流し満貫
  • [ ] 四風連打
  • [ ] さんま

Checklist

  • [ ] Read the contribution guide
  • [ ] Test working in a local environment
  • [ ] (If needed) Add story of storybook
  • [ ] (If needed) Update CHANGELOG.md
  • [ ] (If possible) Add tests

syuilo avatar Jan 30 '24 11:01 syuilo

このPRによるapi.jsonの差分

差分はこちら
--- base
+++ head
@@ -76097,6 +76097,464 @@
           }
         }
       }
+    },
+    "/mahjong/create-room": {
+      "post": {
+        "operationId": "mahjong___create-room",
+        "summary": "mahjong/create-room",
+        "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *write:account*",
+        "externalDocs": {
+          "description": "Source code",
+          "url": "https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/mahjong/create-room.ts"
+        },
+        "security": [
+          {
+            "bearerAuth": []
+          }
+        ],
+        "responses": {
+          "200": {
+            "description": "OK (with results)",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "object",
+                  "$ref": "#/components/schemas/MahjongRoomDetailed"
+                }
+              }
+            }
+          },
+          "400": {
+            "description": "Client error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INVALID_PARAM": {
+                    "value": {
+                      "error": {
+                        "message": "Invalid param.",
+                        "code": "INVALID_PARAM",
+                        "id": "3d81ceae-475f-4600-b2a8-2bc116157532"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "401": {
+            "description": "Authentication error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "CREDENTIAL_REQUIRED": {
+                    "value": {
+                      "error": {
+                        "message": "Credential required.",
+                        "code": "CREDENTIAL_REQUIRED",
+                        "id": "1384574d-a912-4b81-8601-c7b1c4085df1"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "403": {
+            "description": "Forbidden error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "AUTHENTICATION_FAILED": {
+                    "value": {
+                      "error": {
+                        "message": "Authentication failed. Please ensure your token is correct.",
+                        "code": "AUTHENTICATION_FAILED",
+                        "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "418": {
+            "description": "I'm Ai",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "I_AM_AI": {
+                    "value": {
+                      "error": {
+                        "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.",
+                        "code": "I_AM_AI",
+                        "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "500": {
+            "description": "Internal server error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INTERNAL_ERROR": {
+                    "value": {
+                      "error": {
+                        "message": "Internal error occurred. Please contact us if the error persists.",
+                        "code": "INTERNAL_ERROR",
+                        "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    },
+    "/mahjong/join-room": {
+      "post": {
+        "operationId": "mahjong___join-room",
+        "summary": "mahjong/join-room",
+        "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *write:account*",
+        "externalDocs": {
+          "description": "Source code",
+          "url": "https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/mahjong/join-room.ts"
+        },
+        "security": [
+          {
+            "bearerAuth": []
+          }
+        ],
+        "requestBody": {
+          "required": true,
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "object",
+                "properties": {
+                  "roomId": {
+                    "type": "string",
+                    "format": "misskey:id"
+                  }
+                },
+                "required": [
+                  "roomId"
+                ]
+              }
+            }
+          }
+        },
+        "responses": {
+          "200": {
+            "description": "OK (with results)",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "object",
+                  "$ref": "#/components/schemas/MahjongRoomDetailed"
+                }
+              }
+            }
+          },
+          "400": {
+            "description": "Client error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "NO_SUCH_ROOM": {
+                    "value": {
+                      "error": {
+                        "message": "No such room.",
+                        "code": "NO_SUCH_ROOM",
+                        "id": "370e42b0-2a67-4306-9328-51c5f568f110"
+                      }
+                    }
+                  },
+                  "INVALID_PARAM": {
+                    "value": {
+                      "error": {
+                        "message": "Invalid param.",
+                        "code": "INVALID_PARAM",
+                        "id": "3d81ceae-475f-4600-b2a8-2bc116157532"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "401": {
+            "description": "Authentication error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "CREDENTIAL_REQUIRED": {
+                    "value": {
+                      "error": {
+                        "message": "Credential required.",
+                        "code": "CREDENTIAL_REQUIRED",
+                        "id": "1384574d-a912-4b81-8601-c7b1c4085df1"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "403": {
+            "description": "Forbidden error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "AUTHENTICATION_FAILED": {
+                    "value": {
+                      "error": {
+                        "message": "Authentication failed. Please ensure your token is correct.",
+                        "code": "AUTHENTICATION_FAILED",
+                        "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "418": {
+            "description": "I'm Ai",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "I_AM_AI": {
+                    "value": {
+                      "error": {
+                        "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.",
+                        "code": "I_AM_AI",
+                        "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "500": {
+            "description": "Internal server error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INTERNAL_ERROR": {
+                    "value": {
+                      "error": {
+                        "message": "Internal error occurred. Please contact us if the error persists.",
+                        "code": "INTERNAL_ERROR",
+                        "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    },
+    "/mahjong/show-room": {
+      "post": {
+        "operationId": "mahjong___show-room",
+        "summary": "mahjong/show-room",
+        "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *read:account*",
+        "externalDocs": {
+          "description": "Source code",
+          "url": "https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/mahjong/show-room.ts"
+        },
+        "security": [
+          {
+            "bearerAuth": []
+          }
+        ],
+        "requestBody": {
+          "required": true,
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "object",
+                "properties": {
+                  "roomId": {
+                    "type": "string",
+                    "format": "misskey:id"
+                  }
+                },
+                "required": [
+                  "roomId"
+                ]
+              }
+            }
+          }
+        },
+        "responses": {
+          "200": {
+            "description": "OK (with results)",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "object",
+                  "$ref": "#/components/schemas/MahjongRoomDetailed"
+                }
+              }
+            }
+          },
+          "400": {
+            "description": "Client error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "NO_SUCH_ROOM": {
+                    "value": {
+                      "error": {
+                        "message": "No such room.",
+                        "code": "NO_SUCH_ROOM",
+                        "id": "d77df68f-06f3-492b-9078-e6f72f4acf23"
+                      }
+                    }
+                  },
+                  "INVALID_PARAM": {
+                    "value": {
+                      "error": {
+                        "message": "Invalid param.",
+                        "code": "INVALID_PARAM",
+                        "id": "3d81ceae-475f-4600-b2a8-2bc116157532"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "401": {
+            "description": "Authentication error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "CREDENTIAL_REQUIRED": {
+                    "value": {
+                      "error": {
+                        "message": "Credential required.",
+                        "code": "CREDENTIAL_REQUIRED",
+                        "id": "1384574d-a912-4b81-8601-c7b1c4085df1"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "403": {
+            "description": "Forbidden error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "AUTHENTICATION_FAILED": {
+                    "value": {
+                      "error": {
+                        "message": "Authentication failed. Please ensure your token is correct.",
+                        "code": "AUTHENTICATION_FAILED",
+                        "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "418": {
+            "description": "I'm Ai",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "I_AM_AI": {
+                    "value": {
+                      "error": {
+                        "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.",
+                        "code": "I_AM_AI",
+                        "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "500": {
+            "description": "Internal server error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INTERNAL_ERROR": {
+                    "value": {
+                      "error": {
+                        "message": "Internal error occurred. Please contact us if the error persists.",
+                        "code": "INTERNAL_ERROR",
+                        "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
     }
   },
   "components": {
@@ -81282,6 +81740,123 @@
           "name",
           "method"
         ]
+      },
+      "MahjongRoomDetailed": {
+        "type": "object",
+        "properties": {
+          "id": {
+            "type": "string",
+            "format": "id"
+          },
+          "createdAt": {
+            "type": "string",
+            "format": "date-time"
+          },
+          "startedAt": {
+            "type": [
+              "string",
+              "null"
+            ],
+            "format": "date-time"
+          },
+          "endedAt": {
+            "type": [
+              "string",
+              "null"
+            ],
+            "format": "date-time"
+          },
+          "isStarted": {
+            "type": "boolean"
+          },
+          "isEnded": {
+            "type": "boolean"
+          },
+          "user1Id": {
+            "type": "string",
+            "format": "id"
+          },
+          "user2Id": {
+            "type": "string",
+            "format": "id"
+          },
+          "user3Id": {
+            "type": "string",
+            "format": "id"
+          },
+          "user4Id": {
+            "type": "string",
+            "format": "id"
+          },
+          "user1": {
+            "type": "object",
+            "$ref": "#/components/schemas/User"
+          },
+          "user2": {
+            "type": "object",
+            "$ref": "#/components/schemas/User"
+          },
+          "user3": {
+            "type": "object",
+            "$ref": "#/components/schemas/User"
+          },
+          "user4": {
+            "type": "object",
+            "$ref": "#/components/schemas/User"
+          },
+          "user1Ai": {
+            "type": "boolean"
+          },
+          "user2Ai": {
+            "type": "boolean"
+          },
+          "user3Ai": {
+            "type": "boolean"
+          },
+          "user4Ai": {
+            "type": "boolean"
+          },
+          "user1Ready": {
+            "type": "boolean"
+          },
+          "user2Ready": {
+            "type": "boolean"
+          },
+          "user3Ready": {
+            "type": "boolean"
+          },
+          "user4Ready": {
+            "type": "boolean"
+          },
+          "timeLimitForEachTurn": {
+            "type": "number"
+          }
+        },
+        "required": [
+          "id",
+          "createdAt",
+          "startedAt",
+          "endedAt",
+          "isStarted",
+          "isEnded",
+          "user1Id",
+          "user2Id",
+          "user3Id",
+          "user4Id",
+          "user1",
+          "user2",
+          "user3",
+          "user4",
+          "user1Ai",
+          "user2Ai",
+          "user3Ai",
+          "user4Ai",
+          "user1Ready",
+          "user2Ready",
+          "user3Ready",
+          "user4Ready",
+          "timeLimitForEachTurn"
+        ]
       }
     },
     "securitySchemes": {

Get diff files from Workflow Page

github-actions[bot] avatar Jan 30 '24 11:01 github-actions[bot]

Codecov Report

Attention: Patch coverage is 17.96130% with 3010 lines in your changes missing coverage. Please review.

Project coverage is 41.21%. Comparing base (865b303) to head (bf818a6). Report is 69 commits behind head on develop.

Files Patch % Lines
packages/frontend/src/pages/mahjong/room.game.vue 0.00% 1213 Missing and 1 partial :warning:
packages/backend/src/core/MahjongService.ts 24.79% 552 Missing :warning:
packages/frontend/src/pages/mahjong/hand-tiles.vue 0.00% 183 Missing and 1 partial :warning:
...end/src/server/api/stream/channels/mahjong-room.ts 8.12% 181 Missing :warning:
packages/frontend/src/pages/mahjong/index.vue 0.00% 165 Missing and 1 partial :warning:
...ckages/frontend/src/pages/mahjong/room.setting.vue 0.00% 164 Missing and 1 partial :warning:
packages/frontend/src/pages/mahjong/room.vue 0.00% 112 Missing and 1 partial :warning:
packages/frontend/src/scripts/mahjong.ts 0.00% 82 Missing and 1 partial :warning:
packages/frontend/src/pages/mahjong/tile.vue 0.00% 77 Missing and 1 partial :warning:
.../backend/src/server/api/endpoints/mahjong/games.ts 0.00% 63 Missing and 1 partial :warning:
... and 10 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #13112      +/-   ##
===========================================
+ Coverage    40.18%   41.21%   +1.03%     
===========================================
  Files         1524     1567      +43     
  Lines       188816   200223   +11407     
  Branches      3466     2746     -720     
===========================================
+ Hits         75875    82530    +6655     
- Misses      112369   117119    +4750     
- Partials       572      574       +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 30 '24 11:01 codecov[bot]

完成度としては28%くらい

syuilo avatar Jan 30 '24 11:01 syuilo

2DでのレンダリングめんどくさいからThreejsで3D描画にしたい

syuilo avatar Jan 30 '24 11:01 syuilo

misskey-jsのchannel.types.tsも更新したいところ

kakkokari-gtyih avatar Jan 30 '24 12:01 kakkokari-gtyih

35%くらい終わった

syuilo avatar Feb 03 '24 04:02 syuilo

40%くらい終わってる

syuilo avatar Feb 20 '24 12:02 syuilo

四風連打とか今までなったことないし存在を知らなかった

syuilo avatar Jul 14 '24 13:07 syuilo

なんとなく今の進捗を見てて気づいたけど東風戦、半荘戦の区別がまだない?

あと3人麻雀というのもあるわね

tai-cha avatar Jul 15 '24 07:07 tai-cha

東風戦、半荘戦の区別がまだない?

無いわね

あと3人麻雀というのもあるわね

好き

syuilo avatar Jul 15 '24 08:07 syuilo

3麻に対応する予定があるならuser4はnullの可能性を考慮する必要がありそう(当分先だろうけど)

tai-cha avatar Jul 15 '24 16:07 tai-cha