-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameResourceManager.cpp
4194 lines (3501 loc) · 100 KB
/
GameResourceManager.cpp
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
// GameResourceManager.cpp: implementation of the CGameResourceManager class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#ifndef _MURIMNET_
#include "GameResourceManager.h"
#include "MHFile.h"
#include "TacticManager.h"
#include "SkillInfo.h"
#ifdef _MHCLIENT_
#include "SkillManager_client.h"
#include "./Audio/MHAudioManager.h"
#include "GMNotifyManager.h"
#else
#include "SkillManager_server.h"
#include "ItemDrop.h"
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
GLOBALTON(CGameResourceManager);
BOOL g_bTESTSERVER = FALSE;
extern int g_nServerSetNum;
CGameResourceManager::CGameResourceManager()
{
m_bNpcRegenLoad = FALSE;
m_bMonsterListLoad = FALSE;
m_bNpcListLoad = FALSE;
m_bMonsterDropItem = FALSE;
m_bLowResolution = FALSE;
m_TotalNpcGroupCount = 0;
m_MaxNpcRegenCount = 0;
m_SMonsterListTable.Initialize(100);
m_PetListTable.Initialize(50);
m_pBuffList = NULL;
#ifdef _SERVER_RESOURCE_FIELD_
m_StaticNpcTable.Initialize( 300 );
m_WareNpcTable.Initialize( 10 );
m_HideNpcTable.Initialize(3);
m_TitanMapMosterDropTable.Initialize( 100 );
#else
m_PreLoadDataTable.Initialize(4);
m_PreLoadEffectTable.Initialize(25);
#endif //_SERVER_RESOURCE_FIELD_
#ifdef _CLIENT_RESOURCE_FIELD_
m_PreLoadItemlist = NULL;
//2008. 6. 18. CBH - +10 이상 아이탬의 이펙트 정보 테이블 초기화
m_PlusItemEffectInfoTable.Initialize(10);
#endif
m_AvatarEquipTable.Initialize(50);
m_ShopItemDupOptionTable.Initialize(30);
// magi82 //////////////////////////////////////////////////////////////////////////
m_LevPenaltyPool = new CMemoryPoolTempl<LEV_PENALTY>;
m_LevPenaltyPool->Init( 99, 10, "LevPenalty" );
m_LevPenaltyTable.Initialize( 99 );
////////////////////////////////////////////////////////////////////////////////////
//SW070127 타이탄
m_TitanListTable.Initialize(4);
//m_TitanEquipEnduranceInfo.Initialize(16);
//m_TitanSkillLink.Initialize(64);
m_PaneltyTime = 0;
// magi82 - UniqueItem(070625)
m_UniqueItemListTable.Initialize( 100 );
// magi82 - UniqueItem(070709)
m_UniqueItemMixTable.Initialize( 100 );
m_MapKindStateInfoTable.Initialize(128);
//2007. 12. 4. CBH - 스킨 아이탬 리스트 테이블 초기화
m_NomalClothesSkinTable.Initialize(100);
//2008. 1. 16. CBH - 코스튬 스킨 아이탬 리스트 테이블 초기화
m_CotumeSkinTable.Initialize(100);
}
CGameResourceManager::~CGameResourceManager()
{
SAFE_DELETE_ARRAY(m_NpcChxList);
ResetMonsterList();
ResetPetList();
ResetPetBuffList();
//SW070127 타이탄
RemoveTitanList();
//RemoveTitanSkillLink();
//RemoveTitanEquipEnduranceInfo();
#ifdef _CLIENT_RESOURCE_FIELD_
DeletePreLoadData();
RemovePlusItemEffectTable();
#endif
#ifdef _SERVER_RESOURCE_FIELD_
ReleaseStaticNpc();
HIDE_NPC_INFO* info = NULL;
m_HideNpcTable.SetPositionHead();
while(info = m_HideNpcTable.GetData())
{
if(info)
{
delete info;
info = NULL;
}
}
m_HideNpcTable.RemoveAll();
MONSTERDROP_TIMAP *pdata = NULL;
m_TitanMapMosterDropTable.SetPositionHead();
while(pdata = m_TitanMapMosterDropTable.GetData())
SAFE_DELETE( pdata );
m_TitanMapMosterDropTable.RemoveAll();
#endif
//
AVATARITEM* pItem = NULL;
m_AvatarEquipTable.SetPositionHead();
while(pItem = m_AvatarEquipTable.GetData())
{
if(pItem)
{
delete pItem;
pItem = NULL;
}
}
m_AvatarEquipTable.RemoveAll();
SHOPITEMDUP* pDupOption = NULL;
m_ShopItemDupOptionTable.SetPositionHead();
while(pDupOption = m_ShopItemDupOptionTable.GetData())
{
if(pDupOption)
{
delete pDupOption;
pDupOption = NULL;
}
}
m_ShopItemDupOptionTable.RemoveAll();
// magi82 //////////////////////////////////////////////////////////////////////////
m_LevPenaltyTable.SetPositionHead();
LEV_PENALTY* pLevPenalty = NULL;
while( pLevPenalty = m_LevPenaltyTable.GetData() )
{
m_LevPenaltyPool->Free( pLevPenalty );
}
m_LevPenaltyTable.RemoveAll();
SAFE_DELETE(m_LevPenaltyPool);
////////////////////////////////////////////////////////////////////////////////////
// magi82 - UniqueItem(070625)
m_UniqueItemListTable.SetPositionHead();
UNIQUE_ITEM_OPTION_INFO* sUniqueItemTemp = NULL;
while(sUniqueItemTemp = m_UniqueItemListTable.GetData())
{
if(sUniqueItemTemp)
{
delete sUniqueItemTemp;
sUniqueItemTemp = NULL;
}
}
m_UniqueItemListTable.RemoveAll();
//////////////////////////////////////////////////////////////////////////
// magi82 - UniqueItem(070709)
m_UniqueItemMixTable.SetPositionHead();
UNIQUE_ITEM_MIX_INFO* sUniqueItemMixTemp = NULL;
while(sUniqueItemMixTemp = m_UniqueItemMixTable.GetData())
{
// magi82(14) - Memory(071027) 메모리 누수 수정
SAFE_DELETE_ARRAY(sUniqueItemMixTemp->sUniqueItemMixMaterial);
SAFE_DELETE(sUniqueItemMixTemp);
}
m_UniqueItemMixTable.RemoveAll();
//////////////////////////////////////////////////////////////////////////
RemoveNomalClothesSkinList(); // 2007. 12. 4. CBH - 스킨 아이탬 목록 리스트 삭제
RemoveCostumeSkinList(); // 2008. 1. 16. CBH - 코스튬 스킨 아이탬 목록 리스트 삭제
m_MapKindStateInfoTable.SetPositionHead();
while( stMAPKINDINFO* pMapKind = m_MapKindStateInfoTable.GetData() )
{
delete pMapKind;
}
m_MapKindStateInfoTable.RemoveAll();
}
BOOL CGameResourceManager::LoadPetList()
{
CMHFile file;
#ifdef _FILE_BIN_
if(!file.Init("./Resource/PetList.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Reource/PetList.txt", "rt))
return FALSE;
#endif
int count = 0;
BASE_PET_LIST* pList = NULL;
while(!file.IsEOF())
{
if( count == MAX_PET_NUM )
break;
pList = new BASE_PET_LIST;
memset(pList, 0, sizeof(BASE_PET_LIST));
pList->PetKind = file.GetWord();
SafeStrCpy(pList->Name, file.GetString(), MAX_NAME_LENGTH+1);
pList->MotionID = file.GetDword();
pList->Pet2DIdx = file.GetWord();
SafeStrCpy(pList->ChxName_PerGrade[0], file.GetString(), 32);
SafeStrCpy(pList->ChxName_PerGrade[1], file.GetString(), 32);
SafeStrCpy(pList->ChxName_PerGrade[2], file.GetString(), 32);
pList->Scale = file.GetFloat();
pList->SummonLevel = file.GetWord();
pList->Tall[0] = file.GetWord();
pList->Tall[1] = file.GetWord();
pList->Tall[2] = file.GetWord();
pList->SpeedFromHero = file.GetFloat();
pList->SkillIdx[0] = file.GetWord();
pList->SkillIdx[1] = file.GetWord();
pList->SkillIdx[2] = file.GetWord();
pList->SkillInfo[0] = SKILLMGR->GetSkillInfo(pList->SkillIdx[0]);
pList->SkillInfo[1] = SKILLMGR->GetSkillInfo(pList->SkillIdx[1]);
pList->SkillInfo[2] = SKILLMGR->GetSkillInfo(pList->SkillIdx[2]);
pList->SkillRecharge = file.GetDword();
pList->StaminaDecreasePerSkill[0] = file.GetDword();
pList->StaminaDecreasePerSkill[1] = file.GetDword();
pList->StaminaDecreasePerSkill[2] = file.GetDword();
pList->StaminaMax[0] = file.GetDword();
pList->StaminaMax[1] = file.GetDword();
pList->StaminaMax[2] = file.GetDword();
pList->InventoryTapNum[0] = file.GetWord();
pList->InventoryTapNum[1] = file.GetWord();
pList->InventoryTapNum[2] = file.GetWord();
pList->DieDramaNum[0] = FindEffectNum(file.GetString());
pList->DieDramaNum[1] = FindEffectNum(file.GetString());
pList->DieDramaNum[2] = FindEffectNum(file.GetString());
for( int i = 0; i < 3; ++i )
{
pList->BuffList[i][0] = file.GetWord();
pList->BuffList[i][1] = file.GetWord();
pList->BuffList[i][2] = file.GetWord();
}
ASSERT(!m_PetListTable.GetData(pList->PetKind));
m_PetListTable.Add(pList, pList->PetKind);
++count;
}
return TRUE;
}
BASE_PET_LIST* CGameResourceManager::GetPetListInfo(int idx)
{
return m_PetListTable.GetData(idx);
}
void CGameResourceManager::ResetPetList()
{
BASE_PET_LIST* pInfo = NULL;
m_PetListTable.SetPositionHead();
while(pInfo = m_PetListTable.GetData())
{
SAFE_DELETE(pInfo);
}
m_PetListTable.RemoveAll();
}
BOOL CGameResourceManager::LoadPetRule()
{
CMHFile file;
char szBuf[256] = {0,};
#ifdef _FILE_BIN_
if(!file.Init("./Resource/PetRule.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Resource/PetRule.txt", "rt"))
return FALSE;
#endif
while(!file.IsEOF())
{
strcpy(szBuf,strupr(file.GetString()));
if(strcmp(szBuf,"#PET_RESUMMON_VALID_TIME") == 0)
{
m_PetRule.ResummonVilidTime = file.GetDword();
}
else if(strcmp(szBuf,"#PET_GRADEUP_PROB_1TO2") == 0)
{
m_PetRule.GradeUpProb1to2 = file.GetDword();
}
else if(strcmp(szBuf,"#PET_GRADEUP_PROB_2TO3") == 0)
{
m_PetRule.GradeUpProb2to3 = file.GetDword();
}
else if(strcmp(szBuf,"#MAX_FRIENDSHIP") == 0)
{
m_PetRule.MaxFriendship = file.GetDword();
}
else if(strcmp(szBuf,"#DEFAULT_FRIENDSHIP") == 0)
{
m_PetRule.DefaultFriendship = file.GetDword();
}
else if(strcmp(szBuf,"#REVIVAL_FRIENDSHIP") == 0)
{
m_PetRule.RevivalFriendship = file.GetDword();
}
else if(strcmp(szBuf,"#REVIVAL_FRIENDSHIP_SHOP") == 0)
{
m_PetRule.RevivalFriendship_Shop = file.GetDword();
}
else if(strcmp(szBuf,"#FRIENDLY_SKILL") == 0)
{
m_PetRule.FriendShipPerSkill[0] = file.GetInt();
m_PetRule.FriendShipPerSkill[1] = file.GetInt();
m_PetRule.FriendShipPerSkill[2] = file.GetInt();
}
else if(strcmp(szBuf,"#FRIENDLY_TIME") == 0)
{
m_PetRule.FriendShipPer10Sec[0] = file.GetInt();
m_PetRule.FriendShipPer10Sec[1] = file.GetInt();
m_PetRule.FriendShipPer10Sec[2] = file.GetInt();
}
else if(strcmp(szBuf,"#FRIENDLY_MASTER_DIE") == 0)
{
m_PetRule.FriendShipPerMasterDie = file.GetInt();
}
else if(strcmp(szBuf,"#FRIENDLY_STAMINA_ZERO_EVERY10SEC") == 0)
{
m_PetRule.FriendShipPerStaminaZero = file.GetInt();
}
else if(strcmp(szBuf,"#FRIENDLY_TRADE") == 0)
{
m_PetRule.FriendShipPerTrade = file.GetInt();
}
else if(strcmp(szBuf,"#FRIENDLY_UPGRADE_FAIL") == 0)
{
m_PetRule.FriendShipPerUpgradeFail = file.GetInt();
}
else if(strcmp(szBuf,"#STAMINA_STAND") == 0)
{
m_PetRule.StaminaStand = file.GetInt();
}
else if(strcmp(szBuf,"#STAMINA_MOVE") == 0)
{
m_PetRule.StaminaMove = file.GetInt();
}
}
return TRUE;
}
BOOL CGameResourceManager::LoadPetBuffList()
{
CMHFile file;
char szBuf[256] = {0,};
#ifdef _FILE_BIN_
if(!file.Init("./Resource/PetBuffList.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Resource/PetBuffList.txt", "rt"))
return FALSE;
#endif
PET_BUFF_LIST* pList = NULL;
int BuffNum = file.GetInt();
m_pBuffList = new PET_BUFF_LIST[BuffNum];
int count = 0;
while(!file.IsEOF())
{
m_pBuffList[count].Idx = file.GetWord();
SafeStrCpy(m_pBuffList[count].BuffName,file.GetString(),MAX_NAME_LENGTH+1);
m_pBuffList[count].BuffKind = file.GetByte();
m_pBuffList[count].BuffSuccessProb = file.GetDword();
m_pBuffList[count].BuffValueData = file.GetDword();
m_pBuffList[count].BuffAdditionalData = file.GetWord();
++count;
if(count == BuffNum)
break;
}
return TRUE;
}
PET_BUFF_LIST* CGameResourceManager::GetPetBuffInfo( int idx )
{
if(idx == 0) return NULL;
return &m_pBuffList[idx-1];
}
void CGameResourceManager::ResetPetBuffList()
{
if(m_pBuffList)
{
delete[] m_pBuffList;
m_pBuffList = NULL;
}
}
//SW070127 타이탄
BOOL CGameResourceManager::LoadTitanSpellCostInfo()
{
CMHFile file;
#ifdef _FILE_BIN_
// if(!file.Init("./Resource/TitanSpellCostPerMap.bin", "rb"))
if(!file.Init("./Resource/Server/TitanSpellCostPerMap.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Resource/TitanSpellCostPerMap.txt", "rt"))
return FALSE;
#endif
int count = 0;
WORD mapNum = 0;
while(!file.IsEOF())
{
mapNum = file.GetWord();
m_TitanSpellCostInfo[mapNum] = file.GetDword();
++count;
if( count > MAX_MAP_ENUMCOUNT )
break;
}
return TRUE;
}
DWORD CGameResourceManager::GetTitanSpellCost( WORD MapNum )
{
return m_TitanSpellCostInfo[MapNum];
}
BOOL CGameResourceManager::LoadTitanList()
{
CMHFile file;
#ifdef _FILE_BIN_
if(!file.Init("./Resource/TitanList.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Resource/TitanList.txt", "rt"))
return FALSE;
#endif
BASE_TITAN_LIST* pList = NULL;
TITANINFO_GRADE* pGrade = NULL;
int totalCount = file.GetInt();
int count = 0;
while(!file.IsEOF())
{
if( totalCount == count ) break;
pList = new BASE_TITAN_LIST;
memset(pList, 0, sizeof(BASE_TITAN_LIST));
pList->TitanIdx = file.GetWord();
SafeStrCpy(pList->TitanName, file.GetString(), MAX_NAME_LENGTH+1);
SafeStrCpy(pList->TitanBaseChxName, file.GetString(), MAX_CHXNAME_LENGTH+1);
SafeStrCpy(pList->TitanfaceModName, file.GetString(), MAX_CHXNAME_LENGTH+1);
//pList->Titan2DImage = file.GetWord();
char tmp[64] = {0,}; //for 파싱시 구분
float attAtk, attReg;
attAtk = attReg = 0.f;
for( int i = 0; i < MAX_TITAN_GRADE; ++i )
{
SafeStrCpy(tmp, file.GetString(), MAX_CHXNAME_LENGTH);
if( strcmp(tmp, "#") != 0)
ASSERT(0);
pGrade = &pList->GradeInfo[i];
//SafeStrCpy(pGrade->BodyChxName, file.GetString(), MAX_CHXNAME_LENGTH);
//SafeStrCpy(pGrade->FaceModName, file.GetString(), MAX_CHXNAME_LENGTH);
//SafeStrCpy(pGrade->CloakModName, file.GetString(), MAX_CHXNAME_LENGTH);
//SafeStrCpy(pGrade->ShoulderModName, file.GetString(), MAX_CHXNAME_LENGTH);
pGrade->Speed = file.GetDword();
pGrade->KyungGongSpeed[0] = file.GetWord();
pGrade->KyungGongSpeed[1] = file.GetWord();
pGrade->KyungGongSpeed[2] = file.GetWord();
pGrade->Scale = file.GetFloat();
pGrade->Tall = file.GetWord();
pGrade->MaxFuel = file.GetDword();
pGrade->MaxSpell = file.GetDword();
//pGrade->Endurance = file.GetDword();
pGrade->Critical = file.GetDword();
pGrade->AttackRange = file.GetFloat();
pGrade->MeleeAttackPowerMin = file.GetWord();
pGrade->MeleeAttackPowerMax = file.GetWord();
pGrade->RangeAttackPowerMin = file.GetWord();
pGrade->RangeAttackPowerMax = file.GetWord();
//pGrade->PhyAtk = file.GetFloat();
pGrade->PhyDef = file.GetFloat();
float attAtk = file.GetFloat();
for( int att = ATTR_FIRE; att <= ATTR_MAX; ++att )
{
(pGrade->AttAtk).SetElement_Val(att, attAtk);
}
for( int att = ATTR_FIRE; att <= ATTR_MAX; ++att )
{
(pGrade->AttReg).SetElement_Val(att, file.GetFloat());
}
pGrade->RecallReduceTime = file.GetDword();
pGrade->dwRecallSpellTime = file.GetDword(); //2007. 11. 19. CBH - 타이탄 소환 주문 시간 추가
}
if( m_TitanListTable.GetData(pList->TitanIdx) )
{
ASSERT(0);
}
m_TitanListTable.Add(pList, pList->TitanIdx);
count++;
}
return TRUE;
}
BASE_TITAN_LIST* CGameResourceManager::GetTitanListInfo( DWORD idx )
{
//return m_TitanListTable.GetData(idx);
BASE_TITAN_LIST* pList = m_TitanListTable.GetData(idx);
return pList;
}
TITANINFO_GRADE* CGameResourceManager::GetTitanGradeInfo( DWORD idx, DWORD grade )
{
BASE_TITAN_LIST* pList = m_TitanListTable.GetData(idx);
if(!pList) return NULL;
if( 3 < grade || grade < 1 )
{
ASSERT(0);
return NULL;
}
return &pList->GradeInfo[grade-1];
}
void CGameResourceManager::RemoveTitanList()
{
BASE_TITAN_LIST* pInfo = NULL;
m_TitanListTable.SetPositionHead();
while(pInfo = m_TitanListTable.GetData())
{
SAFE_DELETE(pInfo);
}
m_TitanListTable.RemoveAll();
}
/*
BOOL CGameResourceManager::LoadTitanSkillLink()
{
CMHFile file;
#ifdef _FILE_BIN_
if(!file.Init("./Resource/TitanSkillLink.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Resource/TitanSkillLink.txt", "rt"))
return FALSE;
#endif
TITAN_SKILLLINK* pInfo = NULL;
while(!file.IsEOF())
{
if( count >= totalCount ) break;
pInfo = new TITAN_SKILLLINK;
memset(pInfo, 0, sizeof(TITAN_SKILLLINK));
pInfo->CharSkillIdx = file.GetDword();
pInfo->TitanSkillIdx = file.GetDword();
#ifdef _DEBUG
SafeStrCpy(pInfo->skillName, file.GetString(), MAX_NAME_LENGTH + 1);
#else
file.GetString();
#endif
if( m_TitanSkillLink.GetData(pInfo->CharSkillIdx) )
{
ASSERT(0);
return FALSE;
}
m_TitanSkillLink.Add(pInfo, pInfo->CharSkillIdx);
count++;
}
return TRUE;
}
TITAN_SKILLLINK* CGameResourceManager::GetTitanSkillIdx(DWORD charSkillIdx)
{
TITAN_SKILLLINK* pInfo = (TITAN_SKILLLINK*)m_TitanSkillLink.GetData(charSkillIdx);
return pInfo;
}
void CGameResourceManager::RemoveTitanSkillLink()
{
TITAN_SKILLLINK* pInfo = NULL;
m_TitanSkillLink.SetPositionHead();
while(pInfo = m_TitanSkillLink.GetData())
{
SAFE_DELETE(pInfo);
}
m_TitanSkillLink.RemoveAll();
}*/
/*
BOOL CGameResourceManager::LoadTitanEquipEnduranceInfo()
{
CMHFile file;
#ifdef _FILE_BIN_
if(!file.Init("./Resource/TitanEndrncInfo_S.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Resource/TitanEndrncInfo_S.txt", "rt"))
return FALSE;
#endif
TITAN_EQUIPITEM_ENDURANCE* pInfo = NULL;
int totalCount = file.GetInt();
int count = 0;
while(!file.IsEOF())
{
if( count >= totalCount ) break;
pInfo = new TITAN_EQUIPITEM_ENDURANCE;
memset(pInfo, 0, sizeof(TITAN_EQUIPITEM_ENDURANCE));
pInfo->titanEquipItemIdx = file.GetDword();
pInfo->decreaseEndurance = file.GetDword();
if( m_TitanEquipEnduranceInfo.GetData(pInfo->titanEquipItemIdx) )
{
ASSERT(0);
return FALSE;
}
m_TitanEquipEnduranceInfo.Add(pInfo, pInfo->titanEquipItemIdx);
count++;
}
return TRUE;
}
TITAN_EQUIPITEM_ENDURANCE* CGameResourceManager::GetTitanEquipEndurance( DWORD titanEquipItemIdx )
{
return (TITAN_EQUIPITEM_ENDURANCE*)m_TitanEquipEnduranceInfo.GetData(titanEquipItemIdx);
}
DWORD CGameResourceManager::GetDecreaseEnduranceFromItemIdx( DWORD titanEquipItemIdx )
{
TITAN_EQUIPITEM_ENDURANCE* pInfo = m_TitanEquipEnduranceInfo.GetData(titanEquipItemIdx);
if(pInfo)
{
return pInfo->decreaseEndurance;
}
else
{
return 0;
}
}
void CGameResourceManager::RemoveTitanEquipEnduranceInfo()
{
TITAN_EQUIPITEM_ENDURANCE* pInfo = NULL;
m_TitanEquipEnduranceInfo.SetPositionHead();
while(pInfo = m_TitanEquipEnduranceInfo.GetData())
{
SAFE_DELETE(pInfo);
}
m_TitanEquipEnduranceInfo.RemoveAll();
}*/
BOOL CGameResourceManager::LoadTitanRule()
{
CMHFile file;
char szBuf[256] = {0,};
#ifdef _FILE_BIN_
if(!file.Init("./Resource/TitanRule.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Resource/TitanRule.txt", "rt"))
return FALSE;
#endif
while(!file.IsEOF())
{
strcpy(szBuf,strupr(file.GetString()));
if(strcmp(szBuf,"#TITAN_RECALL_VALID_TIME_ZEROFUEL") ==0)
{
m_TitanRule.TitanRecallValidTime_ZeroFuel = file.GetDword();
}
if(strcmp(szBuf,"#TITAN_RECALL_VALID_TIME_SEAL") ==0)
{
m_TitanRule.TitanRecallValidTime_Seal = file.GetDword();
}
if(strcmp(szBuf,"#TITAN_RECALL_VALID_TIME_GENERAL") ==0) // magi82(24)
{
m_TitanRule.TitanRecallValidTime_General = file.GetDword();
}
if(strcmp(szBuf,"#TITAN_VAMP_VALID_TIME") ==0)
{
m_TitanRule.TitanVampValidTime = file.GetDword();
}
if(strcmp(szBuf,"#TITAN_FUELRATE_FOR_VAMP") ==0)
{
m_TitanRule.TitanFuelRate_ForVamp = file.GetDword();
}
if(strcmp(szBuf,"#MASTER_LIFERATE_ALLOWFOR_TITANVAMP") ==0)
{
m_TitanRule.MasterLifeRate_AllowForTitanVamp = file.GetDword();
}
if(strcmp(szBuf,"#MASTER_LIFERATE_FROM_TITANVAMP") ==0)
{
m_TitanRule.MasterLifeRate_FromTitanVamp = file.GetDword();
}
if(strcmp(szBuf,"#FUEL_CONVERTRATE_FROM_TITANVAMP") ==0)
{
m_TitanRule.FuelConvertRate_FromTitanVamp = file.GetDword();
}
if(strcmp(szBuf,"#MASTER_LIFERATE_FOR_TITANCALL") ==0)
{
m_TitanRule.MasterLifeRate_forTitanCall = file.GetDword();
}
if(strcmp(szBuf,"#TITAN_DAMAGE_SHARERATE") ==0)
{
m_TitanRule.TitanDamageShareRate = file.GetDword();
}
if(strcmp(szBuf,"#PROB_DECREASE_ENDURANCE") ==0)
{
m_TitanRule.Prob_DecreaseEndurance = file.GetDword();
}
if(strcmp(szBuf,"#PROB_DECREASE_ARMOR_ENDURANCE_ATK") ==0)
{
m_TitanRule.Prob_DecreaseArmorEndurance_Atk = file.GetDword();
}
if(strcmp(szBuf,"#PROB_DECREASE_ARMOR_ENDURANCE_DEF") ==0)
{
m_TitanRule.Prob_DecreaseArmorEndurance_Def = file.GetDword();
}
if(strcmp(szBuf,"#TITAN_MAINTAIN_TIME") ==0) // magi82(25)
{
m_TitanRule.TitanMaintainTime = file.GetDword();
}
}
return TRUE;
}
BOOL CGameResourceManager::LoadFlagNpcInfo()
{
CMHFile file;
char szBuf[256] = {0,};
char value[256] = {0,};
#ifdef _FILE_BIN_
if(!file.Init("./Resource/FlagNpcInfo.bin", "rb"))
return FALSE;
#else
if(!file.Init("./Resource/FlagNpcInfo.txt", "rt"))
return FALSE;
#endif
while(!file.IsEOF())
{
strcpy(value,strupr(file.GetString()));
if(strcmp(value,"#GTDAY_FLG") == 0)
{
for( int i = 0; i < Week; ++i )
{
FlagNpcSet[eGTFlg][i] = file.GetByte();
}
}
if(strcmp(value,"#SGDAY_FLG") == 0)
{
for( int i = 0; i < Week; ++i )
{
FlagNpcSet[eSGFlg][i] = file.GetByte();
}
}
}
return TRUE;
}
BYTE CGameResourceManager::GetFlagFromDate( int flgKind, int day )
{
if( flgKind >= eFlgKind || day >= Week )
{
char buf[128];
sprintf(buf, "Check Date for Flag : Kind(%d), Day(%d)", flgKind, day);
ASSERTMSG(0, buf);
return 99;
}
BYTE flag = FlagNpcSet[flgKind][day];
return flag;
}
BOOL CGameResourceManager::LoadDeveloperInfo()
{
char filename[256];
char value[256];
CMHFile file;
#ifdef _MHCLIENT_
FILE* fp = fopen("./AutopatchOption.opt","rb");
if( fp != NULL )
{
BOOL bWindowMode = FALSE;
fscanf( fp, "%d", &bWindowMode );
//SW061111 저해상도옵션
fscanf( fp, "%d", &m_bLowResolution );
fclose(fp);
if( bWindowMode == TRUE)
m_GameDesc.dispInfo.dispType = WINDOW_WITH_BLT;
else
m_GameDesc.dispInfo.dispType = /*FULLSCREEN_WITH_FLIP;//*/FULLSCREEN_WITH_BLT;
if( m_bLowResolution )
{
m_GameDesc.dispInfo.dwWidth = LOWRSLTN_W;
m_GameDesc.dispInfo.dwHeight = LOWRSLTN_H;
NOTIFYMGR->SetPosition( NOTIFYMSG_RSLTN_X, NOTIFYMSG_RSLTN_Y, NOTIFYMSG_DEFAULT_WIDTH );
}
else
{
m_GameDesc.dispInfo.dwWidth = MIDRSLTN_W;
m_GameDesc.dispInfo.dwHeight = MIDRSLTN_H;
NOTIFYMGR->SetPosition( NOTIFYMSG_DEFAULT_X, NOTIFYMSG_DEFAULT_Y, NOTIFYMSG_DEFAULT_WIDTH );
}
}
#endif
sprintf(filename,"../DeveloperWorking/Developer.ini");
if(!file.Init(filename, "rt", MHFILE_FLAG_DONOTDISPLAY_NOTFOUNDERROR))
return FALSE;
while(1)
{
if(file.IsEOF())
break;
strcpy(value,strupr(file.GetString()));
if(strcmp(value,"*WINDOWMODE") == 0)
{
#ifdef _MHCLIENT_
if( file.GetBool() )
m_GameDesc.dispInfo.dispType = WINDOW_WITH_BLT;
else
m_GameDesc.dispInfo.dispType = /*FULLSCREEN_WITH_FLIP;//*/FULLSCREEN_WITH_BLT;
#endif
}
else if(strcmp(value,"*ASSERTMSGBOX") == 0)
{
g_bAssertMsgBox = file.GetBool();
}
else if(strcmp(value,"*TESTSERVER") == 0)
{
g_bTESTSERVER = file.GetBool();
}
}
file.Release();
return TRUE;
}
void CGameResourceManager::ResetMonsterList()
{
BASE_MONSTER_LIST * pInfo = NULL;
m_SMonsterListTable.SetPositionHead();
while(pInfo = m_SMonsterListTable.GetData())
{
delete [] pInfo->AttackIndex;
delete [] pInfo->AttackRate;
delete [] pInfo->SkillInfo;
pInfo->AttackIndex = NULL;
pInfo->AttackRate = NULL;
pInfo->SkillInfo = NULL;
delete pInfo;
pInfo = NULL;
}
m_SMonsterListTable.RemoveAll();
}
void CGameResourceManager::LoadUserCommendList()
{
m_UserCommendList.clear();
CMHFile file;
#ifdef _FILE_BIN_
// if(!file.Init("./Resource/UserCommandList.bin", "rb"))
if(!file.Init("./Resource/Client/UserCommandList.bin", "rb"))
return;
#else
if(!file.Init("./Resource/UserCommandList.txt", "rt"))
return;
#endif
while(1)
{
if(file.IsEOF())
break;
std::string szUserAction;
int ActionNumber = file.GetInt();
szUserAction = file.GetString();
m_UserCommendList.push_back(szUserAction);