Go to the documentation of this file.
43 int omin, diff, luck, base, ran;
47 base = (diff > 2) ? 20 : 50;
49 if (
max < 1 || diff < 1) {
57 return((ran%diff)+min);
59 luck =
op->stats.luck;
60 if (
RANDOM()%base < (
unsigned int)
MIN(10, abs(luck))) {
62 ((luck > 0) ? (luck = 1) : (luck = -1));
66 ((goodbad) ? (min += luck) : (diff));
68 return(
MAX(omin,
MIN(
max, (ran%diff)+min)));
70 return((ran%diff)+min);
78 int64_t omin, diff, ran;
84 base = (diff > 2) ? 20 : 50;
86 if (
max < 1 || diff < 1) {
99 return((ran%diff)+min);
101 luck =
op->stats.luck;
104 ((luck > 0) ? (luck = 1) : (luck = -1));
108 ((goodbad) ? (min += luck) : (diff));
110 return (
MAX(omin,
MIN(
max, (ran%diff)+min)));
112 return ((ran%diff)+min);
122 int die_roll(
int num,
int size,
const object *
op,
int goodbad) {
123 int min, diff, luck,
total, i, gotlucky, base, ran;
127 luck =
total = gotlucky = 0;
128 base = (diff > 2) ? 20 : 50;
129 if (size < 2 || diff < 1) {
130 LOG(
llevError,
"Calling die_roll with num=%d size=%d\n", num, size);
135 luck =
op->stats.luck;
137 for (i = 0; i < num; i++) {
138 if (
RANDOM()%base < (
unsigned int)
MIN(10, abs(luck)) && !gotlucky) {
141 ((luck > 0) ? (luck = 1) : (luck = -1));
145 ((goodbad) ? (min += luck) : (diff));
166 if (
max < 1 || diff < 1)
169 return (
RANDOM()%diff+min);
200 if (
op->stats.dam < 0)
208 if (
op->stats.ac < 0)
210 }
else if (
op->type ==
FOOD) {
211 op->stats.food -=
rndm(5, 20);
212 if (
op->stats.food < 0)
235 if (destroy &&
rndm(0, 1)) {
250 if (strcmp(
name, material->name) == 0) {
267 if (
op->materialname == NULL)
279 LOG(
llevError,
"archetype '%s>%s' uses nonexistent material '%s'\n",
op->arch->name,
op->name,
op->materialname);
284 if (
op->resist[j] == 0 && change->
resist[j] != 0) {
285 op->resist[j] += mt->
mod[j];
286 if (
op->resist[j] > 100)
288 if (
op->resist[j] < -100)
289 op->resist[j] = -100;
298 if (
op->materialname != NULL)
302 if (
op->material & material->material) {
309 #define EOL_SIZE (sizeof("\n")-1)
315 if (strlen(
buf) <
sizeof(
"\n")) {
327 void replace(
const char *src,
const char *
key,
const char *replacement,
char *
result,
size_t resultsize) {
332 if (strcmp(
key, replacement) == 0) {
337 keylen = strlen(
key);
340 while (*src !=
'\0' && resultlen+1 < resultsize) {
341 if (strncmp(src,
key, keylen) == 0) {
342 snprintf(
result+resultlen, resultsize-resultlen,
"%s", replacement);
343 resultlen += strlen(
result+resultlen);
346 result[resultlen++] = *src++;
371 if (!input || strlen(input) >
MAX_BUF-5)
377 for (i = strlen(
tmp); i >= 0 && !isalnum(
tmp[i]); i--) {
382 p = strrchr(
tmp,
',');
387 strcat(input,
" and");
430 if (1 <= diff && diff <= 3)
432 else if (5 <= diff && diff <= 7)
434 else if (
rndm(0, 1) == 0)
450 for (p =
buf; *p !=
'\0'; p++) {
487 while (pos < array_size) {
489 while (*p !=
'\0' && *p != sep)
491 if (pos >= array_size)
571 const char *fatalmsgs[] = {
572 "Failed to allocate memory",
573 "Failed repeatedly to load maps",
574 "Hashtable for archetypes is too small",
575 "Fatal issue in archetype file",
583 fprintf(
logfile,
"Fatal error: %s\n", fatalmsgs[err]);
586 fprintf(
logfile,
"Exiting...\n");
void emergency_save(int flag)
int get_randomized_dir(int dir)
void LOG(LogLevel logLevel, const char *format,...)
#define FLAG_OVERLAY_FLOOR
based on the size of the this randomly makes land number of spaces randomly lower or higher The default is Note that this is run also based on the the altitude amount will likely be less So if you do something like l and n
#define QUERY_FLAG(xyz, p)
const char *const spellpathnames[NRSPELLPATHS]
materialtype_t * name_to_material(const char *name)
int adjust_dir(int dir, int destination_dir)
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
StringBuffer * stringbuffer_new(void)
#define FLAG_OBJ_ORIGINAL
void replace(const char *src, const char *key, const char *replacement, char *result, size_t resultsize)
std::vector< materialtype_t * > materials
StringBuffer * describe_attacktype(const char *attack, int value, StringBuffer *buf)
int16_t resist[NROFATTACKS]
Plugin animator file specs[Config] name
static event_registration m
void transmute_materialname(object *op, const object *change)
void object_free_drop_inventory(object *ob)
void decay_objects(mapstruct *m)
sstring add_string(const char *str)
struct linked_char * next
void free_charlinks(linked_char *lc)
int die_roll(int num, int size, const object *op, int goodbad)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
size_t strlcpy(char *dst, const char *src, size_t size)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
void fatal(enum fatal_error err)
void clean_tmp_files(void)
const char *const attacks[NROFATTACKS]
void set_materialname(object *op)
Install Bug reporting Credits but rather whatever guild name you are using *With the current map and server there are three they and GreenGoblin *Whatever name you give the folder should but it will still use GUILD_TEMPLATE *You can change what guild it uses by editing the map files Modify Map or objects if you want to use the optional Python based Guild Storage hall The first three are on the main the next two are in the guild_hq and the final one is in hallofjoining Withe the Storage three objects are found on the main floor and the last two are in the basement It s not that but you will need a map editor You find the object that has the click edit and change the line script options(which currently is "GUILD_TEMPALTE") to the guild you wish to use. And make sure you use the same one for all of them or it won 't work. Here 's a quick HOWTO for using the map editor to make these changes edit the mainfloor map exit(x15, y29 - set to/Edit/This/Exit/Path in the template) back to the world map as well. If you are using the Storage Hall map(storage_hall)
int random_roll(int min, int max, const object *op, int goodbad)
size_t split_string(char *str, char *array[], size_t array_size, char sep)
void strip_endline(char *buf)
void object_remove(object *op)
int rndm(int min, int max)
const char * destination_dir
void make_list_like(char *input)
int64_t random_roll64(int64_t min, int64_t max, const object *op, int goodbad)
void replace_unprintable_chars(char *buf)