/usr/share/doc/dopewars/html/protocol.html is in dopewars-data 1.5.12-14.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>The dopewars network protocol</title>
</head>
<body>
<h1>The dopewars network protocol</h1>
<ul>
<li><a href="#syntax">Syntax used in this document</a></li>
<li><a href="#format">General message format</a></li>
<li><a href="#startgame">Starting a game from the client</a></li>
<li><a href="#refserver">Server to client message reference</a></li>
<li><a href="#refclient">Client to server message reference</a></li>
</ul>
<h2><a id="syntax">Syntax used in this document</a></h2>
<dl>
<dt><tt>(runhere)</tt></dt>
<dd>A single character field (equivalent to C's %c format).</dd>
<dt><tt><ID></tt></dt>
<dd>A numeric field - an integer printed in text form, without spaces, commas
or other punctuation. Note that the number is not stored directly as its
binary representation, but as a string - i.e. "100" takes 3 characters
(bytes), not one. Equivalent to C's %d format.</dd>
<dt><tt>"text"</tt></dt>
<dd>Freeform text, equivalent to C's %s format.</dd>
</dl>
<p>Anything else should be taken as literal characters, which should appear in
the message exactly as printed here.</p>
<h2><a id="format">General message format</a></h2>
<p>dopewars clients communicate with the dopewars server by means of a TCP/IP
connection. Messages are sent in plain text, are of variable length, and
are always terminated by a linefeed character ('\n', ASCII code 10)</p>
<p>Messages themselves are typically split into 'words', delimited by the caret
(^) character. The underline character (_) is also used to break up
translatable strings (tstrings), if the <a href="#tstring">A_TSTRING</a>
ability is active, and thus these two characters, together with the \n
character, should normally be avoided in message data.</p>
<p>Messages are usually of the format:-</p>
<dl>
<dt><tt><ID>^(A)(C)"data"</tt></dt>
<dd><tt>ID</tt> = player ID (may also be blank if this is not applicable)<br />
<tt>A</tt> = one-letter message subtype code (used by AI players)<br />
<tt>C</tt> = one-letter message type code<br />
<tt>data</tt> = message-dependent information</dd>
</dl>
<p>e.g. "1^AFHello player"</p>
<p>If ID is not specified, it should be left blank when sending to the server,
and should be ignored in reading messages from the server.</p>
<p>The "data" field often contains multiple items, separated by ^ characters.
Note that the last field in such a message should <b>not</b> be assumed to be
terminated by the message terminator, \n - although it always will be, it
should also be first terminated by the field separator, the ^ character.
This allows the client to ignore extra fields, if later versions
of the protocol should add them. (N.B. This does not apply to free-form text
fields, as in the C_QUESTION, C_PRINTMESSAGE, C_MSG, C_MSGTO, and C_FIGHTPRINT
messages, which _do_ extend to the end of the message; for these messages,
the caret is generally interpreted as a line break.) Note also that older
servers may not send all the fields, so if fewer fields than expected are
received, the client should substitute default values.</p>
<p>Message codes are shown below, together with the symbolic constants used in
the dopewars code for clarity (e.g. the 'A' code is represented by
C_PRINTMESSAGE)</p>
<p>For the AI codes, see the AICode type in src/message.h</p>
<p><a id="oldprotocol">N.B. Older versions of dopewars used a less
sophisticated protocol:-</a></p>
<dl>
<dt><tt>"From"^"To"^(A)(C)"data"</tt></dt>
<dd><tt>A</tt>, <tt>C</tt>, and <tt>data</tt> are the same; however
<tt>"From"</tt> and <tt>"To"</tt> are the player <b>names</b> (not IDs) of
the players that the message is coming from and going to. Again, these can
often be left blank. This old protocol is used if the
<a href="#playerid">A_PLAYERID</a> ability is not present.</dd>
</dl>
<p>e.g. "Fred^Bert^AFHello player"</p>
<h2><a id="startgame">Starting a game from the client</a></h2>
<p>To start a game, the client must first notify the server of the protocol
it can support (with the <a href="#abilities">C_ABILITIES</a> message) and
then provide a suitable player name (with the <a href="#name">C_NAME</a>
message). Note that both of these messages must be sent using the
<a href="#oldprotocol">old protocol</a>, as before protocol negotiation is
complete (both server and client have sent a C_ABILITIES message) the server
will default to using this protocol, for backwards compatibility. After sending
these two messages, the game is run mainly by the server; the client should
listen for incoming messages, and respond appropriately.</p>
<h2><a id="refserver">Server to client message reference</a></h2>
<p>The messages listed below may be sent from a dopewars server to the client.
Most of these messages require some kind of processing to be done, and may
require a response. The client cannot safely ignore such messages, as the
server will not "retry" if the client does not respond.</p>
<dl>
<dt><b>C_PRINTMESSAGE</b> ('<tt>A</tt>')</dt>
<dd>Sent when the server wishes the client to display some text<br />
<tt>data</tt> = The text that the client should display; any ^ delimiters in
this text should be taken to mean a new line.<br />
e.g. "^AAGame over^You made the high score list"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_LIST</b> ('<tt>B</tt>')</dt>
<dd>Used by the server to tell the client about other logged on players<br />
<tt>data</tt> = <tt>"name"^<ID></tt><br />
<tt>name</tt> = the name of the player<br />
<tt>ID</tt> = the numeric ID that should be used to communicate with this
player<br />
e.g. "^ABFred^1"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_ENDLIST</b> ('<tt>C</tt>')</dt>
<dd>Signals that all players have been listed (no more C_LIST messages to
come)<br />
e.g. "^AC"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_NEWNAME</b> ('<tt>D</tt>')</dt>
<dd>Signals that the name provided by the client is unsuitable (usually, this
is because it's already been taken by another player)<br />
N.B. This is always sent at the start of the game, before protocol negotiation,
so uses the old format, e.g. "^^AD"<br />
<b>Answer required:</b> yes - must send a suitable C_NAME message to
proceed<p /></dd>
<dt><b>C_MSG</b> ('<tt>E</tt>')</dt>
<dd>Contains a message from one player (or the server admin) broadcast to all
connected players.<br />
<tt>data</tt> = the message to display<br />
<tt>ID</tt> = the ID of the player that sent the message<br />
e.g. "1^AEHello world"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_MSGTO</b> ('<tt>F</tt>')</dt>
<dd>Contains a private message from one player to another<br />
<tt>data</tt> = the message to display<br />
<tt>ID</tt> = the ID of the player that sent the message<br />
e.g. "1^AFHello player"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_JOIN</b> ('<tt>G</tt>')</dt>
<dd>Sent by the server to all players when a new player joins the game
(See C_LIST for format)<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_LEAVE</b> ('<tt>H</tt>')</dt>
<dd>Sent by the server to all players when a player leaves the game<br />
<tt>data</tt> = the name of the player that's leaving<br />
<tt>ID</tt> = the ID of the player<br />
e.g. "1^AHFred"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_SUBWAYFLASH</b> ('<tt>I</tt>')</dt>
<dd>Used by the server to tell a client that it has just moved to a new
location. (The client is not told where this location is, since this is
information is contained in a C_UPDATE message.) Clients usually reset any
location-dependent state (e.g. fights) on receiving this message, and flash
a "subway" indicator or similar<br />
e.g. "^AI"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_UPDATE</b> ('<tt>J</tt>')</dt>
<dd>Used by the server to update client state. This is also used to tell the
player about the state of another player (a report from a spy)<br />
<tt>data</tt> = <tt><cash>^<debt>^<bank>^<health>^<coatsize>^<locn>^<turn>^<flags>^<GUNS>^<DRUGS>^<DRUGVALUE>^<bitches></tt><br />
<tt>cash</tt>, <tt>debt</tt>, <tt>bank</tt> = money available, owed to the
loan shark, in the bank<br />
<tt>coatsize</tt> = amount of space available for drugs/guns<br />
<tt>locn</tt> = zero-based game location<br />
<tt>turn</tt> = turn number<br />
<tt>flags</tt> = player status flags - see PlayerFlags in src/dopewars.h for
the individual binary bits. The only one currently used is SPYINGON (16) which
is set if the player is currently spying on one or more other players<br />
<tt>GUNS</tt> = the numbers of each gun carried, separated by ^ characters
(there should be NumGun numbers in this list - see the C_INIT message)<br />
<tt>DRUGS</tt> = similar, for carried drugs<br />
<tt>DRUGVALUE</tt> = similar, but contains the total cash value of each drug;
N.B. this field is only sent if the ability
<a href="#drugvalue">A_DRUGVALUE</a> is present<br />
<tt>bitches</tt> = number of accompanying bitches<br />
<tt>ID</tt> = blank for a status update, otherwise the ID of the player that
you're spying on<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_DRUGHERE</b> ('<tt>K</tt>')</dt>
<dd>Tells the client which drugs are available to buy at the current
location<br />
<tt>data</tt> = drug prices, separated by ^ characters. If a price is zero,
that drug is not available here<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_GUNSHOP</b> ('<tt>L</tt>')</dt>
<dd>Tells the client to start up the "gun shop", for buying/selling guns<br />
e.g. "^AL"<br />
<b>Answer required:</b> yes - zero or more C_BUYOBJECT messages, followed by a
C_DONE message<p /></dd>
<dt><b>C_LOANSHARK</b> ('<tt>M</tt>')</dt>
<dd>Tells the client that the player has a chance to pay back the loan<br />
e.g. "^AM"<br />
<b>Answer required:</b> yes - an optional C_PAYLOAN message, followed by a
C_DONE message<p /></dd>
<dt><b>C_BANK</b> ('<tt>N</tt>')</dt>
<dd>Tells the client that the player has a chance to visit the bank<br />
e.g. "^AN"<br />
<b>Answer required:</b> yes - an optional C_DEPOSIT message, followed by a
C_DONE message<p /></dd>
<dt><b>C_QUESTION</b> ('<tt>O</tt>')</dt>
<dd>Used to display a message from the server that requires a response<br />
<tt>data</tt> = <tt>"keys"^"message"</tt><br />
<tt>keys</tt> = a list of the valid single-character responses - e.g. "YN" for
a yes/no question; the client may use these keys directly, or expand them to
complete words (e.g. YN -> Yes/No)<br />
<tt>message</tt> = the message to display<br />
e.g. "^AOYN^Would you like to visit the bank?"<br />
<b>Answer required:</b> yes - a C_ANSWER message, containing one of the valid
response keys<p /></dd>
<dt><b>C_HISCORE</b> ('<tt>Q</tt>')</dt>
<dd>Used for the server to tell the client about a high score; C_HISCORE
messages should only ever be sent after a C_STARTHISCORE message and before a
C_ENDHISCORE message<br />
<tt>data</tt> = <tt><index>^(B)"score"</tt><br />
<tt>index</tt> = the zero-based index of the high score (0 is the top
score)<br />
<tt>B</tt> = the single character 'B' if this score should be displayed in
bold (usually to indicate that it's "your" score) or 'N' otherwise<br />
<tt>score</tt> = the text containing the score, date, and player name<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_STARTHISCORE</b> ('<tt>R</tt>')</dt>
<dd>Tells the client that the server is about to send it a list of high scores;
usually used by the client to display the title of a high score screen<br />
e.g. "^AR"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_ENDHISCORE</b> ('<tt>S</tt>')</dt>
<dd>Tells the client that the server has sent all of the high scores; usually
used by the client to display a prompt to end the game (if data="end") or to
return to the game (if data is not "end")<br />
<tt>data</tt> = "end" if the game has finished, blank otherwise<br />
e.g. "^ASend"<br />
<b>Answer required:</b> no, but the client should disconnect if data="end"
<p /></dd>
<dt><b>C_PUSH</b> ('<tt>Z</tt>')</dt>
<dd>Requests that the client leave the server<br />
e.g. "^AZ"<br />
<b>Answer required:</b> no, but the client should disconnect<p /></dd>
<dt><b>C_QUIT</b> ('<tt>a</tt>')</dt>
<dd>Notifies the client that the server is about to terminate<br />
e.g. "^Aa"<br />
<b>Answer required:</b> no, but the client should disconnect<p /></dd>
<dt><b>C_RENAME</b> ('<tt>b</tt>')</dt>
<dd>Instructs the client that another player has changed his/her name<br />
<tt>data</tt> = the new player name<br />
<tt>ID</tt> = the player's ID<br />
e.g. "1^AbFred"<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_INIT</b> ('<tt>k</tt>')</dt>
<dd>Tells the client about various global game settings<br />
<tt>data</tt> = <tt>"version"^<numloc>^<numgun>^<numdrug>^"bitch"^"bitches"^"gun"^"guns"^"drug"^"drugs"^"date"^<ID>^"loanshark"^"bank"^"gunshop"^"pub"^(prefix)"currency"</tt><br />
<tt>version</tt> = dopewars version of the server - e.g. "1.5.2"<br />
<tt>numloc</tt> = the number of locations in the game<br />
<tt>numgun</tt> = the number of guns in the game<br />
<tt>numdrug</tt> = the number of drugs in the game<br />
<tt>bitch</tt>, <tt>bitches</tt>, <tt>gun</tt>, <tt>guns</tt>, <tt>drug</tt>,
<tt>drugs</tt>, <tt>date</tt>, <tt>loanshark</tt>,
<tt>bank</tt>, <tt>gunshop</tt>, <tt>pub</tt> = various names used in the
game<br />
<tt>ID</tt> = the ID that the client should use to refer to itself<br />
<tt>prefix</tt> = '1' if the currency symbol (e.g. $) should be printed before
prices in the game, '0' otherwise<br />
<tt>currency</tt> = the currency symbol to use<br />
e.g. "^Ak1.5.2^8^4^12^bitch^bitches^gun^guns^drug^drugs^12-^-1984^0^the Loan Shark^the Bank^Dan's House of Guns^the pub"^1$<br />
<b>Answer required:</b> no<p /></dd>
<dt><b>C_DATA</b> ('<tt>l</tt>')</dt>
<dd>Tells the client about various game settings - 4 variants on this message
are possible:-
<dl>
<dt>Information about locations in the game</dt>
<dd><tt>data</tt> = <tt><index>^A"name"</tt><br />
<tt>index</tt> = zero-based index of the location<br />
<tt>name</tt> = name of the location<br />
e.g. "^Al0^ABronx"<p /></dd>
<dt>Information about drugs</dt>
<dd><tt>data</tt> = <tt><index>^B"name"^<min>^<max></tt>
<tt>index</tt> = zero-based index of the drug<br />
<tt>name</tt> = name of the drug<br />
<tt>min</tt> = the minimum price of the drug<br />
<tt>max</tt> = the maximum price of the drug<br />
e.g. "^Al1^BCocaine^15000^29000"<p /></dd>
<dt>Information about guns</dt>
<dd><tt>data</tt> = <tt><index>^C"name"^<price>^<space>^<damage></tt><br />
<tt>index</tt> = zero-based index of the gun<br />
<tt>name</tt> = name of the gun<br />
<tt>price</tt> = the normal cost of the gun<br />
<tt>damage</tt> = the maximum damage that the gun can do<br />
e.g. "^Al2^CRuger^2900^4^4"<p /></dd>
<dt>Miscellaneous information</dt>
<dd><tt>data</tt> = <tt>0^D<spy>^<tipoff></tt><br />
<tt>spy</tt> = the price to spy on another player<br />
<tt>tipoff</tt> = the price to tip off the cops to another player<br />
e.g. "^Al0^D20000^10000"</dd>
</dl>
<b>Answer required:</b> no<p /></dd>
<dt><b>C_FIGHTPRINT</b> ('<tt>m</tt>')</dt>
<dd><tt>data</tt> = <tt>"attack"^"defend"^<health>^<bitches>^"bitchname"^<killed>^<armpct>^(fightpoint)(runhere)(loot)(canfire)^"text"</tt><br />
<tt>attack</tt> = name of the attacker player/cop if applicable (if blank,
it's you)<br />
<tt>defend</tt> = name of the defending player/cop if applicable (if blank,
it's you)<br />
<tt>health</tt> = defender's health, if applicable<br />
<tt>bitches</tt> = number of bitches/deputies accompanying the defending
player<br />
<tt>bitchname</tt> = usually "bitch", "bitches", "deputy" or "deputies"<br />
<tt>killed</tt> = number of bitches killed in this attack<br />
<tt>armpct</tt> = a number between 0 and 100 showing how heavily armed the
attacker is<br />
<tt>fightpoint</tt> =<br />
<dl>
<dt>'<tt>A</tt>' (<b>F_ARRIVED</b>)</dt>
<dd>The "defending" player has just arrived on the scene</dd>
<dt>'<tt>S</tt>' (<b>F_STAND</b>)</dt>
<dd>The "attacking" player chose not to shoot</dd>
<dt>'<tt>H</tt>' (<b>F_HIT</b>)</dt>
<dd>The "attacking" player fired on the defender, and hit</dd>
<dt>'<tt>M</tt>' (<b>F_MISS</b>)</dt>
<dd>The "attacking" player fired on the defender, and missed</dd>
<dt>'<tt>R</tt>' (<b>F_RELOAD</b>)</dt>
<dd>The "attacking" player is ready to fire again</dd>
<dt>'<tt>L</tt>' (<b>F_LEAVE</b>)</dt>
<dd>The "attacking" player has fled the fight, but other opponents remain</dd>
<dt>'<tt>D</tt>' (<b>F_LASTLEAVE</b>)</dt>
<dd>The "attacking" player has fled, and nobody else is present, so the fight
is over</dd>
<dt>'<tt>F</tt>' (<b>F_FAILFLEE</b>)</dt>
<dd>The "attacking" player tried to get away, but failed</dd>
<dt>'<tt>G</tt>' (<b>F_MSG</b>)</dt>
<dd>Nothing exciting has happened, but "text" should still be displayed</dd>
</dl>
<tt>runhere</tt> = '1' if running should take you to the current location (if
'0', you should jet to another location)<br />
<tt>loot</tt> = '1' if the attack resulted in a kill and a loot of the body<br />
<tt>canfire</tt> = '1' if you are allowed to shoot at other players right
now<br />
<tt>text</tt> = explanatory text from the server, to be printed<br />
<b>Answer required:</b> yes, depending on the message contents: usually a
C_REQUESTJET or C_FIGHTACT message<p /></dd>
<dt><a id="abilities"><b>C_ABILITIES</b></a> ('<tt>r</tt>')</dt>
<dd>Negotiates protocol extensions between client and server<br />
<tt>data</tt> =
<tt>(playerid)(drugvalue)(newfight)(tstring)(donefight)(utf8)(date)</tt>
<p><a id="playerid"><tt>playerid</tt></a> = '1' if we use player IDs rather
than player names to identify players in network messages ('0' otherwise). It is
strongly recommended that this new protocol be used, as the old protocol is
difficult to properly support, and is deprecated. However, the new protocol is
only supported by servers of version 1.5.0 or above. (N.B. Since the old
protocol does not support the C_ABILITIES message either, before the client and
server have exchanged C_ABILITIES messages the server will "talk" using the old
protocol. Thus, the C_ABILITIES message itself from the client, and any
succeeding messages sent before the server sends C_ABILITIES back, must be
sent using the old protocol. "Old" servers will ignore the C_ABILITIES
message.) Ability name in dopewars code: <b>A_PLAYERID</b></p>
<p><a id="drugvalue"><tt>drugvalue</tt></a> = '1' if the server should keep
track of how much players paid for their drugs, so that they can see whether
they're getting a good deal when they come to sell them ('0' otherwise).
Ability name in dopewars code: <b>A_DRUGVALUE</b></p>
<p><a id="newfight"><tt>newfight</tt></a> = '1' if we use the "new" fighting
interface (documented here). Highly recommended. Ability name in dopewars
code: <b>A_NEWFIGHT</b></p>
<p><a id="tstring"><tt>tstring</tt></a> = '1' if names of drugs etc. should be
sent in the <a href="i18n.html">translated string</a> (tstring) notation;
only necessary if you are supporting non-English languages. Ability name
in dopewars code: <b>A_TSTRING</b></p>
<p><a id="donefight"><tt>donefight</tt></a> = '1' if, when a fight finishes,
the client is expected to send a C_DONE message to instruct the server to
move on. (This is to allow the user to close the fight dialog before any
new dialogs pop up.) Ability name in dopewars code: <b>A_DONEFIGHT</b></p>
<p><a id="utf8"><tt>utf8</tt></a> = '1' if all strings are sent over the
network in UTF-8 (Unicode) encoding, rather than an encoding specific to
the locale of the server or client. Ability name in dopewars code:
<b>A_UTF8</b></p>
<p><a id="date"><tt>date</tt></a> = '1' if the C_INIT message sends/receives
the Names.Date variable, rather than Names.Month and Names.Year as older
versions used to. Ability name in dopewars code: <b>A_DATE</b></p>
<p><b>N.B.</b> Only seven abilities are listed here. Older servers or clients
may not only not support some of these abilities, they may not even know
of their existence (conversely, newer versions may add new abilities). Thus
all servers and clients, if passed an unexpectedly short abilities string,
should pad it out with zeroes. If passed a long string, it should be truncated.
This will cause these extra (or unspecified) abilities to be unsupported.
(The order of the abilities string should never change.)</p>
e.g. "^^Ar1010000" (N.B. the double ^ is a feature of the "old" protocol)</dd>
</dl>
<h2><a id="refclient">Client to server message reference</a></h2>
<p>The messages are below are typically sent from the client to the server. Note
that players do not communicate directly between each other, but always via
the server. Note also that some of these messages are also valid when sent
from the server to the client.</p>
<dl>
<dt><b>C_MSG</b> ('<tt>E</tt>')</dt>
<dd>Contains a message from one player to be broadcast to all connected
players<br />
<tt>data</tt> = the message to display<br />
e.g. "^AEHello world"<p /></dd>
<dt><b>C_MSGTO</b> ('<tt>F</tt>')</dt>
<dd>Contains a private message from one player to another<br />
<tt>data</tt> = the message to display<br />
<tt>ID</tt> = the ID of the player to send the message to<br />
e.g. "1^AFHello player"<p /></dd>
<dt><b>C_BUYOBJECT</b> ('<tt>T</tt>')</dt>
<dd>Requests the server to buy or sell an object<br />
<tt>data</tt> = <tt>"type"^<index>^<amount></tt><br />
<tt>type</tt> = "bitch", "gun" or "drug"<br />
<tt>index</tt> = the zero-based index of the gun/drug that you want to
buy/sell, or zero if type="bitch"<br />
<tt>amount</tt> = the number of objects to buy (or, if negative, to sell)<br />
e.g. "^ATbitch^0^1"<p /></dd>
<dt><b>C_DONE</b> ('<tt>U</tt>')</dt>
<dd>Sent by the client when it's finished with the loan shark, bank, or gun
shop<br />
e.g. "^AU"<p /></dd>
<dt><b>C_REQUESTJET</b> ('<tt>V</tt>')</dt>
<dd>Asks the server to jet to a new location (or to run from a fight)<br />
<tt>data</tt> = the numeric, zero-based, location to jet to<br />
e.g. "^AV2"<p /></dd>
<dt><b>C_PAYLOAN</b> ('<tt>W</tt>')</dt>
<dd>Asks to pay back a loan to the loan shark<br />
<tt>data</tt> = the amount of money to pay back<br />
e.g. "^AW5000"<p /></dd>
<dt><b>C_ANSWER</b> ('<tt>X</tt>')</dt>
<dd>Sends the reply to a previous question from the server<br />
<tt>data</tt> = the single character response<br />
e.g. "^AXY"<p /></dd>
<dt><b>C_DEPOSIT</b> ('<tt>Y</tt>')</dt>
<dd>Asks to deposit money into (or withdraw money from) the bank<br />
<tt>data</tt> = the amount of money to deposit, or (if negative) the amount
to withdraw<br />
e.g. "^AY10000"<p /></dd>
<dt><a id="name"><b>C_NAME</b></a> ('<tt>c</tt>')</dt>
<dd>Sent by the client to register the player name with the server<br />
<tt>data</tt> = the player's name<br />
N.B. this is always sent at the start of the game, in which case the old
format should be used, e.g. "^^AcFred"<p /></dd>
<dt><b>C_SACKBITCH</b> ('<tt>d</tt>')</dt>
<dd>Requests that a bitch should be sacked<br />
e.g. "^Ad"<p /></dd>
<dt><b>C_TIPOFF</b> ('<tt>e</tt>')</dt>
<dd>Asks the server to tip off the cops to another player<br />
<tt>ID</tt> = the player ID to tip off the cops to<br />
e.g. "1^Ae"<p /></dd>
<dt><b>C_SPYON</b> ('<tt>f</tt>')</dt>
<dd>Asks the server to spy on another player<br />
<tt>ID</tt> = the player ID to spy on<br />
e.g. "1^Af"<p /></dd>
<dt><b>C_WANTQUIT</b> ('<tt>g</tt>')</dt>
<dd>Tells the server that the client wishes to leave the game early<br />
e.g. "^Ag"<p /></dd>
<dt><b>C_CONTACTSPY</b> ('<tt>h</tt>')</dt>
<dd>Asks the server to send back reports about all the players that we are
currently spying on<br />
e.g. "^Ah"<p /></dd>
<dt><b>C_REQUESTSCORE</b> ('<tt>j</tt>')</dt>
<dd>Asks the server to send back the high score list<br />
e.g. "^Aj"<p /></dd>
<dt><b>C_FIGHTACT</b> ('<tt>n</tt>')</dt>
<dd>Responds to a previous C_FIGHTPRINT message<br />
<tt>data</tt> = "<tt>F</tt>", "<tt>S</tt>", or "<tt>R</tt>"<br />
<tt>F</tt> = return fire<br />
<tt>S</tt> = stand and take it (do not return fire)<br />
<tt>R</tt> = try to run away<br />
N.B. If "runhere" is not set in the C_FIGHTPRINT message, the "R" response
should not be sent - a C_REQUESTJET message should be sent instead.<br />
e.g. "^AnF"<p /></dd>
<dt><b>C_ABILITIES</b> ('<tt>r</tt>')</dt>
<dd>Notifies the server of supported protocol features. See the explanation
for the corresponding <a href="#abilities">server message</a>.
<p>The client will receive this message in response to a previous C_ABILITIES
message that it sent to the server. This reply message contains the abilities
that the server is willing to support. The client should compare these to
those that it previously offered, and then use only those abilities that both
client and server support. (If the server does not support the new protocol,
no C_ABILITIES reply message will be sent, and the client should assume that
<b>no</b> abilities are supported.) The server will expect all client messages
after the C_ABILITIES message to be compliant with these abilities.</p>
e.g.<br />
- client sends "1110111" (supports everything except
<a href="#tstring">A_TSTRING</a>)<br />
- server responds with "1011011" (supports everything except
<a href="#drugvalue">A_DRUGVALUE</a> and
<a href="#donefight">A_DONEFIGHT</a>)<br />
- client should adopt the abilities "1010011"
(<a href="#playerid">A_PLAYERID</a> and <a href="#newfight">A_NEWFIGHT</a>)</dd>
</dl>
<hr />
<ul>
<li><a href="index.html">Main index</a>
<ul>
<li><a href="developer.html">Notes for developers</a></li>
</ul>
</li>
</ul>
<p>
Last update: <b>02-09-2002</b><br />
Valid <a href="http://validator.w3.org/check/referer">XHTML 1.1</a>
</p>
</body>
</html>
|