… | |
… | |
373 | and return; |
373 | and return; |
374 | |
374 | |
375 | 1 |
375 | 1 |
376 | } |
376 | } |
377 | |
377 | |
|
|
378 | =item cf::datalog type => key => value, ... |
|
|
379 | |
|
|
380 | Log a datalog packet of the given type with the given key-value pairs. |
|
|
381 | |
|
|
382 | =cut |
|
|
383 | |
|
|
384 | sub datalog($@) { |
|
|
385 | my ($type, %kv) = @_; |
|
|
386 | warn "DATALOG ", JSON::XS->new->ascii->encode ({ %kv, type => $type }); |
|
|
387 | } |
|
|
388 | |
378 | =back |
389 | =back |
379 | |
390 | |
380 | =cut |
391 | =cut |
381 | |
392 | |
382 | ############################################################################# |
393 | ############################################################################# |
… | |
… | |
1113 | } |
1124 | } |
1114 | |
1125 | |
1115 | \@paths |
1126 | \@paths |
1116 | } |
1127 | } |
1117 | |
1128 | |
1118 | =item $player->ext_reply ($msgid, $msgtype, %msg) |
1129 | =item $player->ext_reply ($msgid, %msg) |
1119 | |
1130 | |
1120 | Sends an ext reply to the player. |
1131 | Sends an ext reply to the player. |
1121 | |
1132 | |
1122 | =cut |
1133 | =cut |
1123 | |
1134 | |
1124 | sub ext_reply($$$%) { |
1135 | sub ext_reply($$%) { |
1125 | my ($self, $id, %msg) = @_; |
1136 | my ($self, $id, %msg) = @_; |
1126 | |
1137 | |
1127 | $msg{msgid} = $id; |
1138 | $msg{msgid} = $id; |
|
|
1139 | |
|
|
1140 | $self->send ("ext " . cf::to_json \%msg); |
|
|
1141 | } |
|
|
1142 | |
|
|
1143 | =item $player->ext_event ($type, %msg) |
|
|
1144 | |
|
|
1145 | Sends an ext event to the client. |
|
|
1146 | |
|
|
1147 | =cut |
|
|
1148 | |
|
|
1149 | sub ext_event($$%) { |
|
|
1150 | my ($self, $type, %msg) = @_; |
|
|
1151 | |
|
|
1152 | delete $msg{msgid}; |
|
|
1153 | $msg{msgtype} = "event"; |
|
|
1154 | $msg{eventtype} = $type; |
1128 | |
1155 | |
1129 | $self->send ("ext " . cf::to_json \%msg); |
1156 | $self->send ("ext " . cf::to_json \%msg); |
1130 | } |
1157 | } |
1131 | |
1158 | |
1132 | package cf; |
1159 | package cf; |