Go to the documentation of this file.
48 #include <unordered_map>
58 #define CITYLIFE_NAME "citylife"
61 #define FIRST_MOVE_KEY "citylife_first_move"
85 std::vector<spawn_point>
points;
92 static std::unordered_map<std::string, mapzone *>
maps;
104 auto find =
maps.find(
map->path);
105 return find ==
maps.end() ? nullptr : find->second;
258 va_arg(
args,
object *);
259 va_arg(
args,
object *);
260 va_arg(
args,
char *);
262 event = va_arg(
args,
object *);
270 LOG(
llevInfo,
"citylife: %s attacked, reverting to default behaviour\n",
who->name);
288 LOG(
llevInfo,
"citylife: removing event from object %s which we didn't generate\n",
who->name);
293 if (strcmp(
value,
"1") == 0) {
301 else if (
RANDOM()%100 < 30) {
302 int16_t sx =
who->x, sy =
who->y;
333 if (zone->
zones.empty()) {
336 if (zone->
points.empty()) {
353 if (
line[0] ==
'\0' ||
line[0] ==
'#') {
365 if (strcmp(
line,
"map") == 0) {
371 if (existing ==
maps.end()) {
375 zone = existing->second;
383 if (strcmp(
line,
"population") == 0) {
387 if (strcmp(
line,
"zone") == 0) {
401 if (strcmp(
line,
"point") == 0) {
409 zone->
points.push_back(p);
413 if (strcmp(
line,
"arch") == 0) {
#define GET_MAP_OB(M, X, Y)
object * object_find_by_type_subtype(const object *who, int type, int subtype)
Install Bug reporting Credits so make sure you have version or later There are files involved in the automatic convert convertall and filelist py GuildList has the list of guilds for the server GuildLocations is what is used by the install script for setting up the maps It has columns in the first is the name of the no spaces The second is the region of the the third is the destination folder for the the fourth is the exit the fifth and sixth are the x and y coords within the exit the seventh eighth and ninth are the exit location for the storage hall If field seven is then it uses the same exit map as for the guild hall itself filelist py has a list of which files to process for each guild hall convert py takes all the files in filelist py and customises them to the specific guild then outputs them into a in the same order that they are listed in GuildLocations convertall py reads the lines from GuildLocations and runs line by line
size_t bufferreader_current_line(BufferReader *br)
static std::unordered_map< std::string, mapzone * > maps
void LOG(LogLevel logLevel, const char *format,...)
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
mapstruct * has_been_loaded(const char *name)
static int eventListener(int *type,...)
static event_registration c
void events_unregister_object_handler(const char *id)
static void add_npc_to_point(const mapzone *zone, mapstruct *map)
std::vector< spawn_point > points
static const mapzone * get_zone_for_map(mapstruct *map)
const char * object_get_value(const object *op, const char *const key)
object * object_insert_in_ob(object *op, object *where)
static const house_zone_struct zones[]
event_registration events_register_global_handler(int eventcode, f_plug_event hook)
static event_registration m
void events_register_object_handler(const char *id, f_plug_event handler)
Crossfire Protocol most of the time after the actual code was already omit certain important and possibly make life miserable any new developer or curious player should be able to find most of the relevant information here If inconsistencies are found or this documentation proves to be consider the latest server side protocol code in the public source code repository as the authoritative reference Introduction If you were ever curious enough to telnet or netcat to a Crossfire chances are you were sorely disappointed While the protocol may seem to use plain text at it actually uses a mix of ASCII and binary data This handbook attempts to document various aspects of the Crossfire protocol As consult the README file to find out how to get in touch with helpful people via mailing and more History the communications plan was set to be a text based system It was up to the server and client to parse these messages and determine what to do These messages were assumed to be line per message At a reasonably early stage of Eric Anderson wrote a then the data itself you could send many data and after the other end could decode these commands This works fairly but I think the creation of numerous sub packets has some performance hit the eutl was not especially well so writing a client for a different platform became more Eric left to work on other products shortly after writing his which didn t really leave anyone with a full understanding of the socket code I have decided to remove the eutl dependency At least one advantage is that having this network related code directly in the client and server makes error handling a bit easier cleaner Packet Format the outside packet method the byte size for the size information is not included here Eutl originally used bytes for the size to bytes seems it makes a least some sense The actual data is something of the nature of the commands listed below It is a text followed by possible other data The remaining data can be binary it is up to the client and server to decode what it sent The commands as described below is just the data portion of the packet If writing a new remember that you must take into account the size of the packet There is no termination of other than knowing how long it should be For most everything that is sent is text This is more or less how things worked under except it packed the ints into bytes in a known order In some we handle ints as in they are sent as binary information How any command handles it is detailed below in the command description The S and C represent the direction of the we use MSB as well as any ints or shorts that get sent inside the packets All packets are defined to have at least one word of followed by a space
void object_free_drop_inventory(object *ob)
void citylife_init(Settings *settings)
static void load_citylife(BufferReader *reader, const char *filename)
int move_ob(object *op, int dir, object *originator)
void events_unregister_global_handler(int eventcode, event_registration id)
sstring add_string(const char *str)
static void check_zone(const mapzone *zone, const char *path)
std::vector< spawn_zone > zones
void add_hook(const char *name, collectorHook hook)
void object_free(object *ob, int flags)
static void add_npcs_to_map(mapstruct *map)
std::vector< std::string > available_archetypes
static void add_npc_to_zone(const mapzone *zone, mapstruct *map)
object * create_archetype(const char *name)
pluglist shows those as well as a short text describing each the list will simply appear empty The keyword for the Python plugin is Python plugout< keyword > Unloads a given identified by its _keyword_ So if you want to unload the Python you need to do plugout Python plugin< libname > Loads a given whose _filename_ is libname So in the case of you d have to do a plugin cfpython so Note that all filenames are relative to the default plugin path(SHARE/plugins). Console messages. ----------------- When Crossfire starts
std::vector< char * > disabled_plugins
static int citylife_globalEventListener(int *type,...)
unsigned long event_registration
static void add_npc_to_random_map(void)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
#define CLEAR_FLAG(xyz, p)
object * arch_to_object(archetype *at)
size_t split_string(char *str, char *array[], size_t array_size, char sep)
void object_remove(object *op)
archetype * try_find_archetype(const char *name)
event
DIALOGCHECK MINARGS 1 MAXARGS 2
int object_teleport(object *op, mapstruct *map, int x, int y)
Crossfire Architecture the general intention is to enhance the enjoyability and playability of CF In this code
static object * get_npc(const mapzone *zone)
static std::vector< std::string > split(const std::string &field, const std::string &by)
int object_set_value(object *op, const char *key, const char *value, int add_key)
char * bufferreader_next_line(BufferReader *br)