// ギルドのEXP上納 unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) { struct guild *g; struct guild_expcache *c; int per; nullpo_retr(0, sd); if (!exp) return 0; if (sd->status.guild_id == 0 || (g = guild_search(sd->status.guild_id)) == NULL || (per = guild_getposition(g,sd)) < 0 || (per = g->position[per].exp_mode) < 1) return 0; if (per < 100) exp = (unsigned int) exp * per / 100; //Otherwise tax everything. c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd); if (c->exp > UINT_MAX - exp) c->exp = UINT_MAX; else c->exp += exp; return exp; }
// Celest int guild_getexp(struct map_session_data *sd,int exp) { struct guild_expcache *c; nullpo_ret(sd); if (sd->status.guild_id == 0 || guild_search(sd->status.guild_id) == NULL) return 0; c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd); if (c->exp > UINT64_MAX - exp) c->exp = UINT64_MAX; else c->exp += exp; return exp; }
// ギルドのEXP上納 unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) { struct guild *g; struct guild_expcache *c; int per; unsigned int exp2; double tmp; nullpo_retr(0, sd); if (sd->status.guild_id == 0 || (g = guild_search(sd->status.guild_id)) == NULL || (per = g->position[guild_getposition(sd,g)].exp_mode) <= 0) return 0; if (per > 100) per = 100; else if (per < 1) return 0; if ((tmp = exp * per / 100) <= 0) return 0; exp2 = (unsigned int)tmp; if (battle_config.guild_exp_rate != 100) tmp = tmp*battle_config.guild_exp_rate/100; c = guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd); if (c->exp > UINT_MAX - (unsigned int)tmp) c->exp = UINT_MAX; else c->exp += (unsigned int)tmp; return exp2; }
/*========================================== * Loads status change data of the player given. [Skotlex] *------------------------------------------*/ struct scdata* status_search_scdata(int aid, int cid) { struct scdata *data; data = scdata_db->ensure(scdata_db, i2key(cid), create_scdata, aid); return data; }
/*========================================== * Loads status change data of the player given. [Skotlex] *------------------------------------------*/ struct scdata* status_search_scdata(int aid, int cid) { return (struct scdata*)scdata_db->ensure(scdata_db, i2key(cid), create_scdata, aid); }