Commit 169e8205 authored by mercury233's avatar mercury233

add send card hint to client function

parent 185af253
......@@ -14,6 +14,7 @@
"HS_PLAYER_CHANGE":"STOC_HS_PlayerChange",
"HS_PLAYER_ENTER":"STOC_HS_PlayerEnter",
"ERROR_MSG": "STOC_ErrorMsg",
"GAME_MSG": "GameMsg_Hint_Card_only",
"CHAT": "STOC_Chat"
}
}
......@@ -83,7 +83,12 @@
"STOC_HS_WatchChange": [
{"name": "watch_count", "type": "unsigned short"}
],
"GameMsg_Hint_Card_only": [
{"name": "curmsg", "type": "word8Ule"},
{"name": "type", "type": "word8"},
{"name": "player", "type": "word8"},
{"name": "data", "type": "word32Ule"}
],
"deck": [
{"name": "mainc", "type": "unsigned int"},
{"name": "sidec", "type": "unsigned int"},
......
......@@ -552,6 +552,9 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
when '/roomname'
ygopro.stoc_send_chat(client,"您当前的房间名是 " + client.room.name) if client.room
when '/test'
ygopro.stoc_send_hint_card_to_room(client.room, 2333365)
return cancel
......
......@@ -636,6 +636,7 @@
case '/help':
ygopro.stoc_send_chat(client, "YGOSrv233 指令帮助");
ygopro.stoc_send_chat(client, "/help 显示这个帮助信息");
ygopro.stoc_send_chat(client, "/roomname 显示当前房间的名字");
if (settings.modules.tips) {
ygopro.stoc_send_chat(client, "/tip 显示一条提示");
}
......@@ -647,8 +648,11 @@
break;
case '/roomname':
if (client.room) {
ygopro.stoc_send_chat(client, "您当前的房间名是" + client.room.name);
ygopro.stoc_send_chat(client, "您当前的房间名是 " + client.room.name);
}
break;
case '/test':
ygopro.stoc_send_hint_card_to_room(client.room, 2333365);
}
return cancel;
});
......
......@@ -130,4 +130,24 @@ for name, declaration of structs_declaration
@stoc_send_chat(client, msg, player) if client
for client in room.watchers
@stoc_send_chat(client, msg, player) if client
return
\ No newline at end of file
return
@stoc_send_hint_card_to_room = (room, card)->
if !room
console.log "err stoc_send_hint_card_to_room"
return
for client in room.players
@stoc_send client, 'GAME_MSG',{
curmsg: 2,
type: 10,
player: 0,
data: card
} if client
for client in room.watchers
@stoc_send client, 'GAME_MSG',{
curmsg: 2,
type: 10,
player: 0,
data: card
} if client
return
......@@ -213,4 +213,36 @@
}
};
this.stoc_send_hint_card_to_room = function(room, card) {
var client, j, k, len1, len2, ref, ref1;
if (!room) {
console.log("err stoc_send_hint_card_to_room");
return;
}
ref = room.players;
for (j = 0, len1 = ref.length; j < len1; j++) {
client = ref[j];
if (client) {
this.stoc_send(client, 'GAME_MSG', {
curmsg: 2,
type: 10,
player: 0,
data: card
});
}
}
ref1 = room.watchers;
for (k = 0, len2 = ref1.length; k < len2; k++) {
client = ref1[k];
if (client) {
this.stoc_send(client, 'GAME_MSG', {
curmsg: 2,
type: 10,
player: 0,
data: card
});
}
}
};
}).call(this);
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