/
area.c
1070 lines (889 loc) · 25.7 KB
/
area.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
/*
*
* $Id: area.c,v 1.6 2008/04/14 14:37:26 devel Exp $ (c) 2005 D.Brockhaus
*
* $Log: area.c,v $
* Revision 1.6 2008/04/14 14:37:26 devel
* added arkhata areas
*
* Revision 1.5 2007/06/22 13:00:53 devel
* added caligar
*
* Revision 1.4 2007/02/24 14:09:54 devel
* NWO first checkin, feb 24
*/
#include <stdlib.h>
#include "server.h"
#include "talk.h"
#include "tool.h"
#include "drdata.h"
#include "death.h"
#include "date.h"
#include "player.h"
#include "area.h"
// should use area file instead of hardcoded list
struct section
{
char *name; // section name
int level; // recommendet character level
};
struct sector
{
int fx,fy;
int tx,ty;
int section;
};
static struct section section[]=
{
{"none",0}, //0
{"Skellie I",1}, //1
{"Thieves Guild II",8}, //2
{"Skellie III Upstairs",5}, //3
{"Zombie I",10}, //4
{"Village",0}, //5
{"Fortress",0}, //6
{"Robber Outpost",8}, //7
{"Skellie II",8}, //8
{"Skellie III Downstairs",6}, //9
{"Skellie Showdown",7}, //10
{"Thieves Guild I",0}, //11
{"Mad Mages",7}, //12
{"Mad Knights",8}, //13
{"Cameron",0}, //14
{"Creeper Death Run",14}, //15
{"Creepers",13}, //16
{"Zombie Showdown",13}, //17
{"Zombie II",13}, //18
{"Zombie III",13}, //19
{"Palace",11}, //20
{"Underground Park I",15}, //21
{"Underground Park II",16}, //22
{"Underground Park III",17}, //23
{"Moonish Caverns",18}, //24
{"Lower Crypt",20}, //25
{"Crypt",21}, //26
{"Inner Crypt",22}, //27
{"Skellie III Downbelow",7}, //28
{"Sewers I",8}, //29
{"Sewers II",10}, //30
{"Sewers III",12}, //31
{"Sewers IV",14}, //32
{"Sewers V",16}, //33
{"Sewers VI",18}, //34
{"Sewers VII",20}, //35
{"Sewers VIII",22}, //36
{"Sewers IX",24}, //37
{"Sewers X",26}, //38
{"Sewers XI",28}, //39
{"Sewers XII",30}, //40
{"Sewers XIII",32}, //41
{"Sewers XIV",34}, //42
{"Sewers XV",36}, //43
{"Sewers XVI",38}, //44
{"Thieves House",1}, //45
{"Skellie I",2}, //46
{"Skellie II",3}, //47
{"Skellie III",4}, //48
{"Robbers Outpost",5}, //49
{"Skellie IV",5}, //50
{"Skellie V",6}, //51
{"Mad Mages",7}, //52
{"Mad Knights",8}, //53
{"Thieves Guild",9}, //54
{"Gwendylon's Tower",0}, //55
{"Fortress",0}, //56
{"Cameron",0}, //57
{"The Woods",0}, //58
{"Aston",0}, //59
{"Garden",16}, //60
{"Park",0}, //61
{"Graveyard",0}, //62
{"Pentagram Quest",0}, //63
{"Earth Underground",0}, //64
{"Fire Underground",0}, //65
{"Ice Underground",0}, //66
{"Ice Palace",0}, //67
{"Mine",0}, //68
{"Clan Halls",0}, //69
{"Random Dungeons",0}, //70
{"Swamp",0}, //71
{"Forest",0}, //72
{"Robber's Lair",36}, //73
{"Dungeon of Bones",36}, //74
{"Skeleton Ruin",36}, //75
{"Robber Sector I",36}, //76
{"Robber Sector II",39}, //77
{"Robber Sector III",42}, //78
{"Robber Sector IV",45}, //79
{"Exkordon Sewers",38}, //80
{"Below the Library",44}, //81
{"Exkordon",0}, //82
{"Governor's Palace",0}, //83
{"Skeleton's Lair",47}, //84
{"Spider's Lair",45}, //85
{"Zombie's Lair",48}, //86
{"Depths of Bone, Level I",50}, //87
{"Depths of Bone, Level II",51}, //88
{"Depths of Bone, Level III",52}, //89
{"Depths of Bone, Level IV",54}, //90
{"Depths of Bone, Level V",55}, //91
{"Depths of Bone, Level VI",57}, //92
{"Depths of Bone, Level VII",58}, //93
{"Depths of Bone, Level VIII",59}, //94
{"Depths of Bone, Level IX",61}, //95
{"Depths of Bone, Hidden Level",63}, //96
{"Depths of Bone, Bottom",63}, //97
{"Depths of Bone, Towers",0}, //98
{"Tower of Ansuz",50}, //99
{"Tower of Berkano",51}, //100
{"Tower of Dagaz",52}, //101
{"Tower of Ehwaz",54}, //102
{"Tower of Fehu",55}, //103
{"Tower of Hagalaz",57}, //104
{"Tower of Isa",58}, //105
{"Tower of Ingwaz",59}, //106
{"Halls of Raidho",61}, //107
{"Nomad Plains",0}, //108
{"Live Quest Area",0}, //109
{"Test Pents",0}, //110
{"Labyrinth, Light&Dark",20}, //111
{"Live Quest Area, Entrance",0}, //112
{"Labyrinth, Undeads",30}, //113
{"Labyrinth, Underwater",25}, //114
{"Labyrinth, First Steps",10}, //115
{"Labyrinth, Hard Life",15}, //116
{"Ice Army Caves",0}, //117
{"More Ice Army Caves",0}, //118
{"Rodneys Warped World, Green",0}, //119
{"Rodneys Warped World, Orange",0}, //120
{"Rodneys Warped World, Red",0}, //121
{"Rodneys Warped World, Blue",0}, //122
{"Rodneys Warped World, White",0}, //123
{"Dragon's Breath",30}, //124
{"Tower Top",0}, //125
{"Tower I",60}, //126
{"Tower II",60}, //127
{"Tower III",60}, //128
{"Tower IV",60}, //129
{"Tover V",60}, //130
{"Tower VI",60}, //131
{"Tower VII",60}, //132
{"Tower VIII",60}, //133
{"Brannington, Bar",0}, //134
{"Brannington, Castle",0}, //135
{"Brannington",0}, //136
{"Grimroot",0}, //137
{"Jobbington",0}, //138
{"Long Tunnel",0}, //139
{"Teufelheim, Slums",38}, //140
{"Teufelheim, Worker District",70}, //141
{"Teufelheim, Noble District",102}, //142
{"Hell Pents",0}, //143
{"Caligar Forest",60}, //144
{"Caligar City",0}, //145
{"Dungeon of Blood",60}, //146
{"Dungeon of Bone",60}, //147
{"Dungeon of Flesh",60}, //148
{"Palace Level 1",60}, //149
{"Palace Level 2",60}, //150
{"Palace Level 3",60}, //151
{"Palace Level 4",60}, //152
{"Amazon Den",60}, //153
{"Underground Passage",60}, //154
{"Arkhata",0}, //155
{"Underground Passage",48}, //156
{"Fortress I",48}, //157
{"Fortress II",60}, //158
{"Bandit's Burrow",50}, //159
{"Knoger Residence",50}, //160
{"Winding Bridge",50}, //161
{"Academy of the Fighting Arts",0}, //162
{"Vampire's Lair",55}, //163
{"Spawing Skeletons",0}, //164
{"Garden",0}, //165
{"Monsters' Lair",58}, //166
{"Library",0}, //167
{"Below the Library",58}, //168
{"Caverns",70}, //169
{"Icy Lair",52}, //170
{"Zombies!",52}, //171
{"Gang Territory",63}, //172
};
static struct sector sector1[]={
{ 73,147, 91,165, 45}, // thieves house
{146,115,202,169, 46}, // skellie 1
{ 35,229, 72,252, 47}, // skellie 2
{182,224,196,254, 48}, // skellie 3
{ 3,229, 33,251, 49}, // robbers outpost
{ 72,209,103,254, 50}, // skellie 4
{ 3,186, 38,223, 51}, // skellie 5
{169, 84,205,114, 52}, // mad mages
{149,103,169,114, 52}, // mad mages
{147, 58,169, 88, 53}, // mad knights
{147, 88,153, 94, 53}, // mad knights
{151,210,181,254, 54}, // mad knights
{ 96,109,116,135, 55}, // gwendy's tower
{110,105,114,110, 55}, // gwendy's tower
{104,135,115,146, 55}, // gwendy's tower
{114,168,134,176, 56}, // fortress
{114,176,145,191, 56}, // fortress
{108, 76,169,168, 57}, // cameron
{ 1, 1,254,254, 58}, // cameron
{0,0,0,0,0}
};
static struct sector sector2[]={
{ 1, 1, 85, 70, 4},
{123, 2,142, 57, 15},
{127, 58,142,102, 15},
{118,102,142,124, 15},
{118,124,128,183, 16},
{ 95,125,118,183, 16},
{ 84,137, 84,183, 16},
{ 59,148, 84,183, 16},
{ 39,141, 59,183, 16},
{ 18,124, 38,183, 16},
{ 2,112, 18,183, 16},
{ 85, 1,122, 62, 17},
{122, 58,126, 62, 17},
{ 1, 70, 14, 84, 18},
{ 1, 84, 7,100, 18},
{ 15, 69, 47, 88, 18},
{ 48, 74, 64, 74, 18},
{ 58, 70, 90, 97, 18},
{ 64, 98, 85,101, 18},
{ 90, 63,121, 82, 18},
{ 96, 83,101, 90, 18},
{ 3,101, 7,110, 19},
{ 8, 86, 12, 90, 19},
{ 8, 90, 19,111, 19},
{ 20, 90, 39,123, 19},
{ 40, 92, 52,140, 19},
{ 53, 97, 60,140, 19},
{ 60, 97, 60,148, 19},
{ 64,102, 83,147, 19},
{ 84,124, 94,136, 19},
{ 84,113,117,113, 19},
{ 87,101,117,112, 19},
{ 91, 83, 96,100, 19},
{ 97, 90,102,100, 19},
{103, 95,127,100, 19},
{103, 85,115, 94, 19},
{116, 83,126, 89, 19},
{122, 83,126, 63, 19},
{143, 1,192, 85, 21},
{143, 85,192,170, 22},
{143,170,192,254, 23},
{ 1,184,142,254, 24},
{194,208,254,254, 25},
{214,197,254,207, 25},
{194,197,212,207, 26},
{194,153,254,197, 26},
{214,116,254,153, 27},
{0,0,0,0,0}
};
static struct sector sector3[]={
{110,100,169,162, 20}, // palace
{218,209,254,254, 58}, // wood
{197,163,219,189, 60}, // astronomer's garden
{179,101,227,160, 61}, // park
{ 62,173,104,213, 62}, // graveyard
{ 91, 93,254,254, 59}, // aston
{0,0,0,0,0}
};
static struct sector sector4[]={
{1,1,254,254,63},
{0,0,0,0,0}
};
static struct sector sector5[]={
{ 55, 70,134,119, 29}, //sewer1
{ 70, 1,134, 70, 30}, //sewer2
{ 1, 55, 55,119, 31}, //sewer3
{ 1, 1, 70, 55, 32}, //sewer4
{134, 55,183,134, 33}, //sewer5
{134, 1,198, 55, 34}, //sewer6
{183, 70,254,134, 35}, //sewer7
{198, 1,254, 70, 36}, //sewer8
{121,136,200,185, 37}, //sewer9
{121,185,185,254, 38}, //sewer10
{200,136,254,200, 39}, //sewer11
{185,200,254,254, 40}, //sewer12
{ 72,121,121,200, 41}, //sewer13
{ 57,200,121,254, 42}, //sewer14
{ 1,121, 72,185, 43}, //sewer15
{ 1,185, 57,254, 44}, //sewer16
{0,0,0,0,0}
};
static struct sector sector6[]={
{1,1,254,254,64},
{0,0,0,0}
};
static struct sector sector7[]={
{1,1,254,254,63},
{0,0,0,0}
};
static struct sector sector8[]={
{1,1,254,254,65},
{0,0,0,0}
};
static struct sector sector9[]={
{1,1,254,254,63},
{0,0,0,0}
};
static struct sector sector10[]={
{1,1,254,254,66},
{0,0,0,0}
};
static struct sector sector11[]={
{1,1,254,254,67},
{0,0,0,0}
};
static struct sector sector12[]={
{1,1,254,254,68},
{0,0,0,0}
};
static struct sector sector13[]={
{1,1,254,254,69},
{0,0,0,0}
};
static struct sector sector14[]={
{1,1,254,254,70},
{0,0,0,0}
};
static struct sector sector15[]={
{1,1,254,254,71},
{0,0,0,0}
};
static struct sector sector16[]={
{92,76,116,96,73},
{42,229,86,255,74},
{114,193,134,226,75},
{1,1,254,254,72},
{0,0,0,0}
};
static struct sector sector17[]={
// robber, part I
{110, 1, 129, 51, 76},
{130, 11, 133, 51, 76},
{134, 31, 137, 51, 76},
{138, 47, 148, 51, 76},
// robber, part II
{113, 52, 133, 78, 77},
{101, 62, 123, 81, 77},
// robber, part III
{134, 52, 170, 88, 78},
{149, 47, 153, 51, 78},
// robber, part IV (order is important)
{132, 1, 175, 52, 79},
// sewers
{195, 1, 254, 99, 80},
// below library
{ 1,191, 37,254, 81},
// governors palace
{ 1, 1, 59, 37, 83},
// skeleton place
{ 38,191, 82,254, 84},
// spider place
{ 83,191, 160,254, 85},
// zombie place
{161,191, 208,254, 86},
// zombie place
{209,222, 225,254, 99},
// exkordon (order!)
{ 1, 1, 194,100, 82},
{0,0,0,0}
};
static struct sector sector18[]={
{ 1, 1, 85, 64, 87},
{ 85, 1,170, 64, 88},
{170, 1,255, 64, 89},
{ 1, 64, 85,128, 90},
{ 85, 64,170,128, 91},
{170, 64,255,128, 92},
{ 1,128, 85,192, 93},
{ 85,128,170,192, 94},
{170,128,255,192, 95},
{ 1,192, 85,255, 96},
{ 85,192,170,255, 97},
{172,222,188,254, 100}, // tower 2
{188,222,204,254, 101}, // tower 3
{204,222,220,254, 102}, // tower 4
{220,222,236,254, 103}, // tower 5
{236,222,252,254, 104}, // tower 6
{172,206,204,222, 105}, // tower 7
{204,206,236,222, 106}, // tower 8
{172,194,236,205, 107}, // underground tower 9
{237,194,254,221, 107}, // underground tower 9
{170,192,255,255, 98},
{0,0,0,0}
};
static struct sector sector19[]={
{ 1, 1,255,255, 108},
{0,0,0,0}
};
static struct sector sector20[]={
{230,233,255,255, 112},
{ 1, 1,255,255, 109},
{0,0,0,0}
};
static struct sector sector21[]={
{ 1, 1,255,255, 110},
{0,0,0,0}
};
static struct sector sector22[]={
{224,199,255,255, 111},
{134,141,223,254, 113},
{134, 1,254,140, 114},
{224,140,254,198, 114},
{ 21,171,133,254, 115},
{ 66, 1,133,114, 116},
{0,0,0,0}
};
static struct sector sector23[]={
{ 1, 1,255,255, 117},
{0,0,0,0}
};
static struct sector sector24[]={
{ 1, 1,255,255, 118},
{0,0,0,0}
};
static struct sector sector25[]={
{ 211,132,254,254, 119}, // green
{ 179, 45,254,131, 120}, // orange
{ 158, 14,254, 44, 121}, // red
{ 212, 1,254, 44, 121}, // red
{ 157, 1,211, 13, 122}, // blue
{ 108, 1,157, 44, 122}, // blue
{ 108, 45,178,131, 122}, // blue
{ 108,132,211,254, 123}, // white
{0,0,0,0}
};
static struct sector sector26[]={
{ 1, 1,165, 55, 124}, // dragons breath (rho)
{0,0,0,0}
};
static struct sector sector27[]={
{0,0,0,0}
};
static struct sector sector28[]={
{0,0,0,0}
};
static struct sector sector29[]={
{ 37,112, 71,146, 125}, // tower top
{ 37,148, 71,182, 126}, // tower 1
{ 37,184, 71,218, 127}, // tower 2
{ 37,220, 71,254, 128}, // tower 3
{ 1,220, 35,254, 129}, // tower 4
{ 1,184, 35,218, 130}, // tower 5
{ 1,148, 35,182, 131}, // tower 6
{ 1,112, 35,146, 132}, // tower 7
{ 1, 76, 35,110, 133}, // tower 8
{ 1, 1, 24, 30, 134}, // brannington bar
{ 1, 32, 26, 43, 135}, // brannington castle
{ 182,167,207,183, 135}, // brannington castle
{ 172,152,243,185, 136}, // brannington
{ 136,185,243,222, 136}, // brannington
{ 181,222,220,232, 136}, // brannington
{0,0,0,0}
};
static struct sector sector30[]={
{0,0,0,0}
};
static struct sector sector31[]={
{1,1,255,255, 137}, // grimroot
{0,0,0,0}
};
static struct sector sector32[]={
{1,1,255,255, 138}, // jobbington
{0,0,0,0}
};
static struct sector sector33[]={
{1,1,255,255, 139}, // long tunnel
{0,0,0,0}
};
static struct sector sector34[]={
{129,193,255,255, 140}, // teufelheim, slums
{1, 193,128,255, 141}, // teufelheim, worker district
{1, 1,128,192, 142}, // teufelheim, noble district
{129, 1,255,192, 143}, // hell pents extension
{0,0,0,0}
};
static struct sector sector35[]={
{0,0,0,0}
};
static struct sector sector36[]={
{207,167,221,194, 146},
{207,138,221,165, 147},
{207,109,221,136, 148},
{100,175,128,227, 149},
{142,176,170,228, 150},
{224,109,252,161, 151},
{172,176,205,196, 152},
{172,196,189,202, 152},
{222,181,255,255, 153},
{190,197,255,255, 153},
{186,203,255,255, 153},
{179,203,186,240, 153},
{171,203,179,228, 153},
{178,241,185,250, 154},
{141,229,178,253, 154},
{108,239,141,253, 154},
{ 1, 1,255,108, 144},
{ 1,109,255,255, 145},
{0,0,0,0}
};
static struct sector sector37[]={
{158, 61,255,141, 156},
{219, 61,253,159, 156}, // rock demon area
{140, 45,183, 59, 157}, // fortress 1
{140, 45,156,155, 157}, // fortress 1
{134,106,141,130, 157}, // fortress 1
{156,141,204,155, 157}, // fortress 1
{203,142,212,161, 157}, // fortress 1
{212,142,219,166, 157}, // fortress 1
{219,161,253,166, 157}, // fortress 1
{134, 60,140, 81, 157}, // fortress 1
{ 2,109, 23,117, 158}, // fortress 2
{ 2,117, 29,143, 158}, // fortress 2
{ 30,117, 35,136, 158}, // fortress 2
{162,215,178,222, 158}, // fortress 2
{162,233,169,232, 158}, // fortress 2
{141, 20,145, 27, 158}, // fortress 2
{138, 22,140, 27, 158}, // fortress 2
{207,178,216,189, 159}, // bandits burrow
{213,172,220,233, 159}, // bandits burrow
{215,170,231,180, 159}, // bandits burrow
{220,180,242,234, 159}, // bandits burrow
{211,205,213,233, 159}, // bandits burrow
{220,234,234,253, 159}, // bandits burrow
{243,214,248,221, 159}, // bandits burrow
{243,185,245,201, 159}, // bandits burrow
{246,188,246,201, 159}, // bandits burrow
{247,189,253,197, 159}, // bandits burrow
{247,190,247,200, 159}, // bandits burrow
{146, 7,160, 28, 160}, // knoger residence
{140, 11,145, 19, 160}, // knoger residence
{134, 9,140, 21, 160}, // knoger residence
{119, 2,133 ,21, 160}, // knoger residence
{ 85, 2,119, 37, 160}, // knoger residence
{ 85, 38,103, 46, 160}, // knoger residence
{ 2,144, 64,218, 161}, // winding bridge
{ 37,219, 64,231, 161}, // winding bridge
{ 2,219, 36,253, 162}, // academy of the fighting arts
{170, 2,184, 10, 163}, // vampire lair
{184, 2,237, 35, 163}, // vampire lair
{184, 36,253, 59, 164}, // spawning skeletons
{238, 2,253, 35, 164}, // spawning skeletons
{105,153,130,166, 165}, // garden
{104,168,120,206, 166}, // the monsters lair
{ 2, 45, 18, 74, 167}, // library
{ 19, 48, 20, 74, 167}, // library
{ 20, 49, 22, 74, 167}, // library
{ 22, 66, 31, 74, 167}, // library
{216,167,232,169, 168}, // below library
{232,167,243,179, 168}, // below library
{244,167,253,184, 168}, // below library
{247,185,252,187, 168}, // below library
{135, 2,141, 8, 168}, // below library
{140, 2,145, 10, 168}, // below library
{ 97,237,118,253, 169}, // caverns
{119,233,170,253, 169}, // caverns
{170,223,210,253, 169}, // caverns
{211,234,219,253, 169}, // caverns
{249,198,253,253, 170}, // icy lair
{243,202,248,213, 170}, // icy lair
{243,222,248,253, 170}, // icy lair
{235,235,242,253, 170}, // icy lair
{ 48, 82, 65,116, 171}, // zombies
{ 41, 92, 42,109, 171}, // zombies
{ 66, 89, 78, 95, 171}, // zombies
{ 70,211, 96,253, 172}, // gang territory
{ 65,218, 69,253, 172}, // gang territory
{ 60,233, 64,253, 172}, // gang territory
{ 55,242, 59,253, 172}, // gang territory
{ 37,211,100,236, 172}, // gang territory
{ 1, 1,255,255, 155},
{0,0,0,0}
};
struct sector *area_sector[]={
NULL,
sector1,
sector2,
sector3,
sector4,
sector5,
sector6,
sector7,
sector8,
sector9,
sector10,
sector11,
sector12,
sector13,
sector14,
sector15,
sector16,
sector17,
sector18,
sector19,
sector20,
sector21,
sector22,
sector23,
sector24,
sector25,
sector26,
sector27,
sector28,
sector29,
sector30,
sector31,
sector32,
sector33,
sector34,
sector35,
sector36,
sector37
};
static short npc_in_section[TOTAL_MAXCHARS];
int get_section(int x,int y)
{
struct sector *sec;
int n;
if (areaID>=ARRAYSIZE(area_sector)) return 0;
if (!(sec=area_sector[areaID])) return 0;
for (n=0; sec[n].fx; n++) {
if (x>=sec[n].fx && x<=sec[n].tx &&
y>=sec[n].fy && y<=sec[n].ty) break;
}
return sec[n].section;
}
char *get_section_name(int x,int y)
{
struct sector *sec;
int n;
if (areaID>=ARRAYSIZE(area_sector)) return NULL;
if (!(sec=area_sector[areaID])) return NULL;
for (n=0; sec[n].fx; n++) {
if (x>=sec[n].fx && x<=sec[n].tx &&
y>=sec[n].fy && y<=sec[n].ty) break;
}
return section[sec[n].section].name;
}
void show_section(int x,int y,int cn)
{
struct section *sec;
int n,diff;
if (!(n=get_section(x,y))) {
log_char(cn,LOG_SYSTEM,0,"(%d,%d)",x,y);
return;
}
sec=§ion[n];
//log_char(cn,LOG_SYSTEM,0,"If the following message seems wrong, please report these numbers to Ishtar: %d,%d - %d",x,y,n);
if (!sec->level) {
log_char(cn,LOG_SYSTEM,0,"%s. (%d,%d)",sec->name,x,y);
return;
}
diff=sec->level-ch[cn].level;
if (diff<-5) {
log_char(cn,LOG_SYSTEM,0,"%s. This area is way too easy for you. (%d,%d)",sec->name,x,y);
return;
} else if (diff>5) {
log_char(cn,LOG_SYSTEM,0,"%s. This area is way too dangerous for you. (%d,%d)",sec->name,x,y);
return;
}
switch(diff) {
case -5: log_char(cn,LOG_SYSTEM,0,"%s. This area is too easy for you. (%d,%d)",sec->name,x,y); return;
case -4: log_char(cn,LOG_SYSTEM,0,"%s. This area is easy for you. (%d,%d)",sec->name,x,y); return;
case -3: log_char(cn,LOG_SYSTEM,0,"%s. This area is fairly easy for you. (%d,%d)",sec->name,x,y); return;
case -2: log_char(cn,LOG_SYSTEM,0,"%s. This area is rather easy for you. (%d,%d)",sec->name,x,y); return;
case -1: log_char(cn,LOG_SYSTEM,0,"%s. This area is just about right for you. (%d,%d)",sec->name,x,y); return;
case 0: log_char(cn,LOG_SYSTEM,0,"%s. This area is just right for you. (%d,%d)",sec->name,x,y); return;
case 1: log_char(cn,LOG_SYSTEM,0,"%s. This area is slightly dangerous for you. (%d,%d)",sec->name,x,y); return;
case 2: log_char(cn,LOG_SYSTEM,0,"%s. This area is a bit dangerous for you. (%d,%d)",sec->name,x,y); return;
case 3: log_char(cn,LOG_SYSTEM,0,"%s. This area is somewhat dangerous for you. (%d,%d)",sec->name,x,y); return;
case 4: log_char(cn,LOG_SYSTEM,0,"%s. This area is dangerous for you. (%d,%d)",sec->name,x,y); return;
case 5: log_char(cn,LOG_SYSTEM,0,"%s. This area is very dangerous for you. (%d,%d)",sec->name,x,y); return;
}
}
void register_npc_to_section(int cn)
{
int s;
if (!(s=get_section(ch[cn].x,ch[cn].y))) return;
if (s<1 || s>=MAXCHARS) return;
npc_in_section[ch[cn].tmpa]=s;
}
struct section_data
{
unsigned char npc[TOTAL_MAXCHARS/8];
int current_section;
};
int register_kill_in_section(int cn,int co)
{
struct section_data *dat;
int t,s,index,bit,n,have=0,need=0,exp,diff,new;
if (!(ch[cn].flags&CF_PLAYER)) return 0;
if (!(dat=set_data(cn,DRD_SECTION_DATA,sizeof(struct section_data)))) return 0; // OOPS
t=ch[co].tmpa;
if (t<1 || t>=MAXCHARS) return 0;
index=t/8;
bit=1<<(t&7);
new=!(dat->npc[index]&bit);
dat->npc[index]|=bit;
s=npc_in_section[t];
if (!section[s].level) return 0;
for (n=1; n<MAXCHARS; n++) {
if (npc_in_section[n]==s) {
need++;
index=n/8;
bit=1<<(n&7);
if (dat->npc[index]&bit) have++;
}
}
diff=need-have;
exp=kill_score_level(section[s].level,ch[cn].level);
if (new && exp && diff && ((diff%10)==0 || diff<6 || have==1)) {
log_char(cn,LOG_SYSTEM,0,"%d done, %d to go.",have,diff);
}
if (have>=need) {
for (n=1; n<MAXCHARS; n++) {
if (npc_in_section[n]==s) {
index=n/8;
bit=1<<(n&7);
dat->npc[index]&=~bit;
}
}
if (exp) {
log_char(cn,LOG_SYSTEM,0,"Strike! You killed all %d enemies in this section. Good work!",need);
give_exp_bonus(cn,(exp*need)/2);
}
return 1;
}
return 0;
}
void walk_section_msg(int cn)
{
int s;
struct section_data *dat;
if (!(ch[cn].flags&CF_PLAYER)) return;
if (!(dat=set_data(cn,DRD_SECTION_DATA,sizeof(struct section_data)))) return; // OOPS
s=get_section(ch[cn].x,ch[cn].y);
if (s!=dat->current_section) {
if (s) {
log_char(cn,LOG_SYSTEM,0,"°c1Now entering %s.",section[s].name);
} else {
log_char(cn,LOG_SYSTEM,0,"°c1Now leaving %s.",section[dat->current_section].name);
}
dat->current_section=s;
}
}
void area_sound_wet_dungeon(int cn)
{
int r;
r=RANDOM(100);
if (r==10 || r==20) player_special(cn,14,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==30 || r==40) player_special(cn,15,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==50 || r==60) player_special(cn,16,-(RANDOM(1000)+100),5000-RANDOM(10000));
}
void area_sound_dry_dungeon(int cn)
{
int r;
r=RANDOM(100);
if (r==10) player_special(cn,36,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==20) player_special(cn,37,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==30) player_special(cn,38,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==40) player_special(cn,39,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==50) player_special(cn,40,-(RANDOM(1000)+100),5000-RANDOM(10000));
}
void area_sound_woods(int cn)
{
int r;
r=RANDOM(100);
if (hour>6 && hour<22) {
if (r==10) player_special(cn,10,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==20) player_special(cn,11,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==30) player_special(cn,12,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==40) player_special(cn,19,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==50) player_special(cn,20,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==60) player_special(cn,21,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==70) player_special(cn,22,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==80) player_special(cn,24,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==90) player_special(cn,25,-(RANDOM(1000)+100),5000-RANDOM(10000));
} else {
if (r==10) player_special(cn,17,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==20) player_special(cn,18,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==30) player_special(cn,26,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==40) player_special(cn,27,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==50) player_special(cn,28,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==60) player_special(cn,23,-(RANDOM(1000)+100),5000-RANDOM(10000));
}
}
void area_sound_park(int cn)
{
int r;
r=RANDOM(100);
if (hour>6 && hour<22) {
if (r==10) player_special(cn,10,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==20) player_special(cn,11,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==30) player_special(cn,12,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==40) player_special(cn,19,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==50) player_special(cn,20,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==60) player_special(cn,21,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==70) player_special(cn,22,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==80) player_special(cn,24,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==90) player_special(cn,25,-(RANDOM(1000)+100),5000-RANDOM(10000));
} else {
if (r==30) player_special(cn,26,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==40) player_special(cn,27,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==50) player_special(cn,28,-(RANDOM(1000)+100),5000-RANDOM(10000));
if (r==60) player_special(cn,23,-(RANDOM(1000)+100),5000-RANDOM(10000));
}
}
void area_sound_underwater(int cn)
{
int r;
r=RANDOM(100);