forked from github/server
parent
4e42cd7169
commit
be4b35d87f
|
@ -972,7 +972,7 @@ drain_exp(const struct unit *u, int n)
|
|||
* 30 points = 1 week
|
||||
*/
|
||||
void
|
||||
drain_exp(const struct unit *u, int n)
|
||||
drain_exp(struct unit *u, int n)
|
||||
{
|
||||
skill_t sk = (skill_t)(rand() % MAXSKILLS);
|
||||
skill_t ssk;
|
||||
|
|
|
@ -236,6 +236,6 @@ extern boolean enemy (const struct side * a, const struct side * b);
|
|||
extern struct troop select_corpse(struct battle * b, struct fighter * af);
|
||||
extern fighter * make_fighter(struct battle * b, struct unit * u, boolean attack);
|
||||
void flee(const troop dt);
|
||||
void drain_exp(const struct unit *u, int d);
|
||||
void drain_exp(struct unit *u, int d);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -703,7 +703,7 @@ sp_shadowcall(fighter * fi, int level, int power, spell * sp)
|
|||
unit *mage = fi->unit;
|
||||
attrib *a;
|
||||
int force = get_force(power, 3)/2;
|
||||
const race *rc;
|
||||
const race *rc = NULL;
|
||||
int num;
|
||||
unit *u;
|
||||
|
||||
|
|
|
@ -781,8 +781,17 @@ transfermen(unit * u, unit * u2, int n)
|
|||
skill * sn = get_skill(u2, sv->id);
|
||||
if (sn==NULL) sn = add_skill(u2, sv->id);
|
||||
/* level abrunden, wochen aufrunden. */
|
||||
sn->level = (unsigned char)((sv->level*n+sn->level*u2->number)/(u2->number+n));
|
||||
sn->weeks = (unsigned char)((sv->weeks*n+sn->weeks*u2->number+u2->number+n-1)/(u2->number+n));
|
||||
if (sn->level!=sv->level) {
|
||||
int level = (sv->level*n+sn->level*u2->number)/(u2->number+n);
|
||||
int weeks = (sv->weeks*n*(level+1)/(sv->level+1)+sn->weeks*u2->number*(level+1)/(sn->level+1)+u2->number+n-1)/(u2->number+n);
|
||||
sn->level = (unsigned char)level;
|
||||
sn->weeks = (unsigned char)weeks;
|
||||
} else {
|
||||
/* aufgerundete wochenzahl */
|
||||
int weeks = (sv->weeks*n+sn->weeks*u2->number+u2->number+n-1)/(u2->number+n);
|
||||
sn->weeks = (unsigned char)weeks;
|
||||
}
|
||||
assert(sn->level>=0 && sn->weeks>=0 && sn->weeks<=sn->level*2+1);
|
||||
}
|
||||
#endif
|
||||
a = a_find(u->attribs, &at_effect);
|
||||
|
|
|
@ -324,6 +324,72 @@ gm_messageregion(const char * str, void * data, const char * cmd)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** GM: KILL UNIT <id> <string>
|
||||
** requires: permission-key "gmkill"
|
||||
**/
|
||||
static void
|
||||
gm_killunit(const char * str, void * data, const char * cmd)
|
||||
{
|
||||
unit * u = (unit*)data;
|
||||
const struct plane * p = rplane(u->region);
|
||||
unit * target = findunit(atoi36(igetstrtoken(str)));
|
||||
const char * msg = getstrtoken();
|
||||
region * r = target->region;
|
||||
|
||||
if (r==NULL || p!=rplane(r)) {
|
||||
mistake(u, cmd, "In dieser Region kann niemand getötet werden.\n", 0);
|
||||
} else {
|
||||
/* checking permissions */
|
||||
attrib * permissions = a_find(u->faction->attribs, &at_permissions);
|
||||
if (!permissions || !has_permission(permissions, atoi36("gmkill"))) {
|
||||
mistake(u, cmd, "Unzureichende Rechte für diesen Befehl.\n", 0);
|
||||
}
|
||||
else {
|
||||
char * zmsg = (char*)gc_add(strdup(msg));
|
||||
scale_number(target, 0);
|
||||
ADDMSG(&target->faction->msgs, msg_message("killedbygm",
|
||||
"region unit string", r, target, zmsg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
** GM: KILL FACTION <id> <string>
|
||||
** requires: permission-key "gmmsgr"
|
||||
**/
|
||||
static void
|
||||
gm_killfaction(const char * str, void * data, const char * cmd)
|
||||
{
|
||||
unit * u = (unit*)data;
|
||||
int n = atoi36(igetstrtoken(str));
|
||||
faction * f = findfaction(n);
|
||||
const char * msg = getstrtoken();
|
||||
plane * p = rplane(u->region);
|
||||
attrib * permissions = a_find(u->faction->attribs, &at_permissions);
|
||||
if (!permissions || !has_permission(permissions, atoi36("gmkill"))) {
|
||||
mistake(u, cmd, "Unzureichende Rechte für diesen Befehl.\n", 0);
|
||||
return;
|
||||
}
|
||||
if (f!=NULL) {
|
||||
region * r;
|
||||
for (r=regions;r;r=r->next) if (rplane(r)==p) {
|
||||
unit * target;
|
||||
for (target=r->units;target;target=target->next) {
|
||||
if (target->faction==f) {
|
||||
char * zmsg = (char*)gc_add(strdup(msg));
|
||||
scale_number(target, 0);
|
||||
ADDMSG(&target->faction->msgs, msg_message("killedbygm",
|
||||
"region unit string", r, target, zmsg));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mistake(u, cmd, "Aus dieser Partei kann niemand gelöscht werden.\n", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
** GM: TELL <unit> <string>
|
||||
** requires: permission-key "gmmsgr"
|
||||
|
@ -463,6 +529,7 @@ gm_skill(const char * str, void * data, const char * cmd)
|
|||
static tnode g_keys;
|
||||
static tnode g_root;
|
||||
static tnode g_tell;
|
||||
static tnode g_kill;
|
||||
|
||||
static void
|
||||
gm_command(const char * str, void * data, const char * cmd)
|
||||
|
@ -476,6 +543,12 @@ gm_tell(const char * str, void * data, const char * cmd)
|
|||
do_command(&g_tell, data, str);
|
||||
}
|
||||
|
||||
static void
|
||||
gm_kill(const char * str, void * data, const char * cmd)
|
||||
{
|
||||
do_command(&g_kill, data, str);
|
||||
}
|
||||
|
||||
void
|
||||
init_gmcmd(void)
|
||||
{
|
||||
|
@ -494,6 +567,9 @@ init_gmcmd(void)
|
|||
add_command(&g_tell, "unit", &gm_messageunit);
|
||||
add_command(&g_tell, "plane", &gm_messageplane);
|
||||
add_command(&g_tell, "faction", &gm_messagefaction);
|
||||
add_command(&g_keys, "kill", &gm_kill);
|
||||
add_command(&g_kill, "unit", &gm_killunit);
|
||||
add_command(&g_kill, "faction", &gm_killfaction);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1058,7 +1058,7 @@ update_gms(void)
|
|||
for (f=factions;f;f=f->next) {
|
||||
attrib * permissions = a_find(f->attribs, &at_permissions);
|
||||
if (permissions) {
|
||||
const char * keys[] = { "gmgate", "gmmsgr", "gmmsgu", NULL };
|
||||
const char * keys[] = { "gmgate", "gmmsgr", "gmkill", "gmmsgu", NULL };
|
||||
int k;
|
||||
item_t i;
|
||||
for (k=0;keys[k];++k) {
|
||||
|
|
|
@ -7320,4 +7320,14 @@
|
|||
<text locale="en">"$resource($item,1): $description"</text>
|
||||
</message>
|
||||
|
||||
<message name="killedbygm" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"></arg>
|
||||
<arg name="string" type="string"></arg>
|
||||
<arg name="region" type="region"></arg>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) wurde in $region($region) von einem GM gelöscht: \"$string\"."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region) was removed by a GM: \"$string\"."</text>
|
||||
</message>
|
||||
|
||||
</messages>
|
||||
|
|
Loading…
Reference in New Issue