 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
53 static void do_sql(
const char *sql, sqlite3 *base) {
60 err = sqlite3_exec(base, sql, NULL, NULL, &msg);
61 if (err != SQLITE_OK) {
70 int nrow, ncolumn, id;
75 sql = sqlite3_mprintf(
"select reg_id from region where reg_name='%q'", reg->
name);
79 id = atoi(
line[ncolumn]);
82 sql = sqlite3_mprintf(
"insert into region(reg_name) values( '%q' )", reg->
name);
87 sqlite3_free_table(
line);
106 const char *propname;
110 va_start(args,
type);
111 propname = va_arg(args,
const char *);
113 if (!strcmp(propname,
"Identification")) {
114 buf = va_arg(args,
char *);
115 size = va_arg(args,
int);
121 if (!strcmp(propname,
"FullName")) {
122 buf = va_arg(args,
char *);
123 size = va_arg(args,
int);
142 va_start(args,
type);
143 event_code = va_arg(args,
int);
145 switch (event_code) {
159 snprintf(path, 500,
"%s/cflogger.db", dir);
168 snprintf(path, 500,
"%s/cfnewspaper.db", dir);
214 va_start(args, format);
215 vsprintf(
buffer, format, args);
226 const char *raw_players =
"select sum(1) as deaths from kill_event inner join living on liv_id = ke_victim_id where liv_is_player = %d and ke_time >= %d and ke_time < %d %s";
227 const char *raw_monsters =
"select sum(1) as deaths from kill_event inner join living on liv_id = ke_victim_id where liv_is_player = %d and ke_time >= %d and ke_time < %d";
229 sql = sqlite3_mprintf(raw_players, 1, start, end, reg);
230 err = sqlite3_get_table(
logger_database, sql, &results, &nrow, &ncolumn, &msg);
232 if (err != SQLITE_OK) {
236 if (nrow > 0 && results[ncolumn] != NULL)
237 deaths = atoi(results[ncolumn]);
238 sqlite3_free_table(results);
242 else if (deaths == 1)
248 sql = sqlite3_mprintf(raw_monsters, 0, start, end);
249 err = sqlite3_get_table(
logger_database, sql, &results, &nrow, &ncolumn, &msg);
251 if (err != SQLITE_OK) {
255 if (nrow > 0 && results[ncolumn] != NULL)
256 deaths = atoi(results[ncolumn]);
257 sqlite3_free_table(results);
261 else if (deaths == 1)
276 f.
no_monster_death =
"No monster was killed, players were lazy around here.";
281 snprintf(where, 50,
"and map_reg_id = %d", region_id);
296 f.
one_player_death =
"Only one player died in the whole world, May Fido(tm) Have Mercy.";
297 f.
many_player_death =
"Monsters all around the world were busy, %d players died.";
298 f.
no_monster_death =
"No monster was killed at all, players must be tired!";
299 f.
one_monster_death =
"One poor monster was killed in the whole world, too bad for it.";
327 sql = sqlite3_mprintf(
"select * from time where time_ingame < '%q' order by time_ingame desc", date);
328 err = sqlite3_get_table(
logger_database, sql, &results, &nrow, &ncolumn, &msg);
330 if (err != SQLITE_OK) {
334 if (nrow > 1 && results[ncolumn+1] != NULL) {
335 end = atol(results[ncolumn+1]);
336 if (nrow > 1 && results[ncolumn+2] != NULL)
337 start = atol(results[ncolumn+2]);
365 va_start(args,
type);
366 who = va_arg(args,
object *);
368 activator = va_arg(args,
object *);
369 va_arg(args,
object *);
370 va_arg(args,
char *);
373 event = va_arg(args,
object *);
374 event_code =
event->subtype;
region * cf_map_get_region_property(mapstruct *map, int propcode)
static void do_world(char *buffer, int size, time_t start, time_t end)
f_plug_api unregisterGlobalEvent
void cf_log(LogLevel logLevel, const char *format,...)
Wrapper for LOG().
static void read_parameters(void)
struct paper_properties paper_properties
static void do_sql(const char *sql, sqlite3 *base)
#define EVENT_APPLY
Object applied-unapplied.
const char * cf_get_directory(int id)
Gets a directory Crossfire uses.
@ llevError
Error, serious thing.
static paper_properties * get_newspaper(const char *name)
int cfnewspaper_globalEventListener(int *type,...)
int eventListener(int *type,...)
Handles an object-related event.
object * cf_create_object_by_name(const char *name)
Wrapper for create_archetype() and create_archetype_by_object_name().
struct mapstruct * map
Pointer to the map in which this object is present.
int cfnewspaper_runPluginCommand(object *op, char *params)
Represents the ingame time.
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
void cf_object_set_string_property(object *op, int propcode, const char *value)
char * name
Shortend name of the region as maps refer to it.
static void do_kills(char *buffer, int size, time_t start, time_t end, const char *reg, kill_format *format)
static void format_time(timeofday_t *tod, char *buffer, int size)
Plugin animator file specs[Config] name
#define CFAPI_MAP_PROP_REGION
static sqlite3 * logger_database
CF_PLUGIN char SvnRevPlugin[]
static void do_region_kills(region *reg, char *buffer, int size, time_t start, time_t end)
void(* f_plug_api)(int *type,...)
General API function.
int cf_init_plugin(f_plug_api getHooks)
void * getPluginProperty(int *type,...)
Gets a plugin property.
int initPlugin(const char *iversion, f_plug_api gethooksptr)
Plugin initialisation function.
static void do_region(region *reg, char *buffer, int size, time_t start, time_t end)
int postInitPlugin(void)
Plugin was initialized, now to finish.
static sqlite3 * newspaper_database
#define CFAPI_OBJECT_PROP_NAME_PLURAL
static void get_newspaper_content(object *paper, paper_properties *properties, region *reg)
f_plug_api registerGlobalEvent
int closePlugin(void)
Close the plugin.
sstring slaying
Which race to do double damage to.
#define CFAPI_OBJECT_PROP_NAME
static void do_world_kills(char *buffer, int size, time_t start, time_t end)
static paper_properties default_properties
the server will also quite happily load unpacked files as long as they have the right file which is convenient if you want to edit your maps and archetypes live It also contains a few like which have hard coded names and are not identified by extension localdir Usually var crossfire Modern systems probably want var lib crossfire instead Contains data that the server does need to live apartment contents
if you malloc the data for the buffer
static void news_cat(char *buffer, int size, const char *format,...)
static int get_region_id(region *reg)
object * cf_object_insert_object(object *op, object *container)
#define CFAPI_OBJECT_PROP_MESSAGE
struct kill_format kill_format
void cf_get_time(timeofday_t *tod)