void bg_team_rewards(int bg_id, int nameid, int amount, int kafrapoints, int quest_id, const char *var, int add_value, int bg_arena, int bg_result) { struct battleground_data *bg; struct map_session_data *sd; struct item_data *id; struct item it; int j, flag; if( amount < 1 || (bg = bg_team_search(bg_id)) == NULL || (id = itemdb->exists(nameid)) == NULL ) return; bg_result = cap_value(bg_result,0,2); memset(&it,0,sizeof(it)); if( nameid == 7828 || nameid == 7829 || nameid == 7773 ) { it.nameid = nameid; it.identify = 1; } else nameid = 0; for( j = 0; j < MAX_BG_MEMBERS; j++ ) { if( (sd = bg->members[j].sd) == NULL ) continue; if( quest_id ) quest->add(sd,quest_id); pc_setglobalreg(sd,script->add_str(var), add_value); if( kafrapoints > 0 ) pc->getcash(sd,0,kafrapoints); if( nameid && amount > 0 ) { if( (flag = pc->additem(sd,&it,amount,LOG_TYPE_NONE)) ) clif->additem(sd,0,0,flag); } } }