Crossfire Server, Trunk
|
#include "global.h"
#include <assert.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include "commands.h"
#include "living.h"
#include "newserver.h"
#include "shared/newclient.h"
#include "sounds.h"
#include "sproto.h"
#include "assets.h"
#include "AssetsManager.h"
Go to the source code of this file.
Macros | |
#define | AddShortAttr(New, Type) |
Functions | |
static void | build_class_list_reply (SockList *sl) |
static void | build_race_list_reply (SockList *sl) |
static void | send_arch_info (SockList *sl, const object *op) |
void | send_class_info (socket_struct *ns, char *params) |
void | send_class_list (socket_struct *ns) |
void | send_exp_table (socket_struct *ns) |
void | send_file (socket_struct *ns, const char *file) |
void | send_map_info (socket_struct *ns) |
void | send_new_char_info (socket_struct *ns) |
void | send_race_info (socket_struct *ns, char *params) |
void | send_race_list (socket_struct *ns) |
void | send_skill_extra (socket_struct *ns, char *params) |
void | send_skill_info (socket_struct *ns, char *params) |
void | send_spell_paths (socket_struct *ns) |
requestinfo protocol handling.
This file implements all of requestinfo protocol commands/responses. This was broken from request.c as that file as getting quite large and throwing everything into that file was making it fairly unmanageable.
Definition in file requestinfo.cpp.
#define AddShortAttr | ( | New, | |
Type | |||
) |
Definition at line 181 of file requestinfo.cpp.
|
static |
Creates the appropriate reply to the 'class_list' request info.
sl | reply. |
Definition at line 375 of file requestinfo.cpp.
References AssetsManager::archetypes(), CLASS, archetype::clone, AssetsCollection< T, Key >::each(), getManager(), SockList_AddString(), SockList_Reset(), and object::type.
Referenced by send_class_list().
|
static |
Creates the appropriate reply to the 'race_list' request info.
sl | suitable reply. |
Definition at line 309 of file requestinfo.cpp.
References AssetsManager::archetypes(), archetype::clone, AssetsCollection< T, Key >::each(), getManager(), PLAYER, SockList_AddString(), and object::type.
Referenced by send_race_list().
This sends information about object op to client - used in response to requestinfo. This function is used by both race & class transmissions, and could perhaps be used by future requestinfo types.
sl | socketlist to add data to |
op | Object to extract data from. |
Definition at line 198 of file requestinfo.cpp.
References AddShortAttr, archininventory::arch, buf, CLASS, CS_STAT_CHA, CS_STAT_CON, CS_STAT_DEX, CS_STAT_INT, CS_STAT_POW, CS_STAT_STR, CS_STAT_WIS, llevError, LOG(), MAX_BUF, object_get_value(), give::op, PLAYER, SockList_AddChar(), SockList_AddData(), SockList_AddLen8Data(), SockList_AddShort(), SockList_AddString(), strdup_local, try_find_archetype(), and autojail::value.
Referenced by send_class_info(), and send_race_info().
void send_class_info | ( | socket_struct * | ns, |
char * | params | ||
) |
Send information on the specified class.
ns | where to send. |
params | class name to send. |
Definition at line 413 of file requestinfo.cpp.
References CLASS, archetype::clone, socket_struct::host, llevError, LOG(), roll-o-matic::params, send_arch_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), try_find_archetype(), and object::type.
Referenced by request_info_cmd().
void send_class_list | ( | socket_struct * | ns | ) |
Sends the list of classes to the client. The reply is kept in a static buffer, as it won't change during server run.
ns | client to send to. |
Definition at line 392 of file requestinfo.cpp.
References build_class_list_reply(), Send_With_Handling(), and SockList_Init().
Referenced by request_info_cmd().
void send_exp_table | ( | socket_struct * | ns | ) |
This sends the experience table the sever is using.
ns | where to write the information. |
Definition at line 158 of file requestinfo.cpp.
References levels, llevError, LOG(), Settings::max_level, Send_With_Handling(), settings, SockList_AddInt64(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_file | ( | socket_struct * | ns, |
const char * | file | ||
) |
Sends the desired file to the client. In all three cases, we are basically just dumping file contents to the client - nothing more.
ns | socket to send to |
file | Which file to send - string of either motd, news, rules |
Definition at line 479 of file requestinfo.cpp.
References buf, Settings::confdir, mad_mage_user::file, llevError, LOG(), MAX_BUF, Settings::motd, Settings::news, Settings::rules, Send_With_Handling(), settings, SockList_AddChar(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_map_info | ( | socket_struct * | ns | ) |
Send information on available start maps.
ns | where to send. |
Definition at line 441 of file requestinfo.cpp.
References AssetsManager::archetypes(), AssetsCollection< T, Key >::each(), getManager(), m, MAP, MAP_TYPE_CHOICE, SockList_AddPrintf(), and SockList_Init().
Referenced by request_info_cmd().
void send_new_char_info | ( | socket_struct * | ns | ) |
Sends information related to creating a new character to the client.
ns | socket to send to |
Definition at line 520 of file requestinfo.cpp.
References buf, MAX_BUF, NUM_STATS, safe_strcat(), Send_With_Handling(), settings, short_stat_name, SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), SockList_Term(), Settings::starting_stat_max, Settings::starting_stat_min, and Settings::starting_stat_points.
Referenced by request_info_cmd().
void send_race_info | ( | socket_struct * | ns, |
char * | params | ||
) |
Sends information on specified race to the client.
ns | where to send. |
params | race name to send. |
Definition at line 347 of file requestinfo.cpp.
References archetype::clone, socket_struct::host, llevError, LOG(), roll-o-matic::params, PLAYER, send_arch_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), try_find_archetype(), and object::type.
Referenced by request_info_cmd().
void send_race_list | ( | socket_struct * | ns | ) |
Send the list of player races to the client. The reply is kept in a static buffer, as it won't change during server run.
ns | where to send. |
Definition at line 326 of file requestinfo.cpp.
References build_race_list_reply(), Send_With_Handling(), and SockList_Init().
Referenced by request_info_cmd().
void send_skill_extra | ( | socket_struct * | ns, |
char * | params | ||
) |
Send extra skill information.
ns | where to write the information. |
params | ignored. |
Definition at line 102 of file requestinfo.cpp.
References CS_STAT_SKILLINFO, llevError, LOG(), MAX_SKILLS, roll-o-matic::params, Send_With_Handling(), skill_messages, skill_names, SockList_AddLen16Data(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Term(), and nlohmann::detail::void().
Referenced by request_info_cmd().
void send_skill_info | ( | socket_struct * | ns, |
char * | params | ||
) |
This sends the skill number to name mapping.
ns | where to write the information. |
params | if '1', then send the face along the skill, else just send the skill name. |
Definition at line 71 of file requestinfo.cpp.
References CS_STAT_SKILLINFO, esrv_send_face(), socket_struct::faces_sent, llevError, LOG(), MAX_SKILLS, NS_FACESENT_FACE, Face::number, roll-o-matic::params, Send_With_Handling(), skill_faces, skill_names, SockList_AddPrintf(), SockList_AddString(), SockList_Avail(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_spell_paths | ( | socket_struct * | ns | ) |
This sends the spell path to name mapping.
ns | where to write the information. |
Definition at line 132 of file requestinfo.cpp.
References llevError, LOG(), NRSPELLPATHS, Send_With_Handling(), SockList_AddPrintf(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Term(), and spellpathnames.
Referenced by request_info_cmd().