Merge pull request #631 from ennorehling/develop

More configuration through eressea.ini
This commit is contained in:
Enno Rehling 2017-01-22 12:04:58 +01:00 committed by GitHub
commit 517bc54856
18 changed files with 51 additions and 65 deletions

View file

@ -42,7 +42,7 @@
<skill name="perception" level="30"/>
<skill name="melee" level="1"/>
</set>
<set name="new_faction">
<set name="autoseed_faction">
<item name="adamantium" amount="1"/>
</set>
</equipment>
@ -53,10 +53,6 @@
<xi:include href="config://default/names-ghouls.xml"/>
<xi:include href="config://default/names-dragons.xml"/>
<strings>
<string name="mailto">
<text locale="de">eressea-server@eressea.kn-bremen.de</text>
<text locale="en">eressea-server@eressea.kn-bremen.de</text>
</string>
<string name="newbie_info_game">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
ERESSEA 2 BEFEHLE an eressea-server@eressea.kn-bremen.de zu senden.</text>

View file

@ -28,14 +28,6 @@
<calendar name="thirdage" newyear="month_1" start="1"/>
<equipment>
<set name="first_unit">
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>
</set>
</equipment>
<xi:include href="config://default/names-undead.xml"/>
<xi:include href="config://default/names-skeletons.xml"/>
<xi:include href="config://default/names-zombies.xml"/>
@ -45,10 +37,6 @@
<function name="wage" value="minimum_wage"/>
</rules>
<strings>
<string name="mailto">
<text locale="de">eressea-server@eressea.kn-bremen.de</text>
<text locale="en">eressea-server@eressea.kn-bremen.de</text>
</string>
<string name="newbie_info_game">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
ERESSEA 3 BEFEHLE an eressea-server@eressea.kn-bremen.de zu senden.</text>

View file

@ -27,15 +27,6 @@
<xi:include href="config://game/resources.xml" />
<calendar name="thirdage" newyear="month_1" start="1"/>
<equipment>
<set name="first_unit">
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>
</set>
</equipment>
<xi:include href="config://default/names-undead.xml"/>
<xi:include href="config://default/names-skeletons.xml"/>
<xi:include href="config://default/names-zombies.xml"/>
@ -46,10 +37,6 @@
<function name="wage" value="minimum_wage"/>
</rules>
<strings>
<string name="mailto">
<text locale="de">eressea-server@eressea.kn-bremen.de</text>
<text locale="en">eressea-server@eressea.kn-bremen.de</text>
</string>
<string name="newbie_info_game">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
ERESSEA 4 BEFEHLE an eressea-server@eressea.kn-bremen.de zu senden.</text>

View file

@ -2,18 +2,18 @@
<equipment>
<!-- one equipment-set per player-race for the first unit in a faction -->
<set name="first_dwarf">
<set name="autoseed_dwarf">
<item name="axe" amount="1"/>
<item name="chainmail" amount="1"/>
<skill name="melee" level="1"/>
</set>
<set name="first_elf">
<set name="autoseed_elf">
<item name="fairyboot" amount="1"/>
<callback name="equip_newunits"/>
</set>
<set name="first_orc">
<set name="autoseed_orc">
<skill name="polearm" level="4"/>
<skill name="melee" level="4"/>
<skill name="crossbow" level="4"/>
@ -21,30 +21,30 @@
<skill name="bow" level="4"/>
</set>
<set name="first_goblin">
<set name="autoseed_goblin">
<item name="roi" amount="1"/>
<callback name="equip_newunits"/>
</set>
<set name="first_human">
<set name="autoseed_human">
<callback name="equip_newunits"/>
</set>
<set name="first_troll">
<set name="autoseed_troll">
<skill name="building" level="1"/>
<skill name="perception" level="3"/>
<item name="stone" amount="50"/>
</set>
<set name="first_demon">
<set name="autoseed_demon">
<skill name="stamina" level="15"/>
</set>
<set name="first_insect">
<set name="autoseed_insect">
<item name="nestwarmth" amount="9"/>
</set>
<set name="first_halfling">
<set name="autoseed_halfling">
<skill name="trade" level="1"/>
<skill name="riding" level="2"/>
<item name="horse" amount="2"/>
@ -58,12 +58,12 @@
<item name="incense" amount="5"/>
</set>
<set name="first_cat">
<set name="autoseed_cat">
<item name="roi" amount="1"/>
<callback name="equip_newunits"/>
</set>
<set name="first_aquarian">
<set name="autoseed_aquarian">
<skill name="sailing" level="1"/>
<callback name="equip_newunits"/>
</set>

View file

@ -96,7 +96,8 @@ touch eressea.ini
ini_start
ini_sec game
ini_add game locales de,en
ini_add id $game
ini_add game id $game
ini_add game start 1
ini_sec lua
ini_add lua install $SOURCE
ini_add lua paths $SOURCE/scripts:$SOURCE/lunit

View file

@ -1,3 +1,4 @@
if not config.autoseed then return nil end
local autoseed = {}
-- minimum required resources in the 7-hex neighborhood:
@ -64,9 +65,9 @@ local function seed(r, email, race, lang)
assert(f)
local u = unit.create(f, r)
assert(u)
equip_unit(u, "new_faction")
equip_unit(u, "first_unit")
equip_unit(u, "first_" .. race, 7) -- disable old callbacks
equip_unit(u, "autoseed_faction")
equip_unit(u, "autoseed_unit")
equip_unit(u, "autoseed_" .. race, 7)
unit.create(f, r, 5):set_skill("mining", 30)
unit.create(f, r, 5):set_skill("quarrying", 30)
f:set_origin(r)

View file

@ -1,8 +1,5 @@
-- Muschelplateau
local embassy = {}
local home = nil
-- global exports (use item)
function use_seashell(u, amount)
-- Muschelplateau...
@ -17,6 +14,11 @@ function use_seashell(u, amount)
return -4
end
if not config.embassy then return nil end
local embassy = {}
local home = nil
function embassy.init()
home = get_region(165,30)
if home==nil then

View file

@ -1,5 +1,5 @@
-- DEPRECATED
if not config.eternath then return nil end
-- implements parts of a quest in E2
-- this module is deprecated, because it puts functions in the global environment for at_building_action

View file

@ -1,3 +1,4 @@
if not config.ponnuki then return nil end
local ponnuki = {}
local directions = { "NW", "NO", "O", "SO", "SW", "W" }

View file

@ -1,4 +1,5 @@
-- DEPRECATED
if not config.wedding then return nil end
-- this script contains the action functions for the two portals
-- used on the jadee/wildente wedding island. the two _action functions

View file

@ -1,3 +1,5 @@
if not config.xmas then return nil end
local gifts = {
e2 = {
{ year = 2015, turn = 959, item = 'snowglobe', msg='santa_f' },

View file

@ -948,7 +948,7 @@ static int init_data(const char *filename, const char *catalog)
return l;
}
if (turn < 0) {
turn = first_turn;
turn = first_turn();
}
return 0;
}

View file

@ -1,10 +1,10 @@
#include <platform.h>
#include "calendar.h"
#include <kernel/config.h>
#include <assert.h>
#include <stdlib.h>
int first_turn = 0;
int first_month = 0;
int weeks_per_month = 4;
int months_per_year = 12;
@ -16,10 +16,15 @@ int *month_season = NULL;
char *agename = NULL;
int seasons = 0;
int first_turn(void)
{
return config_get_int("game.start", 1);
}
const gamedate *get_gamedate(int turn, gamedate * gd)
{
int weeks_per_year = months_per_year * weeks_per_month;
int t = turn - first_turn;
int t = turn - first_turn();
assert(gd);
if (t < 0)

View file

@ -13,7 +13,6 @@ extern "C" {
};
extern char *agename;
extern int first_turn;
extern int first_month;
extern int seasons;
@ -35,8 +34,9 @@ extern "C" {
int week;
} gamedate;
extern const gamedate *get_gamedate(int turn, gamedate * gd);
extern void calendar_cleanup(void);
const gamedate *get_gamedate(int turn, gamedate * gd);
void calendar_cleanup(void);
int first_turn(void);
#ifdef __cplusplus
}

View file

@ -1475,7 +1475,7 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
faction *f = ctx->f;
const char *prefix;
region *r;
const char *mailto = LOC(f->locale, "mailto");
const char *mailto = config_get("game.email");
const attrib *a;
FILE *F = fopen(filename, "w");
static const race *rc_human;
@ -1510,8 +1510,11 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
fprintf(F, "%d;Zeitalter\n", era);
fprintf(F, "\"%s\";Build\n", eressea_version());
if (mailto != NULL) {
// char mailcmd[64];
// snprintf(mailcmd, sizeof(mailcmd), "%s %d, %s", game_name(), game_id(), LOC(f->locale, "mailcmd"));
const char * mailcmd = LOC(f->locale, "mailcmd");
fprintf(F, "\"%s\";mailto\n", mailto);
fprintf(F, "\"%s\";mailcmd\n", LOC(f->locale, "mailcmd"));
fprintf(F, "\"%s\";mailcmd\n", mailcmd);
}
show_alliances_cr(F, f);

View file

@ -22,7 +22,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "alliance.h"
#include "ally.h"
#include "curse.h"
#include "equipment.h"
#include "group.h"
#include "item.h"
#include "messages.h"
@ -286,15 +285,10 @@ faction *addfaction(const char *email, const char *password,
unit *addplayer(region * r, faction * f)
{
unit *u;
char buffer[32];
assert(f->units == NULL);
faction_setorigin(f, 0, r->x, r->y);
u = create_unit(r, f, 1, f->race, 0, NULL, NULL);
equip_items(&u->faction->items, get_equipment("new_faction"));
equip_unit(u, get_equipment("first_unit"));
sprintf(buffer, "first_%s", u_race(u)->_name);
equip_unit(u, get_equipment(buffer));
u->hp = unit_max_hp(u) * u->number;
fset(u, UFL_ISNEW);
if (f->race == get_race(RC_DAEMON)) {

View file

@ -375,8 +375,13 @@ static int parse_calendar(xmlDocPtr doc)
xmlNodeSetPtr nsetWeeks, nsetMonths, nsetSeasons;
xmlChar *propValue = xmlGetProp(calendar, BAD_CAST "name");
xmlChar *newyear = xmlGetProp(calendar, BAD_CAST "newyear");
xmlChar *start;
first_turn = xml_ivalue(calendar, "start", first_turn);
start = xmlGetProp(calendar, BAD_CAST "start");
if (start && config_get("game.start")==NULL) {
config_set("game.start", (const char *)start);
xmlFree(start);
}
if (propValue) {
free(agename);
agename = strdup(mkname("calendar", (const char *)propValue));

View file

@ -1408,7 +1408,7 @@ report_template(const char *filename, report_context * ctx, const char *bom)
newline(out);
newline(out);
sprintf(buf, "%s %s \"password\"", LOC(f->locale, "ERESSEA"), itoa36(f->no));
sprintf(buf, "%s %s \"password\"", LOC(f->locale, parameters[P_FACTION]), itoa36(f->no));
rps_nowrap(out, buf);
newline(out);
newline(out);