forked from librae8226/gmsv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configfile.c
2381 lines (2146 loc) · 62.5 KB
/
configfile.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#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"
// 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; /* 田玄伙及 */
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 _HELP_NEWHAND
int jzitem[15];
#endif
#ifdef _JZ_NEW_CONF
int jzpet[4];
int jzgetridepet;
int jzexp;
int jzupexp;
int jzgold;
int jzridets;
int jzpetlevel;
#endif
int sorecvbuf;
int sorecvlowat;
int sosendlowat;
}Config;
Config config;
/*
* 戊件白奴弘白央奶伙毛 戈凛卞银丹厌瞻
* 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[]=
{
{ "sorecvbuf" , NULL ,0 , (void*)&config.sorecvbuf ,INT},
{ "sorecvlowat" , NULL ,0 , (void*)&config.sorecvlowat ,INT},
{ "sosendlowat" , NULL ,0 , (void*)&config.sosendlowat ,INT},
#ifdef _JZ_NEW_CONF
{ "petlevel" , NULL ,0 , (void*)&config.jzpetlevel ,INT},
{ "pet1" , NULL ,0 , (void*)&config.jzpet[0] ,INT},
{ "pet2" , NULL ,0 , (void*)&config.jzpet[1] ,INT},
{ "pet3" , NULL ,0 , (void*)&config.jzpet[2] ,INT},
{ "pet4" , NULL ,0 , (void*)&config.jzpet[3] ,INT},
{ "getridepet" , NULL ,0 , (void*)&config.jzgetridepet ,INT},
{ "exp" , NULL ,0 , (void*)&config.jzexp ,INT},
{ "upexp" , NULL ,0 , (void*)&config.jzupexp ,INT},
{ "gold" , NULL ,0 , (void*)&config.jzgold ,INT},
{ "ridets" , NULL ,0 , (void*)&config.jzridets ,INT},
#endif
#ifdef _HELP_NEWHAND
{ "item1" , NULL ,0 , (void*)&config.jzitem[0] ,INT},
{ "item2" , NULL ,0 , (void*)&config.jzitem[1] ,INT},
{ "item3" , NULL ,0 , (void*)&config.jzitem[2] ,INT},
{ "item4" , NULL ,0 , (void*)&config.jzitem[3] ,INT},
{ "item5" , NULL ,0 , (void*)&config.jzitem[4] ,INT},
{ "item6" , NULL ,0 , (void*)&config.jzitem[5] ,INT},
{ "item7" , NULL ,0 , (void*)&config.jzitem[6] ,INT},
{ "item8" , NULL ,0 , (void*)&config.jzitem[7] ,INT},
{ "item9" , NULL ,0 , (void*)&config.jzitem[8] ,INT},
{ "item10" , NULL ,0 , (void*)&config.jzitem[9] ,INT},
{ "item11" , NULL ,0 , (void*)&config.jzitem[10] ,INT},
{ "item12" , NULL ,0 , (void*)&config.jzitem[11] ,INT},
{ "item13" , NULL ,0 , (void*)&config.jzitem[12] ,INT},
{ "item14" , NULL ,0 , (void*)&config.jzitem[13] ,INT},
{ "item15" , NULL ,0 , (void*)&config.jzitem[14] ,INT},
#endif
{ "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},
{ "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
};
// 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;i++) {
pettalktext[i].ID = -1;
strcpy( pettalktext[i].DATA, "\0");
}
print("\n LoadPetTalk file:%s", fn);
fp = fopen( fn, "r");
if( fp != NULL ) {
while( fgets( line, sizeof( line), fp)) {
if( strlen( talkmem) != 0 ) {
if( talkmem[strlen( talkmem) -1] != '|' ) {
strcatsafe( talkmem, len, "|");
}
}
chompex( line);
strcatsafe( talkmem,len, line);
}
fclose( fp);
}else {
print("...err:not found !");
}
talkNO=1;
while( getStringFromIndexWithDelim( talkmem,"END",talkNO, buf1, sizeof( buf1)) != FALSE ){
talkNO++;
if( NPC_Util_GetStrFromStrWithDelim( buf1, "PETTEMPNO", buf2, sizeof( buf2)) == NULL )
continue;
mark=1;
strcpy( fn,"\0");
if( getStringFromIndexWithDelim( buf2,",", mark+1,buf3,sizeof( buf3)) != FALSE ) {
pettalktext[maxid].ID = atoi( buf3);
if( getStringFromIndexWithDelim( buf2,",", mark,buf3,sizeof( buf3)) != FALSE ) {
sprintf(fn, "%s/pettalk/%s", getNpcdir(), buf3);
//print("\n ...file:%s", fn);
fp = fopen( fn, "r");
if( fp != NULL ) {
char line[4096];
while( fgets( line, sizeof( line), fp ) ) {
if( strlen( pettalktext[maxid].DATA) != 0 ) {
if( pettalktext[maxid].DATA[strlen( pettalktext[maxid].DATA) -1] != '|' ) {
strcatsafe( pettalktext[maxid].DATA, sizeof( pettalktext[maxid].DATA), "|");
}
}
chompex( line);
strcatsafe( pettalktext[maxid].DATA, sizeof( pettalktext[maxid].DATA), line);
}
maxid++;
fclose( fp);
}else {
print("... err:[%s] not found!", fn);
pettalktext[maxid].ID=-1;
}
}else {
pettalktext[maxid].ID=-1;
}
}
print(".");
if( maxid >= PETTALK_MAXID )
break;
}
print("\n.......maxid=%d", maxid);
{
int haveid=0;
for( i=0;i<PETTALK_MAXID;i++) {
if( pettalktext[i].ID >= 0 ) {
haveid++;
}
}
print("...haveid=%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 READ 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 Could't Found 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 Load GambleItems file:%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("..maxID: %d ", i);
fclose( fp);
}else {
print("err not found %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 Load PetSKill Code file:%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("...not found %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; i++){
BMItem[i].iGraphicsNum = 0;
BMItem[i].GCondition = 0;
for(j=0; j<4; j++){
BMItem[i].iCondition[j] = 0;
for(k=0; k<3; k++){
BMItem[i].iId[j][k] = 0;
}
}
strcpy( BMItem[i].iName, "");
}
for(i=0; i<12; i++) BMSellList[i] = -1;
fp = fopen( filename, "r");
if(fp==NULL){
print("\nFault!! Can't Open File:%s ...\n", filename);
return FALSE;
}else{
while(fgets( line, sizeof(line), fp)!=NULL){
char cTmp1[256]="", cTmp2[256]="", cTmp3[256]="";
char iTmp1[128]="", iTmp2[128]="", iTmp3[128]="", iTmp4[128]="", iTmp5[128]="";
if(BMINum>=BMIMAX){
print("\nWarning!! To beyond the scope of the itemnum(%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<ip){
strcpy( cTmp1, ip+1);
for(i=0; i<4; i++)
if(getStringFromIndexWithDelim( cTmp1, ",", i+1, cTmp3, sizeof( cTmp3))!=FALSE)
BMItem[BMINum].iCondition[i] = atoi(cTmp3);
strncpy( cTmp2, gp+1, ip-gp-1);
BMItem[BMINum].GCondition = atoi(cTmp2);
}else if( gp && !ip){
strcpy( cTmp2, gp+1);
BMItem[BMINum].GCondition = atoi(cTmp2);
}else if( !gp && ip){
strcpy( cTmp1, ip+1);
for(i=0; i<4; i++)
if(getStringFromIndexWithDelim( cTmp1, ",", i+1, cTmp3, sizeof( cTmp3))!=FALSE)
BMItem[BMINum].iCondition[i] = atoi(cTmp3);
}else{
print("\nWarning!! There is not item or gold condition..");
continue;
}
BMINum++;
}
}
for(i=0; i<12; i++) BMSellList[i] = RAND(0, BMINum-1);
fclose(fp);
return TRUE;
}
#endif
#ifdef _GMRELOAD
BOOL LoadGMSet( char* filename )
{
FILE* fp;
int i = 0, gm_num = 0;
fp = fopen(filename, "r");
if (fp == NULL)
{
print("File Open Error\n");
return FALSE;
}
for (i = 0; i < GMMAXNUM; i++)
{
strcpy(gminfo[i].cdkey, "");
gminfo[i].level = 0;
}
char line[64], cdkey[64], level[64];
while(1){
if (fgets(line, sizeof(line), fp) == NULL) break;
chop(line);
//change 使gmset.txt可以增加注解*******
if( line[0] == '#' )
continue;
for( i=0; i<strlen(line); i++ ){
if( line[i] == '#' ){
line[i] = '\0';
break;
}
}
//*************************************
gm_num = gm_num + 1;
if (gm_num > 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;
}
/*------------------------------------------------------------
* 失市它件玄扔□田及失玉伊旦毛 月
* 娄醒
* 卅仄
* 忒曰袄
* 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;
}