Go to the documentation of this file.
69 #define TAG_START "[color=#ff6611]"
70 #define TAG_END "[/color]"
178 dot = strchr(
value,
':');
185 index = atoi(dot + 1);
186 dot = strchr(dot + 1,
':');
223 if (strcmp(rec->
title,
"NONE"))
226 if (
arch->clone.title != NULL) {
256 if (strcmp(rec->
title,
"NONE"))
259 if (
arch->clone.title != NULL) {
270 snprintf(
name,
sizeof(
name),
"an unknown place");
317 while ((*
name) !=
'\0' && (isdigit(*
name) || (*
name) ==
' '))
327 if (strcmp(rec->
title,
"NONE"))
330 if (
arch->clone.title != NULL) {
352 object *cauldron = NULL, *
inv;
353 object *ingredients[50];
355 uint32_t
count, counts[50];
368 LOG(
llevError,
"knowledge: recipe %s has more than 50 ingredients!",
item->item);
374 for (cauldron =
pl->ob->below; cauldron; cauldron = cauldron->
below) {
379 if (cauldron == NULL) {
384 cauldron_tag = cauldron->
count;
388 ingredients[
index] = NULL;
395 if (
inv->title == NULL)
401 for (ing = rp->
ingred; ing != NULL; ing = ing->
next) {
403 if (ingredients[
index] != NULL) {
410 while (isdigit(*ingname)) {
416 while (*ingname ==
' ')
432 for (ing = rp->
ingred; ing != NULL; ing = ing->
next) {
433 if (ingredients[
index] == NULL) {
442 if (
pl->ob->container != cauldron) {
444 if (
pl->ob->container != cauldron) {
451 while (cauldron->
inv != NULL) {
454 if (cauldron->
inv ==
inv) {
493 while (cauldron->
inv) {
500 pl->ob->speed_left -= 1.0;
531 for (i = 0; i <
current->item_count; i++) {
532 if (strcmp(kt->
type,
current->items[i]->handler->type) == 0 && strcmp(
item,
current->items[i]->item) == 0) {
623 char *pos, *
first = dup;
627 pos = strchr(
first,
':');
631 first = pos ? pos + 1 : NULL;
686 what = atoi(pos + 1);
726 char *dup =
strdup_local(
item), *pos =
const_cast<char *
>(strchr(dup,
':'));
738 what = atoi(pos + 1);
740 for (i = 0; i <
current->item_count; i++) {
745 if (strncmp(
check->item, dup, strlen(dup)) == 0) {
748 pos =
const_cast<char *
>(strchr(
check->item,
':'));
749 known = atoi(pos + 1);
787 if (altar_arch == NULL)
851 {
"alchemy",
knowledge_alchemy_summary,
knowledge_alchemy_detail,
knowledge_alchemy_validate,
knowledge_add,
"recipes",
knowledge_alchemy_can_use_item,
knowledge_alchemy_attempt,
"knowledge_recipes.111",
knowledge_alchemy_face },
852 {
"monster",
knowledge_monster_summary,
knowledge_monster_detail,
knowledge_monster_validate,
knowledge_monster_add,
"monsters", NULL, NULL,
"knowledge_monsters.111",
knowledge_monster_face },
853 {
"god",
knowledge_god_summary,
knowledge_god_detail,
knowledge_god_validate,
knowledge_god_add,
"gods", NULL, NULL,
"knowledge_gods.111",
knowledge_god_face },
854 {
"message",
knowledge_message_summary,
knowledge_message_detail,
knowledge_message_validate,
knowledge_add,
"messages", NULL, NULL,
"knowledge_messages.111",
knowledge_message_face },
855 { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
896 fprintf(
file,
"%s:%s\n",
item->handler->type,
item->item);
918 file = fopen(
final,
"r");
924 while (fgets(read,
sizeof(read),
file) != NULL) {
925 if (strlen(read) > 0)
926 read[strlen(read) - 1] =
'\0';
928 dot = strchr(read,
':');
930 LOG(
llevError,
"knowledge: invalid line in file %s\n",
final);
938 LOG(
llevError,
"knowledge: invalid type %s in file %s\n", read,
final);
941 if (!
type->validate(dot + 1)) {
942 LOG(
llevDebug,
"knowledge: ignoring now invalid %s in file %s\n", read,
final);
982 if (
pl->socket->notifications < 2)
994 char *copy, *
code, *dot;
1000 dot =
const_cast<char *
>(strchr(marker,
':'));
1004 copy = strdup(marker);
1008 dot =
const_cast<char *
>(strchr(copy,
':'));
1014 LOG(
llevError,
"knowledge: invalid marker type %s in %s\n", copy, book == NULL ?
"(null)" : book->
name);
1019 none = (
current->items == NULL);
1023 dot = strchr(
code,
'/');
1044 if (
pl->has_directory)
1072 assert(search == NULL || search[0] !=
'\0');
1080 item->handler->summary(
item->item, summary);
1083 if (show_only != NULL &&
item->handler != show_only) {
1086 if (search != NULL && search[0] !=
'\0') {
1087 if (strstr(
final, search) == NULL) {
1090 item->handler->detail(
item->item, detail);
1092 if (strstr(fd, search) == NULL)
1102 else if (show_only != NULL)
1118 else if (show_only != NULL)
1143 if (show_only == NULL) {
1198 if (
item->handler->attempt_alchemy == NULL) {
1201 item->handler->attempt_alchemy(
pl->contr,
item);
1213 LOG(
llevError,
"command_knowledge: called for %s not a player!\n",
pl->name);
1222 if (strncmp(
params,
"list", 4) == 0) {
1227 if (strncmp(
params,
"search ", 7) == 0) {
1232 if (strncmp(
params,
"show ", 5) == 0) {
1237 if (strncmp(
params,
"attempt ", 8) == 0) {
1306 pos = strchr(copy,
':');
1344 if (
item->title != NULL) {
1345 snprintf(item_name,
sizeof(item_name),
"%s %s",
item->name,
item->title);
1403 if (
pl->socket->notifications < 2)
1486 if (
item->handler->item_face != NULL)
1487 face =
item->handler->item_face(
item->item);
1492 size = 4 + (2 + strlen(
item->handler->type)) + (2 + strlen(
title)) + 4;
1529 if (
op->contr == NULL)
#define object_was_destroyed(op, old_tag)
static void knowledge_alchemy_attempt(player *pl, const knowledge_item *item)
void SockList_AddInt(SockList *sl, uint32_t data)
void knowledge_send_info(socket_struct *ns)
static int knowledge_monster_add(struct knowledge_player *current, const char *item, const struct knowledge_type *type)
recipelist * get_formulalist(int i)
void LOG(LogLevel logLevel, const char *format,...)
int of_close(OutputFile *of)
int use_alchemy(object *op)
#define MONSTER_EXCLUDE_FROM_READABLE_KEY
static int knowledge_god_validate(const char *item)
FILE * of_open(OutputFile *of, const char *fname)
#define QUERY_FLAG(xyz, p)
void free_knowledge(void)
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
void knowledge_add_probe_monster(object *op, object *mon)
static StringBuffer * knowledge_alchemy_can_use_item(sstring code, const char *item, StringBuffer *buf, int index)
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
static int knowledge_god_add(struct knowledge_player *current, const char *item, const struct knowledge_type *type)
StringBuffer * stringbuffer_new(void)
void SockList_AddString(SockList *sl, const char *data)
static void knowledge_display(object *pl, const char *params)
const typedef Face *(* knowledge_face)(sstring code)
knowledge_attempt attempt_alchemy
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
knowledge
DIALOGCHECK MINARGS 1 MAXARGS 1
int(* knowledge_is_valid_item)(const char *code)
#define MSG_TYPE_COMMAND_EXAMINE
the faster the spell may be cast there are several other common only the caster may be affected by the spell The most common spell range is that of touch This denotes that the caster much touch the recipient of the spell in order to release the spell monster
static void knowledge_alchemy_detail(const char *value, StringBuffer *buf)
void SockList_AddLen16Data(SockList *sl, const void *data, size_t len)
void SockList_Reset(SockList *sl)
const char * object_get_value(const object *op, const char *const key)
void apply_by_living_below(object *pl)
static int knowledge_add(knowledge_player *current, const char *item, const knowledge_type *kt)
void(* knowledge_summary)(const char *code, StringBuffer *buf)
Plugin animator file specs[Config] name
static void knowledge_god_summary(const char *item, StringBuffer *buf)
size_t SockList_Avail(const SockList *sl)
static void knowledge_write_player_data(const knowledge_player *kp)
static const Face * knowledge_god_face(sstring code)
static const recipe * knowledge_alchemy_get_recipe(const char *value)
char * stringbuffer_finish(StringBuffer *sb)
knowledge_summary summary
sstring add_refcount(sstring str)
static int knowledge_message_validate(const char *item)
void esrv_send_face(socket_struct *ns, const Face *face, int nocache)
void command_take(object *op, const char *params)
static void free_knowledge_items(knowledge_player *kp)
void query_name(const object *op, char *buf, size_t size)
sstring stringbuffer_finish_shared(StringBuffer *sb)
a copper bar weighs and has a value of
#define MSG_TYPE_COMMAND_INFO
sstring add_string(const char *str)
static void knowledge_show(object *pl, const char *params)
void knowledge_give(player *pl, const char *marker, const object *book)
void command_help(object *op, const char *params)
struct linked_char * next
static void knowledge_monster_summary(const char *item, StringBuffer *buf)
static knowledge_player * knowledge_global
sstring get_message_body(const GeneralMessage *message)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
int knowledge_player_knows(const player *pl, const char *knowledge)
knowledge_is_valid_item validate
void SockList_Init(SockList *sl)
const GeneralMessage * get_message_from_identifier(const char *identifier)
static knowledge_player * knowledge_get_or_create(const player *pl)
void knowledge_item_can_be_used_alchemy(object *op, const object *item)
static std::shared_ptr< inja::Environment > env
static const knowledge_type knowledges[]
#define MSG_TYPE_ADMIN_LOADSAVE
size_t strlcpy(char *dst, const char *src, size_t size)
void knowledge_read(player *pl, object *book)
StringBuffer * describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
void(* knowledge_detail)(const char *code, StringBuffer *buf)
void knowledge_first_player_save(player *pl)
void free_string(sstring str)
int(* knowledge_add_item)(knowledge_player *current, const char *item, const knowledge_type *type)
void SockList_Term(SockList *sl)
void command_knowledge(object *pl, const char *params)
static void knowledge_message_summary(const char *value, StringBuffer *buf)
void fatal(enum fatal_error err)
archetype * find_archetype_by_object_name(const char *name)
sstring get_message_title(const GeneralMessage *message)
static const knowledge_type * knowledge_find(const char *type)
static void knowledge_monster_detail(const char *item, StringBuffer *buf)
const typedef char * sstring
void(* knowledge_attempt)(player *pl, const knowledge_item *item)
static const Face * knowledge_message_face(sstring code)
static void knowledge_do_display(object *pl, const knowledge_type *show_only, const char *search)
void knowledge_send_known(player *pl)
static void knowledge_god_detail(const char *item, StringBuffer *buf)
static const Face * knowledge_monster_face(sstring code)
static void knowledge_do_attempt(object *pl, const char *params)
#define MSG_TYPE_CLIENT_NOTICE
static void free_knowledge_player(knowledge_player *kp)
StringBuffer *(* knowledge_can_use_alchemy)(sstring code, const char *item, StringBuffer *buf, int index)
const knowledge_type * handler
static int knowledge_monster_validate(const char *item)
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 first
archetype * try_find_archetype(const char *name)
const Face * try_find_face(const char *name, const Face *error)
static void knowledge_read_player_data(knowledge_player *kp)
Crossfire Architecture the general intention is to enhance the enjoyability and playability of CF In this code
static void knowledge_message_detail(const char *value, StringBuffer *buf)
static int knowledge_alchemy_validate(const char *item)
knowledge_can_use_alchemy use_alchemy
void knowledge_process_incremental(void)
int describe_god(const object *god, int what, StringBuffer *buf, size_t maxlen)
static void knowledge_alchemy_summary(const char *value, StringBuffer *buf)
static const Face * knowledge_alchemy_face(sstring code)
void examine(object *op, object *tmp)
void Send_With_Handling(socket_struct *ns, SockList *sl)
const Face * recipe_get_face(const recipe *rp)
const Face * get_message_face(const GeneralMessage *message)
void SockList_AddPrintf(SockList *sl, const char *format,...)
static int knowledge_known(const knowledge_player *current, const char *item, const knowledge_type *kt)
void put_object_in_sack(object *op, object *sack, object *tmp, uint32_t nrof)