Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Feb 3, 2024
1 parent 2dd886e commit 586a458
Show file tree
Hide file tree
Showing 12 changed files with 424 additions and 149 deletions.
210 changes: 210 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9649,6 +9649,216 @@ export interface Locale extends ILocale {
* 北
*/
"north": string;
/**
* ドラ
*/
"dora": string;
/**
* 赤ドラ
*/
"redDora": string;
/**
* 飜
*/
"fan": string;
"_yakus": {
/**
* 立直
*/
"riichi": string;
/**
* 一発
*/
"ippatsu": string;
/**
* 門前清自摸和
*/
"tsumo": string;
/**
* 断么
*/
"tanyao": string;
/**
* 平和
*/
"pinfu": string;
/**
* 一盃口
*/
"iipeko": string;
/**
* 東
*/
"field-wind-e": string;
/**
* 南
*/
"field-wind-s": string;
/**
* 東
*/
"seat-wind-e": string;
/**
* 南
*/
"seat-wind-s": string;
/**
* 西
*/
"seat-wind-w": string;
/**
* 北
*/
"seat-wind-n": string;
/**
* 白
*/
"white": string;
/**
* 發
*/
"green": string;
/**
* 中
*/
"red": string;
/**
* 嶺上開花
*/
"rinshan": string;
/**
* 搶槓
*/
"chankan": string;
/**
* 海底摸月
*/
"haitei": string;
/**
* 河底撈魚
*/
"hotei": string;
/**
* 三色同順
*/
"sanshoku-dojun": string;
/**
* 三色同刻
*/
"sanshoku-doko": string;
/**
* 一気通貫
*/
"ittsu": string;
/**
* 混全帯么九
*/
"chanta": string;
/**
* 七対子
*/
"chitoitsu": string;
/**
* 対々
*/
"toitoi": string;
/**
* 三暗刻
*/
"sananko": string;
/**
* 混老頭
*/
"honroto": string;
/**
* 三槓子
*/
"sankantsu": string;
/**
* 小三元
*/
"shosangen": string;
/**
* ダブル立直
*/
"double-riichi": string;
/**
* 混一色
*/
"honitsu": string;
/**
* 清全帯么九
*/
"junchan": string;
/**
* ニ盃口
*/
"ryampeko": string;
/**
* 清一色
*/
"chinitsu": string;
/**
* 国士無双
*/
"kokushi": string;
/**
* 国士無双13面待ち
*/
"kokushi-13": string;
/**
* 四暗刻
*/
"suanko": string;
/**
* 四暗刻単騎待ち
*/
"suanko-tanki": string;
/**
* 大三元
*/
"daisangen": string;
/**
* 字一色
*/
"tsuiso": string;
/**
* 小四喜
*/
"shosushi": string;
/**
* 大四喜
*/
"daisushi": string;
/**
* 緑一色
*/
"ryuiso": string;
/**
* 清老頭
*/
"chinroto": string;
/**
* 四槓子
*/
"sukantsu": string;
/**
* 九蓮宝燈
*/
"churen": string;
/**
* 純正九連宝灯
*/
"pure-churen": string;
/**
* 天和
*/
"tenho": string;
/**
* 地和
*/
"chiho": string;
};
};
"_offlineScreen": {
/**
Expand Down
53 changes: 53 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2571,6 +2571,59 @@ _mahjong:
south: ""
west: "西"
north: ""
dora: "ドラ"
redDora: "赤ドラ"
fan: ""
_yakus:
"riichi": "立直"
"ippatsu": "一発"
"tsumo": "門前清自摸和"
"tanyao": "断么"
"pinfu": "平和"
"iipeko": "一盃口"
"field-wind-e": ""
"field-wind-s": ""
"seat-wind-e": ""
"seat-wind-s": ""
"seat-wind-w": "西"
"seat-wind-n": ""
"white": ""
"green": ""
"red": ""
"rinshan": "嶺上開花"
"chankan": "搶槓"
"haitei": "海底摸月"
"hotei": "河底撈魚"
"sanshoku-dojun": "三色同順"
"sanshoku-doko": "三色同刻"
"ittsu": "一気通貫"
"chanta": "混全帯么九"
"chitoitsu": "七対子"
"toitoi": "対々"
"sananko": "三暗刻"
"honroto": "混老頭"
"sankantsu": "三槓子"
"shosangen": "小三元"
"double-riichi": "ダブル立直"
"honitsu": "混一色"
"junchan": "清全帯么九"
"ryampeko": "ニ盃口"
"chinitsu": "清一色"
"kokushi": "国士無双"
"kokushi-13": "国士無双13面待ち"
"suanko": "四暗刻"
"suanko-tanki": "四暗刻単騎待ち"
"daisangen": "大三元"
"tsuiso": "字一色"
"shosushi": "小四喜"
"daisushi": "大四喜"
"ryuiso": "緑一色"
"chinroto": "清老頭"
"sukantsu": "四槓子"
"churen": "九蓮宝燈"
"pure-churen": "純正九連宝灯"
"tenho": "天和"
"chiho": "地和"

_offlineScreen:
title: "オフライン - サーバーに接続できません"
Expand Down
28 changes: 14 additions & 14 deletions packages/backend/src/core/GlobalEventService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,30 +209,30 @@ export interface MahjongRoomEventTypes {
room: Packed<'MahjongRoomDetailed'>;
};
tsumo: {
house: Mahjong.Common.House;
tile: Mahjong.Common.Tile;
house: Mahjong.House;
tile: Mahjong.Tile;
};
dahai: {
house: Mahjong.Common.House;
tile: Mahjong.Common.Tile;
house: Mahjong.House;
tile: Mahjong.Tile;
riichi: boolean;
};
dahaiAndTsumo: {
dahaiHouse: Mahjong.Common.House;
dahaiTile: Mahjong.Common.Tile;
tsumoTile: Mahjong.Common.Tile;
dahaiHouse: Mahjong.House;
dahaiTile: Mahjong.Tile;
tsumoTile: Mahjong.Tile;
riichi: boolean;
};
ponned: {
caller: Mahjong.Common.House;
callee: Mahjong.Common.House;
tile: Mahjong.Common.Tile;
caller: Mahjong.House;
callee: Mahjong.House;
tile: Mahjong.Tile;
};
kanned: {
caller: Mahjong.Common.House;
callee: Mahjong.Common.House;
tile: Mahjong.Common.Tile;
rinsyan: Mahjong.Common.Tile;
caller: Mahjong.House;
callee: Mahjong.House;
tile: Mahjong.Tile;
rinsyan: Mahjong.Tile;
};
ronned: {
};
Expand Down
14 changes: 7 additions & 7 deletions packages/backend/src/core/MahjongService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ type NextKyokuConfirmation = {
user4: boolean;
};

function getUserIdOfHouse(room: Room, engine: Mahjong.MasterGameEngine, house: Mahjong.Common.House): MiUser['id'] {
function getUserIdOfHouse(room: Room, engine: Mahjong.MasterGameEngine, house: Mahjong.House): MiUser['id'] {
return engine.state.user1House === house ? room.user1Id : engine.state.user2House === house ? room.user2Id : engine.state.user3House === house ? room.user3Id : room.user4Id;
}

function getHouseOfUserId(room: Room, engine: Mahjong.MasterGameEngine, userId: MiUser['id']): Mahjong.Common.House {
function getHouseOfUserId(room: Room, engine: Mahjong.MasterGameEngine, userId: MiUser['id']): Mahjong.House {
return userId === room.user1Id ? engine.state.user1House : userId === room.user2Id ? engine.state.user2House : userId === room.user3Id ? engine.state.user3House : engine.state.user4House;
}

Expand Down Expand Up @@ -310,7 +310,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
pon: answers.pon ?? false,
cii: answers.cii ?? false,
kan: answers.kan ?? false,
ron: [...(answers.ron.e ? ['e'] : []), ...(answers.ron.s ? ['s'] : []), ...(answers.ron.w ? ['w'] : []), ...(answers.ron.n ? ['n'] : [])] as Mahjong.Common.House[],
ron: [...(answers.ron.e ? ['e'] : []), ...(answers.ron.s ? ['s'] : []), ...(answers.ron.w ? ['w'] : []), ...(answers.ron.n ? ['n'] : [])] as Mahjong.House[],
});
room.gameState = engine.state;
await this.saveRoom(room);
Expand Down Expand Up @@ -376,7 +376,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
}

@bindThis
private async dahai(room: Room, engine: Mahjong.MasterGameEngine, house: Mahjong.Common.House, tile: Mahjong.Common.Tile, riichi = false) {
private async dahai(room: Room, engine: Mahjong.MasterGameEngine, house: Mahjong.House, tile: Mahjong.Tile, riichi = false) {
const res = engine.commit_dahai(house, tile, riichi);
room.gameState = engine.state;
await this.saveRoom(room);
Expand Down Expand Up @@ -482,7 +482,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
const room = await this.getRoom(roomId);
if (room == null) return;
if (room.gameState == null) return;
if (!Mahjong.Common.isTile(tile)) return;
if (!Mahjong.isTile(tile)) return;

const engine = new Mahjong.MasterGameEngine(room.gameState);
const myHouse = getHouseOfUserId(room, engine, user.id);
Expand Down Expand Up @@ -606,13 +606,13 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
* @param engine
*/
@bindThis
private async waitForTurn(room: Room, house: Mahjong.Common.House, engine: Mahjong.MasterGameEngine) {
private async waitForTurn(room: Room, house: Mahjong.House, engine: Mahjong.MasterGameEngine) {
const aiHouses = [[1, room.user1Ai], [2, room.user2Ai], [3, room.user3Ai], [4, room.user4Ai]].filter(([id, ai]) => ai).map(([id, ai]) => engine.getHouse(id));

if (engine.state.riichis[house]) {
// リーチ時はアガリ牌でない限りツモ切り
const handTiles = engine.state.handTiles[house];
const horaSets = Mahjong.Common.getHoraSets(handTiles);
const horaSets = Mahjong.getHoraSets(handTiles);
if (horaSets.length === 0) {
setTimeout(() => {
this.dahai(room, engine, house, handTiles.at(-1));
Expand Down
Binary file modified packages/frontend/assets/mahjong/putted-tile-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/frontend/assets/mahjong/putted-tile-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/frontend/assets/mahjong/putted-tile-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/frontend/src/pages/mahjong/huro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import * as Mahjong from 'misskey-mahjong';
import XTile from './tile.vue';
const props = defineProps<{
huro: Mahjong.Common.Huro;
huro: Mahjong.Huro;
variation: string;
doras: Mahjong.Common.Tile[];
doras: Mahjong.Tile[];
}>();
</script>

Expand Down
Loading

0 comments on commit 586a458

Please sign in to comment.