⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 npctemplate.c

📁 石器时代2.0完整版源代码.已经加入新功能. 在REDHAT9下GCC3.4编译成功.
💻 C
📖 第 1 页 / 共 3 页
字号:
      "GambleMasterTalked","","","","","","",	  "GambleMasterWindowTalked"	}#endif#ifdef _TRANSER_MAN	/* TranserMan  */    ,{ "TranserMan","TranserManInit","","",      "","","","TranserManLoop",      "","TranserManTalked","","",      "","", "","","TranserManWindowTalked"	}#endif#ifdef _VIP_SHOP	/* VipShop  */    ,{ "VipShop","VipShopInit","","",      "","","","VipShopLoop",      "","VipShopTalked","","",      "","", "","","VipShopWindowTalked"	}	    ,{ "VipPoint","VipPointInit","","",      "","","","VipPointLoop",      "","VipPointTalked","","",      "","", "","","VipPointWindowTalked"	}#endif#ifdef _AUTO_PK	/* VipShop  */    ,{ "AutoPk","AutoPkInit","","",      "","","","",      "","AutoPkTalked","","",      "","", "","","AutoPkWindowTalked"	}#endif#ifdef _ITEM_NPCCHANGE    ,{ "ItemchangeMan","ItemchangeManInit","","",      "","","","ItemchangeManLoop",      "","ItemchangeManTalked","","",      "","", "","","ItemchangeManWindowTalked"	}#endif#ifdef _CFREE_petskill	,{      "NPC_FreePetSkill","FreePetSkillInit","","","","","",      "","",      "FreePetSkillTalked","","","","","","",	  "FreePetSkillWindowTalked"	}#endif#ifdef _PETRACE	//主持人	,{      "PetRaceMaster","PetRaceMasterInit","","","","","",      "PetRaceMasterLoop","",      "PetRaceMasterTalked","","","","","","",	  "PetRaceMasterWindowTalked"	}	// 宠物	,{      "PetRacePet","PetRacePetInit","","","","","",      "PetRacePetLoop","",      "PetRacePetTalked","","","","","","",""	}#endif#ifdef _NEW_WARPMAN	,{      "NPC_NewNpcMan","NewNpcManInit","","","","","",      "NewNpcManLoop","",      "NewNpcManTalked","","","","","","",      "NewNpcManWindowTalked"    }#endif#ifdef _ALLDOMAN   // (不可开) Syu ADD 排行榜NPC	,{		"Alldoman","AlldomanInit","","",      "","","","","","AlldomanTalked","","","","","","",	  "AlldomanWindowTalked"}#endif};static int NPC_searchFunctionSet( char* name, int* unuse){    int     i;    for( i=0 ; i <arraysizeof( functionSet ) ; i++ )        if( strcasecmp( name, functionSet[i].id ) == 0 )            return i;    return -1;}BOOL NPC_copyFunctionSetToChar( int id, Char* ch ){    if( id<0 || id>=arraysizeof(functionSet) )return FALSE;    strcpysafe( ch->charfunctable[CHAR_INITFUNC].string,                sizeof( ch->charfunctable[CHAR_INITFUNC].string ),                functionSet[id].initfunc);    strcpysafe( ch->charfunctable[CHAR_WALKPREFUNC].string,                sizeof(ch->charfunctable[CHAR_WALKPREFUNC].string),                functionSet[id].walkprefunc);    strcpysafe( ch->charfunctable[CHAR_WALKPOSTFUNC].string,                sizeof(ch->charfunctable[CHAR_WALKPOSTFUNC].string),                functionSet[id].walkpostfunc);    strcpysafe( ch->charfunctable[CHAR_PREOVERFUNC].string,                sizeof(ch->charfunctable[CHAR_PREOVERFUNC].string),                functionSet[id].preoverfunc);    strcpysafe( ch->charfunctable[CHAR_POSTOVERFUNC].string,                sizeof(ch->charfunctable[CHAR_POSTOVERFUNC].string),                functionSet[id].postoverfunc);    strcpysafe( ch->charfunctable[CHAR_WATCHFUNC].string,                sizeof(ch->charfunctable[CHAR_WATCHFUNC].string),                functionSet[id].watchfunc);    strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string,                sizeof(ch->charfunctable[CHAR_LOOPFUNC].string),                functionSet[id].loopfunc);    strcpysafe( ch->charfunctable[CHAR_TALKEDFUNC].string,                sizeof(ch->charfunctable[CHAR_TALKEDFUNC].string),                functionSet[id].talkedfunc);    strcpysafe( ch->charfunctable[CHAR_DYINGFUNC].string,                sizeof(ch->charfunctable[CHAR_DYINGFUNC].string),                functionSet[id].dyingfunc);    strcpysafe( ch->charfunctable[CHAR_PREATTACKEDFUNC].string,                sizeof(ch->charfunctable[CHAR_PREATTACKEDFUNC].string),                functionSet[id].preattackedfunc);    strcpysafe( ch->charfunctable[CHAR_POSTATTACKEDFUNC].string,                sizeof(ch->charfunctable[CHAR_POSTATTACKEDFUNC].string),                functionSet[id].postattackedfunc);    strcpysafe( ch->charfunctable[CHAR_OFFFUNC].string,                sizeof(ch->charfunctable[CHAR_OFFFUNC].string),                functionSet[id].offfunc );    strcpysafe( ch->charfunctable[CHAR_LOOKEDFUNC].string,                sizeof(ch->charfunctable[CHAR_LOOKEDFUNC].string),                functionSet[id].lookedfunc );    strcpysafe( ch->charfunctable[CHAR_ITEMPUTFUNC].string,                sizeof(ch->charfunctable[CHAR_ITEMPUTFUNC].string),                functionSet[id].itemputfunc );    strcpysafe( ch->charfunctable[CHAR_SPECIALTALKEDFUNC].string,                sizeof(ch->charfunctable[CHAR_SPECIALTALKEDFUNC].string),                functionSet[id].specialtalkedfunc );    strcpysafe( ch->charfunctable[CHAR_WINDOWTALKEDFUNC].string,                sizeof(ch->charfunctable[CHAR_WINDOWTALKEDFUNC].string),                functionSet[id].windowtalkedfunc );#ifdef _USER_CHARLOOPS    strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string,                sizeof(ch->charfunctable[CHAR_LOOPFUNCTEMP1].string), "");    strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP2].string,                sizeof(ch->charfunctable[CHAR_LOOPFUNCTEMP2].string), "");#endif    return TRUE;}typedef enum{    NPC_INTENTRY=0,    NPC_CHARENTRY=1,    NPC_INTFUNC=2,    NPC_CHARFUNC=3,}NPC_TYPECATEGORYATREADFILE;/*------------------------------------------------------------ * Template index 午仄化恳仄中井升丹井check允月 * 娄醒 *  index       int             index * 忒曰袄 *  valid       TRUE *  invalid     FALSE ------------------------------------------------------------*/INLINE int NPC_CHECKTEMPLATEINDEX(int index){    if(  NPC_templatenum <= index || index < 0 )return FALSE;    return TRUE;}/*------------------------------------------------------------ * Template intdata index 午仄化恳仄中井升丹井check允月 * 娄醒 *  index     int             index * 忒曰袄 *  valid       TRUE *  invalid     FALSE ------------------------------------------------------------*/static INLINE int NPC_CHECKTEMPLATEINTINDEX(int index){    if(  NPC_TEMPLATEINTNUM <= index || index < 0 )return FALSE;    return TRUE;}/*------------------------------------------------------------ * Template chardata index 午仄化恳仄中井升丹井check允月 * 娄醒 *  index     int             index * 忒曰袄 *  valid       TRUE *  invalid     FALSE ------------------------------------------------------------*/static INLINE int NPC_CHECKTEMPLATECHARINDEX(int index){    if(  NPC_TEMPLATECHARNUM <= index || index < 0 )return FALSE;    return TRUE;}/*------------------------------------------------------------ * 娄醒 *  filenum    int      白央奶伙醒 * 忒曰袄 ------------------------------------------------------------*/BOOL NPC_initTemplateArray( int templatenum ){    NPC_templatenum = templatenum;    NPC_template = (NPC_Template*)allocateMemory( sizeof( NPC_Template ) *                                                  NPC_templatenum );    if( NPC_template == NULL )return FALSE;    NPC_template_readindex = 0;    return TRUE;}/*------------------------------------------------------------ * 娄醒 * 忒曰袄 *  卅仄 ------------------------------------------------------------*/void NPC_setDefaultNPCTemplate( NPC_Template*  temp ){    int i;    if( temp == NULL )return;    for( i=0 ; i< arraysizeof(temp->chardata) ; i ++ )        memset( &temp->chardata[i], 0, sizeof(temp->chardata[i] ));    temp->intdata[NPC_TEMPLATEMAKEATNOBODY]=0;    temp->intdata[NPC_TEMPLATEMAKEATNOSEE]=0;    temp->intdata[NPC_TEMPLATEIMAGENUMBER]=0;    temp->intdata[NPC_TEMPLATETYPE]=-1;    temp->intdata[NPC_TEMPLATEMINHP]=0;    temp->intdata[NPC_TEMPLATEMINMP]=0;    temp->intdata[NPC_TEMPLATEMINSTR]=0;    temp->intdata[NPC_TEMPLATEMINTOUGH]=0;    temp->intdata[NPC_TEMPLATEISFLYING]=0;    temp->intdata[NPC_TEMPLATEITEMNUM]=0;    temp->intdata[NPC_TEMPLATELOOPFUNCTIME]=-1;    temp->intdata[NPC_TEMPLATEFUNCTIONINDEX]=-1;    for( i=0; i<NPC_TEMPLATEINTNUM; i++){        temp->randomdata[i] = 0;    }    temp->hash = 0;    temp->haveitem=NULL;}BOOL NPC_IsNPCTemplateFile( char* filename ){    FILE*   f;    char    line1[128];    char*   ret;    if( filename == NULL        ||strlen( filename ) < 1        ||filename[strlen(filename)-1] == '~'        ||filename[0] == '#'        ||strcmptail( filename, ".bak" ) == 0 )return FALSE;    f = fopen( filename , "r" );    if( f == NULL ) goto RETURNFALSE;    ret = fgets( line1, sizeof( line1 ), f );    if( ret == NULL )goto FCLOSERETURNFALSE;    if( strcmp( NPC_TEMPLATEFILEMAGIC, line1 ) == 0 ){        fclose(f);        return TRUE;    }FCLOSERETURNFALSE:    fclose(f);RETURNFALSE:    return FALSE;}void NPC_templateallocitemdata( NPC_Template* one ){    int     itemnum = one->intdata[NPC_TEMPLATEITEMNUM];    if( itemnum > 8 ) itemnum = 8;    else if( itemnum <= 0 ) itemnum = 0;    one->intdata[NPC_TEMPLATEITEMNUM] = itemnum;    one->haveitem = allocateMemory( sizeof( NPC_haveItem ) * itemnum );}/*------------------------------------------------------------ * NPC_getRandomValue 午及娄醒及询晶岭及凶户及楮醒 * 娄醒 * 忒曰袄 ------------------------------------------------------------*/static int NPC_seekGraphicNumberFromString( char* string, int* unuse ){    return CHAR_seekGraphicNumberFromString( string );}/*------------------------------------------------------------ * 娄醒 * 忒曰袄 ------------------------------------------------------------*/static int NPC_getRandomValue( char*  string,int* randomwidth ){    int   minvalue;    int   maxvalue;    char*   startmax=NULL;    minvalue = atoi( string );    startmax = index( string,',' );    if( startmax != NULL ){        /*  仿件母丞涩烂互今木化中月    */        /*  +1 反 ","及凶户  */        maxvalue = atoi(startmax+1);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -