예제 #1
0
void CHAR_playerTalkedfunc( int charaindex, int talkindex,char* message, int color, int channel )
{
    int     fd;
    char    lastbuf[4096];
    char    mesgbuf[4096];
    char    escapebuf[4096];
    int fmindex = CHAR_getInt( charaindex, CHAR_FMINDEX );
    fd = getfdFromCharaIndex( charaindex );
    if( fd == -1 )return;
    if( (channel>-1) && (fmindex>0) ) {
        if( channel == 0 ) {
            snprintf( lastbuf,sizeof(lastbuf),"P|[×å]%s",
                      makeEscapeString( CHAR_appendNameAndTitle(talkindex, message, mesgbuf,sizeof(mesgbuf)),
                                        escapebuf,sizeof(escapebuf) ));
        }
#ifdef _FMVER21
        else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ) {
#else
        else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == 1 ) {
#endif
            snprintf( lastbuf,sizeof(lastbuf),"P|[×峤¹ã²¥]%s",
                      makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)),
                                       escapebuf,sizeof(escapebuf) ));
        } else {
            snprintf( lastbuf,sizeof(lastbuf),"P|[%d]%s",channel,
                      makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)),
                                       escapebuf,sizeof(escapebuf) ));
        }
    } else {
        snprintf( lastbuf,sizeof(lastbuf),"P|%s",
                  makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)),
                                   escapebuf,sizeof(escapebuf) ));
    }
    lssproto_TK_send( fd, CHAR_getWorkInt( talkindex, CHAR_WORKOBJINDEX ),lastbuf, color);
}
예제 #2
0
int CHAR_talkToCli(int talkedcharaindex, int talkcharaindex, char *message, CHAR_COLOR color) {
  static char lastbuf[2048];
  static char escapebuf[2048];
  static char mesgbuf[1024];
  int fd;

  if(!CHAR_CHECKINDEX(talkedcharaindex))
    return FALSE;
  if(CHAR_getInt(talkedcharaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) {
    print("err CHAR_talkToCli CHAR_WHICHTYPE != CHAR_TYPEPLAYER\n");
    return FALSE;
  }

  fd = getfdFromCharaIndex(talkedcharaindex);
  if(fd == -1) {
    print("err CHAR_talkToCli can't get fd from:%d \n", talkedcharaindex);
    return FALSE;
  }

  if(color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2) {
    print("CHAR_talkToCli color err\n");
    return FALSE;
  }
  snprintf(lastbuf, sizeof(lastbuf), "P|%s", makeEscapeString(CHAR_appendNameAndTitle(talkcharaindex, message, mesgbuf, sizeof(mesgbuf)), escapebuf, sizeof(escapebuf)));
  int talkchar = -1;
  if(talkcharaindex != -1)
    talkchar = CHAR_getWorkInt(talkcharaindex, CHAR_WORKOBJINDEX);
  lssproto_TK_send(fd, talkchar, lastbuf, color);
  return TRUE;
}
예제 #3
0
/*
 * int meindex:·ßÛм°(÷Ò¼°)Ä̼þ·¸Û͵©
 * int cliindex:Ýμ°Ä̼þ·¸Û͵©
 */
static void NPC_SimpleShopOpenShopWindow( int meindex, int cliindex,
                                          char *npcarg )
{
    int fd;
    int objindex;

    char tmp[1024*12], itemstr[1024 * 8];

    char maincaption[SIMPLESHOPTALKBUFSIZE];
    char buycaption[SIMPLESHOPTALKBUFSIZE];
    char okbuycaption[SIMPLESHOPTALKBUFSIZE];
    char sellcaption[SIMPLESHOPTALKBUFSIZE];
    char oksellcaption[SIMPLESHOPTALKBUFSIZE];
    char poorcaption[SIMPLESHOPTALKBUFSIZE];
    char itemfullcaption[SIMPLESHOPTALKBUFSIZE];

    getStringFromIndexWithDelim( npcarg,"|",MAINTOKEN,
                                 maincaption,sizeof(maincaption) );
    getStringFromIndexWithDelim( npcarg,"|",BUYTOKEN,
                                 buycaption,sizeof(buycaption) );
    getStringFromIndexWithDelim( npcarg,"|",OKBUYTOKEN,
                                 okbuycaption,sizeof(okbuycaption) );
    getStringFromIndexWithDelim( npcarg,"|",SELLTOKEN,
                                 sellcaption,sizeof(sellcaption) );
    getStringFromIndexWithDelim( npcarg,"|",OKSELLTOKEN,
                                 oksellcaption,sizeof(oksellcaption) );
    getStringFromIndexWithDelim( npcarg,"|",POORTOKEN,
                                 poorcaption,sizeof(poorcaption));
    getStringFromIndexWithDelim( npcarg,"|",ITEMFULLTOKEN,
                                 itemfullcaption,sizeof(itemfullcaption));

    tmp[0] = 0;
    NPC_SimpleShopGetEscapedItemString( meindex, cliindex, itemstr );
    objindex = CHAR_getWorkInt( meindex,CHAR_WORKOBJINDEX );
    snprintf( tmp,sizeof(tmp),"S|%d|%s|%s|%s|"
              "%s|%s|%s|%s|"
              "-1|%d%s", objindex,
              maincaption,
              buycaption,
              okbuycaption,
              sellcaption,
              oksellcaption,
              poorcaption,
              itemfullcaption,
              NPC_SimpleShopGetItemNum( meindex ),
              itemstr );
    fd = getfdFromCharaIndex( cliindex );

    if( fd == -1 )return;

    lssproto_TK_send(fd, -1 ,tmp, CHAR_COLORWHITE );


}
예제 #4
0
/*
 * int meindex : ÷Ò¼°index
 * int playerindex : ËüÄ̼þÓñËüëÇëÔÊÃóÒÁÄÌØÀ¡õ¼°index
 * char *str :
 */
static void NPC_SimpleShopNormalWindow( int meindex, int playerindex,
                                        char *str )
{
    int fd;
    int objindex;
    char tmp[512], *name;

    objindex = CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX);
    name = CHAR_getChar( meindex, CHAR_NAME );
    snprintf(tmp,sizeof(tmp),"W|%d|N|%s|123|%s", objindex, name, str );
    fd = getfdFromCharaIndex(playerindex);
    if( fd == -1 ) return;
    lssproto_TK_send(fd,-1,tmp,CHAR_COLORWHITE );
}
예제 #5
0
BOOL NPCS_NpcstalkToCli( int charaindex,int npcobjindex, char* message, CHAR_COLOR color )
{
	static char    lastbuf[2048];
	static char    escapebuf[2048];
	int fd;

	if( !CHAR_CHECKINDEX(charaindex) ) return FALSE;
	if( CHAR_getInt( charaindex,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER) return FALSE;
	if( (fd=getfdFromCharaIndex( charaindex )) == -1 ) return FALSE;
	if( color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2 )return FALSE;
#ifndef _CHANNEL_MODIFY    
	snprintf( lastbuf, sizeof(lastbuf), "P|%s:%s",
#else
	snprintf( lastbuf, sizeof(lastbuf), "P|P|%s:%s",
#endif
			makeEscapeString( OBJECT_getName( npcobjindex), escapebuf, sizeof(escapebuf)), message);

	lssproto_TK_send( fd, npcobjindex, lastbuf, color);
	return TRUE;
}