Ejemplo n.º 1
0
// ギルドのEXP上納
unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
{
	struct guild *g;
	struct guild_expcache *c;
	int per;
	
	nullpo_ret(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 = exp * per / 100;
	//Otherwise tax everything.
	
	c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, 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;
}
Ejemplo n.º 2
0
// ギルド追放要求
int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes)
{
	struct map_session_data *tsd;
	struct guild *g;
	int i,ps;

	nullpo_ret(sd);

	g = guild_search(sd->status.guild_id);

	if(g==NULL)
		return 0;

	if(sd->status.guild_id!=guild_id)
		return 0;

	if( (ps=guild_getposition(g,sd))<0 || !(g->position[ps].mode&0x0010) )
		return 0;	//Expulsion permission

  	//Can't leave inside guild castles.
	if ((tsd = map_id2sd(account_id)) &&
		tsd->status.char_id == char_id &&
		((agit_flag || agit2_flag || agit3_flag) && map[tsd->bl.m].flag.gvg_castle))
		return 0;

	// find the member and perform expulsion
	i = guild_getindex(g, account_id, char_id);
	if( i != -1 && strcmp(g->member[i].name,g->master) != 0 ) //Can't expel the GL!
		intif_guild_leave(g->guild_id,account_id,char_id,1,mes);

	return 0;
}
Ejemplo n.º 3
0
// ギルド追放要求
int guild_explusion(struct map_session_data *sd,int guild_id,
	int account_id,int char_id,const char *mes)
{
	struct guild *g;
	int i,ps;

	nullpo_retr(0, sd);

	g = guild_search(sd->status.guild_id);

	if(g==NULL)
		return 0;

	if(sd->status.guild_id!=guild_id || map[sd->bl.m].flag.gvg_castle) //Can't leave inside guild castles.
		return 0;

	if( (ps=guild_getposition(sd,g))<0 || !(g->position[ps].mode&0x0010) )
		return 0;	// 処罰権限無し

	for(i=0;i<g->max_member;i++){	// 所属しているか
		if(	g->member[i].account_id==account_id &&
			g->member[i].char_id==char_id ){
			intif_guild_leave(g->guild_id,account_id,char_id,1,mes);
			//It's wrong way, member info will erased later
			//see guild_member_leaved [LuzZza]
			//memset(&g->member[i],0,sizeof(struct guild_member));
			return 0;
		}
	}
	return 0;
}
Ejemplo n.º 4
0
// ギルドへの勧誘
int guild_invite(struct map_session_data *sd,struct map_session_data *tsd)
{
	struct guild *g;
	int i;

	nullpo_ret(sd);

	g=guild_search(sd->status.guild_id);

	if(tsd==NULL || g==NULL)
		return 0;

	if( (i=guild_getposition(g,sd))<0 || !(g->position[i].mode&0x0001) )
		return 0; //Invite permission.

	if(!battle_config.invite_request_check) {
		if (tsd->party_invite>0 || tsd->trade_partner || tsd->adopt_invite ) {	// 相手が取引中かどうか
			clif_guild_inviteack(sd,0);
			return 0;
		}
	}
	
	if (!tsd->fd) { //You can't invite someone who has already disconnected.
		clif_guild_inviteack(sd,1);
		return 0;
	}

	if(tsd->status.guild_id>0 ||
		tsd->guild_invite>0 ||
		((agit_flag || agit2_flag || agit3_flag) && map[tsd->bl.m].flag.gvg_castle))
	{	//Can't invite people inside castles. [Skotlex]
		clif_guild_inviteack(sd,0);
		return 0;
	}

	// 定員確認
	ARR_FIND( 0, g->max_member, i, g->member[i].account_id == 0 );
	if(i==g->max_member){
		clif_guild_inviteack(sd,3);
		return 0;
	}

	tsd->guild_invite=sd->status.guild_id;
	tsd->guild_invite_account=sd->status.account_id;

	clif_guild_invite(tsd,g);
	return 0;
}
Ejemplo n.º 5
0
// ギルドへの勧誘
int guild_invite(struct map_session_data *sd,struct map_session_data *tsd)
{
	struct guild *g;
	int i;

	nullpo_retr(0, sd);

	g=guild_search(sd->status.guild_id);

	if(tsd==NULL || g==NULL)
		return 0;

	if( (i=guild_getposition(sd,g))<0 || !(g->position[i].mode&0x0001) )
		return 0; //Invite permission.

	if(!battle_config.invite_request_check) {
		if (tsd->party_invite>0 || tsd->trade_partner) {	// 相手が取引中かどうか
			clif_guild_inviteack(sd,0);
			return 0;
		}
	}
	if(tsd->status.guild_id>0 ||
		tsd->guild_invite>0 ||
		map[tsd->bl.m].flag.gvg_castle)
	{	//Can't invite people inside castles. [Skotlex]
		clif_guild_inviteack(sd,0);
		return 0;
	}

	// 定員確認
	for(i=0;i<g->max_member;i++)
		if(g->member[i].account_id==0)
			break;
	if(i==g->max_member){
		clif_guild_inviteack(sd,3);
		return 0;
	}

	tsd->guild_invite=sd->status.guild_id;
	tsd->guild_invite_account=sd->status.account_id;

	clif_guild_invite(tsd,g);
	return 0;
}
Ejemplo n.º 6
0
// ギルドの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;
}
Ejemplo n.º 7
0
// ギルド追放要求
int guild_expulsion(struct map_session_data *sd,int guild_id,
	int account_id,int char_id,const char *mes)
{
	struct map_session_data *tsd;
	struct guild *g;
	int i,ps;

	nullpo_retr(0, sd);

	g = guild_search(sd->status.guild_id);

	if(g==NULL)
		return 0;

	if(sd->status.guild_id!=guild_id)
		return 0;

	if( (ps=guild_getposition(sd,g))<0 || !(g->position[ps].mode&0x0010) )
		return 0;	//Expulsion permission

  	//Can't leave inside guild castles.
	if ((tsd = map_id2sd(account_id)) &&
		tsd->status.char_id == char_id &&
		map[tsd->bl.m].flag.gvg_castle)
		return 0;

	for(i=0;i<g->max_member;i++){	// 所属しているか
		if(g->member[i].account_id==account_id &&
			g->member[i].char_id==char_id ){
			if(!strcmp(g->member[i].name,g->master))
				return 0; //Can't expel the GM!
			intif_guild_leave(g->guild_id,account_id,char_id,1,mes);
			return 0;
		}
	}
	return 0;
}