 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
39 #include <sys/types.h>
41 #include <netinet/in.h>
42 #include <netinet/tcp.h>
82 LOG(
llevError,
"Buffer overflow in send_skill_info, not sending all skill information\n");
86 if (params != NULL && *params ==
'1') {
115 LOG(
llevError,
"Buffer overflow in send_skill_extra, not sending all skill information\n");
143 LOG(
llevError,
"Buffer overflow in send_spell_paths, not sending all spell information\n");
168 LOG(
llevError,
"Buffer overflow in send_exp_table, not sending all information\n");
181 #define AddShortAttr(New, Type) \
183 SockList_AddChar(sl, Type); \
184 SockList_AddShort(sl, New); \
237 const char *value, *value1;
238 char *lasts, *mychoices, *token;
242 snprintf(
buf,
MAX_BUF,
"race_choice_description_%d", i);
247 snprintf(
buf,
MAX_BUF,
"class_choice_description_%d", i);
253 if (value && value1) {
268 token = strtok_r(mychoices,
" ", &lasts);
278 LOG(
llevError,
"send_arch_info: Unable to find archetype %s\n", token);
280 token = strtok_r(NULL,
" ", &lasts);
314 SockList_AddPrintf(sl,
"|%s", race->name);
328 static int sl_initialized = 0;
330 if (!sl_initialized) {
348 if (params == NULL) {
349 LOG(
llevError,
"send_race_info: IP '%s' sent bogus race_info command.\n", ns->
host);
380 SockList_AddPrintf(sl,
"|%s", cl->name);
394 static int sl_initialized = 0;
396 if (!sl_initialized) {
414 if (params == NULL) {
415 LOG(
llevError,
"send_class_info: IP '%s' sent bogus class_info request.\n", ns->
host);
449 SockList_AddChar(&sl, INFO_MAP_ARCH_NAME);
450 SockList_AddLen16Data(&sl, m->name, strlen(m->name));
452 SockList_AddChar(&sl, INFO_MAP_NAME);
453 SockList_AddLen16Data(&sl, m->clone.name, strlen(m->clone.name));
459 SockList_AddChar(&sl, INFO_MAP_DESCRIPTION);
460 SockList_AddLen16Data(&sl, m->clone.msg, strlen(m->clone.msg));
484 if (!strcmp(file,
"motd"))
486 else if (!strcmp(file,
"rules"))
488 else if (!strcmp(file,
"news"))
491 LOG(
llevError,
"send_file requested to send unknown file: %s\n", file);
494 fp = fopen(
buf,
"r");
551 snprintf(
buf,
MAX_BUF,
"R class requestinfo");
554 snprintf(
buf,
MAX_BUF,
"O startingmap requestinfo");
@ CLASS
Object for applying character class modifications to someone.
#define NS_FACESENT_FACE
Bitmask for the faces_sent[] array - what portion of the face have we sent?
struct Settings settings
Server settings.
int16_t max_level
This is read out of exp_table.
void SockList_AddInt64(SockList *sl, uint64_t data)
Adds a 64 bit value.
static void build_race_list_reply(SockList *sl)
Creates the appropriate reply to the 'race_list' request info.
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void send_skill_extra(socket_struct *ns, char *params)
Send extra skill information.
static void build_class_list_reply(SockList *sl)
Creates the appropriate reply to the 'class_list' request info.
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
Simple function we use below to keep adding to the same string but also make sure we don't overwrite ...
const char *const spellpathnames[NRSPELLPATHS]
Perhaps not the best place for this, but needs to be in some file in the common area so that standalo...
Socket structure, represents a client-server connection.
void SockList_AddString(SockList *sl, const char *data)
Adds a string without length.
uint8_t starting_stat_min
Minimum value of a starting stat.
void send_new_char_info(socket_struct *ns)
Sends information related to creating a new character to the client.
static void send_arch_info(SockList *sl, const object *op)
This sends information about object op to client - used in response to requestinfo.
void SockList_AddLen16Data(SockList *sl, const void *data, size_t len)
Adds a data block prepended with an 16 bit length field.
void SockList_Reset(SockList *sl)
Resets the length of the stored data for writing.
const char * object_get_value(const object *op, const char *const key)
Get an extra value by key.
AssetsManager * getManager()
size_t SockList_Avail(const SockList *sl)
Returns the available bytes in a SockList instance.
const char *const short_stat_name[NUM_STATS]
Short name of stats.
static event_registration m
void send_file(socket_struct *ns, const char *file)
Sends the desired file to the client.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points cl
void esrv_send_face(socket_struct *ns, const Face *face, int nocache)
Sends a face to a client if they are in pixmap mode, nothing gets sent in bitmap mode.
int64_t * levels
Number of levels for which we have experience.
uint16_t number
This is the image unique identifier.
const char * motd
Name of the motd file.
object clone
An object from which to do object_copy()
void SockList_AddShort(SockList *sl, uint16_t data)
Adds a 16 bit value.
void send_race_info(socket_struct *ns, char *params)
Sends information on specified race to the client.
void SockList_AddChar(SockList *sl, unsigned char c)
Adds an 8 bit value.
char * host
Which host it is connected from (ip address).
const char * rules
Name of rules file.
const char * news
Name of news file.
uint8_t type
PLAYER, BULLET, etc.
const char * skill_names[MAX_SKILLS]
Will contain a number-name mapping for skills, initialized by init_skills().
#define CS_STAT_SKILLINFO
CS_STAT_SKILLINFO is used as the starting index point.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
const char * confdir
Configuration files.
#define MAX_SKILLS
This is the maximum number of skills the game may handle.
void each(std::function< void(T *)> op)
Apply a function to each asset.
#define MAP_TYPE_CHOICE
Choice of maps presented to player.
void send_spell_paths(socket_struct *ns)
This sends the spell path to name mapping.
void SockList_Init(SockList *sl)
Initializes the SockList instance.
Archetypes * archetypes()
Get archetypes.
#define MAX_BUF
Used for all kinds of things.
void SockList_Term(SockList *sl)
Frees all resources allocated by a SockList instance.
uint8_t starting_stat_points
How many stat points character starts with.
void send_skill_info(socket_struct *ns, char *params)
This sends the skill number to name mapping.
void SockList_AddData(SockList *sl, const void *data, size_t len)
Adds a data block.
sstring name
The name of the object, obviously...
const Face * skill_faces[MAX_SKILLS]
Will contain the face numbers for the skills, initialized by init_skill().
void send_map_info(socket_struct *ns)
Send information on available start maps.
void SockList_AddLen8Data(SockList *sl, const void *data, size_t len)
Adds a data block prepended with an 8 bit length field.
sstring msg
If this is a book/sign/magic mouth/etc.
#define AddShortAttr(New, Type)
void send_class_list(socket_struct *ns)
Sends the list of classes to the client.
uint8_t * faces_sent
This is a bitmap on sent face status.
void send_class_info(socket_struct *ns, char *params)
Send information on the specified class.
sstring skill_messages[MAX_SKILLS]
Will contain the message for the skills, initialized by init_skill().
archetype * try_find_archetype(const char *name)
living stats
Str, Con, Dex, etc.
void send_exp_table(socket_struct *ns)
This sends the experience table the sever is using.
void Send_With_Handling(socket_struct *ns, SockList *sl)
Calls Write_To_Socket to send data to the client.
Contains the base information we use to make up a packet we want to send.
@ NUM_STATS
Number of statistics.
#define NRSPELLPATHS
Number of spell paths.
void SockList_AddPrintf(SockList *sl, const char *format,...)
Adds a printf like formatted string.
uint8_t starting_stat_max
Maximum value of a starting stat.
void send_race_list(socket_struct *ns)
Send the list of player races to the client.