Esempio n. 1
0
/// Creates a chat room for the npc.
int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl, bool upperBool)
{
	struct chat_data* cd;
	nullpo_ret(nd);

	if( nd->chat_id )
	{
		ShowError("chat_createnpcchat: npc '%s' already has a chatroom, cannot create new one!\n", nd->exname);
		return 0;
	}

	if( zeny > MAX_ZENY || maxLvl > MAX_LEVEL )
	{
		ShowError("chat_createnpcchat: npc '%s' has a required lvl or amount of zeny over the max limit!\n", nd->exname);
		return 0;
	}

	cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev, zeny, minLvl, maxLvl, upperBool);

	if( cd )
	{
		nd->chat_id = cd->bl.id;
		clif_dispchat(cd,0);
	}

	return 0;
}
Esempio n. 2
0
/// Creates a chat room for the npc.
int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev)
{
	struct chat_data* cd;
	nullpo_retr(0, nd);

	cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev);
	if( cd )
	{
		nd->chat_id = cd->bl.id;
		clif_dispchat(cd,0);
	}

	return 0;
}
Esempio n. 3
0
/**
 * Player chat room creation.
 * @param sd : player requesting
 * @param title : title of chat room
 * @param pass : password for chat room
 * @param limit : amount allowed to enter
 * @param pub : public or private
 * @return 0
 */
int chat_createpcchat(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
{
	struct chat_data* cd;

	nullpo_ret(sd);

	if( sd->chatID )
		return 0; //Prevent people abusing the chat system by creating multiple chats, as pointed out by End of Exam. [Skotlex]

	if( sd->state.vending || sd->state.buyingstore ) // not chat, when you already have a store open
		return 0;

	if( map_getmapflag(sd->bl.m, MF_NOCHAT) ) {
		clif_displaymessage(sd->fd, msg_txt(sd,281));
		return 0; //Can't create chatrooms on this map.
	}

	if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) {
		clif_displaymessage (sd->fd, msg_txt(sd,665));
		return 0;
	}

	pc_stop_walking(sd,1);

	cd = chat_createchat(&sd->bl, title, pass, limit, pub, 0, "", 0, 1, MAX_LEVEL);

	if( cd ) {
		cd->users = 1;
		cd->usersd[0] = sd;
		pc_setchatid(sd,cd->bl.id);
		pc_stop_attack(sd);
		clif_createchat(sd,0);
		clif_dispchat(cd,0);

		if (status_isdead(&sd->bl))
			achievement_update_objective(sd, AG_CHAT_DYING, 1, 1);
		else
			achievement_update_objective(sd, AG_CHAT_CREATE, 1, 1);
	} else
		clif_createchat(sd,1);

	return 0;
}
Esempio n. 4
0
/// Creates a chat room for the npc.
int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev)
{
	struct chat_data* cd;
	nullpo_ret(nd);

	if( nd->chat_id )
	{
		ShowError("chat_createnpcchat: npc '%s' already has a chatroom, cannot create new one!\n", nd->exname);
		return 0;
	}

	cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev);
	if( cd )
	{
		nd->chat_id = cd->bl.id;
		clif_dispchat(cd,0);
	}

	return 0;
}
Esempio n. 5
0
/*==========================================
 * player chatroom creation
 *------------------------------------------*/
int chat_createpcchat(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
{
	struct chat_data* cd;
	nullpo_ret(sd);

	if( sd->chatID )
		return 0; //Prevent people abusing the chat system by creating multiple chats, as pointed out by End of Exam. [Skotlex]

	if( sd->state.vending || sd->state.buyingstore )
	{// not chat, when you already have a store open
		return 0;
	}

	if( map[sd->bl.m].flag.nochat )
	{
		clif_displaymessage(sd->fd, msg_txt(281));
		return 0; //Can't create chatrooms on this map.
	}

	if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) )
	{
		clif_displaymessage (sd->fd, "Can't create chat rooms in this Area.");
		return 0;
	}

	pc_stop_walking(sd,1);

	cd = chat_createchat(&sd->bl, title, pass, limit, pub, 0, "", 0, 1, MAX_LEVEL, 0);
	if( cd )
	{
		cd->users = 1;
		cd->usersd[0] = sd;
		pc_setchatid(sd,cd->bl.id);
		clif_createchat(sd,0);
		clif_dispchat(cd,0);
	}
	else
		clif_createchat(sd,1);

	return 0;
}
Esempio n. 6
0
/// Creates a chat room for the npc.
int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl)
{
	struct chat_data* cd;
	nullpo_ret(nd);

	if( nd->chat_id ) {
		ShowError("chat_createnpcchat: npc '%s' já tem chatroom, não pode criar uma nova!\n", nd->exname);
		return 0;
	}

	if( zeny > MAX_ZENY || maxLvl > MAX_LEVEL ) {
		ShowError("chat_createnpcchat: npc '%s' tem um nível ou quant. de zeny acima do limite máximo!\n", nd->exname);
		return 0;
	}

	cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev, zeny, minLvl, maxLvl);

	if( cd ) {
		nd->chat_id = cd->bl.id;
		clif_dispchat(cd,0);
	}

	return 0;
}