viewing paste Unknown #13908 | C++

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
int guild_create(struct map_session_data *sd, const char *name) {
    char tname[NAME_LENGTH];
    struct guild_member m;
    nullpo_ret(sd);
 
    safestrncpy(tname, name, NAME_LENGTH);
    trim(tname);
 
    if( !tname[0] )
        return 0; // empty name
 
    if( sd->status.guild_id ) {
        // already in a guild
        clif_guild_created(sd,1);
        return 0;
    }
    if( battle_config.guild_emperium_check && pc_search_inventory(sd,ITEMID_EMPERIUM) == -1 ) {
        // item required
        clif_guild_created(sd,3);
        return 0;
    }
    if(sd->status.zeny < 1000000){
    //zeny requirement
    clif_guild_created(sd,3); //or maybe a clif_display for custom message
        return 0;
    }
    guild_makemember(&m,sd);
    m.position=0;
    intif_guild_create(name,&m);
    return 1;
}
 
//Whether or not to create guild
int guild_created(int account_id,int guild_id) {
    struct map_session_data *sd=map_id2sd(account_id);
 
    if(sd==NULL)
        return 0;
    if(!guild_id) {
        clif_guild_created(sd, 2); // Creation failure (presence of the same name Guild)
        return 0;
    }
 
    sd->status.guild_id = guild_id;
    clif_guild_created(sd,0);
    if(battle_config.guild_emperium_check)
        pc_delitem(sd,pc_search_inventory(sd,ITEMID_EMPERIUM),1,0,0,LOG_TYPE_CONSUME);  //emperium consumption
        pc_payzeny(sd,1000000,LOG_TYPE_NPC,NULL)
    return 0;
}
Viewed 1265 times, submitted by Pneuma.