📄 configfile.c
字号:
#define __CONFIGFILE_C__#include "version.h"#include <stdio.h>#include <string.h>#include <strings.h>#include <unistd.h>#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; /*白央奶伙毛腹绸匹五月白央奶伙及醒*/ unsigned int npctemplatenum; /*NPC及 件皿伊□玄白央奶伙及醒*/ unsigned int npccreatenum; /*NPC及戏遣白央奶伙及醒*/ 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_CFint newplayertrans;int newplayerlv;int newplayergivepet[5];int newplayergiveitem[15];int newplayerpetlv;unsigned int newplayergivegold;#endif#ifdef _USER_EXP_CFchar expfile[64];#endif#ifdef _UNLAW_WARP_FLOORint unlawwarpfloor[5];#endif#ifdef _UNREG_NEMAchar unregname[5][16];#endif#ifdef _TRANS_LEVEL_CFint chartrans;int pettrans;int yblevel;#endif#ifdef _LOCK_IPchar lockip[64];#endif}Config;Config config;#ifdef _USER_EXP_CFint NeedLevelUpTbls[160];int MaxLevel=0;#endif#ifdef _LOCK_IPtypedef 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -