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;
}