Commit 169e8205 authored by mercury233's avatar mercury233

add send card hint to client function

parent 185af253
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"HS_PLAYER_CHANGE":"STOC_HS_PlayerChange", "HS_PLAYER_CHANGE":"STOC_HS_PlayerChange",
"HS_PLAYER_ENTER":"STOC_HS_PlayerEnter", "HS_PLAYER_ENTER":"STOC_HS_PlayerEnter",
"ERROR_MSG": "STOC_ErrorMsg", "ERROR_MSG": "STOC_ErrorMsg",
"GAME_MSG": "GameMsg_Hint_Card_only",
"CHAT": "STOC_Chat" "CHAT": "STOC_Chat"
} }
} }
...@@ -83,7 +83,12 @@ ...@@ -83,7 +83,12 @@
"STOC_HS_WatchChange": [ "STOC_HS_WatchChange": [
{"name": "watch_count", "type": "unsigned short"} {"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": [ "deck": [
{"name": "mainc", "type": "unsigned int"}, {"name": "mainc", "type": "unsigned int"},
{"name": "sidec", "type": "unsigned int"}, {"name": "sidec", "type": "unsigned int"},
......
...@@ -552,6 +552,9 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -552,6 +552,9 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
when '/roomname' when '/roomname'
ygopro.stoc_send_chat(client,"您当前的房间名是 " + client.room.name) if client.room 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 return cancel
......
...@@ -636,6 +636,7 @@ ...@@ -636,6 +636,7 @@
case '/help': case '/help':
ygopro.stoc_send_chat(client, "YGOSrv233 指令帮助"); ygopro.stoc_send_chat(client, "YGOSrv233 指令帮助");
ygopro.stoc_send_chat(client, "/help 显示这个帮助信息"); ygopro.stoc_send_chat(client, "/help 显示这个帮助信息");
ygopro.stoc_send_chat(client, "/roomname 显示当前房间的名字");
if (settings.modules.tips) { if (settings.modules.tips) {
ygopro.stoc_send_chat(client, "/tip 显示一条提示"); ygopro.stoc_send_chat(client, "/tip 显示一条提示");
} }
...@@ -647,8 +648,11 @@ ...@@ -647,8 +648,11 @@
break; break;
case '/roomname': case '/roomname':
if (client.room) { 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; return cancel;
}); });
......
...@@ -130,4 +130,24 @@ for name, declaration of structs_declaration ...@@ -130,4 +130,24 @@ for name, declaration of structs_declaration
@stoc_send_chat(client, msg, player) if client @stoc_send_chat(client, msg, player) if client
for client in room.watchers for client in room.watchers
@stoc_send_chat(client, msg, player) if client @stoc_send_chat(client, msg, player) if client
return return
\ No newline at end of file
@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 @@ ...@@ -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); }).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