[Crossfire-wiki] [Crossfire DokuWiki] page added: parties
no-reply_wiki at metalforge.org
no-reply_wiki at metalforge.org
Wed Nov 6 06:49:03 CST 2013
A page in your DokuWiki was added or changed. Here are the details:
Date : 2013/11/06 06:49
User : saru
Edit Summary: need help with this code too
====== Party Play ======
Characters in crossfire can form 'parties' which enables them to work towards common goals. Whilst in the same party, characters will share experience.
This is defined as
void share_exp(object *op, sint64 exp, const char *skill, int flag) {
int shares = 0, count = 0;
player *pl;
partylist *party;
if (op->type != PLAYER || op->contr->party == NULL) {
change_exp(op, exp, skill, 0);
return;
}
party = op->contr->party;
for (pl = first_player; pl != NULL; pl = pl->next) {
if (party && pl->ob->contr->party == party && on_same_map(pl->ob, op)) {
count++;
shares += (pl->ob->level+4);
}
}
if (count == 1 || shares > exp)
change_exp(op, exp, skill, flag);
else {
sint64 share = exp/shares, given = 0, nexp;
for (pl = first_player; pl != NULL; pl = pl->next) {
if (party && pl->ob->contr->party == party && on_same_map(pl->ob, op)) {
nexp = (pl->ob->level+4)*share;
change_exp(pl->ob, nexp, skill, SK_EXP_TOTAL);
given += nexp;
}
}
exp -= given;
/* give any remainder to the player */
change_exp(op, exp, skill, flag);
IP-Address : 59.167.121.117
Old Revision: none
New Revision: http://wiki.metalforge.net/doku.php/parties
--
This mail was generated by DokuWiki at
http://wiki.metalforge.net/
More information about the crossfire-wiki
mailing list