#define __CONFIGFILE_C__ #include "version.h" #include #include #include #include #include "util.h" //#include "configfile.h" //ttom #include "lssproto_util.h" #include "configfile.h" #include "net.h" //ttom end #include "npcutil.h" // Arminius 7.12 login announce #include "char.h" #include "char_data.h" // CoolFish: add #include "lssproto_serv.h" #include "npc_raceman.h" /* ɬÀÃëâç ÔÊÔÂÑáÕ° */ typedef struct tagConfig { /*Ãó·òºë·ÂØ© (·ß ¶Á±å·Æ»§Ð×ÖÐØêÉýÒý·ÖòÍ */ char progname[8]; char configfilename[32]; /* config°×ÑëÄÌ»ï */ unsigned char debuglevel; /* ·¸ÌïÓÀºëÒÁì»ï */ unsigned int usememoryunit; /*¶ªÆ¹Øø¼°½»ÍßÓÀÐþÈÓÄÌÊõ */ unsigned int usememoryunitnum; /*¶ªÆ¹Øø¼°½»ÍßÓÀÐþÐÑ */ char asname[32]; /*ʧÊÐËü¼þÐþÈÓ¡õÌï¼° ó¡*/ unsigned short acservport; /*ʧÊÐËü¼þÐþÈÓ¡õÌï¼°ºÌ¡õÐþ */ char acpasswd[32]; /*ʧÊÐËü¼þÐþÈÓ¡õÌï³ß¼°Óɵ©·¥¡õÓñ*/ char gsnamefromas[32]; /* * ʧÊÐËü¼þÐþÈÓ¡õÌï¾®ÈÕέÒüÔ * ±Ø¡õØ©ÈÓ¡õÌïÎçØÆ»¯¼° ó¡ */ // Arminius 7.24 manor pk char gsid[32]; // game server chinese id #ifdef _SERVICE // Terry 2001/10/03 char apid[32]; // service ap id unsigned short apport; //service ap port int looptime; // ¼¸ÃëááÉ趨À뿪 int enableservice; // ÊÇ·ñʹÓÃʯÆ÷·þÎñÔ±¹¦ÄÜ #endif unsigned short allowmanorpk; // is this server allow manor pk unsigned short port; /* ÈÓ¡õÌï¼°½÷Çа¾ØêºÌ¡õÐþ */ int servernumber; /* ±Ø¡õØ©ÈÓ¡õÌï¼° į */ int reuseaddr; /* Address already used... »¥÷±ÒýÈÕئÖÐÁݼ°Ð×»§±å */ int do_nodelay; /* TCP_NODELAY ±åÔÊÔ¾®Éýµ¤¾® */ int log_write_time; /* ̤Îå³ðÐÄ·òºëëÔÊÔ¾®Éýµ¤¾®£Û */ int log_io_time; /* I/Oòå ¼°ÁÝÃÞ·´¾®Ô¾®Éýµ¤¾®£Û */ int log_game_time; /* ±Ø¡õØ©¼°ÖÊ òå ¼°ÁÝÃÞë·´¾®Ô */ int log_netloop_faster; /* netloop_faster ¼°·òºë */ int saacwritenum; /* ʧÊÐËü¼þÐþÈÓ¡õÌï³ß¼°ÖÏÚÐ ±åwriteÔÊÔ¾® */ int saacreadnum; /* ʧÊÐËü¼þÐþÈÓ¡õÌï¾®ÈÕ¼°dispatch ëÖϼÔÔÊÔ¾® */ unsigned short fdnum; /*Éýľ·ÖØêÎìÉúÛÍÆËÒà¼þëâç ÔÊÔ¾® */ unsigned int othercharnum; /* ¹«¼°Ö°¼°Æ½Åҷ¼°ÐÑ */ unsigned int objnum; /* ×óƤ³âÄáÛÍÐþ¼° ÐÑ*/ unsigned int petcharnum; /* ʸÓÀÐþ¼°ÐÑ */ unsigned int itemnum; /* ʧÄÌ Ø©¼° ÐÑ*/ unsigned int battlenum; /* ÌïÐþ»ï¼° */ unsigned int battleexp; /* ÌïÐþ»ï¼° */ char topdir[64]; /* ÐþÓÀÃó·¸Å«ÒÁÛÍÐþØø */ char mapdir[64]; /* ѨÓÀÃó·¸Å«ÒÁÛÍÐþØø */ char maptilefile[64]; /* ѨÓÀÃóɬÀð×ÑëÄÌ»ï */ char battlemapfile[64]; /* ÌïÐþ»ïѨÓÀÃóɬÀð×ÑëÄÌ»ï */ char itemfile[64]; /* ʧÄÌ Ø©É¬Àð×ÑëÄÌ»ï */ char invfile[64]; /* ³ÄɬÀð×ÑëÄÌ»ï */ char appearfile[64]; /* ÇëòØÞË É¬Àð×ÑëÄÌ»ï */ char titlenamefile[64]; /* ±¹Ä¯°×ÑëÄÌ»ï */ char titleconfigfile[64]; /* ±¹Ä¯É¬Àð×ÑëÄÌ»ï */ char encountfile[64]; /* ¾Þ¼þÊÐËü¼þÐþɬÀð×ÑëÄÌ»ï */ char enemybasefile[64]; /* ³ÄÏæ ɬÀð×ÑëÄÌ»ï */ char enemyfile[64]; /* ³ÄɬÀð×ÑëÄÌ»ï */ char groupfile[64]; /* ºë»ï¡õÃóɬÀð×ÑëÄÌ»ï */ char magicfile[64]; /* ÈÈÖîɬÀð×ÑëÄÌ»ï */ #ifdef __ATTACK_MAGIC char attmagicfile[64]; // ¹¥»÷ÐÔÖäÊõ #endif char petskillfile[64]; /* ʸÓÀÐþ ÈÈÖîɬÀð×ÑëÄÌ»ï */ char itematomfile[64]; /* ʧÄÌ Ø©¼°¼ã °×ÑëÄÌ»ï */ char effectfile[64]; /* ÉÒÇëɬÀð×ÑëÄÌ»ï */ char quizfile[64]; /* ÛÍÄÌÊõɬÀð×ÑëÄÌ»ï */ char lsgenlog[64]; /*ÈÓ¡õÌï¼°lsgen ʧËüÐþÃóÓÀÐþ°×ÑëÄÌ»ï */ char storedir[64]; /*µ©Ðþʧ·¸Å«ÒÁÛÍÐþØø */ char npcdir[64]; /*NPC¼°É¬Àð×ÑëÄÌ»ïë ÈÊ·¸Å«ÒÁÛÍÐþØø */ char logdir[64]; /* * ·òºë·¸Å«ÒÁÛÍÐþØø */ char logconfname[64]; /* * ·òºëɬÀð×ÑëÄÌ»ï */ char chatmagicpasswd[64]; /* ÃñÅÒÓÀÐþ Ü·Óɵ©·¥¡õÓñ */ #ifdef _STORECHAR char storechar[64]; #endif unsigned int chatmagiccdkeycheck; /* ÃñÅÒÓÀÐþ Ü·Æ¥CDKEYëÃñÄáÓÀÛÍÔÊÔ¾® */ unsigned int filesearchnum; /*°×ÑëÄÌ»ï븹³ñÆ¥ÎåÔ°×ÑëÄ̻PÐÑ*/ unsigned int npctemplatenum; /*NPC¼° ¼þÃóÒÁ¡õÐþ°×ÑëÄ̻PÐÑ*/ unsigned int npccreatenum; /*NPC¼°Ï·Ç²°×ÑëÄ̻PÐÑ*/ unsigned int walksendinterval; /* ÐÚÈʼ°Ã«ËªÔÂÃÞØÊ */ unsigned int CAsendinterval_ms; /* CAë˪ÔÂÃÞØÊ (ms)*/ unsigned int CDsendinterval_ms; /* CDë˪ÔÂÃÞØÊ (ms)*/ unsigned int Onelooptime_ms; /* 1»ï¡õÃó±å¾®ØêÔÂÁÝÃÞ */ unsigned int Petdeletetime; /* ʸÓÀÐþ»¥ÛÕ ÔÊÔÂÁÝÃÞ */ unsigned int Itemdeletetime; /* ʧÄÌ Ø©»¥ÛÕ ÔÊÔÂÁÝÃÞ */ /* ·òºëÄ̼þ ¼°Æ½Åҷ¼°±¾¡õƤëÔÊÔÂÃÞØÊ */ unsigned int CharSavesendinterval; unsigned int addressbookoffmsgnum; /* * ʧÓñÒÁµ©Æ¤ÓÀÛͱå×ó°×·ÂÄ̼þ * ¶ªÓÀ±¾¡õ³âë * Ö϶ªÓÀ±¾¡õ³âËáÁùÔ¾® */ unsigned int protocolreadfrequency; /* * Ãó·òÐþÎì»ïëÖÏÁ¢Øø * ±å ¸ê¾® */ unsigned int allowerrornum; /* * ¾Þ·Â¡õëÖÏòÛÒýÆ¥¸¤Ôʾ® */ unsigned int loghour; /* * ·òºëëâçÐåÔÊÔÂÁÝ¶Ô £¢ÁÝ */ unsigned int battledebugmsg; /* * ÌïÐþ»ï ¼°·¸ÌïÓÀºë¶ªÓÀ±¾¡õ³âëÇëÔʾ®£Û¨ßئÈÕÇë½ñئÖÐ */ //ttom add this because the second had this unsigned int encodekey; unsigned int acwbsize; unsigned int acwritesize; unsigned int ErrUserDownFlg; //ttom end #ifdef _GMRELOAD char gmsetfile[64]; /* GMÕʺš¢È¨ÏÞÉ趨µµ */ #endif #ifdef _AUCTIONEER char auctiondir[256]; // ÅÄÂô×ÊÁÏĿ¼ #endif #ifdef _BLACK_MARKET char blackmarketfile[256]; #endif #ifdef _M_SERVER char msname[32]; unsigned short msport; #endif #ifdef _NPCSERVER_NEW char nsaddress[64]; unsigned short nsport; #endif #ifdef _PROFESSION_SKILL // WON ADD ÈËÎïÖ°Òµ¼¼ÄÜ char profession[64]; #endif #ifdef _ITEM_QUITPARTY char itemquitparty[64]; #endif #ifdef _MUSEUM int museum; #endif #ifdef _DEL_DROP_GOLD unsigned int Golddeletetime; #endif #ifdef _NEW_PLAYER_CF int newplayertrans; int newplayerlv; int newplayergivepet[5]; int newplayergiveitem[15]; int newplayerpetlv; unsigned int newplayergivegold; #endif #ifdef _USER_EXP_CF char expfile[64]; #endif #ifdef _UNLAW_WARP_FLOOR int unlawwarpfloor[5]; #endif #ifdef _UNREG_NEMA char unregname[5][16]; #endif #ifdef _TRANS_LEVEL_CF int chartrans; int pettrans; int yblevel; #endif #ifdef _LOCK_IP char lockip[64]; #endif }Config; Config config; #ifdef _USER_EXP_CF int NeedLevelUpTbls[160]; int MaxLevel=0; #endif #ifdef _LOCK_IP typedef struct slockip { int a,b,c,d; int locktime; int logintime; }sLockip; sLockip lockip[100]; int maxlockip=0; #endif /* * Îì¼þ°×Å«ºë°×ÑëÄÌ»ïë ¸êÁݱåÒøµ¤ÑáÕ° * xxxx=yyyy ÐÄÐ×ÖÐئ¼°Ã« ¸ê */ typedef struct tagReadConf { char name[32]; /*xxxx±åؤÐ×Ô°À*/ /*Æݼ°2¹´·´NULLë ľÔÂÎçÖÏÊÖÖÊ ØÆئÖÐ*/ char *charvalue; /*yyyy빫¼°ÒýÒýÒ½ ÔÊÔÂÁݼ°Ò½ ÛÆ*/ size_t charsize; /*charvalue¼°ÈÓÄÌÊõ*/ /* * ¿á ÎçØÆ»¯=¼° »¥ "ON"·ÖÔÈÐ×ÈÕ intvalue ±å·´1ëҽ ÔÊÔ * ¹«Ä¾¶¯Â½·´ atoi ¼°çø°í */ void* value; /*yyyyë ¾§ÔÊÔÂÒ½ ÔÊÔÂÁݼ°Ò½ ÛÆ*/ CTYPE valuetype; }ReadConf; ReadConf readconf[]= { { "debuglevel" , NULL ,0 , (void*)&config.debuglevel ,CHAR}, { "usememoryunit" , NULL ,0 , (void*)&config.usememoryunit ,INT}, { "usememoryunitnum", NULL ,0 , (void*)&config.usememoryunitnum,INT}, { "acserv", config.asname,sizeof(config.asname) ,NULL , 0}, { "acservport", NULL ,0 , (void*)&config.acservport ,SHORT}, { "acpasswd", config.acpasswd,sizeof( config.acpasswd),NULL,0}, { "gameservname", config.gsnamefromas,sizeof(config.gsnamefromas), NULL,0}, // Arminius 7.24 manor pk { "gameservid", config.gsid, sizeof(config.gsid), NULL, 0}, #ifdef _SERVICE // Terry 2001/10/03 service ap { "apid", config.apid, sizeof(config.apid), NULL, 0}, { "apport", NULL ,0 ,(void*)&config.apport ,SHORT}, { "looptime",NULL,0,(void*)&config.looptime,INT}, { "enableservice",NULL,0,(void*)&config.enableservice,INT}, #endif { "allowmanorpk", NULL, 0, (void*)&config.allowmanorpk, SHORT}, { "port", NULL ,0 , (void*)&config.port ,SHORT}, { "servernumber", NULL ,0 , (void*)&config.servernumber ,INT}, { "reuseaddr", NULL ,0 , (void*)&config.reuseaddr , INT}, { "nodelay", NULL , 0 , (void*)&config.do_nodelay , INT}, { "log_write_time", NULL, 0 , (void*)&config.log_write_time, INT}, { "log_io_time", NULL, 0 , (void*)&config.log_io_time, INT}, { "log_game_time", NULL, 0 , (void*)&config.log_game_time, INT}, { "log_netloop_faster", NULL,0,(void*)&config.log_netloop_faster, INT}, { "saacwritenum", NULL,0,(void*)&config.saacwritenum, INT}, { "saacreadnum", NULL,0,(void*)&config.saacreadnum, INT}, { "fdnum", NULL ,0 , (void*)&config.fdnum, SHORT}, { "petnum", NULL ,0 , (void*)&config.petcharnum, INT}, { "othercharnum", NULL ,0 , (void*)&config.othercharnum, INT}, { "objnum", NULL ,0 , (void*)&config.objnum, INT}, { "itemnum", NULL ,0 , (void*)&config.itemnum, INT}, { "battlenum", NULL ,0 , (void*)&config.battlenum, INT}, { "battleexp", NULL ,0 , (void*)&config.battleexp, INT}, { "topdir" , config.topdir,sizeof(config.topdir),NULL,0}, { "mapdir" , config.mapdir,sizeof(config.mapdir),NULL,0}, { "maptilefile" , config.maptilefile,sizeof(config.maptilefile),NULL,0}, { "battlemapfile" , config.battlemapfile,sizeof(config.battlemapfile),NULL,0}, #ifdef _ITEMSET6_TXT { "itemset6file", config.itemfile, sizeof(config.invfile), NULL, 0}, #else #ifdef _ITEMSET5_TXT { "itemset5file", config.itemfile, sizeof(config.invfile), NULL, 0}, #else #ifdef _ITEMSET4_TXT { "itemset4file" , config.itemfile,sizeof(config.invfile),NULL,0}, #else #ifdef _ITEMSET3_ITEM { "itemset3file" , config.itemfile,sizeof(config.invfile),NULL,0}, #endif #endif #endif #endif { "invinciblefile" , config.invfile,sizeof(config.invfile),NULL,0}, { "appearpositionfile" , config.appearfile,sizeof(config.appearfile),NULL,0}, { "titlenamefile", config.titlenamefile, sizeof( config.titlenamefile),NULL,0}, { "titleconfigfile", config.titleconfigfile, sizeof( config.titleconfigfile),NULL,0}, { "encountfile", config.encountfile, sizeof( config.encountfile),NULL,0}, { "enemyfile", config.enemyfile, sizeof( config.enemyfile),NULL,0}, { "enemybasefile", config.enemybasefile, sizeof( config.enemybasefile),NULL,0}, { "groupfile", config.groupfile, sizeof( config.groupfile),NULL,0}, { "magicfile", config.magicfile, sizeof( config.magicfile),NULL,0}, #ifdef __ATTACK_MAGIC { "attmagicfile" , config.attmagicfile , sizeof( config.attmagicfile ) , NULL , 0 }, #endif #ifdef _PETSKILL2_TXT { "petskillfile2", config.petskillfile, sizeof( config.petskillfile),NULL,0}, #else { "petskillfile1", config.petskillfile, sizeof( config.petskillfile),NULL,0}, #endif { "itematomfile" , config.itematomfile, sizeof( config.itematomfile),NULL,0}, { "effectfile" , config.effectfile,sizeof(config.effectfile),NULL,0}, { "quizfile" , config.quizfile,sizeof(config.quizfile),NULL,0}, { "lsgenlogfilename", config.lsgenlog,sizeof(config.lsgenlog),NULL,0}, #ifdef _GMRELOAD { "gmsetfile", config.gmsetfile, sizeof( config.gmsetfile),NULL,0}, #endif { "storedir" ,config.storedir,sizeof(config.storedir),NULL,0}, { "npcdir" ,config.npcdir,sizeof(config.npcdir),NULL,0}, { "logdir" ,config.logdir,sizeof(config.logdir),NULL,0}, { "logconfname" ,config.logconfname,sizeof(config.logconfname),NULL,0}, { "chatmagicpasswd", config.chatmagicpasswd, sizeof( config.chatmagicpasswd),NULL,0}, #ifdef _STORECHAR { "storechar", config.storechar, sizeof( config.storechar),NULL,0}, #endif { "chatmagiccdkeycheck", NULL,0, &config.chatmagiccdkeycheck,INT}, { "filesearchnum", NULL,0, &config.filesearchnum,INT}, { "npctemplatenum", NULL,0, &config.npctemplatenum,INT}, { "npccreatenum", NULL,0, &config.npccreatenum,INT}, { "walkinterval" ,NULL,0,(void*)&config.walksendinterval,INT}, { "CAinterval" ,NULL,0,(void*)&config.CAsendinterval_ms,INT}, { "CDinterval" ,NULL,0,(void*)&config.CDsendinterval_ms,INT}, { "CharSaveinterval" ,NULL,0,(void*)&config.CharSavesendinterval,INT}, { "Onelooptime" ,NULL,0,(void*)&config.Onelooptime_ms,INT}, { "Petdeletetime" ,NULL,0,(void*)&config.Petdeletetime,INT}, { "Itemdeletetime" ,NULL,0,(void*)&config.Itemdeletetime,INT}, { "addressbookoffmesgnum" ,NULL,0, (void*)&config.addressbookoffmsgnum,INT}, { "protocolreadfrequency" ,NULL,0, (void*)&config.protocolreadfrequency,INT}, { "allowerrornum" ,NULL,0,(void*)&config.allowerrornum,INT}, { "loghour" ,NULL,0,(void*)&config.loghour,INT}, { "battledebugmsg" ,NULL,0,(void*)&config.battledebugmsg,INT}, //ttom add because the second had { "encodekey" ,NULL,0,(void*)&config.encodekey,INT}, { "acwritesize" ,NULL,0,(void*)&config.acwritesize,INT}, { "acwbsize" ,NULL,0,(void*)&config.acwbsize,INT}, { "erruser_down" ,NULL,0,(void*)&config.ErrUserDownFlg,INT}, //ttom end #ifdef _AUCTIONEER { "auctiondir" , config.auctiondir, sizeof(config.auctiondir),NULL,0}, #endif #ifdef _BLACK_MARKET { "blackmarketfile", config.blackmarketfile, sizeof(config.blackmarketfile), NULL, 0}, #endif #ifdef _M_SERVER { "msname", config.msname,sizeof(config.msname) ,NULL , 0}, { "msport", NULL ,0 , (void*)&config.msport ,SHORT}, #endif #ifdef _NPCSERVER_NEW { "npcaddress", config.nsaddress, sizeof(config.nsaddress) ,NULL , 0}, { "nsport", NULL, 0 , (void*)&config.nsport ,SHORT}, #endif #ifdef _PROFESSION_SKILL // WON ADD ÈËÎïÖ°Òµ¼¼ÄÜ { "profession", config.profession, sizeof(config.profession) ,NULL , 0}, #endif #ifdef _ITEM_QUITPARTY { "itemquitparty", config.itemquitparty, sizeof(config.itemquitparty) ,NULL , 0}, #endif #ifdef _MUSEUM { "museum", NULL , 0 , (void*)&config.museum , INT}, #endif #ifdef _DEL_DROP_GOLD { "Golddeletetime" ,NULL,0,(void*)&config.Golddeletetime, INT}, #endif #ifdef _NEW_PLAYER_CF { "TRANS" ,NULL,0,(void*)&config.newplayertrans, INT}, { "LV" ,NULL,0,(void*)&config.newplayerlv, INT}, { "PET1" ,NULL,0,(void*)&config.newplayergivepet[1], INT}, { "PET2" ,NULL,0,(void*)&config.newplayergivepet[2], INT}, { "PET3" ,NULL,0,(void*)&config.newplayergivepet[3], INT}, { "PET4" ,NULL,0,(void*)&config.newplayergivepet[4], INT}, { "ITEM1" ,NULL,0,(void*)&config.newplayergiveitem[0], INT}, { "ITEM2" ,NULL,0,(void*)&config.newplayergiveitem[1], INT}, { "ITEM3" ,NULL,0,(void*)&config.newplayergiveitem[2], INT}, { "ITEM4" ,NULL,0,(void*)&config.newplayergiveitem[3], INT}, { "ITEM5" ,NULL,0,(void*)&config.newplayergiveitem[4], INT}, { "ITEM6" ,NULL,0,(void*)&config.newplayergiveitem[5], INT}, { "ITEM7" ,NULL,0,(void*)&config.newplayergiveitem[6], INT}, { "ITEM8" ,NULL,0,(void*)&config.newplayergiveitem[7], INT}, { "ITEM9" ,NULL,0,(void*)&config.newplayergiveitem[8], INT}, { "ITEM10" ,NULL,0,(void*)&config.newplayergiveitem[9], INT}, { "ITEM11" ,NULL,0,(void*)&config.newplayergiveitem[10], INT}, { "ITEM12" ,NULL,0,(void*)&config.newplayergiveitem[11], INT}, { "ITEM13" ,NULL,0,(void*)&config.newplayergiveitem[12], INT}, { "ITEM14" ,NULL,0,(void*)&config.newplayergiveitem[13], INT}, { "ITEM15" ,NULL,0,(void*)&config.newplayergiveitem[14], INT}, { "PETLV" ,NULL,0,(void*)&config.newplayerpetlv, INT}, { "GOLD" ,NULL,0,(void*)&config.newplayergivegold, INT}, #endif #ifdef _USER_EXP_CF { "USEREXP", config.expfile, sizeof( config.expfile),NULL,0}, #endif #ifdef _UNLAW_WARP_FLOOR { "FLOOR1" ,NULL,0,(void*)&config.unlawwarpfloor[0], INT}, { "FLOOR2" ,NULL,0,(void*)&config.unlawwarpfloor[1], INT}, { "FLOOR3" ,NULL,0,(void*)&config.unlawwarpfloor[2], INT}, { "FLOOR4" ,NULL,0,(void*)&config.unlawwarpfloor[3], INT}, { "FLOOR5" ,NULL,0,(void*)&config.unlawwarpfloor[4], INT}, #endif #ifdef _UNREG_NEMA { "NAME1" ,config.unregname[0], sizeof( config.unregname[0]),NULL,0}, { "NAME2" ,config.unregname[1], sizeof( config.unregname[1]),NULL,0}, { "NAME3" ,config.unregname[2], sizeof( config.unregname[2]),NULL,0}, { "NAME4" ,config.unregname[3], sizeof( config.unregname[3]),NULL,0}, { "NAME5" ,config.unregname[4], sizeof( config.unregname[4]),NULL,0}, #endif #ifdef _TRANS_LEVEL_CF { "CHARTRANS" ,NULL,0,(void*)&config.chartrans, INT}, { "PETTRANS" ,NULL,0,(void*)&config.pettrans, INT}, { "LEVEL" ,NULL,0,(void*)&config.yblevel, INT}, #endif #ifdef _LOCK_IP { "LOCKIP" ,config.lockip, sizeof( config.lockip),NULL,0}, #endif }; // Arminius 7.12 login announce char announcetext[8192]; void AnnounceToPlayer(int charaindex) { char *ptr,*qtr; ptr=announcetext; while ((qtr=strstr(ptr,"\n"))!=NULL) { qtr[0]='\0'; // printf("ptr=%s\n",ptr); CHAR_talkToCli(charaindex, -1, ptr, CHAR_COLORYELLOW); qtr[0]='\n'; ptr=qtr+1; } CHAR_talkToCli(charaindex, -1, ptr, CHAR_COLORYELLOW); } // Robin 0720 void AnnounceToPlayerWN(int fd) { char buf[8192]; lssproto_WN_send( fd , WINDOW_MESSAGETYPE_LOGINMESSAGE, WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString( announcetext, buf, sizeof(buf)) ); } void LoadAnnounce(void) { FILE *f; memset(announcetext, 0, sizeof(announcetext)); if ((f=fopen("./announce.txt","r"))!=NULL) { fread(announcetext, sizeof(announcetext), 1, f); announcetext[sizeof(announcetext)-1]='\0'; fclose(f); } } #ifdef _PET_TALKPRO PTALK pettalktext[PETTALK_MAXID]; void LoadPetTalk(void) { FILE *fp; char fn[256]; char line[ 4096]; char talkmem[4096]; int maxid=0; char buf1[256], buf2[256], buf3[256]; int talkNO=-1, mark=-1, i; int len = sizeof( talkmem); memset(talkmem, 0, sizeof(talkmem)); sprintf(fn, "%s/pettalk/pettalk.menu", getNpcdir()); for( i=0;i= PETTALK_MAXID ) break; } print("×î´óID=%d...", maxid); { int haveid=0; for( i=0;i= 0 ) { haveid++; } } print("ÔØÈë×ÜÊý=%d", haveid); } } #else char pettalktext[4096]; void LoadPetTalk(void) { FILE *fp; char fn[256]; char line[ 4096]; int len = sizeof( pettalktext); memset(pettalktext, 0, sizeof(pettalktext)); sprintf(fn, "%s/pettalk/pettalk.mem", getNpcdir()); fp = fopen( fn, "r"); if( fp != NULL ) { print("\n\n ¶ÁÈ¡ pettalk.mem"); while( fgets( line, sizeof( line), fp)) { if( strlen( pettalktext) != 0 ) { if( pettalktext[strlen( pettalktext) -1] != '|' ) { strcatsafe( pettalktext, len, "|"); } } chompex( line); strcatsafe( pettalktext,len, line); } fclose( fp); print("\n %s", pettalktext); }else { print("\n ²»ÄÜÕÒµ½ pettalk.mem"); } } #endif #ifdef _GAMBLE_BANK GAMBLEBANK_ITEMS GB_ITEMS[GAMBLEBANK_ITEMSMAX]; void Load_GambleBankItems( void) { FILE *fp; char filename[256]; char buf1[256]; char name[128]; int num,ID,type; int i=0; sprintf(filename, "./data/gambleitems.txt" ); print("\n¼ÓÔضIJ©ÎïÆ·Îļþ %s ...", filename); fp = fopen( filename, "r"); if( fp != NULL ) { while( fgets( buf1, sizeof( buf1), fp) != NULL ) { if( strstr( buf1, "#") != 0 ) continue; sscanf( buf1,"%s %d %d %d", name, &ID, &num , &type); strcpy( GB_ITEMS[i].name, name); GB_ITEMS[i].Gnum = num; GB_ITEMS[i].ItemId = ID; GB_ITEMS[i].type = type; i++; } print("×î´óID: %d ", i); fclose( fp); }else { print("´íÎó ÕÒ²»µ½Îļþ %s", filename); } } #endif #ifdef _CFREE_petskill PETSKILL_CODES Code_skill[PETSKILL_CODE]; void Load_PetSkillCodes( void) { FILE *fp; char filename[256]; char buf1[256]; char name[128]; char type[256]; int num,ID; int i=0; sprintf(filename, "./data/skillcode.txt" ); print("\n¼ÓÔسèÎï¼¼ÄܱàÂëÎļþ:%s...", filename); fp = fopen( filename, "r"); if( fp != NULL ) { while( fgets( buf1, sizeof( buf1), fp) != NULL ) { sscanf( buf1,"%s %d %d %s", name, &num, &ID, type); strcpy( Code_skill[i].name, name); Code_skill[i].TempNo = num; Code_skill[i].PetId = ID; strcpy( Code_skill[i].Code, type); //print("\n %s|%d|%d|%s|", Code_skill[i].name, Code_skill[i].TempNo, // Code_skill[i].PetId, Code_skill[i].Code); i++; if( i >= PETSKILL_CODE ) break; } fclose( fp); }else { print("´ò²»µ½Îļþ %s", filename); } print("Íê³É\n"); } #endif #ifdef _BLACK_MARKET BOOL LoadBMItem( char* filename) { FILE *fp; int i, j, k; char line[512]="", cTmp[256]=""; char *ip=NULL, *gp=NULL; for(i=0; i=BMIMAX){ print("\n¾¯¸æ!! Îï¿ÚÊýÄ¿³¬Ô½·¶Î§(%d).", BMIMAX); break; } sscanf( line, "%s %d %s %s %s %s %s", BMItem[BMINum].iName, &BMItem[BMINum].iGraphicsNum, iTmp1, iTmp2, iTmp3, iTmp4, cTmp); for(i=0; i<3; i++){ if(getStringFromIndexWithDelim( iTmp1, ",", i+1, iTmp5, sizeof( iTmp5))!=FALSE) BMItem[BMINum].iId[0][i] = atoi(iTmp5); if(getStringFromIndexWithDelim( iTmp2, ",", i+1, iTmp5, sizeof( iTmp5))!=FALSE) BMItem[BMINum].iId[1][i] = atoi(iTmp5); if(getStringFromIndexWithDelim( iTmp3, ",", i+1, iTmp5, sizeof( iTmp5))!=FALSE) BMItem[BMINum].iId[2][i] = atoi(iTmp5); if(getStringFromIndexWithDelim( iTmp4, ",", i+1, iTmp5, sizeof( iTmp5))!=FALSE) BMItem[BMINum].iId[3][i] = atoi(iTmp5); } ip = strstr( cTmp, "I"); gp = strstr( cTmp, "G"); if( ip && gp && gp>ip){ strncpy( cTmp1, ip+1, gp-ip-1); for(i=0; i<4; i++) if(getStringFromIndexWithDelim( cTmp1, ",", i+1, cTmp3, sizeof( cTmp3))!=FALSE) BMItem[BMINum].iCondition[i] = atoi(cTmp3); strcpy( cTmp2, gp+1); BMItem[BMINum].GCondition = atoi(cTmp2); }else if( ip && gp && gp GMMAXNUM) break; easyGetTokenFromString(line, 1, cdkey, sizeof(cdkey)); if (strcmp(cdkey, "") == 0) break; strncpy(gminfo[gm_num].cdkey, cdkey, sizeof(gminfo[gm_num].cdkey)); easyGetTokenFromString(line, 2, level, sizeof(level)); if (strcmp(level, "") == 0) break; gminfo[gm_num].level = atoi(level); // print("\ncdkey:%s, level:%d", gminfo[gm_num].cdkey, gminfo[gm_num].level); } fclose(fp); return TRUE; } #endif /*------------------------------------------------------------ * Ãó·òºë·ÂØ© ë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * cahr* ------------------------------------------------------------*/ char* getProgname( void ) { return config.progname; } /*------------------------------------------------------------ * configfilename ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getConfigfilename( void ) { return config.configfilename; } /*------------------------------------------------------------ * configfilename ëɬÀÃÔÊÔÂ£Û * ¦ÐÑ * newv char* Þ¥ØÆÖаÀ * ߯Ի°À * ئØÆ ------------------------------------------------------------*/ void setConfigfilename( char* newv ) { strcpysafe( config.configfilename, sizeof( config.configfilename ), newv ); } /*------------------------------------------------------------ * ·¸ÌïÓÀºëÒÁì»ïë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getDebuglevel( void ) { return config.debuglevel; } /*------------------------------------------------------------ * ·¸ÌïÓÀºëÒÁì»ïëɬÀÃÔÊÔ * ¦ÐÑ * newv int Þ¥ØÆÖаÀ * ߯Ի°À * unsigned int éɼ°°À ------------------------------------------------------------*/ unsigned int setDebuglevel( unsigned int newv ) { int old; old = config.debuglevel; config.debuglevel = newv; return old; } /*------------------------------------------------------------ * memoryunit ë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getMemoryunit( void ) { return config.usememoryunit; } /*------------------------------------------------------------ * memoryunitnum ë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getMemoryunitnum( void ) { return config.usememoryunitnum; } /*------------------------------------------------------------ * ʧÊÐËü¼þÐþÈÓ¡õÌPʧÓñÒÁµ©Ã« Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getAccountservername( void ) { return config.asname; } /*------------------------------------------------------------ * ʧÊÐËü¼þÐþÈÓ¡õÌï¼°ºÌ¡õÐþë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned short ------------------------------------------------------------*/ unsigned short getAccountserverport( void ) { return config.acservport; } /*------------------------------------------------------------ * ʧÊÐËü¼þÐþÈÓ¡õÌï³ß¼°Óɵ©·¥¡õÓñë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned short ------------------------------------------------------------*/ char* getAccountserverpasswd( void ) { return config.acpasswd; } /*------------------------------------------------------------ * ʧÊÐËü¼þÐþÈÓ¡õÌï¾®ÈÕέÒüÔ±ءõØ©ÈÓ¡õÌïÎçØÆ»¯¼° ó¡Ã« ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned short ------------------------------------------------------------*/ char* getGameservername( void ) { return config.gsnamefromas; } // Arminius 7.24 manor pk char* getGameserverID( void ) { if (config.gsid[strlen(config.gsid)-1]=='\n') config.gsid[strlen(config.gsid)-1]='\0'; return config.gsid; } #ifdef _SERVICE // Terry 2001/10/03 char* getApID(void) { return config.apid; } unsigned short getApPort(void) { return config.apport; } int getLoopTime(void) { return config.looptime; } int getEnableService(void) { return config.enableservice; } #endif unsigned short getAllowManorPK( void ) { return config.allowmanorpk; } unsigned short getPortnumber( void ) { return config.port; } /*------------------------------------------------------------ * ±Ø¡õØ©ÈÓ¡õÌï¼° į įë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned short ------------------------------------------------------------*/ int getServernumber( void ) { return config.servernumber; } /*------------------------------------------------------------ * reuseaddr ¼°°Àë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned short ------------------------------------------------------------*/ int getReuseaddr( void ) { return config.reuseaddr; } int getNodelay( void ) { return config.do_nodelay; } int getLogWriteTime(void) { return config.log_write_time; } int getLogIOTime( void) { return config.log_io_time; } int getLogGameTime(void) { return config.log_game_time; } int getLogNetloopFaster(void) { return config.log_netloop_faster; } /*------------------------------------------------------------ * saacwritenum ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * int ------------------------------------------------------------*/ int getSaacwritenum( void ) { return config.saacwritenum; } /*------------------------------------------------------------ * saacwritenum ëɬÀÃÔÊÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * int ------------------------------------------------------------*/ void setSaacwritenum( int num ) { config.saacwritenum = num; } /*------------------------------------------------------------ * saacreadnum ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * int ------------------------------------------------------------*/ int getSaacreadnum( void ) { return config.saacreadnum; } /*------------------------------------------------------------ * saacreadnum ëɬÀÃÔÊÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * int ------------------------------------------------------------*/ void setSaacreadnum( int num ) { config.saacreadnum = num; } /*------------------------------------------------------------ * fdnum ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getFdnum( void ) { return config.fdnum; } /*------------------------------------------------------------ * petcharanum ë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getPetcharnum( void ) { return config.petcharnum; } /*------------------------------------------------------------ * othercharnum ë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getOtherscharnum( void ) { return config.othercharnum; } /*------------------------------------------------------------ * objnum ë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getObjnum( void ) { return config.objnum; } /*------------------------------------------------------------ * itemnum ë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getItemnum( void ) { return config.itemnum; } /*------------------------------------------------------------ * battlenum ë Ô * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getBattlenum( void ) { return config.battlenum; } #ifdef _GET_BATTLE_EXP unsigned int getBattleexp( void ) { return config.battleexp; } #endif /*------------------------------------------------------------ * topdir ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getTopdir( void ) { return config.topdir; } /*------------------------------------------------------------ * mapdir ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getMapdir( void ) { return config.mapdir; } /*------------------------------------------------------------ * maptilefile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getMaptilefile( void ) { return config.maptilefile; } /*------------------------------------------------------------ * battlemapfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getBattleMapfile( void ) { return config.battlemapfile; } /*------------------------------------------------------------ * itemfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getItemfile( void ) { return config.itemfile; } /*------------------------------------------------------------ * invfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getInvfile( void ) { return config.invfile; } /*------------------------------------------------------------ * appearfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getAppearfile( void ) { return config.appearfile; } /*------------------------------------------------------------ * effectfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getEffectfile( void ) { return config.effectfile; } /*------------------------------------------------------------ * titlenamefile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getTitleNamefile( void ) { return config.titlenamefile; } /*------------------------------------------------------------ * titleconfigfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getTitleConfigfile( void ) { return config.titleconfigfile; } /*------------------------------------------------------------ * encountfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getEncountfile( void ) { return config.encountfile; } /*------------------------------------------------------------ * enemyfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getEnemyfile( void ) { return config.enemyfile; } /*------------------------------------------------------------ * enemybasefile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getEnemyBasefile( void ) { return config.enemybasefile; } /*------------------------------------------------------------ * groupfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getGroupfile( void ) { return config.groupfile; } /*------------------------------------------------------------ * magicfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getMagicfile( void ) { return config.magicfile; } #ifdef __ATTACK_MAGIC /*------------------------------------------------------------ * È¡µÃ¹¥»÷ÐÔµÄÖäÊõ * ²ÎÊý * None * ·µ»ØÖµ * char* ------------------------------------------------------------*/ char* getAttMagicfileName( void ) { return config.attmagicfile; } #endif char* getPetskillfile( void ) { return config.petskillfile; } #ifdef _PROFESSION_SKILL // WON ADD ÈËÎïÖ°Òµ¼¼ÄÜ char* getProfession( void ) { return config.profession; } #endif #ifdef _ITEM_QUITPARTY char* getitemquitparty( void ) { return config.itemquitparty; } #endif char *getItematomfile( void ) { return config.itematomfile; } char* getQuizfile( void ) { return config.quizfile; } /*------------------------------------------------------------ * lsgenlogfile ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getLsgenlogfilename( void ) { return config.lsgenlog; } #ifdef _BLACK_MARKET char* getBMItemFile(void){ return config.blackmarketfile; } #endif #ifdef _GMRELOAD char* getGMSetfile( void ) { return config.gmsetfile; } #endif /*------------------------------------------------------------ * storedir ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getStoredir( void ) { return config.storedir; } #ifdef _STORECHAR /*------------------------------------------------------------ ------------------------------------------------------------*/ char* getStorechar( void ) { return config.storechar; } #endif #ifdef _AUCTIONEER char* getAuctiondir(void) { return config.auctiondir; } #endif /*------------------------------------------------------------ * NPC åü°·¸Å«ÒÁÛÍÐþØøë »¯ÈÊÔÂèúÐÑ * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getNpcdir( void ) { return config.npcdir; } /*------------------------------------------------------------ * ·òºë·¸Å«ÒÁÛÍÐþØøë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getLogdir( void ) { return config.logdir; } /*------------------------------------------------------------ * ·òºëɬÀð×ÑëÄÌ»ï ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getLogconffile( void ) { return config.logconfname; } /*------------------------------------------------------------ * ÃñÅÒÓÀÐþ Ü·Óɵ©·¥¡õÓñ ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ char* getChatMagicPasswd( void ) { return config.chatmagicpasswd; } /*------------------------------------------------------------ * ·¸ÌïÓÀºëÃñÅÒÓÀÐþ Ü·Æ¥¼°CDKEYÃñÄáÓÀÛÍëÔÊÔ¾®Éýµ¤¾®Ã« ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * char* ------------------------------------------------------------*/ unsigned getChatMagicCDKeyCheck( void ) { return config.chatmagiccdkeycheck; } /*------------------------------------------------------------ * filesearchnumë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getFilesearchnum( void ) { return config.filesearchnum; } /*------------------------------------------------------------ * npctemplatenumë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getNpctemplatenum( void ) { return config.npctemplatenum; } /*------------------------------------------------------------ * npccreatenumë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getNpccreatenum( void ) { return config.npccreatenum; } /*------------------------------------------------------------ * walksendintervalë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getWalksendinterval( void ) { return config.walksendinterval; } /*------------------------------------------------------------ * walksendintervalë±¾ÓÀÐþÔÊÔÂ£Û * ¦ÐÑ * unsigned int interval ÁÝÃÞ Á¢Øø * ߯Ի°À * void ------------------------------------------------------------*/ void setWalksendinterval( unsigned int interval ) { config.walksendinterval = interval; } /*------------------------------------------------------------ * CAsendintervalë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getCAsendinterval_ms( void ) { return config.CAsendinterval_ms; } /*------------------------------------------------------------ * CAsendintervalë±¾ÓÀÐþÔÊÔÂ£Û * ¦ÐÑ * unsigned int interval * ߯Ի°À * unsigned int ------------------------------------------------------------*/ void setCAsendinterval_ms( unsigned int interval_ms ) { config.CAsendinterval_ms = interval_ms; } /*------------------------------------------------------------ * CDsendintervalë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getCDsendinterval_ms( void ) { return config.CDsendinterval_ms; } /*------------------------------------------------------------ * CDsendintervalë±¾ÓÀÐþÔÊÔÂ£Û * ¦ÐÑ * interval unsigned int * ߯Ի°À * void ------------------------------------------------------------*/ void setCDsendinterval_ms( unsigned int interval_ms ) { config.CDsendinterval_ms = interval_ms; } /*------------------------------------------------------------ * Onelooptimeë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getOnelooptime_ms( void ) { return config.Onelooptime_ms; } /*------------------------------------------------------------ * Onelooptimeë±¾ÓÀÐþÔÊÔÂ£Û * ¦ÐÑ * interval unsigned int * ߯Ի°À * void ------------------------------------------------------------*/ void setOnelooptime_ms( unsigned int interval_ms ) { config.Onelooptime_ms = interval_ms; } /*------------------------------------------------------------ * Petdeletetimeë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getPetdeletetime( void ) { return config.Petdeletetime; } /*------------------------------------------------------------ * Petdeletetimeë±¾ÓÀÐþÔÊÔÂ£Û * ¦ÐÑ * interval unsigned int * ߯Ի°À * void ------------------------------------------------------------*/ void setPetdeletetime( unsigned int interval ) { config.Petdeletetime = interval; } /*------------------------------------------------------------ * Itemdeletetimeë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getItemdeletetime( void ) { return config.Itemdeletetime; } /*------------------------------------------------------------ * Itemdeletetimeë±¾ÓÀÐþÔÊÔÂ£Û * ¦ÐÑ * interval unsigned int * ߯Ի°À * void ------------------------------------------------------------*/ void setItemdeletetime( unsigned int interval ) { config.Itemdeletetime = interval; } /*------------------------------------------------------------ * CharSavesendintervalë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getCharSavesendinterval( void ) { return config.CharSavesendinterval; } /*------------------------------------------------------------ * CharSavesendintervalë±¾ÓÀÐþÔÊÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ void setCharSavesendinterval( unsigned int interval) { config.CharSavesendinterval = interval; } /*------------------------------------------------------------ * Addressbookoffmsgnum ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getAddressbookoffmsgnum( void ) { return config.addressbookoffmsgnum; } /*------------------------------------------------------------ * Protocolreadfrequency ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getProtocolreadfrequency( void ) { return config.protocolreadfrequency; } /*------------------------------------------------------------ * Allowerrornum ë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getAllowerrornum( void ) { return config.allowerrornum; } /*------------------------------------------------------------ * ·òºëëäú ÔÊÔÂÁݶÔë ÔÂ£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ------------------------------------------------------------*/ unsigned int getLogHour( void ) { return config.loghour; } /*------------------------------------------------------------ * ÌïÐþ»ï ¼°·¸ÌïÓÀºë¶ªÓÀ±¾¡õ³âëÇëÔʾ®£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int 1ئÈÕÇëÔÊ ------------------------------------------------------------*/ unsigned int getBattleDebugMsg( void ) { return config.battledebugmsg; } /*------------------------------------------------------------ * ÌïÐþ»ï ¼°·¸ÌïÓÀºë¶ªÓÀ±¾¡õ³âëÇëÔʾ®£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int 1ئÈÕÇëÔÊ ------------------------------------------------------------*/ void setBattleDebugMsg( unsigned int num ) { config.battledebugmsg = num; } /* * Config¼°·¸°×ÇÉ»ïÐþ°Àë裻§ÔÂèúÐÑ * ¦ÐÑ * argv0 char* ÎìѨ¼þÓñ·ÂÄ̼þ¦ÐѼ° âÙ */ void defaultConfig( char* argv0 ) { char* program; /* program ë·Æ»§Ô¼°±åÒøµ¤ */ /* ·¸°×ÇÉ»ïÐþ°Àë ľÔ */ /*Ãó·òºë·ÂØ© */ program = rindex(argv0, '/'); if (program == NULL) program = argv0; else program++; /* "/"¼°Æݾ®ÈÕ±åØÆÐ×Öм°Æ¥++ÔÊÔÂ*/ strcpysafe( config.progname , sizeof( config.progname ) ,program ); /*ɬÀð×ÑëÄÌ»ï */ strcpysafe( config.configfilename, sizeof( config.configfilename ),"setup.cf" ); } /* * ɬÀð×ÑëÄÌ»ï ë ÊÏ·Ö Æ¥¼°ÖÊ Ã«µæµ¤£Û * ¦ÐÑ * ئØÆ * ߯Ի°À * ئØÆ */ void lastConfig( void ) { char entry[256]; /* ѨÓÀÃó·¸Å«ÒÁÛÍÐþØø¼°É¬Àà */ snprintf(entry, sizeof(entry), "%s/%s", config.topdir, config.mapdir); strcpysafe(config.mapdir, sizeof(config.mapdir), entry); /* ѨÓÀÃóɬÀð×ÑëÄÌ»ï ¼°É¬Àà */ snprintf(entry,sizeof(entry),"%s/%s", config.topdir,config.maptilefile); strcpysafe(config.maptilefile, sizeof(config.maptilefile), entry); /* ÌïÐþ»ïѨÓÀÃóɬÀð×ÑëÄÌ»ï ¼°É¬Àà */ snprintf(entry,sizeof(entry),"%s/%s", config.topdir,config.battlemapfile); strcpysafe(config.battlemapfile, sizeof(config.battlemapfile), entry); /* ʧÄÌ Ø©É¬Àð×ÑëÄÌ»ï ¼°É¬Àà */ snprintf(entry,sizeof(entry), "%s/%s", config.topdir,config.itemfile); strcpysafe(config.itemfile, sizeof(config.itemfile), entry); /* ³ÄɬÀð×ÑëÄÌ»ï ¼°É¬Àà */ snprintf(entry,sizeof(entry), "%s/%s", config.topdir,config.invfile); strcpysafe(config.invfile, sizeof(config.invfile), entry); /* ÇëòØÞË É¬Àð×ÑëÄÌ»ï ¼°É¬Àà */ snprintf(entry,sizeof(entry), "%s/%s", config.topdir,config.appearfile); strcpysafe(config.appearfile, sizeof(config.appearfile), entry); /* ÉÒÇëɬÀð×ÑëÄÌ»ï ¼°É¬Àà */ snprintf(entry,sizeof(entry), "%s/%s", config.topdir,config.effectfile); strcpysafe(config.effectfile, sizeof(config.effectfile), entry); /* ÛÍÄÌÊõɬÀð×ÑëÄÌ»ï ¼°É¬Àà */ snprintf(entry,sizeof(entry), "%s/%s", config.topdir,config.quizfile); strcpysafe(config.quizfile, sizeof(config.quizfile), entry); /* ±¹Ä¯ °×ÑëÄÌ»ï ¼°É¬Àà */ snprintf(entry,sizeof(entry), "%s/%s", config.topdir,config.titlenamefile); strcpysafe(config.titlenamefile, sizeof(config.titlenamefile), entry); /* lsgen ʧËüÐþÃóÓÀÐþ°×ÑëÄÌ»ï */ snprintf(entry,sizeof(entry),"%s/%s", config.topdir,config.lsgenlog); strcpysafe(config.lsgenlog, sizeof(config.lsgenlog), entry); /* µ©Ðþʧ·¸Å«ÒÁÛÍÐþØø¼°É¬Àà */ /* snprintf(entry,sizeof(entry), "%s/%s",config.topdir,config.storedir); strcpysafe(config.storedir, sizeof(config.storedir), entry); */ /* NPCɬÀÃÐþÓÀÃó·¸Å«ÒÁÛÍÐþØø¼°É¬Àà */ snprintf(entry,sizeof(entry), "%s/%s",config.topdir,config.npcdir); strcpysafe(config.npcdir, sizeof(config.npcdir), entry); #ifdef _STORECHAR /* */ snprintf(entry,sizeof(entry), "%s/%s",config.topdir,config.storechar); strcpysafe(config.storechar, sizeof(config.storechar), entry); #endif } /* * ºÌÄ̼þÕý¡õÎçØÍå©Ø¦µáÊ÷ ë ÔÈ»¯Ò½ ëÔÊÔÂèúÐÑ * ¦ÐÑ * to void* °Àëҽ ÔÊÔºÌÄ̼þÕý * type CTYPE to¼°µáë裻§Ô * value double to±åÒ½ ÔÊÔ°À * ߯Ի°À * ئØÆ */ void substitutePointerFromType( void* to , CTYPE type ,double value) { switch( type ){ case CHAR: *(char*)to = (char)value; break; case SHORT: *(short*)to = (short)value; break; case INT: *(int*)to = (int)value; break; case DOUBLE: *(double*)to = (double)value; break; } } /*------------------------------------------------------------ * ɬÀð×ÑëÄÌ»ïë ¸ê * ¦ÐÑ * filename °×ÑëÄÌ»ï * ߯Ի°À * TRUE(1) ÔÀ * FALSE(0) Áà -> °×ÑëÄ̻P×ó¡õÃó¼þ±åÁà ØÆÐ× ------------------------------------------------------------*/ BOOL readconfigfile( char* filename ) { FILE* f=NULL; char linebuf[256]; /* Óòµæ ÐÄ ¸êÌïÓÀ°×Ñë */ int linenum=0; /* µæÐÑëÐÑÒüÔ */ char realopenfilename[256]; /* ¶Ë±åopen ÔÊÔ°×ÑëÄÌ»ï */ char hostname[128]; /* ʯµ©Ðþ ë·Æ»§Ô */ if( gethostname( hostname, sizeof(hostname) ) != -1 ){ char* initdot; initdot = index( hostname, '.' ); if( initdot != NULL ) *initdot = '\0'; snprintf( realopenfilename, sizeof(realopenfilename), "%s.%s" , filename, hostname); /* °×ÑëÄ̻P×ó¡õÃó¼þ */ f=fopen( realopenfilename, "r" ); if( f == NULL ) print( "Can't open %s. use %s instead\n", realopenfilename, filename ); } if( f == NULL ){ f=fopen( filename , "r" ); /* °×ÑëÄ̻P×ó¡õÃó¼þ */ if( f == NULL ){ print( "Can't open %s\n", filename ); return FALSE; } } /* ÓòµæÎð¹´ ÐÄ ¸ê */ while( fgets( linebuf , sizeof( linebuf ), f ) ){ char firstToken[256]; /*1 ¼° Ù¯ */ int i; /*»ï¡õÃó ÐÑ*/ int ret; /*ØøÕý¡õ¼þÎì¡õÓñ*/ linenum ++; deleteWhiteSpace(linebuf); /* remove whitespace */ if( linebuf[0] == '#' )continue; /* comment */ if( linebuf[0] == '\n' )continue; /* none */ chomp( linebuf ); /* remove tail newline */ /* delim "=" Æ¥ âÙ(1)¼°Ðþ¡õÛͼþë ÔÂ*/ ret = getStringFromIndexWithDelim( linebuf , "=", 1, firstToken, sizeof(firstToken) ); if( ret == FALSE ){ print( "Find error at %s in line %d. Ignore\n", filename , linenum); continue; } /* readconf ¼°ÈÓÄÌÊõÆ¥»ï¡õÃó */ for( i = 0 ; i < arraysizeof( readconf ) ; i ++ ){ if( strcmp( readconf[i].name ,firstToken ) == 0 ){ /* match */ char secondToken[256]; /*2 ¼° Ù¯ */ /* delim "=" Æ¥2 ¼°Ðþ¡õÛͼþë ÔÂ*/ ret = getStringFromIndexWithDelim( linebuf , "=" , 2 , secondToken , sizeof(secondToken) ); /* NULL Ù¯¾®Éýµ¤¾®Ã«Æ©ÍÍÔ */ if( ret == FALSE ){ print( "Find error at %s in line %d. Ignore", filename , linenum); break; } /*NULL·ÖÔÈÐ×ÈÕÒ½ ØÆئÖÐ*/ if( readconf[i].charvalue != NULL ) strcpysafe( readconf[i].charvalue ,readconf[i].charsize, secondToken); /*NULL·ÖÔÈÐ×ÈÕÒ½ ØÆئÖÐ*/ if( readconf[i].value != NULL ) { if( strcmp( "ON" ,secondToken ) == 0 ) { /*ON·ÖÔÈÐ×ÈÕ1ë ľÔÂ*/ substitutePointerFromType( readconf[i].value, readconf[i].valuetype, 1.0); }else if( strcmp( "OFF" ,secondToken ) == 0 ) { /*OFF·ÖÔÈÐ×ÈÕ1ë ľÔÂ*/ substitutePointerFromType( readconf[i].value, readconf[i].valuetype, 1.0); }else { strtolchecknum(secondToken, (int*)readconf[i].value, 10, readconf[i].valuetype); } } break; } } } fclose( f ); lastConfig(); return TRUE; } //ttom add this becaus the second had this function /*------------------------------------------------------------ * ¾Þ¼þÎì¡õÓñƽ¡õëɬÀÃÔÊÔ * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ƽ¡õë߯ÔÊ ------------------------------------------------------------*/ unsigned int setEncodeKey( void ) { JENCODE_KEY = config.encodekey; return JENCODE_KEY; } /*------------------------------------------------------------ * ʧÊÐËü¼þÐþÈÓ¡õÌï¡õ±å̤Îå ¸êÌïÓÀ°×Ñë¼°ÈÓÄÌÊõëɬÀÃÔÊÔ * ¦ÐÑ * ئØÆ * ߯Ի°À * unsigned int ƽ¡õë߯ÔÊ ------------------------------------------------------------*/ unsigned int setAcWBSize( void ) { AC_WBSIZE = config.acwbsize; return AC_WBSIZE; } unsigned int getAcwriteSize( void ) { return config.acwritesize; } unsigned int getErrUserDownFlg( void ) { return config.ErrUserDownFlg; } //tom end #ifdef _M_SERVER char* getmservername(void) { return config.msname; } void setmservername( char *msname) { sprintf( config.msname, "%s", msname); } unsigned int getmserverport(void) { return config.msport; } void setmserverport( int port) { config.msport = port; } #endif #ifdef _NPCSERVER_NEW char *getnpcserveraddr(void) { return config.nsaddress; } unsigned int getnpcserverport(void) { return config.nsport; } void NS_setAddressAndPort( char *address, int nport) { sprintf( config.nsaddress, "%s", address); config.nsport = nport; } #endif #ifdef _MUSEUM int getMuseum( void ) { return config.museum; } #endif #ifdef _DEL_DROP_GOLD unsigned int getGolddeletetime( void ) { if( config.Golddeletetime > 0 ) return config.Golddeletetime; else return config.Itemdeletetime; } void setIGolddeletetime( unsigned int interval ) { config.Golddeletetime = interval; } #endif #ifdef _NEW_PLAYER_CF int getNewplayertrans( void ) { if(config.newplayertrans > 7) return 7; else if(config.newplayertrans >= 0) return config.newplayertrans; else return 0; } int getNewplayerlv( void ) { if(config.newplayerlv > 160) return 160; else if(config.newplayerlv >0) return config.newplayerlv; else return 0; } int getNewplayerpetlv( void ) { if(config.newplayerpetlv > 160) return 160; else if(config.newplayerpetlv > 0) return config.newplayerpetlv; else return 0; } int getNewplayergivepet( unsigned int index ) { if(config.newplayergivepet[index] > 0 ) return config.newplayergivepet[index]; else return -1; } int getNewplayergiveitem( unsigned int index ) { if(config.newplayergiveitem[index] > 0 ) return config.newplayergiveitem[index]; else return -1; } void setNewplayergivepet( unsigned int index ,unsigned int interval) { config.newplayergivepet[index] = interval; } unsigned int getNewplayergivegold( void ) { if(config.newplayergivegold > 1000000) return 1000000; else if(config.newplayergivegold >= 0) return config.newplayergivegold; else return 0; } #endif #ifdef _UNLAW_WARP_FLOOR int getUnlawwarpfloor( unsigned int index ) { if(config.unlawwarpfloor[index] > 0 ) return config.unlawwarpfloor[index]; else return -1; } #endif #ifdef _ANGEL_SUMMON extern int mission_num; BOOL LoadMissionList( ) { FILE* fp; int i = 0; mission_num = 0; fp = fopen("./data/mission.txt", "r"); if (fp == NULL) { print("ÈÎÎñÎļþ´ò¿ª´íÎó\n"); return FALSE; } memset( missionlist, 0, sizeof(missionlist)); while(1){ char line[1024], level[64]; char token[1024]; int mindex; if (fgets(line, sizeof(line), fp) == NULL) break; print("\n %s ", line); chop(line); // ÒÔ#Ϊע½â******* if( line[0] == '#' ) continue; for( i=0; i= MAXMISSION) break; missionlist[mindex].id = mindex; getStringFromIndexWithDelim(line, ",", 2, token, sizeof(token)); if (strcmp(token, "") == 0) break; missionlist[mindex].level = atoi( token); getStringFromIndexWithDelim(line, ",", 3, token, sizeof(token)); if (strcmp(token, "") == 0) break; strcpy( missionlist[mindex].eventflag, token); getStringFromIndexWithDelim(line, ",", 4, token, sizeof(token)); if (strcmp(token, "") == 0) break; strcpy( missionlist[mindex].detail, token); //getStringFromIndexWithDelim(line, ",", 4, token, sizeof(token)); //if (strcmp(token, "") == 0) break; //strcpy( missionlist[mindex].bonus, token); getStringFromIndexWithDelim(line, ",", 5, token, sizeof(token)); if (strcmp(token, "") == 0) break; missionlist[mindex].limittime = atoi( token); /*print("\nMISSION[%d] lv:%d ef:%s detail:%s limit:%d ", mindex, missionlist[mindex].level, missionlist[mindex].eventflag, missionlist[mindex].detail, missionlist[mindex].limittime ); */ mission_num++; //if (mission_num > MAXMISSION) break; } fclose(fp); return TRUE; } BOOL LoadMissionCleanList( ) { // ¸ñʽ... ʹÕß,ÓÂÕß,ÈÎÎñ,½±ÉÍ FILE* fp; int listindex =0; int i = 0; memset( missiontable, 0, sizeof(missiontable)); fp = fopen("./data/missionclean.txt", "r"); if (fp == NULL) { print("Çå³ýÈÎÎñÎļþ´ò¿ª´íÎó\n"); return FALSE; } while(1){ char line[1024], angelinfo[128], heroinfo[128]; char token[1024]; if (fgets(line, sizeof(line), fp) == NULL) break; print("\n %s ", line); chop(line); // ÒÔ#Ϊע½â******* if( line[0] == '#' ) continue; for( i=0; i= MAXMISSIONTABLE) break; } fclose(fp); return TRUE; } #endif #ifdef _JOBDAILY extern DailyFileType dailyfile[MAXDAILYLIST]; BOOL LoadJobdailyfile(void) { char line[20000]; char token[16384]; int listindex =0; int i; FILE* fp; fp = fopen("./data/jobdaily.txt", "r"); if (fp == NULL) { print("ÈÕ³£¹¤×÷Îļþ´ò¿ª´íÎó\n"); return FALSE; } memset( dailyfile, 0, sizeof(dailyfile)); while(1){ line[0]='\0'; if (fgets(line, sizeof(line), fp) == NULL) break; //print("\n %s ", line); chop(line); // #Ϊע½â if( line[0] == '#' ) continue; for( i=0; i96){ print("ÈÎÎñ˵Ã÷¹ý³¤:%d",strlen(token)); return FALSE; } strcpy( dailyfile[listindex].explain, token); getStringFromIndexWithDelim(line, "|", 4, token, sizeof(token)); if (strcmp(token, "") == 0) break; strcpy( dailyfile[listindex].state, token); /*print("\ndailyfile[%d] %s %s %s %s", listindex, dailyfile[listindex].jobid, dailyfile[listindex].rule, dailyfile[listindex].explain, dailyfile[listindex].state); */ listindex++; if ( listindex >= MAXDAILYLIST) break; } fclose(fp); return TRUE; } #endif #ifdef _RACEMAN //extern int petflgtable[640]; //extern struct ASKTABLE asktable[400]; extern int asktotal; BOOL LoadRacepetfile(void) { char line[1000]; char token[64]; int i; FILE* fp; asktotal = 0; memset(asktable,0,sizeof(asktable)); fp = fopen("./data/raceman.txt", "r"); if (fp == NULL) { print("³èÎïÈüÅÜÎļþ´ò¿ª´íÎó\n"); return FALSE; } while(1){ line[0]='\0'; if (fgets(line, sizeof(line), fp) == NULL) break; chop(line); // #Ϊע½â if( line[0] == '#' ) continue; for( i=0; i 140 ) return FALSE; asktable[asktotal].highlv = atoi(token); asktotal++; } fclose(fp); return TRUE; /* for( k=0,j=0;j=640) { print( "Valid petflag Num is %d...", k ); break; } } //if( CHAR_getInt( petindex, CHAR_PETID) == ENEMYTEMP_getInt( j, E_T_TEMPNO ) ) {//ENEMY_getInt( j, ENEMY_TEMPNO) } */ } #endif #ifdef _USER_EXP_CF BOOL LoadEXP( char* filename ) { FILE* fp; int i = 0; fp = fopen(filename, "r"); if (fp == NULL) { print("ÎÞ·¨´ò¿ªÎļþ\n"); return FALSE; } while(1){ char line[64], exp[64]; if (fgets(line, sizeof(line), fp) == NULL) break; chop(line); if( line[0] == '#' ) continue; for( i=0; i 160) break; easyGetTokenFromString(line, 2, exp, sizeof(exp)); NeedLevelUpTbls[MaxLevel]=atoi(exp); } fclose(fp); return TRUE; } char* getEXPfile( void ) { return config.expfile; } int getNeedLevelUpTbls( int level ) { return NeedLevelUpTbls[level]; } int getMaxLevel( void ) { if(MaxLevel>160) MaxLevel=160; return MaxLevel; } #endif #ifdef _UNREG_NEMA char* getUnregname( int index ) { return config.unregname[index]; } #endif #ifdef _TRANS_LEVEL_CF int getChartrans( void ) { if(config.chartrans>6) config.chartrans=6; return config.chartrans; } int getPettrans( void ) { if(config.pettrans>2) config.pettrans=2; return config.pettrans; } int getYBLevel( void ) { if(config.yblevel>MaxLevel) config.yblevel=MaxLevel; return config.yblevel; } #endif #ifdef _LOCK_IP char* getLockipPath( void ) { return config.lockip; } int loadLockip( char* filename ) { FILE* fp; int i = 0; fp = fopen(filename, "r"); if (fp == NULL) { print("ÎÞ·¨´ò¿ªÎļþ\n"); return FALSE; } while(1){ char line[64], buf[16]; if (fgets(line, sizeof(line), fp) == NULL) break; chop(line); if( line[0] == '#' ) continue; for( i=0; i99)return FALSE; int i; for(i=0;ilockip[index].locktime) return TRUE; else return FALSE; }else return FALSE; else return FALSE; else return FALSE; else return FALSE; } #endif