Пример #1
0
// パーティ
int mapif_parse_CreateParty(int fd,int account_id,char *name,char *nick,char *map,int lv)
{
	struct party *p;
	if( (p=search_partyname(name))!=NULL){
		printf("int_party: same name party exists [%s]\n",name);
		mapif_party_created(fd,account_id,NULL);
		return 0;
	}
	p=malloc(sizeof(struct party));
	if(p==NULL){
		printf("int_party: out of memory !\n");
		mapif_party_created(fd,account_id,NULL);
		return 0;
	}
	memset(p,0,sizeof(struct party));
	p->party_id=party_newid++;
	memcpy(p->name,name,24);
	p->exp=0;
	p->item=0;
	p->member[0].account_id=account_id;
	memcpy(p->member[0].name,nick,24);
	memcpy(p->member[0].map,map,16);
	p->member[0].leader=1;
	p->member[0].online=1;
	p->member[0].lv=lv;
	
	numdb_insert(party_db,p->party_id,p);
	
	mapif_party_created(fd,account_id,p);
	mapif_party_info(fd,p);
	
	return 0;
}
Пример #2
0
// Create Party
int mapif_parse_CreateParty (int fd, char *name, int item, int item2, struct party_member *leader)
{
	struct party_data *p;
	int i;

	if ( (p = search_partyname (name)) != NULL)
	{
		mapif_party_created (fd, leader->account_id, leader->char_id, NULL);
		return 0;
	}

	// Check Authorised letters/symbols in the name of the character
	if (char_name_option == 1)   // only letters/symbols in char_name_letters are authorised
	{
		for (i = 0; i < NAME_LENGTH && name[i]; i++)
			if (strchr (char_name_letters, name[i]) == NULL)
			{
				mapif_party_created (fd, leader->account_id, leader->char_id, NULL);
				return 0;
			}
	}
	else if (char_name_option == 2)     // letters/symbols in char_name_letters are forbidden
	{
		for (i = 0; i < NAME_LENGTH && name[i]; i++)
			if (strchr (char_name_letters, name[i]) != NULL)
			{
				mapif_party_created (fd, leader->account_id, leader->char_id, NULL);
				return 0;
			}
	}

	p = (struct party_data *) aCalloc (1, sizeof (struct party_data));
	memcpy (p->party.name, name, NAME_LENGTH);
	p->party.exp = 0;
	p->party.item = (item ? 1 : 0) | (item2 ? 2 : 0);
	memcpy (&p->party.member[0], leader, sizeof (struct party_member));
	p->party.member[0].leader = 1;
	p->party.member[0].online = 1;
	p->party.party_id = -1; //New party.

	if (inter_party_tosql (&p->party, PS_CREATE | PS_ADDMEMBER, 0))
	{
		//Add party to db
		int_party_calc_state (p);
		idb_put (party_db_, p->party.party_id, p);
		mapif_party_info (fd, &p->party, 0);
		mapif_party_created (fd, leader->account_id, leader->char_id, &p->party);
	}
	else     //Failed to create party.
	{
		aFree (p);
		mapif_party_created (fd, leader->account_id, leader->char_id, NULL);
	}

	return 0;
}
Пример #3
0
// パ?ティ
int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct party_member *leader)
{
	struct party_data *p;
	int i;

	//FIXME: this should be removed once the savefiles can handle all symbols
	for(i = 0; i < NAME_LENGTH && name[i]; i++) {
		if (!(name[i] & 0xe0) || name[i] == 0x7f) {
			ShowInfo("int_party: illegal party name [%s]\n", name);
			mapif_party_created(fd, leader->account_id, leader->char_id, NULL);
			return 0;
		}
	}

	if ((p = search_partyname(name)) != NULL) {
		ShowInfo("int_party: same name party exists [%s]\n", name);
		mapif_party_created(fd, leader->account_id, leader->char_id, NULL);
		return 0;
	}

	// Check Authorised letters/symbols in the name of the character
	if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised
		for (i = 0; i < NAME_LENGTH && name[i]; i++)
			if (strchr(char_name_letters, name[i]) == NULL) {
				mapif_party_created(fd, leader->account_id, leader->char_id, NULL);
				return 0;
			}
	} else if (char_name_option == 2) { // letters/symbols in char_name_letters are forbidden
		for (i = 0; i < NAME_LENGTH && name[i]; i++)
			if (strchr(char_name_letters, name[i]) != NULL) {
				mapif_party_created(fd, leader->account_id, leader->char_id, NULL);
				return 0;
			}
	}

	p = (struct party_data *) aCalloc(sizeof(struct party_data), 1);
	if (p == NULL) {
		ShowFatalError("int_party: out of memory !\n");
		mapif_party_created(fd,leader->account_id,leader->char_id,NULL);
		return 0;
	}
	p->party.party_id = party_newid++;
	memcpy(p->party.name, name, NAME_LENGTH);
	p->party.exp = 0;
	p->party.item=(item?1:0)|(item2?2:0);
	memcpy(&p->party.member[0], leader, sizeof(struct party_member));
	p->party.member[0].leader = 1;
	int_party_calc_state(p);
	idb_put(party_db, p->party.party_id, p);

	mapif_party_info(fd, &p->party, 0);
	mapif_party_created(fd, leader->account_id, leader->char_id, &p->party);

	return 0;
}
Пример #4
0
//--------------------
// Creation of a party
//--------------------
void mapif_parse_CreateParty(int fd, int account_id, char *party_name, char *nick, char *map, int lv, unsigned char item, unsigned char item2) {
	struct party *p;

// check of structure of party_name is done in map-server

/* moved to map-server------------
	// check control chars and del
	for(i = 0; i < 24 && party_name[i]; i++) {
		if (!(party_name[i] & 0xe0) || party_name[i] == 0x7f) {
			printf("int_party: illegal party name [%s]\n", party_name);
			mapif_party_created(fd, account_id, NULL);
			return;
		}
	}--------------------*/

	if ((p = search_partyname(party_name)) != NULL) {
		printf("int_party: same name party exists [%s]\n", party_name);
		mapif_party_created(fd, account_id, NULL);
		return;
	}

	CALLOC(p, struct party, 1);
	p->party_id = party_newid++;
	strncpy(p->name, party_name, 24);
	//p->exp = 0;
	// <item1>�A�C�e�����W���@�B0�Ōl�ʁA1�Ńp�[�e�B���L
	// <item2>�A�C�e�����z���@�B0�Ōl�ʁA1�Ńp�[�e�B�ɋϓ����z
	p->item = item; // item 1
	p->itemc = item2; // item 2

	p->member[0].account_id = account_id;
	strncpy(p->member[0].name, nick, 24);
	strncpy(p->member[0].map, map, 16); // 17 - NULL
	p->member[0].leader = 1;
	p->member[0].online = 1;
	p->member[0].lv = lv;

	numdb_insert(party_db, (CPU_INT)p->party_id, p);

	mapif_party_created(fd, account_id, p);
	mapif_party_info(fd, p);

	return;
}
Пример #5
0
// Create Party
int mapif_parse_CreateParty(int fd,int account_id,char *name,char *nick,char *map,int lv, int item, int item2)
{
	struct party *p;
	if( (p=search_partyname(name))!=NULL){
//		printf("int_party: same name party exists [%s]\n",name);
		mapif_party_created(fd,account_id,NULL);
		return 0;
	}
	p=party_pt;
	if(p==NULL){
		ShowFatalError("int_party: out of memory !\n");
		mapif_party_created(fd,account_id,NULL);
		return 0;
	}
	memset(p,0,sizeof(struct party));
	p->party_id=party_newid++;
	memcpy(p->name,name,NAME_LENGTH-1);
	p->exp=0;
	p->item=item;
	//<item1>アイテム?集方法。0で個人別、1でパ?ティ公有
	//<item2>アイテム分配方法。0で個人別、1でパ?ティに均等分配
	//difference between "collection" and "distribution" is...? ^^;
	p->itemc = 0;

	p->member[0].account_id=account_id;
	memcpy(p->member[0].name,nick,NAME_LENGTH-1);
	memcpy(p->member[0].map,map,MAP_NAME_LENGTH-1);
	p->member[0].leader=1;
	p->member[0].online=1;
	p->member[0].lv=lv;

	inter_party_tosql(p->party_id,p);

	mapif_party_created(fd,account_id,p);
	mapif_party_info(fd,p);

	return 0;
}
Пример #6
0
// パーティ
int mapif_parse_CreateParty(int fd,int account_id,char *name,char *nick,char *map,int lv)
{
	struct party *p;
	int i;
	
	for(i=0;i<24 && name[i];i++){
		if( !(name[i]&0xe0) || name[i]==0x7f){
			printf("int_party: illeagal party name [%s]\n",name);
			mapif_party_created(fd,account_id,NULL);
			return 0;
		}
	}

	if( (p=search_partyname(name))!=NULL){
		printf("int_party: same name party exists [%s]\n",name);
		mapif_party_created(fd,account_id,NULL);
		return 0;
	}
	p=(struct party *)aCalloc(1,sizeof(struct party));
	p->party_id=party_newid++;
	memcpy(p->name,name,24);
	p->exp=0;
	p->item=0;
	p->member[0].account_id=account_id;
	memcpy(p->member[0].name,nick,24);
	memcpy(p->member[0].map,map,16);
	p->member[0].leader=1;
	p->member[0].online=1;
	p->member[0].lv=lv;
	
	numdb_insert(party_db,p->party_id,p);
	
	mapif_party_created(fd,account_id,p);
	mapif_party_info(fd,p);
	
	return 0;
}
Пример #7
0
// パーティ
static
void mapif_parse_CreateParty(int fd, int account_id, PartyName name, CharName nick,
        MapName map, int lv)
{
    {
        if (!name.is_print())
        {
            PRINTF("int_party: illegal party name [%s]\n", name);
            mapif_party_created(fd, account_id, NULL);
            return;
        }
    }

    if (search_partyname(name) != NULL)
    {
        PRINTF("int_party: same name party exists [%s]\n", name);
        mapif_party_created(fd, account_id, NULL);
        return;
    }
    struct party p {};
    p.party_id = party_newid++;
    p.name = name;
    p.exp = 0;
    p.item = 0;
    p.member[0].account_id = account_id;
    p.member[0].name = nick;
    p.member[0].map = map;
    p.member[0].leader = 1;
    p.member[0].online = 1;
    p.member[0].lv = lv;

    party_db.insert(p.party_id, p);

    mapif_party_created(fd, account_id, &p);
    mapif_party_info(fd, &p);
}