svn -> git Migration

This commit is contained in:
KimLS
2013-02-16 16:14:39 -08:00
parent 88c9715fb0
commit da7347f76f
1174 changed files with 445622 additions and 0 deletions
+328
View File
@@ -0,0 +1,328 @@
create table titles (
id int UNSIGNED primary key AUTO_INCREMENT,
skill_id tinyint UNSIGNED NOT NULL,
skill_value mediumint UNSIGNED NOT NULL,
aa_points TINYINT UNSIGNED NOT NULL,
title varchar(32) NOT NULL
);
alter table inventory add instnodrop tinyint(1) unsigned default 0 not null;
alter table tributes ADD isguild TINYINT NOT NULL DEFAULT '0';
alter table tributes drop primary key;
alter table tributes ADD primary key(id,isguild);
ALTER TABLE zone ADD fog_red2 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_green2 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_blue2 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_minclip2 float NOT NULL default '450';
ALTER TABLE zone ADD fog_maxclip2 float NOT NULL default '450';
ALTER TABLE zone ADD fog_red3 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_green3 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_blue3 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_minclip3 float NOT NULL default '450';
ALTER TABLE zone ADD fog_maxclip3 float NOT NULL default '450';
ALTER TABLE zone ADD fog_red4 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_green4 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_blue4 tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE zone ADD fog_minclip4 float NOT NULL default '450';
ALTER TABLE zone ADD fog_maxclip4 float NOT NULL default '450';
UPDATE zone SET fog_red2=fog_red,fog_red3=fog_red,fog_red4=fog_red,
fog_green2=fog_green,fog_green3=fog_green,fog_green4=fog_green,
fog_blue2=fog_blue,fog_blue3=fog_blue,fog_blue4=fog_blue,
fog_minclip2=fog_minclip,fog_minclip3=fog_minclip,fog_minclip4=fog_minclip,
fog_maxclip2=fog_maxclip,fog_maxclip3=fog_maxclip,fog_maxclip4=fog_maxclip;
ALTER TABLE zone_points ADD target_zone_id int UNSIGNED NOT NULL;
UPDATE zone_points SET target_zone_id=39 WHERE target_zone='hole';
UPDATE zone_points SET target_zone_id=75 WHERE target_zone='paineel';
UPDATE zone_points SET target_zone_id=100 WHERE target_zone='stonebrunt';
UPDATE zone_points SET target_zone_id=101 WHERE target_zone='warrens';
UPDATE zone_points SET target_zone_id=109 WHERE target_zone='veksar';
UPDATE zone_points SET target_zone_id=181 WHERE target_zone='jaggedpine';
UPDATE zone_points SET target_zone_id=1 WHERE target_zone='qeynos';
UPDATE zone_points SET target_zone_id=2 WHERE target_zone='qeynos2';
UPDATE zone_points SET target_zone_id=3 WHERE target_zone='qrg';
UPDATE zone_points SET target_zone_id=4 WHERE target_zone='qeytoqrg';
UPDATE zone_points SET target_zone_id=5 WHERE target_zone='highpass';
UPDATE zone_points SET target_zone_id=6 WHERE target_zone='highkeep';
UPDATE zone_points SET target_zone_id=8 WHERE target_zone='freportn';
UPDATE zone_points SET target_zone_id=9 WHERE target_zone='freportw';
UPDATE zone_points SET target_zone_id=10 WHERE target_zone='freporte';
UPDATE zone_points SET target_zone_id=11 WHERE target_zone='runnyeye';
UPDATE zone_points SET target_zone_id=12 WHERE target_zone='qey2hh1';
UPDATE zone_points SET target_zone_id=13 WHERE target_zone='northkarana';
UPDATE zone_points SET target_zone_id=14 WHERE target_zone='southkarana';
UPDATE zone_points SET target_zone_id=15 WHERE target_zone='eastkarana';
UPDATE zone_points SET target_zone_id=16 WHERE target_zone='beholder';
UPDATE zone_points SET target_zone_id=17 WHERE target_zone='blackburrow';
UPDATE zone_points SET target_zone_id=18 WHERE target_zone='paw';
UPDATE zone_points SET target_zone_id=19 WHERE target_zone='rivervale';
UPDATE zone_points SET target_zone_id=20 WHERE target_zone='kithicor';
UPDATE zone_points SET target_zone_id=21 WHERE target_zone='commons';
UPDATE zone_points SET target_zone_id=22 WHERE target_zone='ecommons';
UPDATE zone_points SET target_zone_id=23 WHERE target_zone='erudnint';
UPDATE zone_points SET target_zone_id=24 WHERE target_zone='erudnext';
UPDATE zone_points SET target_zone_id=25 WHERE target_zone='nektulos';
UPDATE zone_points SET target_zone_id=26 WHERE target_zone='cshome';
UPDATE zone_points SET target_zone_id=27 WHERE target_zone='lavastorm';
UPDATE zone_points SET target_zone_id=29 WHERE target_zone='halas';
UPDATE zone_points SET target_zone_id=30 WHERE target_zone='everfrost';
UPDATE zone_points SET target_zone_id=31 WHERE target_zone='soldunga';
UPDATE zone_points SET target_zone_id=32 WHERE target_zone='soldungb';
UPDATE zone_points SET target_zone_id=33 WHERE target_zone='misty';
UPDATE zone_points SET target_zone_id=34 WHERE target_zone='nro';
UPDATE zone_points SET target_zone_id=35 WHERE target_zone='sro';
UPDATE zone_points SET target_zone_id=36 WHERE target_zone='befallen';
UPDATE zone_points SET target_zone_id=37 WHERE target_zone='oasis';
UPDATE zone_points SET target_zone_id=38 WHERE target_zone='tox';
UPDATE zone_points SET target_zone_id=40 WHERE target_zone='neriaka';
UPDATE zone_points SET target_zone_id=41 WHERE target_zone='neriakb';
UPDATE zone_points SET target_zone_id=42 WHERE target_zone='neriakc';
UPDATE zone_points SET target_zone_id=44 WHERE target_zone='najena';
UPDATE zone_points SET target_zone_id=46 WHERE target_zone='innothule';
UPDATE zone_points SET target_zone_id=47 WHERE target_zone='feerrott';
UPDATE zone_points SET target_zone_id=48 WHERE target_zone='cazicthule';
UPDATE zone_points SET target_zone_id=49 WHERE target_zone='oggok';
UPDATE zone_points SET target_zone_id=50 WHERE target_zone='rathemtn';
UPDATE zone_points SET target_zone_id=51 WHERE target_zone='lakerathe';
UPDATE zone_points SET target_zone_id=52 WHERE target_zone='gukta';
UPDATE zone_points SET target_zone_id=54 WHERE target_zone='gfaydark';
UPDATE zone_points SET target_zone_id=55 WHERE target_zone='akanon';
UPDATE zone_points SET target_zone_id=56 WHERE target_zone='steamfont';
UPDATE zone_points SET target_zone_id=57 WHERE target_zone='lfaydark';
UPDATE zone_points SET target_zone_id=58 WHERE target_zone='crushbone';
UPDATE zone_points SET target_zone_id=59 WHERE target_zone='mistmoore';
UPDATE zone_points SET target_zone_id=60 WHERE target_zone='kaladima';
UPDATE zone_points SET target_zone_id=61 WHERE target_zone='felwithea';
UPDATE zone_points SET target_zone_id=62 WHERE target_zone='felwitheb';
UPDATE zone_points SET target_zone_id=63 WHERE target_zone='unrest';
UPDATE zone_points SET target_zone_id=64 WHERE target_zone='kedge';
UPDATE zone_points SET target_zone_id=65 WHERE target_zone='guktop';
UPDATE zone_points SET target_zone_id=66 WHERE target_zone='gukbottom';
UPDATE zone_points SET target_zone_id=67 WHERE target_zone='kaladimb';
UPDATE zone_points SET target_zone_id=68 WHERE target_zone='butcher';
UPDATE zone_points SET target_zone_id=69 WHERE target_zone='oot';
UPDATE zone_points SET target_zone_id=70 WHERE target_zone='cauldron';
UPDATE zone_points SET target_zone_id=71 WHERE target_zone='airplane';
UPDATE zone_points SET target_zone_id=72 WHERE target_zone='fearplane';
UPDATE zone_points SET target_zone_id=73 WHERE target_zone='permafrost';
UPDATE zone_points SET target_zone_id=74 WHERE target_zone='kerraridge';
UPDATE zone_points SET target_zone_id=76 WHERE target_zone='hateplane';
UPDATE zone_points SET target_zone_id=77 WHERE target_zone='arena';
UPDATE zone_points SET target_zone_id=180 WHERE target_zone='arena2';
UPDATE zone_points SET target_zone_id=98 WHERE target_zone='erudsxing';
UPDATE zone_points SET target_zone_id=45 WHERE target_zone='qcat';
UPDATE zone_points SET target_zone_id=78 WHERE target_zone='fieldofbone';
UPDATE zone_points SET target_zone_id=79 WHERE target_zone='warslikswood';
UPDATE zone_points SET target_zone_id=80 WHERE target_zone='soltemple';
UPDATE zone_points SET target_zone_id=81 WHERE target_zone='droga';
UPDATE zone_points SET target_zone_id=82 WHERE target_zone='cabwest';
UPDATE zone_points SET target_zone_id=83 WHERE target_zone='swampofnohope';
UPDATE zone_points SET target_zone_id=84 WHERE target_zone='firiona';
UPDATE zone_points SET target_zone_id=85 WHERE target_zone='lakeofillomen';
UPDATE zone_points SET target_zone_id=86 WHERE target_zone='dreadlands';
UPDATE zone_points SET target_zone_id=87 WHERE target_zone='burningwood';
UPDATE zone_points SET target_zone_id=88 WHERE target_zone='kaesora';
UPDATE zone_points SET target_zone_id=89 WHERE target_zone='sebilis';
UPDATE zone_points SET target_zone_id=90 WHERE target_zone='citymist';
UPDATE zone_points SET target_zone_id=91 WHERE target_zone='skyfire';
UPDATE zone_points SET target_zone_id=92 WHERE target_zone='frontiermtns';
UPDATE zone_points SET target_zone_id=93 WHERE target_zone='overthere';
UPDATE zone_points SET target_zone_id=94 WHERE target_zone='emeraldjungle';
UPDATE zone_points SET target_zone_id=95 WHERE target_zone='trakanon';
UPDATE zone_points SET target_zone_id=96 WHERE target_zone='timorous';
UPDATE zone_points SET target_zone_id=97 WHERE target_zone='kurn';
UPDATE zone_points SET target_zone_id=102 WHERE target_zone='karnor';
UPDATE zone_points SET target_zone_id=103 WHERE target_zone='chardok';
UPDATE zone_points SET target_zone_id=104 WHERE target_zone='dalnir';
UPDATE zone_points SET target_zone_id=105 WHERE target_zone='charasis';
UPDATE zone_points SET target_zone_id=106 WHERE target_zone='cabeast';
UPDATE zone_points SET target_zone_id=107 WHERE target_zone='nurga';
UPDATE zone_points SET target_zone_id=108 WHERE target_zone='veeshan';
UPDATE zone_points SET target_zone_id=186 WHERE target_zone='hateplaneb';
UPDATE zone_points SET target_zone_id=188 WHERE target_zone='tutoriala';
UPDATE zone_points SET target_zone_id=189 WHERE target_zone='tutorialb';
UPDATE zone_points SET target_zone_id=110 WHERE target_zone='iceclad';
UPDATE zone_points SET target_zone_id=111 WHERE target_zone='frozenshadow';
UPDATE zone_points SET target_zone_id=112 WHERE target_zone='velketor';
UPDATE zone_points SET target_zone_id=113 WHERE target_zone='kael';
UPDATE zone_points SET target_zone_id=114 WHERE target_zone='skyshrine';
UPDATE zone_points SET target_zone_id=115 WHERE target_zone='thurgadina';
UPDATE zone_points SET target_zone_id=116 WHERE target_zone='eastwastes';
UPDATE zone_points SET target_zone_id=117 WHERE target_zone='cobaltscar';
UPDATE zone_points SET target_zone_id=118 WHERE target_zone='greatdivide';
UPDATE zone_points SET target_zone_id=119 WHERE target_zone='wakening';
UPDATE zone_points SET target_zone_id=120 WHERE target_zone='westwastes';
UPDATE zone_points SET target_zone_id=121 WHERE target_zone='crystal';
UPDATE zone_points SET target_zone_id=123 WHERE target_zone='necropolis';
UPDATE zone_points SET target_zone_id=124 WHERE target_zone='templeveeshan';
UPDATE zone_points SET target_zone_id=125 WHERE target_zone='sirens';
UPDATE zone_points SET target_zone_id=126 WHERE target_zone='mischiefplane';
UPDATE zone_points SET target_zone_id=127 WHERE target_zone='growthplane';
UPDATE zone_points SET target_zone_id=128 WHERE target_zone='sleeper';
UPDATE zone_points SET target_zone_id=129 WHERE target_zone='thurgadinb';
UPDATE zone_points SET target_zone_id=183 WHERE target_zone='tutorial';
UPDATE zone_points SET target_zone_id=184 WHERE target_zone='load';
UPDATE zone_points SET target_zone_id=185 WHERE target_zone='load2';
UPDATE zone_points SET target_zone_id=150 WHERE target_zone='Shadowhaven';
UPDATE zone_points SET target_zone_id=151 WHERE target_zone='Bazaar';
UPDATE zone_points SET target_zone_id=152 WHERE target_zone='Nexus';
UPDATE zone_points SET target_zone_id=153 WHERE target_zone='echo';
UPDATE zone_points SET target_zone_id=154 WHERE target_zone='acrylia';
UPDATE zone_points SET target_zone_id=155 WHERE target_zone='sharvahl';
UPDATE zone_points SET target_zone_id=156 WHERE target_zone='paludal';
UPDATE zone_points SET target_zone_id=157 WHERE target_zone='fungusgrove';
UPDATE zone_points SET target_zone_id=158 WHERE target_zone='vexthal';
UPDATE zone_points SET target_zone_id=159 WHERE target_zone='sseru';
UPDATE zone_points SET target_zone_id=160 WHERE target_zone='katta';
UPDATE zone_points SET target_zone_id=161 WHERE target_zone='netherbian';
UPDATE zone_points SET target_zone_id=162 WHERE target_zone='ssratemple';
UPDATE zone_points SET target_zone_id=163 WHERE target_zone='griegsend';
UPDATE zone_points SET target_zone_id=164 WHERE target_zone='thedeep';
UPDATE zone_points SET target_zone_id=165 WHERE target_zone='shadeweaver';
UPDATE zone_points SET target_zone_id=166 WHERE target_zone='hollowshade';
UPDATE zone_points SET target_zone_id=167 WHERE target_zone='grimling';
UPDATE zone_points SET target_zone_id=168 WHERE target_zone='mseru';
UPDATE zone_points SET target_zone_id=169 WHERE target_zone='letalis';
UPDATE zone_points SET target_zone_id=170 WHERE target_zone='twilight';
UPDATE zone_points SET target_zone_id=171 WHERE target_zone='thegrey';
UPDATE zone_points SET target_zone_id=172 WHERE target_zone='tenebrous';
UPDATE zone_points SET target_zone_id=173 WHERE target_zone='maiden';
UPDATE zone_points SET target_zone_id=174 WHERE target_zone='dawnshroud';
UPDATE zone_points SET target_zone_id=175 WHERE target_zone='scarlet';
UPDATE zone_points SET target_zone_id=176 WHERE target_zone='umbral';
UPDATE zone_points SET target_zone_id=179 WHERE target_zone='akheva';
UPDATE zone_points SET target_zone_id=995 WHERE target_zone='arttest';
UPDATE zone_points SET target_zone_id=200 WHERE target_zone='codecay';
UPDATE zone_points SET target_zone_id=201 WHERE target_zone='pojustice';
UPDATE zone_points SET target_zone_id=202 WHERE target_zone='poknowledge';
UPDATE zone_points SET target_zone_id=203 WHERE target_zone='potranquility';
UPDATE zone_points SET target_zone_id=204 WHERE target_zone='ponightmare';
UPDATE zone_points SET target_zone_id=205 WHERE target_zone='podisease';
UPDATE zone_points SET target_zone_id=206 WHERE target_zone='poinnovation';
UPDATE zone_points SET target_zone_id=207 WHERE target_zone='potorment';
UPDATE zone_points SET target_zone_id=208 WHERE target_zone='povalor';
UPDATE zone_points SET target_zone_id=209 WHERE target_zone='bothunder';
UPDATE zone_points SET target_zone_id=210 WHERE target_zone='postorms';
UPDATE zone_points SET target_zone_id=211 WHERE target_zone='hohonora';
UPDATE zone_points SET target_zone_id=212 WHERE target_zone='solrotower';
UPDATE zone_points SET target_zone_id=213 WHERE target_zone='powar';
UPDATE zone_points SET target_zone_id=214 WHERE target_zone='potactics';
UPDATE zone_points SET target_zone_id=215 WHERE target_zone='poair';
UPDATE zone_points SET target_zone_id=216 WHERE target_zone='powater';
UPDATE zone_points SET target_zone_id=217 WHERE target_zone='pofire';
UPDATE zone_points SET target_zone_id=218 WHERE target_zone='poeartha';
UPDATE zone_points SET target_zone_id=219 WHERE target_zone='potimea';
UPDATE zone_points SET target_zone_id=220 WHERE target_zone='hohonorb';
UPDATE zone_points SET target_zone_id=221 WHERE target_zone='nightmareb';
UPDATE zone_points SET target_zone_id=222 WHERE target_zone='poearthb';
UPDATE zone_points SET target_zone_id=223 WHERE target_zone='potimeb';
UPDATE zone_points SET target_zone_id=224 WHERE target_zone='gunthak';
UPDATE zone_points SET target_zone_id=225 WHERE target_zone='dulak';
UPDATE zone_points SET target_zone_id=226 WHERE target_zone='torgiran';
UPDATE zone_points SET target_zone_id=227 WHERE target_zone='nadox';
UPDATE zone_points SET target_zone_id=228 WHERE target_zone='hatesfury';
UPDATE zone_points SET target_zone_id=277 WHERE target_zone='chardokb';
UPDATE zone_points SET target_zone_id=278 WHERE target_zone='soldungc';
UPDATE zone_points SET target_zone_id=229 WHERE target_zone='guka';
UPDATE zone_points SET target_zone_id=234 WHERE target_zone='gukb';
UPDATE zone_points SET target_zone_id=239 WHERE target_zone='gukc';
UPDATE zone_points SET target_zone_id=244 WHERE target_zone='gukd';
UPDATE zone_points SET target_zone_id=249 WHERE target_zone='guke';
UPDATE zone_points SET target_zone_id=254 WHERE target_zone='gukf';
UPDATE zone_points SET target_zone_id=259 WHERE target_zone='gukg';
UPDATE zone_points SET target_zone_id=264 WHERE target_zone='gukh';
UPDATE zone_points SET target_zone_id=232 WHERE target_zone='mira';
UPDATE zone_points SET target_zone_id=237 WHERE target_zone='mirb';
UPDATE zone_points SET target_zone_id=242 WHERE target_zone='mirc';
UPDATE zone_points SET target_zone_id=247 WHERE target_zone='mird';
UPDATE zone_points SET target_zone_id=252 WHERE target_zone='mire';
UPDATE zone_points SET target_zone_id=257 WHERE target_zone='mirf';
UPDATE zone_points SET target_zone_id=262 WHERE target_zone='mirg';
UPDATE zone_points SET target_zone_id=267 WHERE target_zone='mirh';
UPDATE zone_points SET target_zone_id=271 WHERE target_zone='miri';
UPDATE zone_points SET target_zone_id=275 WHERE target_zone='mirj';
UPDATE zone_points SET target_zone_id=233 WHERE target_zone='mmca';
UPDATE zone_points SET target_zone_id=238 WHERE target_zone='mmcb';
UPDATE zone_points SET target_zone_id=243 WHERE target_zone='mmcc';
UPDATE zone_points SET target_zone_id=248 WHERE target_zone='mmcd';
UPDATE zone_points SET target_zone_id=253 WHERE target_zone='mmce';
UPDATE zone_points SET target_zone_id=258 WHERE target_zone='mmcf';
UPDATE zone_points SET target_zone_id=263 WHERE target_zone='mmcg';
UPDATE zone_points SET target_zone_id=268 WHERE target_zone='mmch';
UPDATE zone_points SET target_zone_id=272 WHERE target_zone='mmci';
UPDATE zone_points SET target_zone_id=276 WHERE target_zone='mmcj';
UPDATE zone_points SET target_zone_id=230 WHERE target_zone='ruja';
UPDATE zone_points SET target_zone_id=235 WHERE target_zone='rujb';
UPDATE zone_points SET target_zone_id=240 WHERE target_zone='rujc';
UPDATE zone_points SET target_zone_id=245 WHERE target_zone='rujd';
UPDATE zone_points SET target_zone_id=250 WHERE target_zone='ruje';
UPDATE zone_points SET target_zone_id=255 WHERE target_zone='rujf';
UPDATE zone_points SET target_zone_id=260 WHERE target_zone='rujg';
UPDATE zone_points SET target_zone_id=265 WHERE target_zone='rujh';
UPDATE zone_points SET target_zone_id=269 WHERE target_zone='ruji';
UPDATE zone_points SET target_zone_id=273 WHERE target_zone='rujj';
UPDATE zone_points SET target_zone_id=231 WHERE target_zone='taka';
UPDATE zone_points SET target_zone_id=236 WHERE target_zone='takb';
UPDATE zone_points SET target_zone_id=241 WHERE target_zone='takc';
UPDATE zone_points SET target_zone_id=246 WHERE target_zone='takd';
UPDATE zone_points SET target_zone_id=251 WHERE target_zone='take';
UPDATE zone_points SET target_zone_id=256 WHERE target_zone='takf';
UPDATE zone_points SET target_zone_id=261 WHERE target_zone='takg';
UPDATE zone_points SET target_zone_id=266 WHERE target_zone='takh';
UPDATE zone_points SET target_zone_id=270 WHERE target_zone='taki';
UPDATE zone_points SET target_zone_id=274 WHERE target_zone='takj';
UPDATE zone_points SET target_zone_id=187 WHERE target_zone='shadowrest';
UPDATE zone_points SET target_zone_id=279 WHERE target_zone='abysmal';
UPDATE zone_points SET target_zone_id=280 WHERE target_zone='natimbi';
UPDATE zone_points SET target_zone_id=281 WHERE target_zone='qinimi';
UPDATE zone_points SET target_zone_id=282 WHERE target_zone='riwwi';
UPDATE zone_points SET target_zone_id=283 WHERE target_zone='barindu';
UPDATE zone_points SET target_zone_id=284 WHERE target_zone='ferubi';
UPDATE zone_points SET target_zone_id=285 WHERE target_zone='snpool';
UPDATE zone_points SET target_zone_id=286 WHERE target_zone='snlair';
UPDATE zone_points SET target_zone_id=287 WHERE target_zone='snplant';
UPDATE zone_points SET target_zone_id=288 WHERE target_zone='sncrematory';
UPDATE zone_points SET target_zone_id=289 WHERE target_zone='tipt';
UPDATE zone_points SET target_zone_id=290 WHERE target_zone='vxed';
UPDATE zone_points SET target_zone_id=291 WHERE target_zone='yxtta';
UPDATE zone_points SET target_zone_id=292 WHERE target_zone='uqua';
UPDATE zone_points SET target_zone_id=293 WHERE target_zone='kodtaz';
UPDATE zone_points SET target_zone_id=294 WHERE target_zone='ikkinz';
UPDATE zone_points SET target_zone_id=295 WHERE target_zone='inktuta';
UPDATE zone_points SET target_zone_id=296 WHERE target_zone='txevu';
UPDATE zone_points SET target_zone_id=297 WHERE target_zone='tacvi';
UPDATE zone_points SET target_zone_id=298 WHERE target_zone='qvic';
UPDATE zone_points SET target_zone_id=299 WHERE target_zone='qvicb';
UPDATE zone_points SET target_zone_id=182 WHERE target_zone='nedaria';
UPDATE zone_points SET target_zone_id=300 WHERE target_zone='wallofslaughter';
UPDATE zone_points SET target_zone_id=301 WHERE target_zone='bloodfields';
UPDATE zone_points SET target_zone_id=302 WHERE target_zone='draniksscar';
UPDATE zone_points SET target_zone_id=303 WHERE target_zone='causeway';
UPDATE zone_points SET target_zone_id=304 WHERE target_zone='chambersa';
UPDATE zone_points SET target_zone_id=305 WHERE target_zone='chambersb';
UPDATE zone_points SET target_zone_id=306 WHERE target_zone='chambersc';
UPDATE zone_points SET target_zone_id=307 WHERE target_zone='chambersd';
UPDATE zone_points SET target_zone_id=308 WHERE target_zone='chamberse';
UPDATE zone_points SET target_zone_id=309 WHERE target_zone='chambersf';
UPDATE zone_points SET target_zone_id=316 WHERE target_zone='provinggrounds';
UPDATE zone_points SET target_zone_id=317 WHERE target_zone='anguish';
UPDATE zone_points SET target_zone_id=318 WHERE target_zone='dranikhollowsa';
UPDATE zone_points SET target_zone_id=319 WHERE target_zone='dranikhollowsb';
UPDATE zone_points SET target_zone_id=320 WHERE target_zone='dranikhollowsc';
UPDATE zone_points SET target_zone_id=328 WHERE target_zone='dranikcatacombsa';
UPDATE zone_points SET target_zone_id=329 WHERE target_zone='dranikcatacombsb';
UPDATE zone_points SET target_zone_id=330 WHERE target_zone='dranikcatacombsc';
UPDATE zone_points SET target_zone_id=331 WHERE target_zone='draniksewersa';
UPDATE zone_points SET target_zone_id=332 WHERE target_zone='draniksewersb';
UPDATE zone_points SET target_zone_id=333 WHERE target_zone='draniksewersc';
UPDATE zone_points SET target_zone_id=334 WHERE target_zone='riftseekers';
UPDATE zone_points SET target_zone_id=335 WHERE target_zone='harbingers';
UPDATE zone_points SET target_zone_id=336 WHERE target_zone='dranik';
ALTER TABLE zone_points DROP target_zone;
ALTER TABLE account ADD hideme TINYINT NOT NULL DEFAULT 0;
ALTER TABLE `character_` ADD `extprofile` BLOB NOT NULL;
+254
View File
@@ -0,0 +1,254 @@
ALTER TABLE `zone` ADD `underworld` FLOAT DEFAULT "0" NOT NULL;
ALTER TABLE `zone` ADD `minclip` FLOAT DEFAULT "450" NOT NULL;
ALTER TABLE `zone` ADD `maxclip` FLOAT DEFAULT "450" NOT NULL;
ALTER TABLE `zone` ADD `fog_minclip` FLOAT DEFAULT "450" NOT NULL;
ALTER TABLE `zone` ADD `fog_maxclip` FLOAT DEFAULT "450" NOT NULL;
ALTER TABLE `zone` ADD `fog_blue` TINYINT(3) UNSIGNED DEFAULT "0" NOT NULL;
ALTER TABLE `zone` ADD `fog_red` TINYINT(3) UNSIGNED DEFAULT "0" NOT NULL;
ALTER TABLE `zone` ADD `fog_green` TINYINT(3) UNSIGNED DEFAULT "0" NOT NULL;
ALTER TABLE `zone` ADD `sky` TINYINT(3) UNSIGNED DEFAULT "1" NOT NULL;
ALTER TABLE `zone` ADD `ztype` TINYINT(3) UNSIGNED DEFAULT "1" NOT NULL;
ALTER TABLE `zone` ADD `zone_exp_multiplier` FLOAT DEFAULT "1" NOT NULL;
ALTER TABLE `zone` ADD `walkspeed` FLOAT DEFAULT ".4" NOT NULL;
ALTER TABLE `zone` ADD `time_type` TINYINT(3) UNSIGNED DEFAULT "2" NOT NULL;
update zone set underworld=-320,minclip=450,maxclip=450,fog_minclip=10,fog_maxclip=450,fog_blue=210,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=1;
update zone set underworld=-404,minclip=450,maxclip=1000,fog_minclip=10,fog_maxclip=450,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=2;
update zone set underworld=-58,minclip=450,maxclip=450,fog_minclip=10,fog_maxclip=450,fog_blue=183,fog_red=180,fog_green=175,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=3;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=4;
update zone set underworld=-60,minclip=400,maxclip=400,fog_minclip=10,fog_maxclip=400,fog_blue=200,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.8,walkspeed=0.4,time_type=2 where zoneidnumber=5;
update zone set underworld=-94,minclip=600,maxclip=600,fog_minclip=0,fog_maxclip=0,fog_blue=0,fog_red=0,fog_green=0,sky=1,ztype=0,zone_exp_multiplier=1.5,walkspeed=0.4,time_type=2 where zoneidnumber=6;
update zone set underworld=-54,minclip=450,maxclip=450,fog_minclip=10,fog_maxclip=450,fog_blue=200,fog_red=230,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=8;
update zone set underworld=-126,minclip=450,maxclip=450,fog_minclip=10,fog_maxclip=450,fog_blue=200,fog_red=230,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=1,walkspeed=0.4,time_type=2 where zoneidnumber=9;
update zone set underworld=-298,minclip=450,maxclip=450,fog_minclip=10,fog_maxclip=450,fog_blue=200,fog_red=230,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=10;
update zone set underworld=-192,minclip=600,maxclip=600,fog_minclip=10,fog_maxclip=600,fog_blue=25,fog_red=75,fog_green=150,sky=1,ztype=1,zone_exp_multiplier=1,walkspeed=0.4,time_type=2 where zoneidnumber=11;
update zone set underworld=-131,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=12;
update zone set underworld=-214,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=13;
update zone set underworld=-292,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=14;
update zone set underworld=-250,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=15;
update zone set underworld=-105,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=600,fog_blue=150,fog_red=240,fog_green=180,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=16;
update zone set underworld=-252,minclip=700,maxclip=700,fog_minclip=10,fog_maxclip=700,fog_blue=90,fog_red=50,fog_green=100,sky=1,ztype=0,zone_exp_multiplier=1,walkspeed=0.4,time_type=2 where zoneidnumber=17;
update zone set underworld=-96,minclip=180,maxclip=180,fog_minclip=10,fog_maxclip=180,fog_blue=10,fog_red=30,fog_green=25,sky=0,ztype=255,zone_exp_multiplier=0.9,walkspeed=0.4,time_type=2 where zoneidnumber=18;
update zone set underworld=-72,minclip=400,maxclip=400,fog_minclip=10,fog_maxclip=400,fog_blue=200,fog_red=200,fog_green=210,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=19;
update zone set underworld=-231,minclip=150,maxclip=250,fog_minclip=10,fog_maxclip=200,fog_blue=100,fog_red=120,fog_green=140,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=20;
update zone set underworld=-295,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=21;
update zone set underworld=-171,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=22;
update zone set underworld=-48,minclip=600,maxclip=600,fog_minclip=0,fog_maxclip=0,fog_blue=0,fog_red=0,fog_green=0,sky=4,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=23;
update zone set underworld=-84,minclip=550,maxclip=550,fog_minclip=10,fog_maxclip=550,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=24;
update zone set underworld=-189,minclip=200,maxclip=275,fog_minclip=10,fog_maxclip=250,fog_blue=70,fog_red=80,fog_green=90,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=25;
update zone set underworld=-84,minclip=550,maxclip=550,fog_minclip=10,fog_maxclip=550,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=26;
update zone set underworld=-368,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=10,fog_red=255,fog_green=50,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=27;
update zone set underworld=-162,minclip=300,maxclip=300,fog_minclip=10,fog_maxclip=300,fog_blue=255,fog_red=200,fog_green=230,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=29;
update zone set underworld=-374,minclip=300,maxclip=600,fog_minclip=10,fog_maxclip=500,fog_blue=255,fog_red=200,fog_green=230,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=30;
update zone set underworld=-48,minclip=100,maxclip=100,fog_minclip=10,fog_maxclip=100,fog_blue=30,fog_red=180,fog_green=30,sky=0,ztype=255,zone_exp_multiplier=1.3,walkspeed=0.4,time_type=2 where zoneidnumber=31;
update zone set underworld=-148,minclip=350,maxclip=350,fog_minclip=10,fog_maxclip=350,fog_blue=30,fog_red=180,fog_green=30,sky=1,ztype=255,zone_exp_multiplier=0.8,walkspeed=0.4,time_type=2 where zoneidnumber=32;
update zone set underworld=-126,minclip=450,maxclip=550,fog_minclip=10,fog_maxclip=500,fog_blue=50,fog_red=100,fog_green=120,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=33;
update zone set underworld=-101,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=180,fog_red=250,fog_green=250,sky=2,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=34;
update zone set underworld=-120,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=180,fog_red=250,fog_green=250,sky=2,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=35;
update zone set underworld=-100,minclip=175,maxclip=175,fog_minclip=10,fog_maxclip=175,fog_blue=90,fog_red=30,fog_green=30,sky=0,ztype=0,zone_exp_multiplier=1.6,walkspeed=0.4,time_type=2 where zoneidnumber=36;
update zone set underworld=-240,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=180,fog_red=250,fog_green=250,sky=2,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=37;
update zone set underworld=-231,minclip=200,maxclip=300,fog_minclip=50,fog_maxclip=250,fog_blue=30,fog_red=220,fog_green=200,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=38;
update zone set underworld=-1300,minclip=300,maxclip=600,fog_minclip=200,fog_maxclip=500,fog_blue=10,fog_red=10,fog_green=10,sky=0,ztype=0,zone_exp_multiplier=1,walkspeed=0.4,time_type=2 where zoneidnumber=39;
update zone set underworld=-26,minclip=250,maxclip=250,fog_minclip=10,fog_maxclip=250,fog_blue=60,fog_red=10,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=40;
update zone set underworld=-101,minclip=250,maxclip=250,fog_minclip=10,fog_maxclip=250,fog_blue=60,fog_red=10,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=41;
update zone set underworld=-152,minclip=250,maxclip=250,fog_minclip=10,fog_maxclip=250,fog_blue=60,fog_red=10,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=42;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=43;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=28;
update zone set underworld=-66,minclip=110,maxclip=110,fog_minclip=10,fog_maxclip=110,fog_blue=40,fog_red=30,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=1.3,walkspeed=0.4,time_type=2 where zoneidnumber=44;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=45;
update zone set underworld=-85,minclip=400,maxclip=550,fog_minclip=10,fog_maxclip=500,fog_blue=90,fog_red=170,fog_green=160,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=46;
update zone set underworld=-192,minclip=150,maxclip=200,fog_minclip=10,fog_maxclip=175,fog_blue=30,fog_red=60,fog_green=90,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=47;
update zone set underworld=-332,minclip=450,maxclip=450,fog_minclip=10,fog_maxclip=450,fog_blue=20,fog_red=50,fog_green=80,sky=1,ztype=0,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=48;
update zone set underworld=-182,minclip=300,maxclip=300,fog_minclip=10,fog_maxclip=300,fog_blue=80,fog_red=130,fog_green=140,sky=0,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=49;
update zone set underworld=-230,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=50;
update zone set underworld=-454,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=51;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=52;
update zone set underworld=-90,minclip=250,maxclip=325,fog_minclip=10,fog_maxclip=300,fog_blue=200,fog_red=230,fog_green=255,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=54;
update zone set underworld=-614,minclip=600,maxclip=600,fog_minclip=10,fog_maxclip=600,fog_blue=30,fog_red=30,fog_green=60,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=55;
update zone set underworld=-222,minclip=600,maxclip=800,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=56;
update zone set underworld=-77,minclip=275,maxclip=325,fog_minclip=10,fog_maxclip=300,fog_blue=200,fog_red=230,fog_green=255,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=57;
update zone set underworld=-212,minclip=400,maxclip=400,fog_minclip=10,fog_maxclip=400,fog_blue=190,fog_red=90,fog_green=90,sky=1,ztype=0,zone_exp_multiplier=1.6,walkspeed=0.4,time_type=2 where zoneidnumber=58;
update zone set underworld=-292,minclip=250,maxclip=250,fog_minclip=10,fog_maxclip=250,fog_blue=90,fog_red=60,fog_green=30,sky=0,ztype=255,zone_exp_multiplier=0.9,walkspeed=0.4,time_type=2 where zoneidnumber=59;
update zone set underworld=-62,minclip=175,maxclip=175,fog_minclip=10,fog_maxclip=175,fog_blue=20,fog_red=70,fog_green=50,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=60;
update zone set underworld=-92,minclip=300,maxclip=300,fog_minclip=10,fog_maxclip=300,fog_blue=100,fog_red=100,fog_green=130,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=61;
update zone set underworld=-82,minclip=300,maxclip=300,fog_minclip=10,fog_maxclip=300,fog_blue=100,fog_red=100,fog_green=130,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=62;
update zone set underworld=-112,minclip=300,maxclip=300,fog_minclip=10,fog_maxclip=300,fog_blue=60,fog_red=40,fog_green=10,sky=0,ztype=1,zone_exp_multiplier=1.3,walkspeed=0.4,time_type=2 where zoneidnumber=63;
update zone set underworld=-364,minclip=600,maxclip=600,fog_minclip=0,fog_maxclip=0,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=0,zone_exp_multiplier=1,walkspeed=0.4,time_type=2 where zoneidnumber=64;
update zone set underworld=-180,minclip=140,maxclip=140,fog_minclip=10,fog_maxclip=140,fog_blue=20,fog_red=40,fog_green=45,sky=0,ztype=255,zone_exp_multiplier=1.5,walkspeed=0.4,time_type=2 where zoneidnumber=65;
update zone set underworld=-292,minclip=140,maxclip=140,fog_minclip=10,fog_maxclip=140,fog_blue=20,fog_red=50,fog_green=45,sky=0,ztype=255,zone_exp_multiplier=0.8,walkspeed=0.4,time_type=2 where zoneidnumber=66;
update zone set underworld=-112,minclip=175,maxclip=175,fog_minclip=10,fog_maxclip=175,fog_blue=20,fog_red=70,fog_green=50,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=67;
update zone set underworld=-32756,minclip=800,maxclip=1400,fog_minclip=10,fog_maxclip=1000,fog_blue=140,fog_red=150,fog_green=170,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=68;
update zone set underworld=-342,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=69;
update zone set underworld=-486,minclip=800,maxclip=1400,fog_minclip=10,fog_maxclip=1000,fog_blue=140,fog_red=100,fog_green=100,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=70;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=3,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=71;
update zone set underworld=-42,minclip=800,maxclip=1400,fog_minclip=10,fog_maxclip=1000,fog_blue=10,fog_red=255,fog_green=50,sky=5,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=72;
update zone set underworld=-120,minclip=180,maxclip=180,fog_minclip=10,fog_maxclip=180,fog_blue=45,fog_red=25,fog_green=35,sky=0,ztype=255,zone_exp_multiplier=0.9,walkspeed=0.4,time_type=2 where zoneidnumber=73;
update zone set underworld=-72,minclip=600,maxclip=600,fog_minclip=10,fog_maxclip=600,fog_blue=200,fog_red=220,fog_green=220,sky=1,ztype=0,zone_exp_multiplier=0.9,walkspeed=0.4,time_type=2 where zoneidnumber=74;
update zone set underworld=-320,minclip=400,maxclip=1000,fog_minclip=200,fog_maxclip=850,fog_blue=150,fog_red=150,fog_green=150,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=75;
update zone set underworld=-1000,minclip=200,maxclip=200,fog_minclip=30,fog_maxclip=200,fog_blue=128,fog_red=128,fog_green=128,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=76;
update zone set underworld=-454,minclip=1000,maxclip=1500,fog_minclip=10,fog_maxclip=1500,fog_blue=100,fog_red=100,fog_green=100,sky=1,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=77;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=180;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=53;
update zone set underworld=-370,minclip=300,maxclip=1400,fog_minclip=200,fog_maxclip=800,fog_blue=235,fog_red=235,fog_green=235,sky=1,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=78;
update zone set underworld=-500,minclip=300,maxclip=800,fog_minclip=60,fog_maxclip=600,fog_blue=210,fog_red=210,fog_green=235,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=79;
update zone set underworld=-85,minclip=500,maxclip=500,fog_minclip=50,fog_maxclip=500,fog_blue=5,fog_red=180,fog_green=5,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=80;
update zone set underworld=-400,minclip=300,maxclip=800,fog_minclip=100,fog_maxclip=300,fog_blue=0,fog_red=0,fog_green=15,sky=0,ztype=1,zone_exp_multiplier=0.95,walkspeed=0.4,time_type=2 where zoneidnumber=81;
update zone set underworld=-170,minclip=100,maxclip=300,fog_minclip=40,fog_maxclip=300,fog_blue=80,fog_red=150,fog_green=120,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=82;
update zone set underworld=-270,minclip=300,maxclip=1000,fog_minclip=60,fog_maxclip=400,fog_blue=210,fog_red=210,fog_green=200,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=83;
update zone set underworld=-350,minclip=300,maxclip=1800,fog_minclip=200,fog_maxclip=800,fog_blue=235,fog_red=235,fog_green=235,sky=4,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=84;
update zone set underworld=-1000,minclip=300,maxclip=1800,fog_minclip=200,fog_maxclip=800,fog_blue=235,fog_red=235,fog_green=235,sky=1,ztype=1,zone_exp_multiplier=0.6,walkspeed=0.4,time_type=2 where zoneidnumber=85;
update zone set underworld=-1000,minclip=300,maxclip=1800,fog_minclip=200,fog_maxclip=600,fog_blue=235,fog_red=235,fog_green=235,sky=4,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=86;
update zone set underworld=-776,minclip=300,maxclip=1200,fog_minclip=60,fog_maxclip=400,fog_blue=235,fog_red=235,fog_green=235,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=87;
update zone set underworld=-400,minclip=200,maxclip=800,fog_minclip=20,fog_maxclip=200,fog_blue=0,fog_red=0,fog_green=10,sky=0,ztype=255,zone_exp_multiplier=1.1,walkspeed=0.4,time_type=2 where zoneidnumber=88;
update zone set underworld=-300,minclip=100,maxclip=600,fog_minclip=50,fog_maxclip=400,fog_blue=60,fog_red=20,fog_green=10,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=89;
update zone set underworld=-130,minclip=200,maxclip=400,fog_minclip=50,fog_maxclip=275,fog_blue=60,fog_red=90,fog_green=110,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=90;
update zone set underworld=-430,minclip=100,maxclip=1800,fog_minclip=200,fog_maxclip=600,fog_blue=200,fog_red=235,fog_green=200,sky=2,ztype=1,zone_exp_multiplier=0.8,walkspeed=0.4,time_type=2 where zoneidnumber=91;
update zone set underworld=-777,minclip=300,maxclip=1800,fog_minclip=200,fog_maxclip=800,fog_blue=235,fog_red=235,fog_green=235,sky=4,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=92;
update zone set underworld=-762,minclip=300,maxclip=1800,fog_minclip=200,fog_maxclip=800,fog_blue=235,fog_red=235,fog_green=235,sky=1,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=93;
update zone set underworld=-605,minclip=100,maxclip=800,fog_minclip=60,fog_maxclip=200,fog_blue=210,fog_red=200,fog_green=235,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=94;
update zone set underworld=-648,minclip=100,maxclip=1000,fog_minclip=60,fog_maxclip=250,fog_blue=213,fog_red=210,fog_green=235,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=95;
update zone set underworld=-611,minclip=300,maxclip=1400,fog_minclip=100,fog_maxclip=700,fog_blue=230,fog_red=225,fog_green=225,sky=4,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=96;
update zone set underworld=-220,minclip=200,maxclip=800,fog_minclip=10,fog_maxclip=200,fog_blue=20,fog_red=50,fog_green=50,sky=0,ztype=1,zone_exp_multiplier=1.5,walkspeed=0.4,time_type=2 where zoneidnumber=97;
update zone set underworld=-350,minclip=600,maxclip=1400,fog_minclip=10,fog_maxclip=800,fog_blue=220,fog_red=200,fog_green=200,sky=1,ztype=0,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=98;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=130;
update zone set underworld=-1000,minclip=600,maxclip=1200,fog_minclip=10,fog_maxclip=800,fog_blue=235,fog_red=235,fog_green=235,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=100;
update zone set underworld=-10000,minclip=300,maxclip=800,fog_minclip=100,fog_maxclip=300,fog_blue=0,fog_red=0,fog_green=15,sky=0,ztype=1,zone_exp_multiplier=1.5,walkspeed=0.4,time_type=2 where zoneidnumber=101;
update zone set underworld=-272,minclip=100,maxclip=800,fog_minclip=10,fog_maxclip=350,fog_blue=20,fog_red=50,fog_green=20,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=102;
update zone set underworld=-405,minclip=100,maxclip=600,fog_minclip=30,fog_maxclip=300,fog_blue=6,fog_red=90,fog_green=53,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=103;
update zone set underworld=-210,minclip=210,maxclip=600,fog_minclip=30,fog_maxclip=210,fog_blue=25,fog_red=20,fog_green=10,sky=0,ztype=1,zone_exp_multiplier=0.95,walkspeed=0.4,time_type=2 where zoneidnumber=104;
update zone set underworld=-230,minclip=600,maxclip=1400,fog_minclip=50,fog_maxclip=400,fog_blue=200,fog_red=160,fog_green=180,sky=0,ztype=255,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=105;
update zone set underworld=-170,minclip=100,maxclip=300,fog_minclip=40,fog_maxclip=300,fog_blue=80,fog_red=150,fog_green=120,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=106;
update zone set underworld=-400,minclip=300,maxclip=800,fog_minclip=100,fog_maxclip=300,fog_blue=0,fog_red=0,fog_green=15,sky=0,ztype=1,zone_exp_multiplier=0.95,walkspeed=0.4,time_type=2 where zoneidnumber=107;
update zone set underworld=-220,minclip=1200,maxclip=1200,fog_minclip=100,fog_maxclip=1200,fog_blue=0,fog_red=20,fog_green=0,sky=2,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=108;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=109;
update zone set underworld=-250,minclip=800,maxclip=1800,fog_minclip=200,fog_maxclip=1800,fog_blue=200,fog_red=200,fog_green=200,sky=4,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=110;
update zone set underworld=-31,minclip=150,maxclip=350,fog_minclip=10,fog_maxclip=350,fog_blue=25,fog_red=25,fog_green=25,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=111;
update zone set underworld=-10000,minclip=300,maxclip=600,fog_minclip=10,fog_maxclip=500,fog_blue=130,fog_red=10,fog_green=130,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=112;
update zone set underworld=-2000,minclip=300,maxclip=600,fog_minclip=20,fog_maxclip=500,fog_blue=50,fog_red=10,fog_green=10,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=113;
update zone set underworld=-250,minclip=100,maxclip=600,fog_minclip=100,fog_maxclip=600,fog_blue=200,fog_red=50,fog_green=0,sky=1,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=114;
update zone set underworld=-150,minclip=300,maxclip=600,fog_minclip=100,fog_maxclip=300,fog_blue=25,fog_red=25,fog_green=25,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=115;
update zone set underworld=-950,minclip=1500,maxclip=1800,fog_minclip=200,fog_maxclip=1800,fog_blue=200,fog_red=200,fog_green=200,sky=4,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=116;
update zone set underworld=-110,minclip=1000,maxclip=1800,fog_minclip=200,fog_maxclip=1800,fog_blue=180,fog_red=180,fog_green=180,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=117;
update zone set underworld=-1061,minclip=800,maxclip=1800,fog_minclip=200,fog_maxclip=1800,fog_blue=172,fog_red=160,fog_green=160,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=118;
update zone set underworld=-300,minclip=300,maxclip=1200,fog_minclip=60,fog_maxclip=600,fog_blue=254,fog_red=254,fog_green=254,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=119;
update zone set underworld=-439,minclip=800,maxclip=1800,fog_minclip=200,fog_maxclip=1800,fog_blue=160,fog_red=128,fog_green=128,sky=4,ztype=1,zone_exp_multiplier=0.8,walkspeed=0.4,time_type=2 where zoneidnumber=120;
update zone set underworld=-1000,minclip=400,maxclip=800,fog_minclip=0,fog_maxclip=0,fog_blue=0,fog_red=0,fog_green=0,sky=255,ztype=0,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=121;
update zone set underworld=-355,minclip=1500,maxclip=2000,fog_minclip=10,fog_maxclip=2000,fog_blue=35,fog_red=35,fog_green=50,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=123;
update zone set underworld=-2500,minclip=100,maxclip=1200,fog_minclip=30,fog_maxclip=300,fog_blue=10,fog_red=60,fog_green=10,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=124;
update zone set underworld=-400,minclip=300,maxclip=600,fog_minclip=10,fog_maxclip=500,fog_blue=130,fog_red=30,fog_green=100,sky=0,ztype=0,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=125;
update zone set underworld=-10000,minclip=300,maxclip=800,fog_minclip=60,fog_maxclip=600,fog_blue=210,fog_red=210,fog_green=235,sky=0,ztype=1,zone_exp_multiplier=1,walkspeed=0.4,time_type=2 where zoneidnumber=126;
update zone set underworld=-1000,minclip=300,maxclip=1200,fog_minclip=60,fog_maxclip=1200,fog_blue=100,fog_red=0,fog_green=50,sky=0,ztype=1,zone_exp_multiplier=0.8,walkspeed=0.4,time_type=2 where zoneidnumber=127;
update zone set underworld=-1200,minclip=300,maxclip=800,fog_minclip=200,fog_maxclip=800,fog_blue=220,fog_red=80,fog_green=80,sky=0,ztype=1,zone_exp_multiplier=1,walkspeed=0.4,time_type=2 where zoneidnumber=128;
update zone set underworld=-160,minclip=300,maxclip=600,fog_minclip=100,fog_maxclip=300,fog_blue=25,fog_red=25,fog_green=25,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=129;
update zone set underworld=-510,minclip=100,maxclip=650,fog_minclip=200,fog_maxclip=600,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=150;
update zone set underworld=-200,minclip=100,maxclip=400,fog_minclip=200,fog_maxclip=400,fog_blue=50,fog_red=50,fog_green=50,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=151;
update zone set underworld=-510,minclip=100,maxclip=1000,fog_minclip=200,fog_maxclip=300,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=152;
update zone set underworld=-150,minclip=100,maxclip=400,fog_minclip=100,fog_maxclip=300,fog_blue=10,fog_red=10,fog_green=10,sky=0,ztype=1,zone_exp_multiplier=0.8,walkspeed=0.4,time_type=2 where zoneidnumber=153;
update zone set underworld=-450,minclip=100,maxclip=650,fog_minclip=450,fog_maxclip=600,fog_blue=50,fog_red=50,fog_green=50,sky=0,ztype=1,zone_exp_multiplier=0.9,walkspeed=0.4,time_type=2 where zoneidnumber=154;
update zone set underworld=-1000,minclip=100,maxclip=600,fog_minclip=10,fog_maxclip=600,fog_blue=5,fog_red=5,fog_green=5,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=155;
update zone set underworld=-10000,minclip=100,maxclip=700,fog_minclip=1,fog_maxclip=700,fog_blue=10,fog_red=10,fog_green=10,sky=0,ztype=1,zone_exp_multiplier=1.6,walkspeed=0.4,time_type=2 where zoneidnumber=156;
update zone set underworld=-10000,minclip=100,maxclip=600,fog_minclip=100,fog_maxclip=600,fog_blue=50,fog_red=25,fog_green=50,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=157;
update zone set underworld=-200,minclip=508,maxclip=800,fog_minclip=50,fog_maxclip=800,fog_blue=60,fog_red=90,fog_green=110,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=158;
update zone set underworld=-200,minclip=100,maxclip=800,fog_minclip=100,fog_maxclip=800,fog_blue=72,fog_red=72,fog_green=72,sky=9,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=159;
update zone set underworld=-6000,minclip=100,maxclip=800,fog_minclip=10,fog_maxclip=800,fog_blue=40,fog_red=100,fog_green=40,sky=7,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=160;
update zone set underworld=-500,minclip=100,maxclip=700,fog_minclip=1,fog_maxclip=700,fog_blue=10,fog_red=10,fog_green=10,sky=0,ztype=1,zone_exp_multiplier=0.8,walkspeed=0.4,time_type=2 where zoneidnumber=161;
update zone set underworld=-10000,minclip=100,maxclip=400,fog_minclip=10,fog_maxclip=400,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=1,zone_exp_multiplier=1,walkspeed=0.4,time_type=2 where zoneidnumber=162;
update zone set underworld=-1000,minclip=100,maxclip=1800,fog_minclip=100,fog_maxclip=1000,fog_blue=0,fog_red=0,fog_green=0,sky=8,ztype=1,zone_exp_multiplier=0.9,walkspeed=0.4,time_type=2 where zoneidnumber=163;
update zone set underworld=-10000,minclip=100,maxclip=1400,fog_minclip=100,fog_maxclip=1400,fog_blue=50,fog_red=50,fog_green=50,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=164;
update zone set underworld=-500,minclip=100,maxclip=1500,fog_minclip=200,fog_maxclip=1500,fog_blue=122,fog_red=11,fog_green=76,sky=7,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=165;
update zone set underworld=-600,minclip=100,maxclip=2000,fog_minclip=200,fog_maxclip=2000,fog_blue=40,fog_red=100,fog_green=110,sky=7,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=166;
update zone set underworld=-500,minclip=100,maxclip=1000,fog_minclip=100,fog_maxclip=1000,fog_blue=80,fog_red=70,fog_green=50,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=167;
update zone set underworld=-2000,minclip=100,maxclip=1000,fog_minclip=10,fog_maxclip=1000,fog_blue=255,fog_red=200,fog_green=230,sky=6,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=168;
update zone set underworld=-2000,minclip=100,maxclip=700,fog_minclip=10,fog_maxclip=700,fog_blue=255,fog_red=200,fog_green=230,sky=6,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=169;
update zone set underworld=-500,minclip=100,maxclip=1000,fog_minclip=200,fog_maxclip=1000,fog_blue=0,fog_red=0,fog_green=0,sky=7,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=170;
update zone set underworld=-500,minclip=100,maxclip=2000,fog_minclip=100,fog_maxclip=700,fog_blue=24,fog_red=24,fog_green=24,sky=9,ztype=1,zone_exp_multiplier=0.65,walkspeed=0.4,time_type=2 where zoneidnumber=171;
update zone set underworld=-150,minclip=100,maxclip=800,fog_minclip=10,fog_maxclip=800,fog_blue=65,fog_red=45,fog_green=4,sky=7,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=172;
update zone set underworld=-2000,minclip=100,maxclip=1000,fog_minclip=10,fog_maxclip=1000,fog_blue=255,fog_red=200,fog_green=230,sky=6,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=173;
update zone set underworld=-2000,minclip=100,maxclip=1000,fog_minclip=10,fog_maxclip=1000,fog_blue=255,fog_red=200,fog_green=230,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=174;
update zone set underworld=-10000,minclip=100,maxclip=700,fog_minclip=100,fog_maxclip=700,fog_blue=20,fog_red=220,fog_green=20,sky=0,ztype=1,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=175;
update zone set underworld=-1000,minclip=100,maxclip=700,fog_minclip=10,fog_maxclip=700,fog_blue=30,fog_red=30,fog_green=10,sky=7,ztype=1,zone_exp_multiplier=0.9,walkspeed=0.4,time_type=2 where zoneidnumber=176;
update zone set underworld=-510,minclip=100,maxclip=500,fog_minclip=200,fog_maxclip=500,fog_blue=1,fog_red=1,fog_green=1,sky=0,ztype=1,zone_exp_multiplier=0.85,walkspeed=0.4,time_type=2 where zoneidnumber=179;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=183;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=184;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=185;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=200;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=201;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=202;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=203;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=204;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=205;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=206;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=207;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=208;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=209;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=210;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=211;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=212;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=213;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=214;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=215;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=216;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=217;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=218;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=219;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=220;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=221;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=222;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=223;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=181;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=186;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=224;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=225;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=226;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=227;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=228;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=277;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=278;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=229;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=234;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=239;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=244;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=249;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=254;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=259;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=264;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=232;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=237;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=242;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=247;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=252;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=257;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=262;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=267;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=271;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=275;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=233;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=238;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=243;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=248;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=253;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=258;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=263;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=268;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=272;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=276;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=230;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=235;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=240;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=245;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=250;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=255;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=260;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=265;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=269;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=273;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=231;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=236;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=241;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=246;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=251;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=256;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=261;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=266;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=270;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=274;
update zone set underworld=-2030,minclip=1500,maxclip=2000,fog_minclip=500,fog_maxclip=2000,fog_blue=0,fog_red=0,fog_green=0,sky=0,ztype=255,zone_exp_multiplier=0.75,walkspeed=0.4,time_type=2 where zoneidnumber=995;
File diff suppressed because it is too large Load Diff
+591
View File
@@ -0,0 +1,591 @@
/*
Fear Pathing generation utility.
(c) 2005 Father Nitwit
Settings table:
CREATE TABLE fear_settings (
zone VARCHAR(16) NOT NULL PRIMARY KEY,
#general settings:
use_doors TINYINT NOT NULL DEFAULT 1,
min_fix_z FLOAT NOT NULL DEFAULT 20,
max_fear_distance FLOAT NOT NULL DEFAULT 250,
image_scale TINYINT NOT NULL DEFAULT 4,
#path related
check_initial_los TINYINT NOT NULL DEFAULT 0,
split_invalid_paths TINYINT NOT NULL DEFAULT 0,
link_path_endpoints TINYINT NOT NULL DEFAULT 1,
end_distance FLOAT NOT NULL DEFAULT 25,
split_long_min FLOAT NOT NULL DEFAULT 300,
split_long_step FLOAT NOT NULL DEFAULT 200,
#node combining settings:
same_dist FLOAT NOT NULL DEFAULT 2.5,
node_combine_dist FLOAT NOT NULL DEFAULT 30,
grid_combine_dist FLOAT NOT NULL DEFAULT 30,
close_all_los TINYINT NOT NULL DEFAULT 0,
#line-crossing reduction settings:
cross_count INT NOT NULL DEFAULT 5,
cross_min_length FLOAT NOT NULL DEFAULT 1,
cross_max_z_diff FLOAT NOT NULL DEFAULT 20,
cross_combine_dist FLOAT NOT NULL DEFAULT 120,
#linking:
second_link_dist FLOAT NOT NULL DEFAULT 100,
link_max_dist FLOAT NOT NULL DEFAULT 400,
link_count TINYINT NOT NULL DEFAULT 1
);
*/
#include "../common/types.h"
#include "../zone/map.h"
#include "../common/rdtsc.h"
#include "quadtree.h"
#include "apathing.h"
#include "boostcrap.h"
#include <stdio.h>
#include <mysql.h>
#include <stdlib.h>
#include <string.h>
#include <gd.h>
//parameters:
bool INCLUDE_DOORS = true;
float FEAR_MAXIMUM_DISTANCE = 250;
float ENDPOINT_CONNECT_MAX_DISTANCE = 25;
float MIN_FIX_Z = 20.0f;
float CLOSE_ENOUGH = 2.5;
bool COMBINE_CHECK_ALL_LOS = false;
float CLOSE_ENOUGH_COMBINE = 30; //30;
float SPAWN_MIN_SECOND_DIST = 100;
bool SPLIT_INVALID_PATHS = false;
bool LINK_PATH_ENDPOINTS = true;
float MAX_LINK_SPAWN_DIST = 400;
float FINAL_LINK_POINTS_DIST = 30;
bool SPAWN_LINK_TWICE = true;
bool SPAWN_LINK_THRICE = true;
float MERGE_MIN_SECOND_DIST = 30;
float SPLIT_LINE_LENGTH = 300;
float SPLIT_LINE_INTERVAL = 200;
float LONG_PATH_CHECK_LOS = 0; //0=disable
int CROSS_REDUCE_COUNT = 5;
float CROSS_MIN_LENGTH = 1;
float CROSS_MAX_Z_DIFF = 20;
float CLOSE_ENOUGH_CROSS = 120;
int IMAGE_SCALE = 4;
int main(int argc, char *argv[]) {
srand(2038833498);
/* const char *zone =
//"qeynos";
"qeynos2";
//"northkarana";
*/
if(argc != 2) {
printf("Usage: %s [zone_short_name]\n", argv[0]);
return(1);
}
const char *zone = argv[1];
char buf[256];
MYSQL m;
list<PathGraph *> db_paths;
list<PathNode *> db_spawns;
mysql_init(&m);
if(!mysql_real_connect(&m, DB_HOST, DB_LOGIN, DB_PASSWORD, DB_NAME, 0, NULL, 0)) {
printf("Unable to connect: %s.\n", mysql_error(&m));
return(1);
}
/*
Data loading phase
*/
//load up our map file
Map *map = Map::LoadMapfile(zone);
if(map == NULL) {
printf("Unable to load map file.");
return(1);
}
//try to load the EQ map file to make our pictures prettier
PathGraph eqmap;
if(load_eq_map(zone, &eqmap)) {
printf("Loaded EQ Client map: %d edges.\n", eqmap.edges.size());
} else {
printf("Unable to load EQ Client map, continuing without it.\n");
}
//load our crap from the DB...
if(!load_paths_from_db(&m, map, zone, db_paths, db_spawns))
return(1);
if(db_paths.size() == 0)
db_paths.push_back(new PathGraph());
if(!load_spawns_from_db(&m, zone, db_spawns))
return(1);
if(INCLUDE_DOORS) {
if(!load_doors_from_db(&m, zone, db_spawns))
return(1);
}
if(!load_hints_from_db(&m, zone, db_spawns))
return(1);
/*{
PathGraph *g;
PathNode *cur = NULL, *last = NULL;
g = new PathGraph();
g->nodes.push_back(cur = new PathNode(200, 200, 5));
last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(700, 200, 5)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(700, -300, 5)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(200, -300, 5)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(200, 200, 5)));
g->add_edge(last, cur); last = cur;
db_paths.push_back(g);
}*/
/*{
PathGraph *g;
PathNode *cur = NULL, *last = NULL;
g = new PathGraph();
g->nodes.push_back(cur = new PathNode(200, 200, 5));
last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(385, 35, 23)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(450, -50, 23)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(535, -115, 23)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(700, -300, 5)));
g->add_edge(last, cur); last = cur;
db_paths.push_back(g);
g = new PathGraph();
g->nodes.push_back(cur = new PathNode(700, 200, 5));
last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(535, 35, 23)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(450, -50, 23)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(385, -115, 23)));
g->add_edge(last, cur); last = cur;
g->nodes.push_back(cur = new PathNode(GPoint(200, -300, 5)));
g->add_edge(last, cur); last = cur;
db_paths.push_back(g);
}*/
//try to load settings, dont care if it fails
if(load_settings_from_db(&m, zone))
printf("Loaded zone settings from the database.\n");
else
printf("Unable to load settings from database. Using defaults.\n");
printf("Load: got %d paths and %d spawn points from the database.\n", db_paths.size(), db_spawns.size());
printf("Load: had to split up %d invalid paths.\n", load_split_paths);
/*
The make-the-db-suck-less phase
*/
//try to lower waypoints way in the sky:
repair_high_waypoints(map, db_paths, db_spawns);
printf("Fix Z: %d missed map, %d were not broken, %d were fixed.\n", z_no_map_count, z_not_fixed_count, z_fixed_count);
printf("Fix Z: broken avg diff=%.3f, not broken avg diff=%.3f\n", z_fixed_diffs/z_fixed_count, z_not_fixed_diffs/z_not_fixed_count);
//run a waypoint reduction algorithm in 3space:
reduce_waypoints(db_paths);
printf("WP Reduce: removed %d redundant waypoints.\n", wp_reduce_count);
/*
Graph connection and merging phase
*/
//make trivial connections of nodes at about the same spot on diff grids
combine_trivial_grids(map, db_paths);
printf("Trivial Merge: %d grids merged.\n", trivial_merge_count);
//now do the 'closest with LOS' connection method
combine_closest_grids(map, db_paths);
printf("Closest Merge: %d grids linked, %d grids double-linked.\n", closest_merge_count, closest_merge2_count);
PathGraph *big = db_paths.front();
//now add in the spawn points, and link to closest with LOS
link_spawns(map, big, db_spawns, MAX_LINK_SPAWN_DIST, NULL);
printf("Link Spawns: %d linked once, %d linked twice, %d not linked, %d invalid.\n", link_spawn_count, link_spawn2_count, link_spawn_nocount, link_spawn_invalid);
//combining close points might be causing small LOS obstacles...
//so we want to run this before we combine them.
//this seems to do more harm than good right now
// check_edge_los(map, big);
// printf("Bad Edges: removed %d no-LOS edges.\n", removed_edges_los);
#ifdef LONG_PATH_CHECK_LOS
//check long paths LOS, we seem to have a problem with random long links
//disable this if we check all edges above...
check_long_edge_los(map, big);
printf("Bad Edges: removed %d long no-LOS edges.\n", removed_long_edges_los);
#endif
//clean up points close enough to eachother to be the same point.
combine_grid_points(map, big, CLOSE_ENOUGH_COMBINE);
printf("Point Combine: combined %d very close nodes (%d missed strict LOS).\n", combined_grid_points, combine_broke_los);
printf("Point Combine: so far, %d LOS cache hits, %d LOS cache misses.\n", los_cache_hits, los_cache_misses);
list<PathEdge *> all_edges = big->edges;
printf("Big Graph: %d original nodes, %d original edges.\n", big->nodes.size(), big->edges.size());
#ifdef DRAW_PRETREE_GRAPH
//draw out our graph before trimming
sprintf(buf, "paths-%s-pretree.png", zone);
draw_paths(map, big->edges, eqmap.edges, buf);
#endif
/*
Graph algorithm application (boost)
run it on each disjoint graph
*/
vector<PathGraph *> disjoints;
vector<int> start_nodes;
//find all the disjoint graphs
{
//build the boost graph
MyGraph boost_graph(big->nodes.size());
property_map<MyGraph, edge_weight_t>::type weightlist;
std::map<PathEdge *, EdgeDesc> edgemap;
build_boost_graph(boost_graph, weightlist, edgemap, big, false);
//find the grid which has most of the edges
sprintf(buf, "paths-%s-colors.png", zone);
find_disjoint_grids(map, boost_graph, big, buf, start_nodes, disjoints);
}
printf("\nSplit: There are %d valid disjoint graphs.\n", disjoints.size());
//for each disjoint graph....
int djnum = 0;
PathGraph *tmpg; int start_node;
vector<PathGraph *>::iterator cur,end;
vector<int>::iterator curs,ends;
cur = disjoints.begin(); curs = start_nodes.begin();
end = disjoints.end(); ends = start_nodes.end();
for(; cur != end; cur++,curs++) {
big = *cur;
start_node = *curs;
printf("Disjoint %d: has %d edges and %d nodes.\n", djnum, big->edges.size(), big->nodes.size());
//reset our stats...
combine_broke_los = 0;
combined_grid_points = 0;
removed_edges_los = 0;
removed_long_edges_los = 0;
broke_paths = 0;
cross_edge_count = 0;
cross_add_count = 0;
{
//build the boost graph
MyGraph boost_graph(big->nodes.size());
property_map<MyGraph, edge_weight_t>::type weightlist;
std::map<PathEdge *, EdgeDesc> edgemap;
build_boost_graph(boost_graph, weightlist, edgemap, big);
//calculate the MST
run_min_spanning_tree(boost_graph, weightlist, edgemap, big, start_node);
printf("Ran Min Spanning Tree: ended with %d edges\n", big->edges.size());
}
/*
Now we have our minimal spanning tree, try to refine it.
the goal of this crap is to fix newbie fields and open zones
*/
std::map<PathEdge*, vector<GPoint> > cross_list;
PathGraph *cross_big = new PathGraph();
PathGraph *cross_excess = new PathGraph();
//count the number of times each edge crosses another edge, and record
//the intersection points. Also seperate crossers from non-crossers
count_crossing_lines(big->edges, cross_big, cross_excess, cross_list);
printf("Cross Count: %d edges cross more than the specified number of other edges.\n", cross_edge_count);
if(cross_edge_count > 2) {
//Make waypoints at all points of intersection
cut_crossed_grids(cross_big, cross_list);
printf("Cross Cut: Created %d new nodes cutting intersections\n", cross_add_count);
//combine close points with a somewhat big radius...
combine_grid_points(map, cross_big, CLOSE_ENOUGH_CROSS);
printf("Cross Combine: combined %d nodes. (%d missed strict LOS)\n", combined_grid_points, combine_broke_los);
printf("Cross Combine: so far, %d LOS cache hits, %d LOS cache misses.\n", los_cache_hits, los_cache_misses);
//build our boost graph, so we can do reachability
MyGraph cross_graph(cross_big->nodes.size());
property_map<MyGraph, edge_weight_t>::type cross_weightlist;
std::map<PathEdge *, EdgeDesc> cross_edgemap;
build_boost_graph(cross_graph, cross_weightlist, cross_edgemap, cross_big, false);
//isolate each disjoint graph and try to reduce it, gathering
//all non-cross points and edges while we are at it.
sprintf(buf, "paths-%s-crosses.png", zone);
consolidate_cross_graphs(map, cross_big, cross_excess, cross_graph, buf);
//rebuild the big graph by merging cross_big and cross_excess
//might be as simple as append the two arrays and run a combine on it.
//leaks 'big'
*cur = big = cross_excess;
cross_excess->add_edges(cross_big->edges);
rebuild_node_list(big->edges, big->nodes);
//This is used to re-link the cross grids with the non-cross stuff
combine_grid_points(map, big, CLOSE_ENOUGH_COMBINE);
printf("Cross Merge: combined %d close nodes. (%d missed strict LOS)\n", combined_grid_points, combine_broke_los);
printf("Cross Merge: so far, %d LOS cache hits, %d LOS cache misses.\n", los_cache_hits, los_cache_misses);
//build yet another boost graph so we can run MST
MyGraph cross_graph_final(big->nodes.size());
property_map<MyGraph, edge_weight_t>::type cross_weightlist_final;
std::map<PathEdge *, EdgeDesc> cross_edgemap_final;
build_boost_graph(cross_graph_final, cross_weightlist_final, cross_edgemap_final, big);
//run our MST to reduce the new cross-reduced graph
run_min_spanning_tree(cross_graph_final, cross_weightlist_final, cross_edgemap_final, big, 0);
printf("Ran Min Spanning Tree 2: ended with %d edges\n", big->edges.size());
} //end if there were some cross edges
/*
Final refinement phase, the graph has been reduced to our final
form, this phase is for adding anything back in we might want
*/
//now that we reduced all our co-linear points, add a bunch back in for
//long paths, so we have more points over space. Idea is that this way
//we control how many colinear points there are, it isnt random
//this counteracts any attempts to use line-crossing as a criteria for reduction
//for some stupid reason, this just destroys the graph
// break_long_lines(db_paths);
// printf("WP Increase: created %d waypoints on long paths.\n", broke_paths);
/*
Things we might want to do:
- Try to create some cycles. Specifically large cycles.
- do this after reachability calculations
- use allready calculated reacahbility and distances, just adjust them as cycles added
- these will add more realism to the pathing
- might be implemented like this:
- run all pairs shortest path on the MST (is this a byproduct?)
- for each node N, for each other node K
- if path(N, K) is at least MIN_CYCLE_JOIN_PATH (to prevent making small cycles)
- and dist(N,K) is less than MAX_CYCLE_JOIN_DIST (do not want to invent long paths)
- and there is LOS from N to K
- connect N and K
- have to re-run all pairs again... that sucks
- another twist on the implementation would be to only look at paths
which were discarded by the MST. Or maybe run this first, then the other.
*/
/*
The final tree has been built, remove anything we dont need from
it, and gather some information.
*/
//build a boost graph out of our minimal spanning tree.
MyGraph boost_mst(big->nodes.size());
property_map<MyGraph, edge_weight_t>::type weightlist_mst;
std::map<PathEdge *, EdgeDesc> edgemap_mst;
build_boost_graph(boost_mst, weightlist_mst, edgemap_mst, big, true);
//determine the path lengths to all nodes from all others
//including the longest path reachable by each node.
//this also cleans up big by removing anything unreachable
// vector< vector<int> > AllPairs;
sprintf(buf, "paths-%s-mstcolors%d.png", zone, djnum++);
// calc_path_lengths(map, boost_mst, big, AllPairs, buf);
calc_path_lengths(map, boost_mst, big, edgemap_mst, buf);
printf("Calculated the longest paths from each node.\n");
printf("\n");
}
printf("Combining all disjoint graphs...\n");
//now combine all our disjoint graphs into one big one...
big = new PathGraph();
cur = disjoints.begin();
end = disjoints.end();
big->nodes.clear();
big->edges.clear();
djnum = 1;
for(; cur != end; cur++, djnum++) {
tmpg = *cur;
list<PathEdge *>::iterator cure,ende;
cure = tmpg->edges.begin();
ende = tmpg->edges.end();
for(; cure != ende; cure++) {
big->edges.push_back(*cure);
}
// sprintf(buf, "paths-%s-dj%d.png", zone, djnum-1);
// just_color_the_damned_thing(map, tmpg, buf);
}
rebuild_node_list(big->edges, big->nodes, NULL);
printf("Validating results...\n");
validate_edges(map, big);
//now we have our final node and edge set.
//build a graph of all final nodes to find pathing info
// MyGraph final(big->nodes.size());
// property_map<MyGraph, edge_weight_t>::type weightlist_final;
// std::map<PathEdge *, EdgeDesc> edgemap_final;
// build_boost_graph(final, weightlist_final, edgemap_final, big, true);
// sprintf(buf, "paths-%s-mstcolors%d-ppi.png", zone, djnum-1);
// just_color_the_damned_thing(map, big, buf);
vector< vector<PathEdge*> > path_finding;
find_path_info(map, big, path_finding);
printf("Calculated pathing information...\n");
//write out a nice image of our MST
sprintf(buf, "paths-%s-mstree.png", zone);
draw_paths2(map, all_edges, big->edges, eqmap.edges, db_spawns, buf);
//write out a map for inside the EQ client, not as pretty as the PNG
sprintf(buf, "eqmaps_out/%s_2.txt", zone);
write_eq_map(big->edges, buf);
/*
Build structures, and write out the path file.
*/
RDTSC_Timer t1, t2;
QTNode *root;
root = build_quadtree(map, big);
if(root == NULL) {
printf("Failed to build quadtree, quitting.\n");
return(1);
}
t2.start();
sprintf(buf, "%s.path", zone);
if(!write_path_file(root, big, buf, path_finding)) {
printf("Unable to write path file.\n");
return(1);
}
printf("Everything completed successfully. %s.path has been generated.\n", zone);
/*
** now we have a minimal connected graph such that any mob can get anywhere
by only a single path.
** now we have our final pathing grid. determine some useful info for each node.
look for dead ends/node preference:
- at each node, sum up the length of all edges reachable by using that link
- for each node as N
-- for each edge leaving N as E
---- reset marks on all edges
---- mark all edges leaving N
---- perform a depth first search of all reachable nodes
------ Only traverse unmarked edges. Mark each edge as it is traversed.
---- unmark all edges leaving N, except E
---- sum the length of all marked edges
---- store this reachable length as a weight for this edge of this node.
-- for each edge leaving N as E
---- determine highest edge weight in this node
-- for each edge leaving N as E
---- count number of edges within RANDOM_WALK % of the highest node.
-- sort the edge list for this node to have all random nodes first
-- store the random walkable counter for this node
** Finally we have all the calculation
things we need to store:
nodes
edge lists
quadtree containing nodes
- We do not really need to store edges which are not on the random walk
list since the pathing code will never consider using them.
Node {
x, y, z
edge list pointer
edge list length
random walkable counter
}
edge list entry {
ending node pointer
reachable edge weight? (not used by pathing, might have other purpose)
}
quadtree node {
minx, maxx, miny, maxy
union {
node pointers: q1, q2, q3, q4
node list offset and length
}
}
how to do fear pathing...
when a mob is feared, it uses the quadtree to find the node closest to it
that it can see to. The LOS requirement will make this more difficult, but feasible.
Once it has found its first node, the mob will set this as its waypoint and go there.
Once the mob reaches a node, it will look at the node's random counter (RC)
if RC is 1, take the first edge and use its terminal as next waypoint
if RC is >1, randomly choose an edge from 0 to RC-1, and walk that edge.
*/
mysql_close(&m);
}
+290
View File
@@ -0,0 +1,290 @@
#ifndef APATHING_H
#define APATHING_H
#include <mysql.h>
#include <gd.h>
#define DB_HOST "10.1.1.1"
#define DB_LOGIN "eqserver"
#define DB_PASSWORD "pw4eqserver"
#define DB_NAME "peq"
//for now, all of these were arbitrarily chosen
//load up doors as spawn points, since they are also valid locations
extern bool INCLUDE_DOORS;
//this is the furthest a mob can be from a fear point and still expect
//to find the node.
extern float FEAR_MAXIMUM_DISTANCE;
extern float ENDPOINT_CONNECT_MAX_DISTANCE; //begin and end point must be this close
extern float MIN_FIX_Z; //minimum drop before correcting waypoint
#define ALMOST_COLINEAR_COS 0.99f //cosine of an angle to consider colinear... .99== 8 degrees
//if we miss the map on one Z-checking try, move the point by these
#define X_JITTER 3
#define Y_JITTER 3
//if two nodes are this close together, consider them the same
extern float CLOSE_ENOUGH;
//this causes us to check all of a node's edges for LOS from the new
//node when we are considering combining into that node
//this is not working as well as one might hope, leads to many invalids
extern bool COMBINE_CHECK_ALL_LOS;
//this is bigger than close enough, since we check LOS when combining these
//so that we prevent little juntions
extern float CLOSE_ENOUGH_COMBINE;
//a second link on a spawn must be this far away from the first.
extern float SPAWN_MIN_SECOND_DIST;
//uncomment to split a pathin with two waypoints which cannot see eachother into two
extern bool SPLIT_INVALID_PATHS;
//enabled linking of path endpoints as if they were spawn points.
extern bool LINK_PATH_ENDPOINTS;
//the maximum distance of the closest point to a spawn inorder to link it
extern float MAX_LINK_SPAWN_DIST;
//before we generate pathing info, we try to link all points within this range to eachother
extern float FINAL_LINK_POINTS_DIST;
//enables linking a spawn point to two nodes instead of just one.
extern bool SPAWN_LINK_TWICE;
extern bool SPAWN_LINK_THRICE; //link up to 3 times.. requires twice enabled
//a second link point must be further than this from the first for closest merge
extern float MERGE_MIN_SECOND_DIST;
//if an edge is longer than this, it will get cut into pieces interval long
extern float SPLIT_LINE_LENGTH;
extern float SPLIT_LINE_INTERVAL;
//an edge must cross this many lines before being considered for cross reduction
extern int CROSS_REDUCE_COUNT;
//an edge must be longer than this before we think it can cross anything
extern float CROSS_MIN_LENGTH;
//The intersect points of two edges must be within this range of Z to count
extern float CROSS_MAX_Z_DIFF;
//the max distance between two nodes to consider them the same when crossing
extern float CLOSE_ENOUGH_CROSS;
//check long paths on load for LOS
//#define LONG_PATH_CHECK_LOS
//minimum number of nodes for a graph to possible be a disjoint graph
#define MIN_DISJOINT_NODES 3 //5
//divide the image scale by this number in each direction
extern int IMAGE_SCALE;
//enable drawing of a color-by-reachability graph when coloring a graph
#define DRAW_ALL_COLORS 1
//enable drawing of the original non-reduced combined graph.
#define DRAW_PRETREE_GRAPH 1
#include "gpoint.h"
#include <vector>
#include <list>
using namespace std;
class PathNode : public GPoint {
public:
PathNode() {
init();
}
PathNode(const GPoint &them) : GPoint(them) {
init();
}
PathNode(float ix, float iy, float iz) : GPoint(ix, iy, iz) {
init();
}
void init() {
color = 0;
// color2 = 0;
final_id = -1;
longest_path = 0;
valid = true;
forced = false;
disjoint = false;
}
int node_id;
int final_id;
// inherited:
// float x;
// float y;
// float z;
// VertDesc vert;
int color;
int longest_path;
char valid:1,
forced:1,
disjoint:1,
extra:5;
float Dist2(const GPoint *o) const {
float tmp;
float sum;
tmp = x - o->x;
sum = tmp*tmp;
tmp = y - o->y;
sum += tmp*tmp;
tmp = z - o->z;
sum += tmp*tmp;
return(sum);
}
};
class PathEdge {
public:
PathEdge( PathNode *_from, PathNode *_to) {
from = _from;
to = _to;
normal_reach = -1;
reverse_reach = -1;
valid = true;
}
PathNode *from;
PathNode *to;
int normal_reach;
int reverse_reach;
bool valid;
// EdgeDesc edge_id;
};
class PathGraph {
public:
~PathGraph() {
{
list<PathNode *>::iterator cur,end;
cur = nodes.begin();
end = nodes.end();
for(; cur != end; cur++) {
delete *cur;
}
}
{
list<PathEdge *>::iterator cur,end;
cur = edges.begin();
end = edges.end();
for(; cur != end; cur++) {
delete *cur;
}
}
}
void add_edge(PathNode *b, PathNode *e) {
edges.push_back(new PathEdge(b, e));
}
void add_edges(list<PathEdge *> &o) {
list<PathEdge *>::iterator cur,end;
cur = o.begin();
end = o.end();
for(; cur != end; cur++) {
edges.push_back(*cur);
}
}
list<PathNode *> nodes;
list<PathEdge *> edges;
//used for graph color accounts
int curcolor;
int ccount;
};
class ColorRecord {
public:
int color;
float height;
};
extern int load_split_paths;
extern int z_fixed_count;
extern int z_not_fixed_count;
extern int z_no_map_count;
extern float z_fixed_diffs;
extern float z_not_fixed_diffs;
extern int wp_reduce_count;
extern int trivial_merge_count;
extern int closest_merge_count;
extern int closest_merge2_count;
extern int link_spawn_count;
extern int link_spawn_invalid;
extern int link_spawn2_count;
extern int link_spawn3_count;
extern int link_spawn_nocount;
extern int combine_broke_los;
extern int combined_grid_points;
extern int removed_edges_los;
extern int removed_long_edges_los;
extern int broke_paths;
extern int cross_edge_count;
extern int cross_add_count;
extern int los_cache_misses;
extern int los_cache_hits;
#include <vector>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
class QTNode;
//ye-olde prototypes
bool load_paths_from_db(MYSQL *m, Map *map, const char *zone, list<PathGraph*> &db_paths, list<PathNode*> &end_points);
bool load_spawns_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns);
bool load_doors_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns);
bool load_hints_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns);
bool load_settings_from_db(MYSQL *m, const char *zone);
void repair_a_high_waypoint(Map *map, PathNode *it);
void repair_high_waypoints(Map *map, list<PathGraph*> &db_paths, list<PathNode*> &db_spawns);
bool almost_colinear(PathNode *first, PathNode *second, PathNode *third);
void reduce_waypoints(list<PathGraph*> &db_paths);
void break_long_lines(list<PathGraph*> &db_paths);
//void build_big_graph(PathGraph *big, list<PathGraph*> &db_paths, list<PathNode*> &db_spawns);
void combine_trivial_grids(Map *map, list<PathGraph*> &db_paths);
void combine_closest_grids(Map *map, list<PathGraph*> &db_paths);
void link_spawns(Map *map, PathGraph *big, list<PathNode*> &db_spawns, float maxdist, map< pair<PathNode *, PathNode *>, bool > *edgelist);
void combine_grid_points(Map *map, PathGraph *big, float close_enough);
void draw_paths(Map *map, list<PathEdge *> &edges, list<PathEdge *> &edges2, const char *fname);
void draw_paths2(Map *map, list<PathEdge *> &edges1, list<PathEdge *> &edges2, list<PathEdge *> &edges3, list<PathNode *> &spawns, const char *fname);
void check_edge_los(Map *map, PathGraph *big);
void check_long_edge_los(Map *map, PathGraph *big);
bool CheckLOS(Map *map, PathNode *from, PathNode *to);
void cut_crossed_grids(PathGraph *big, map<PathEdge*, vector<GPoint> > &cross_list);
void rebuild_node_list(list<PathEdge *> &edges, list<PathNode *> &nodes, list<PathNode *> *excess_nodes = NULL);
QTNode *build_quadtree(Map *map, PathGraph *big);
bool write_path_file(QTNode *_root, PathGraph *big, const char *file, vector< vector<PathEdge*> > &path_finding);
bool load_eq_map(const char *zone, PathGraph *eqmap);
void write_eq_map(list<PathEdge *> &edges, const char *fname);
//void edge_stats(list<PathEdge*> &edges, const char *s);
void choose_biggest_graph(PathGraph *big, vector<int> &counts, vector<int> &first_node);
void find_path_info(Map *map, PathGraph *big, vector< vector<PathEdge *> > &path_finding);
void find_node_edges(PathGraph *big, std::map<PathNode*, vector<PathEdge*> > &node_edges);
void validate_edges(Map *map, PathGraph *big);
void DrawGradientLine(gdImagePtr im, GPoint *first, GPoint *second, vector<ColorRecord> &colors);
void allocateGradient(gdImagePtr im, float r1, float g1, float b1, float r2, float g2, float b2,
float min, float max, float divs, vector<ColorRecord> &colors);
#endif
+759
View File
@@ -0,0 +1,759 @@
/*
Fear Pathing generation utility.
(c) 2005 Father Nitwit
*/
#include "../common/types.h"
#include "../zone/map.h"
#include "../common/rdtsc.h"
#include "quadtree.h"
#include "apathing.h"
#include "boostcrap.h"
#include <stdio.h>
#include <mysql.h>
#include <stdlib.h>
#include <string.h>
#include <gd.h>
/*
We assume this overwrites the edge array in big
and does not free the old edges
*/
void build_boost_graph(MyGraph &vg, property_map<MyGraph, edge_weight_t>::type &weightmap, map<PathEdge *, EdgeDesc> &em, PathGraph *big, bool set_weights) {
list<PathEdge*>::iterator cur,end;
list<PathNode*>::iterator curn,endn;
PathNode *n;
PathEdge *e;
//first we need to number our nodes...
curn = big->nodes.begin();
endn = big->nodes.end();
int r = 0;
for(; curn != endn; curn++) {
n = *curn;
n->node_id = r;
r++;
}
typedef std::pair < int, int > E; //our edge type
weightmap = get(edge_weight, vg);
//now add all our edges to the graph
cur = big->edges.begin();
end = big->edges.end();
for(r = 0; cur != end; cur++, r++) {
e = *cur;
if(e->from == e->to)
continue;
// printf("A %d/%d (%.3f,%.3f,%.3f) -> (%.3f,%.3f,%.3f) d=%.3f\n", r, big->edges.size(), e->from->x, e->from->y, e->from->z, e->to->x, e->to->y, e->to->z, e->from->Dist2(e->to));
EdgeDesc ed;
bool inserted;
tie(ed, inserted) = add_edge(e->from->node_id, e->to->node_id, vg);
if(set_weights)
weightmap[ed] = int(e->from->Dist2(e->to));
else
weightmap[ed] = 1;
em[e] = ed;
// e->edge_id = ed;
}
//now we should have a nice happy undirected graph...
}
void run_min_spanning_tree(MyGraph &vg, property_map<MyGraph, edge_weight_t>::type &weightmap, map<PathEdge *, EdgeDesc> &em, PathGraph *big, int start_node) {
int noedge = 0;
list<PathEdge *> out_paths;
vector < EdgeDesc > spanning_tree;
kruskal_minimum_spanning_tree(vg, back_inserter(spanning_tree));
vector < EdgeDesc >::iterator cur,end;
list<PathEdge*>::iterator cure,ende;
cur = spanning_tree.begin();
end = spanning_tree.end();
for(; cur != end; cur++) {
//find the edge
cure = big->edges.begin();
ende = big->edges.end();
for(; cure != ende; cure++) {
if(em[*cure] == *cur) {
out_paths.push_back(new PathEdge((*cure)->from, (*cure)->to));
break;
}
}
}
noedge = big->edges.size() - out_paths.size() - 1;
printf("Ran Min Spanning Tree: %d paths were eliminated.\n", noedge);
/*
//make our results list.
vector < VertDesc > p(num_vertices(vg));
//finally run the stupid algorithm.
prim_minimum_spanning_tree(vg, &p[0], root_vertex(start_node));
for (std::size_t i = 0; i != p.size(); ++i) {
if (p[i] != i) {
out_paths.push_back(new PathEdge(big->nodes[p[i]], big->nodes[i]));
} else {
//no edge here...
noedge++;
}
}
printf("Ran Min Spanning Tree: %d nodes were disconnected.\n", noedge);
*/
//now swap out our edge list to the MST.
big->edges = out_paths;
}
void find_disjoint_grids(Map *map, MyGraph &vg, PathGraph *big, const char *fname, vector<int> &start_nodes, vector<PathGraph *> &disjoints) {
vector< vector<int> > D;
vector<int> counts;
vector<int> disjoint_counts;
vector<int> first_node;
//color the graph and get us the info we need to do out job
color_disjoint_graphs(big, vg, map, fname, D, counts, disjoint_counts, first_node);
//find the biggest grid, that one gets to be included no matter what
int best_graph = 0;
int best_count = counts[0];
unsigned int r;
for(r = 1; r < counts.size(); r++) {
if(best_count < counts[r]) {
best_count = counts[r];
best_graph = r;
}
}
disjoint_counts[best_graph] = 1;
//break up the graphs based on color if we want them.
vector<int>::iterator ccur,djcur,fcur,cend;
list<PathEdge*>::iterator cur,end;
PathEdge *e;
PathGraph *pg;
ccur = counts.begin();
djcur = disjoint_counts.begin();
fcur = first_node.begin();
cend = counts.end();
int color = 0;
for(; ccur != cend; ccur++, djcur++, fcur++, color++) {
int count = *ccur;
int dj = *djcur;
// int fn = *fcur;
if(dj < 1)
continue; //skip disjoint sets not marked for use.
if(count < MIN_DISJOINT_NODES)
continue; //make sure we have a reasonable node count
pg = new PathGraph();
cur = big->edges.begin();
end = big->edges.end();
for(; cur != end; cur++) {
e = *cur;
if(e->from->color != e->to->color) {
printf("Color Mismatch %d-%d: #%d(%.3f,%.3f,%.3f) -> #%d(%.3f,%.3f,%.3f)\n", e->from->color, e->to->color, e->from->node_id, e->from->x, e->from->y, e->from->z, e->to->node_id, e->to->x, e->to->y, e->to->z);
//... what to do...
}
//just use the color of the from node
if(e->from->color == color) {
pg->edges.push_back(e);
}
}
//get our list of nodes based on our edge list.
rebuild_node_list(pg->edges, pg->nodes, NULL);
disjoints.push_back(pg);
start_nodes.push_back(1); //each graph only contains its own nodes, so any node will work.
}
/*
int best_graph = 0;
int best_count = counts[0];
unsigned int r;
for(r = 1; r < counts.size(); r++) {
if(best_count < counts[r]) {
best_count = counts[r];
best_graph = r;
}
// printf("Graph %d has %d edges\n", r, counts[r]);
}
start_node = first_node[best_graph];
printf("Best sub-graph: chose #%d of %d, has %d nodes, and contains node %d\n", best_graph, counts.size()-1, best_count, start_node);
//todo: eliminate other graphs...
*/
/* list<PathEdge*>::iterator cure,ende;
PathEdge *e;
cure = big->edges.begin();
ende = big->edges.end();
for(; cure != ende; cure++) {
e = *cure;
if(e->from->color != e->to->color) {
printf("Color Mismatch %d-%d: #%d(%.3f,%.3f,%.3f) -> #%d(%.3f,%.3f,%.3f)\n", e->from->color, e->to->color, e->from->node_id, e->from->x, e->from->y, e->from->z, e->to->node_id, e->to->x, e->to->y, e->to->z);
} else if(e->from->color != best_graph) {
printf("Color %d: (%.3f,%.3f,%.3f) -> (%.3f,%.3f,%.3f)\n", e->from->color, e->from->x, e->from->y, e->from->z, e->to->x, e->to->y, e->to->z);
}
}
*/
}
static const int INT_LIMIT = (std::numeric_limits < int >::max)();
void color_disjoint_graphs(
PathGraph *big,
MyGraph &vg,
Map *map,
const char *fname,
vector< vector<int> > &D, //output
vector<int> &counts, //output
vector<int> &disjoint_counts, //output
vector<int> &first_node //output
) {
int count = big->nodes.size();
// int r;
// vector< vector<int> > D(count, vector<int>(count, INT_LIMIT));
// vector<int> counts(1, 0);
// vector<int> first_node(1, 0);
//make sure everything is inited right...
D.resize(0);
D.resize(count, vector<int>(count, INT_LIMIT));
counts.resize(1);
counts[0] = 0;
disjoint_counts.resize(1);
disjoint_counts[0] = 0;
first_node.resize(1);
first_node[0] = 0;
//make up a weight map with all 1s, done while building now
/* property_map < MyGraph, edge_weight_t >::type w = get(edge_weight, vg);
graph_traits < MyGraph >::edge_iterator e, e_end;
for (boost::tie(e, e_end) = edges(vg); e != e_end; ++e)
w[*e] = 1;*/
johnson_all_pairs_shortest_paths(vg, D);
list<PathNode*>::iterator cur,end,cur2;
PathNode *n,*f;
int cur_color = 1;
int cc,djc;
//clear node colors
cur = big->nodes.begin();
end = big->nodes.end();
for(; cur != end; cur++) {
n = *cur;
n->color = 0;
}
//color the graph based on reachability, basically labeling subgraphs
//this finds the number of nodes reachable from each node
//which is used to pick the best disconnected graph in the tree.
//its a series of wrong bullshit that forces us to do this, but it works
cur = big->nodes.begin();
end = big->nodes.end();
for(; cur != end; cur++) {
n = *cur;
if(n->color != 0)
continue; //allready visited
//printf("New Color at: (%.3f,%.3f,%.3f)\n", n->x, n->y, n->z);
cc = 1;
djc = 0;
if(n->disjoint)
djc++;
n->color = cur_color;
cur_color++;
cur2 = cur;
for(; cur2 != end; cur2++) {
f = *cur2;
if(f->color == 0 && D[n->node_id][f->node_id] != INT_LIMIT) {
cc++;
f->color = n->color;
}
if(f->disjoint)
djc++;
}
counts.push_back(cc);
disjoint_counts.push_back(djc);
first_node.push_back(n->node_id);
}
#ifdef DRAW_ALL_COLORS
if(fname != NULL) {
printf("Drawing with %d seperate sub-graphs from %d nodes and %d edges\n", cur_color-1, big->nodes.size(), big->edges.size());
FILE *pngout;
pngout = fopen(fname, "wb");
if(pngout == NULL) {
printf("Unable to open %s\n", fname);
return;
}
gdImagePtr im;
int minx = int(map->GetMinX());
int maxx = int(map->GetMaxX());
int miny = int(map->GetMinY());
int maxy = int(map->GetMaxY());
im = gdImageCreate((maxx - minx)/IMAGE_SCALE, (maxy - miny)/IMAGE_SCALE);
// im = gdImageCreate(maxx - minx, maxy - miny);
//allocate this first, to make it the BG color.
/*int black =*/ gdImageColorAllocate(im, 0, 0, 0);
// int grey = gdImageColorAllocate(im, 100, 100, 100);
int *clist = new int[cur_color];
int r;
for(r = 0; r < cur_color; r++) {
clist[r] = gdImageColorAllocate(im, rand()%255, rand()%255, rand()%255);
}
{
list<PathEdge*>::iterator cur,end;
PathEdge *e;
cur = big->edges.begin();
end = big->edges.end();
for(; cur != end; cur++) {
e = *cur;
int x1 = int(e->from->x) - minx;
int y1 = int(e->from->y) - miny;
int x2 = int(e->to->x) - minx;
int y2 = int(e->to->y) - miny;
x1 /= IMAGE_SCALE;
y1 /= IMAGE_SCALE;
x2 /= IMAGE_SCALE;
y2 /= IMAGE_SCALE;
gdImageLine(im, x1, y1, x2, y2, clist[e->from->color]);
}
}
delete[] clist;
gdImagePng(im, pngout);
gdImageDestroy(im);
fclose(pngout);
printf("Wrote image: %s\n", fname);
}
#endif //DRAW_ALL_COLORS
}
void calc_path_lengths(Map *map, MyGraph &vg, PathGraph *big, map<PathEdge *, EdgeDesc> &em, const char *fname) {
vector<int> counts;
vector<int> disjoint_counts;
vector<int> first_node;
vector< vector<int> > D;
list<PathNode*>::iterator cur,end;
PathNode *n;
/*
Node distances:
1. find the root node.
- find the longest path from each node to any other node
- the node with the shortest of these longest paths is the root
2. record each node's distance from that root node
*/
//color the graph and get us the info we need to do out job
color_disjoint_graphs(big, vg, map, fname, D, counts, disjoint_counts, first_node);
vector<int>::iterator curp,endp;
int shortest_node = 0;
int shortest = 0xFFFFFF;
int the_longest = 0;
int longest_node = 0;
//stores the longest path from each node
vector<int> longest_dists(D.size(), 0);
//find the node with the longest path of all, so we know what
//tree we are trying to find the root of
cur = big->nodes.begin();
end = big->nodes.end();
for(; cur != end; cur++) {
n = *cur;
vector<int> &cv = D[n->node_id];
curp = cv.begin();
endp = cv.end();
int longest = 0;
int discount = 0;
for(; curp != endp; curp++) {
if(*curp == INT_LIMIT) {
discount++;
continue;
}
if(*curp > longest)
longest = *curp;
}
longest_dists[n->node_id] = longest;
if(longest > the_longest) {
the_longest = longest;
longest_node = n->node_id;
}
}
//find the node with the shortest, longest path
//the idea is to locate the 'root' of the tree.
cur = big->nodes.begin();
end = big->nodes.end();
for(; cur != end; cur++) {
n = *cur;
vector<int> &cv = D[n->node_id];
if(cv[longest_node] == INT_LIMIT)
continue; //this node cannot reach the root
int longest = longest_dists[n->node_id];
//n->longest_path = longest;
//printf("Node %d's longest path is %d\n", n->node_id, longest);
if(longest < shortest) {
shortest = longest;
shortest_node = n->node_id;
}
}
//now we have our root, set each node to their distance from the root
vector<int> &root_dists = D[shortest_node];
printf("The tree's root is %d\n", shortest_node);
cur = big->nodes.begin();
end = big->nodes.end();
for(; cur != end; cur++) {
n = *cur;
if(n->node_id == shortest_node)
n->longest_path = 0;
else
n->longest_path = root_dists[n->node_id];
//printf("Node %d's distance from root is %d\n", n->node_id, root_dists[n->node_id]);
}
/*
the reachability is the number of nodes which we could possibly get to
by traveling each direction across an edge.
to find reachability:
loop through each edge e
Remove that edge from the graph
color_disjoint_graphs
fc = count number of nodes with the same color as 'e->from'
tc = count number of nodes with the same color as 'e->to'
e->normal_reach = tc;
e->reverse_reach = fc;
*/
property_map<MyGraph, edge_weight_t>::type weightmap;
weightmap = get(edge_weight, vg);
int tc,fc;
int from_color, to_color;
printf("Finding lengths (%d dots)", 1+big->edges.size()/10);
int pos = 0;
PathEdge *e;
list<PathEdge*>::iterator cur4,end4;
cur4 = big->edges.begin();
end4 = big->edges.end();
for(; cur4 != end4; cur4++, pos++) {
if(pos % 10 == 0) {
printf(".");
fflush(stdout);
}
e = *cur4;
//remove this edge from the boost graph..
remove_edge(em[e], vg);
//color the graph and get us the info we need to do our job
//char out[64];
//sprintf(out, "lengraph-%d.png", pos);
color_disjoint_graphs(big, vg, map,
NULL,
D, counts, disjoint_counts, first_node);
//add the edge back in
EdgeDesc ed;
bool inserted;
tie(ed, inserted) = add_edge(e->from->node_id, e->to->node_id, vg);
em[e] = ed;
weightmap[em[e]] = int(e->from->Dist2(e->to)); //cause its a new edge
//make sure this stupid thing worked.
if(e->from->color == e->to->color) {
printf("Cycle detected in MST... WTF?\n");
e->normal_reach = -1;
e->reverse_reach = -1;
continue;
}
from_color = e->from->color;
to_color = e->to->color;
//count our crap.
tc = 0;
fc = 0;
cur = big->nodes.begin();
end = big->nodes.end();
for(; cur != end; cur++) {
n = *cur;
if(n->color == to_color)
tc++;
else if(n->color == from_color)
fc++;
}
//put it on our edge
e->normal_reach = tc;
e->reverse_reach = fc;
}
printf("\n");
//re-color the graph, since we dicked with it above
color_disjoint_graphs(big, vg, map, fname, D, counts, disjoint_counts, first_node);
choose_biggest_graph(big, counts, first_node);
}
void just_color_the_damned_thing(Map *map, PathGraph *big, const char *fname) {
MyGraph vg(big->nodes.size());
property_map<MyGraph, edge_weight_t>::type weightlist_mst;
std::map<PathEdge *, EdgeDesc> edgemap_mst;
build_boost_graph(vg, weightlist_mst, edgemap_mst, big, true);
vector<int> counts;
vector<int> disjoint_counts;
vector<int> first_node;
vector< vector<int> > D;
list<PathNode*>::iterator cur,end;
color_disjoint_graphs(big, vg, map, fname, D, counts, disjoint_counts, first_node);
}
/*
void calc_path_lengths(Map *map, MyGraph &vg, PathGraph *big, vector< vector<int> > &D, const char *fname) {
// vector< vector<int> > D;
vector<int> counts;
vector<int> first_node;
choose_biggest_graph(big, counts, first_node);
}
*/
//assumes that the graph is freshly colored disjoint, and counts/first_node are results from it
void choose_biggest_graph(PathGraph *big, vector<int> &counts, vector<int> &first_node) {
int best_graph = 0;
int best_count = counts[0];
unsigned int r;
for(r = 1; r < counts.size(); r++) {
if(best_count < counts[r]) {
best_count = counts[r];
best_graph = r;
}
printf("Graph %d has %d edges\n", r, counts[r]);
}
printf("Best Tree: Detected %d graphs in the MST, selected #%d\n", counts.size(), best_graph);
list<PathNode*> new_nodes;
list<PathEdge*> new_edges;
//rebuild the node list to include only nodes which are in
//the best graph, also only keeping the edges which connect them.
std::map<PathNode *, int> havenodelist;
list<PathEdge*>::iterator cur4,end4;
cur4 = big->edges.begin();
end4 = big->edges.end();
for(; cur4 != end4; cur4++) {
PathEdge *e = *cur4;
//remove the edge if it is not the main color
//this also causes the removal of the nodes if they
//are not used in any other edges.
if(e->from->color != e->to->color) {
printf("Miscolor.\n");
continue;
}
if(e->from->color != best_graph) {
continue;
}
if(e->to->color != best_graph) {
continue;
}
new_edges.push_back(e);
if(havenodelist.count(e->from) != 1) {
e->from->final_id = new_nodes.size();
new_nodes.push_back(e->from);
havenodelist[e->from] = 1;
}
if(havenodelist.count(e->to) != 1) {
e->to->final_id = new_nodes.size();
new_nodes.push_back(e->to);
havenodelist[e->to] = 1;
}
}
printf("Best Tree: Removed %d nodes and %d edges which were disconnected.\n",
big->nodes.size() - new_nodes.size(), big->edges.size() - new_edges.size());
big->nodes = new_nodes;
big->edges = new_edges;
}
void consolidate_cross_graphs(Map *map, PathGraph *big, PathGraph *excess, MyGraph &cross_graph, const char *fname) {
vector< vector<int> > D;
vector<int> counts;
vector<int> disjoint_counts;
vector<int> first_node;
//color the graph and get us the info we need to do our job
color_disjoint_graphs(big, cross_graph, map, fname, D, counts, disjoint_counts, first_node);
}
void find_path_info(Map *map, MyGraph &vg, vector< vector<PathEdge*> > &path_finding, PathGraph *big) {
//make sure our path finding vector is big enough.
{
int size = big->nodes.size();
vector<PathEdge*> tmp(size, (PathEdge*)NULL);
path_finding.resize(0);
path_finding.resize(size, tmp);
}
vector< vector<int> > D;
vector<int> counts;
vector<int> disjoint_counts;
vector<int> first_node;
//color the graph and get us the info we need to do our job
color_disjoint_graphs(big, vg, map, NULL, D, counts, disjoint_counts, first_node);
//figure out what edges link to each node.
std::map<PathNode*, vector<PathEdge*> > node_edges;
find_node_edges(big, node_edges);
//for each node, find best edge to reach each other node.
list<PathNode*>::iterator cur,end;
PathNode *n;
vector<int>::iterator curp,endp;
vector<PathEdge *>::iterator cure,ende;
int r;
cur = big->nodes.begin();
end = big->nodes.end();
for(; cur != end; cur++) {
n = *cur;
//get all our vector refs that we need since this is kinda expensive
vector<int> &cv = D[n->node_id]; //distance array
vector<PathEdge *> &pf = path_finding[n->node_id]; //result
vector<PathEdge *> &el = node_edges[n]; //our edges
curp = cv.begin();
endp = cv.end();
for(r = 0; curp != endp; curp++, r++) {
if(n->node_id == r) {
//this is the end of the path, we cannot take an edge to reach ourself
pf[r] = NULL;
continue;
}
int my_dist = *curp;
if(my_dist == INT_MAX) {
//this node is unreachable.
pf[r] = NULL;
continue;
}
//else, node r reachable from us, find best edge.
cure = el.begin();
ende = el.end();
// int shortest;
PathEdge *ce;
PathNode *cn;
//for each edge
for(; cure != ende; cure++) {
ce = *cure;
//find the node other than ourself on the edge
if(ce->from == n)
cn = ce->to;
else
cn = ce->from;
//see how far away this node is
int cdist = D[cn->node_id][r];
if(cdist < my_dist) {
//found one which is closer... due to min span tree, there
//should only be one path possible so just go with it.
pf[r] = ce;
break;
}
}
//assume that this node got assigned.. next
if(pf[r] == NULL) {
printf("Node id %d was not able to find a good path to node %d\n", n->node_id, r);
}
}
}
}
+32
View File
@@ -0,0 +1,32 @@
#ifndef BOOSTCRAP_H
#define BOOSTCRAP_H
#include "apathing.h"
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/prim_minimum_spanning_tree.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/johnson_all_pairs_shortest.hpp>
using namespace boost;
//man I hate boost
typedef adjacency_list < vecS, vecS, undirectedS,
property<vertex_distance_t, int>, property < edge_weight_t, int > >
MyGraph;
typedef graph_traits < MyGraph >::vertex_descriptor VertDesc;
typedef graph_traits < MyGraph >::edge_descriptor EdgeDesc;
void build_boost_graph(MyGraph &vg, property_map<MyGraph, edge_weight_t>::type &weightmap, map<PathEdge *, EdgeDesc> &em, PathGraph *big, bool set_weights = true);
void run_min_spanning_tree(MyGraph &vg, property_map<MyGraph, edge_weight_t>::type &weightmap, map<PathEdge *, EdgeDesc> &em, PathGraph *big, int start_node);
void find_disjoint_grids(Map *map, MyGraph &vg, PathGraph *big, const char *file, vector<int> &start_nodes, vector<PathGraph *> &disjoints);
void calc_path_lengths(Map *map, MyGraph &vg, PathGraph *big, map<PathEdge *, EdgeDesc> &em, const char *fname);
void color_disjoint_graphs(PathGraph *big, MyGraph &vg, Map *map, const char *fname, vector< vector<int> > &D, vector<int> &counts, vector<int> &disjoint_counts, vector<int> &first_node );
void count_crossing_lines(list<PathEdge *> &edges, PathGraph *out, PathGraph *excess, map<PathEdge*, vector<GPoint> > &cross_list);
void consolidate_cross_graphs(Map *map, PathGraph *cross_big, PathGraph *cross_excess, MyGraph &cross_graph, const char *fname);
void just_color_the_damned_thing(Map *map, PathGraph *big, const char *fname);
#endif
+113
View File
@@ -0,0 +1,113 @@
#include <math.h>
#include <stdio.h>
#include "gpoint.h"
GPoint::GPoint() {
x = 0;
y = 0;
z = 0;
}
GPoint::GPoint(VERTEX &v) {
x = v.x;
y = v.y;
z = v.z;
}
GPoint::GPoint(float ix, float iy, float iz) {
x = ix;
y = iy;
z = iz;
}
GPoint::GPoint(const GPoint &them) {
x = them.x;
y = them.y;
z = them.z;
}
//dot of x,y,z
float GPoint::dot3(const GPoint &them) const {
return((x * them.x) + (y * them.y) +
(z * them.z));
}
//cross product
GPoint GPoint::cross(const GPoint &them) const {
return(GPoint(y * them.z - z * them.y,
z * them.x - x * them.z,
x * them.y - y * them.x));
}
const GPoint &GPoint::operator+=(const GPoint &them) {
x += them.x;
y += them.y;
z += them.z;
return(*this);
}
const GPoint &GPoint::operator*=(const float num) {
x *= num;
y *= num;
z *= num;
return(*this);
}
GPoint operator-(const GPoint &v1, const GPoint &v2) {
return(GPoint(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z));
}
//ordering on X only
bool operator<(const GPoint &v1, const GPoint &v2) {
return(v1.x < v2.x);
}
//ordering on X only
bool operator>(const GPoint &v1, const GPoint &v2) {
return(v1.x > v2.x);
}
GVector::GVector() : GPoint() {
W = 0;
}
GVector::GVector(const GPoint &them) : GPoint(them) {
W = 1.0f;
}
GVector::GVector(const GPoint &from, const GPoint &to)
: GPoint(to.x - from.x, to.y - from.y, to.z - from.z)
{
W = 1.0f;
}
GVector::GVector(float x, float y, float z, float w) : GPoint(x, y, z) {
W = w;
}
//dot product of x,y,z,w
float GVector::dot4(const GVector &them) const {
return((x * them.x) + (y * them.y) +
(z * them.z) + (W * them.W));
}
//dot product of x,y,z+w
float GVector::dot4(const GPoint &them) const {
return((x * them.x) + (y * them.y) +
(z * them.z) + W);
}
float GVector::length() {
return(sqrt((x * x) + (y * y) + (z * z)));
}
void GVector::normalize() {
float len = length(); //stupid square roots take forever
x /= len;
y /= len;
z /= len;
}
+49
View File
@@ -0,0 +1,49 @@
#ifndef GPOINT_H
#define GPOINT_H
#include "../zone/map.h"
class GPoint {
public:
GPoint();
GPoint(const GPoint &them);
GPoint(VERTEX &v);
GPoint(float x, float y, float z);
inline void operator()(float nx, float ny, float nz) { x = nx; y = ny; z = nz; }
GPoint cross(const GPoint &them) const;
float dot3(const GPoint &them) const;
const GPoint &operator+=(const GPoint &them);
const GPoint &operator*=(const float num);
float x;
float y;
float z;
};
GPoint operator-(const GPoint &v1, const GPoint &v2);
bool operator<(const GPoint &v1, const GPoint &v2);
bool operator>(const GPoint &v1, const GPoint &v2);
class GVector : public GPoint {
public:
GVector();
GVector(const GPoint &them);
GVector(const GPoint &from, const GPoint &to);
GVector(float x, float y, float z, float w = 1.0f);
inline void operator()(float nx, float ny, float nz, float nw) { x = nx; y = ny; z = nz; W = nw; }
float dot4(const GVector &them) const;
float dot4(const GPoint &them) const;
void normalize();
float length();
float W;
};
#endif
+276
View File
@@ -0,0 +1,276 @@
/*
Fear Pathing generation utility.
(c) 2005 Father Nitwit
*/
#include "../common/types.h"
#include "../zone/map.h"
#include "../common/rdtsc.h"
#include "quadtree.h"
#include "apathing.h"
#include <stdio.h>
#include <mysql.h>
#include <stdlib.h>
#include <string.h>
#include <gd.h>
bool load_paths_from_db(MYSQL *m, Map *map, const char *zone, list<PathGraph*> &db_paths, list<PathNode*> &end_points) {
char query[512];
sprintf(query,
"SELECT x,y,z,gridid FROM grid_entries,zone "
"WHERE zone.zoneidnumber=zoneid AND short_name='%s' "
"ORDER BY gridid,number", zone);
if(mysql_query(m, query) != 0) {
printf("Unable to query: %s\n", mysql_error(m));
return(false);
}
MYSQL_RES *res = mysql_store_result(m);
if(res == NULL) {
printf("Unable to store res: %s\n", mysql_error(m));
return(false);
}
MYSQL_ROW row;
PathNode *cur = NULL, *last = NULL, *first = NULL;
PathGraph *g = NULL;
int cur_g = -1,last_g = -1;
// int lid = 0;
while((row = mysql_fetch_row(res))) {
last = cur;
cur = new PathNode;
// cur->load_id = lid++;
cur->x = atof(row[0]);
cur->y = atof(row[1]);
cur->z = atof(row[2]);
cur_g = atoi(row[3]);
if(cur_g != last_g) {
if(g != NULL) {
//if we have a first and last node for this path
//and they are not the same node, try to connect them.
if(first != NULL && last != NULL && first != last && last->Dist2(first) < ENDPOINT_CONNECT_MAX_DISTANCE*ENDPOINT_CONNECT_MAX_DISTANCE) {
if(CheckLOS(map, last, first))
g->add_edge(last, first);
}
#ifdef LINK_PATH_ENDPOINTS
if(first != last && last != NULL)
end_points.push_back(last);
#endif
db_paths.push_back(g);
}
g = new PathGraph();
first = cur;
last_g = cur_g;
last = NULL;
}
g->nodes.push_back(cur);
#ifdef LINK_PATH_ENDPOINTS
//this is a begining point
if(last == NULL)
end_points.push_back(cur);
#endif
if(last != NULL) {
#ifdef SPLIT_INVALID_PATHS
if(CheckLOS(map, last, cur)) {
g->edges.push_back(new PathEdge(last, cur));
} else {
//no LOS, split the path into two
load_split_paths++;
last_g = -1; //tell this thing to start over
}
#else
g->edges.push_back(new PathEdge(last, cur));
#endif
}
}
//handle the last active path
if(g != NULL) {
if(first != NULL && cur->Dist2(first) < ENDPOINT_CONNECT_MAX_DISTANCE*ENDPOINT_CONNECT_MAX_DISTANCE) {
if(CheckLOS(map, cur, first))
g->add_edge(cur, first);
}
db_paths.push_back(g);
}
mysql_free_result(res);
return(true);
}
bool load_spawns_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns) {
char query[512];
sprintf(query,
"SELECT x,y,z FROM spawn2 "
"WHERE zone='%s'", zone);
if(mysql_query(m, query) != 0) {
printf("Unable to query: %s\n", mysql_error(m));
return(false);
}
MYSQL_RES *res = mysql_store_result(m);
if(res == NULL) {
printf("Unable to store res: %s\n", mysql_error(m));
return(false);
}
MYSQL_ROW row;
PathNode *cur = NULL;
while((row = mysql_fetch_row(res))) {
cur = new PathNode;
cur->x = atof(row[0]);
cur->y = atof(row[1]);
cur->z = atof(row[2]);
db_spawns.push_back(cur);
}
mysql_free_result(res);
return(true);
}
bool load_doors_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns) {
char query[512];
sprintf(query,
"SELECT pos_x,pos_y,pos_z FROM doors "
"WHERE zone='%s'", zone);
if(mysql_query(m, query) != 0) {
printf("Unable to query: %s\n", mysql_error(m));
return(false);
}
MYSQL_RES *res = mysql_store_result(m);
if(res == NULL) {
printf("Unable to store res: %s\n", mysql_error(m));
return(false);
}
MYSQL_ROW row;
PathNode *cur = NULL;
while((row = mysql_fetch_row(res))) {
cur = new PathNode;
cur->x = atof(row[0]);
cur->y = atof(row[1]);
cur->z = atof(row[2]);
//TODO: it would be nice if we could get to the middle of these
//doors, not the edge of them which I assume these points are
db_spawns.push_back(cur);
}
mysql_free_result(res);
return(true);
}
bool load_hints_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns) {
char query[512];
sprintf(query,
"SELECT x,y,z,forced,disjoint FROM fear_hints "
"WHERE zone='%s'", zone);
if(mysql_query(m, query) != 0) {
printf("Unable to query: %s\n", mysql_error(m));
return(false);
}
MYSQL_RES *res = mysql_store_result(m);
if(res == NULL) {
printf("Unable to store res: %s\n", mysql_error(m));
return(false);
}
MYSQL_ROW row;
PathNode *cur = NULL;
while((row = mysql_fetch_row(res))) {
cur = new PathNode;
cur->x = atof(row[0]);
cur->y = atof(row[1]);
cur->z = atof(row[2]);
cur->forced = atoi(row[3])?true:false;
cur->disjoint = atoi(row[4])?true:false;
db_spawns.push_back(cur);
}
mysql_free_result(res);
return(true);
}
bool load_settings_from_db(MYSQL *m, const char *zone) {
char query[512];
sprintf(query,
"SELECT use_doors, min_fix_z, max_fear_distance, image_scale, split_invalid_paths,"
" link_path_endpoints, end_distance, split_long_min, split_long_step, same_dist, node_combine_dist,"
" grid_combine_dist, close_all_los, cross_count, cross_min_length, cross_max_z_diff, cross_combine_dist,"
" second_link_dist, link_max_dist, link_count"
" FROM fear_settings"
" WHERE zone='%s'", zone);
if(mysql_query(m, query) != 0) {
// printf("Unable to query: %s\n", mysql_error(m));
return(false);
}
MYSQL_RES *res = mysql_store_result(m);
if(res == NULL) {
// printf("Unable to store res: %s\n", mysql_error(m));
return(false);
}
MYSQL_ROW row;
int r = 0;
if((row = mysql_fetch_row(res))) {
INCLUDE_DOORS = atoi(row[r++])?true:false;
MIN_FIX_Z = atof(row[r++]);
FEAR_MAXIMUM_DISTANCE = atof(row[r++]);
IMAGE_SCALE = atoi(row[r++]);
SPLIT_INVALID_PATHS = atoi(row[r++])?true:false;
LINK_PATH_ENDPOINTS = atoi(row[r++])?true:false;
ENDPOINT_CONNECT_MAX_DISTANCE = atof(row[r++]);
SPLIT_LINE_LENGTH = atof(row[r++]);
SPLIT_LINE_INTERVAL = atof(row[r++]);
CLOSE_ENOUGH = atof(row[r++]);
CLOSE_ENOUGH_COMBINE = atof(row[r++]);
MERGE_MIN_SECOND_DIST = atof(row[r++]);
COMBINE_CHECK_ALL_LOS = atoi(row[r++])?true:false;
CROSS_REDUCE_COUNT = atoi(row[r++]);
CROSS_MIN_LENGTH = atof(row[r++]);
CROSS_MAX_Z_DIFF = atof(row[r++]);
CLOSE_ENOUGH_CROSS = atof(row[r++]);
SPAWN_MIN_SECOND_DIST = atof(row[r++]);
MAX_LINK_SPAWN_DIST = atof(row[r++]);
int sc = atoi(row[r++]);
SPAWN_LINK_TWICE = sc >= 2?true:false;
SPAWN_LINK_THRICE = sc >= 3?true:false;
mysql_free_result(res);
return(true);
}
mysql_free_result(res);
return(false);
}
+212
View File
@@ -0,0 +1,212 @@
//this is the path finding portion of the program.
#include "../common/types.h"
#include "../zone/map.h"
#include "../common/rdtsc.h"
#include "quadtree.h"
#include "apathing.h"
#include "boostcrap.h"
#include <stdio.h>
#include <mysql.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
void find_path_info(Map *map, PathGraph *big, vector< vector<PathEdge*> > &path_finding) {
//make sure our path finding vector is big enough, and all NULL
{
int size = big->nodes.size();
vector<PathEdge*> tmp(size, (PathEdge*)NULL);
path_finding.resize(0);
path_finding.resize(size, tmp);
}
//take our minimal spanning tree and try to link every single
//point in it like spawns are linked. The idea is to create
//a large set of alternative paths and cycles.
//get our list of nodes.
list<PathNode *> all_points = big->nodes;
big->nodes.clear();
//make our current edge list
std::map< pair<PathNode *, PathNode *>, bool > edgelist;
list<PathEdge*>::iterator cure,ende,tmp;
PathEdge *e;
cure = big->edges.begin();
ende = big->edges.end();
PathNode *from;
PathNode *to;
for(; cure != ende; cure++) {
e = *cure;
from = e->from;
to = e->to;
//hack to make order on the ID not matter
if(int32(from) < int32(to)) {
PathNode *tmp = from;
from = to;
to = tmp;
}
pair<PathNode *, PathNode *> id(from, to);
edgelist[id] = true;
}
//link up the points, making sure not to add edges allready in the MST
link_spawns(map, big, all_points, FINAL_LINK_POINTS_DIST, &edgelist);
//now we have our graph all connected up.
/*
disabled in favor of all-pairs shortest path.
//get the list of edges leaving each node.
std::map<PathNode*, vector<PathEdge*> > node_edges;
find_node_edges(big, node_edges);
//color every node 0
list<PathNode *>::iterator curn, endn;
curn = big->nodes.begin();
endn = big->nodes.end();
for(; curn != endn; curn++) {
(*curn)->color = 0;
}
//for each node, run a breadth first search from each node to find the
//shortest path to each node from each node.
*/
//run all pairs shortest path so we have some information to
//use for our metric in A*
//build our boost graph with length weights
MyGraph vg(big->nodes.size());
property_map<MyGraph, edge_weight_t>::type weightlist;
std::map<PathEdge *, EdgeDesc> edgemap;
build_boost_graph(vg, weightlist, edgemap, big, true); //set weights to distances
vector< vector<int> > D;
vector<int> counts;
vector<int> disjoint_counts;
vector<int> first_node;
//color the graph and get us the info we need to do our job (D)
color_disjoint_graphs(big, vg, map, NULL, D, counts, disjoint_counts, first_node);
//figure out what edges link to each node.
std::map<PathNode*, vector<PathEdge*> > node_edges;
find_node_edges(big, node_edges);
int cur_node_id;
list<PathNode*>::iterator curn,endn;
PathNode *n;
vector<int>::iterator curp,endp;
vector<PathEdge*>::iterator curev,endev;
vector<PathEdge *>::iterator cur_res, end_res;
curn = big->nodes.begin();
endn = big->nodes.end();
for(; curn != endn; curn++) {
n = *curn;
//get all our vector refs that we need since
vector<int> &cv = D[n->node_id]; //distance array
vector<PathEdge *> &pf = path_finding[n->node_id]; //result
vector<PathEdge *> &el = node_edges[n]; //our edges
//for each other node, find an edge which gets us closer to that node
curp = cv.begin();
endp = cv.end();
cur_res = pf.begin();
end_res = pf.end();
for(cur_node_id = 0; curp != endp && cur_res != end_res; curp++, cur_node_id++, cur_res++) {
int distance_to_cur_node = *curp;
//if this ourself, we have no path basically.
if(n->node_id == cur_node_id) {
*cur_res = NULL;
continue;
}
//if we cant reach them, why look
if(distance_to_cur_node == INT_MAX) {
*cur_res = NULL;
continue;
}
//see which edge gets us closer
int closest = distance_to_cur_node; //start with the distance between this node and the target node, we need something closer
PathEdge *best_edge = NULL;
curev = el.begin();
endev = el.end();
for(; curev != endev; curev++) {
e = *curev;
int this_dist; //distance from the other end of this edge to the current target node
if(e->from == n) {
if(e->to->node_id == cur_node_id)
this_dist = 0; //this is the goal node
else
this_dist = D[e->to->node_id][cur_node_id];
} else { //assume e->to == n
if(e->from->node_id == cur_node_id)
this_dist = 0; //this is the goal node
else
this_dist = D[e->from->node_id][cur_node_id];
}
if(this_dist == 0) {
//this will be the best.
best_edge = e;
break;
}
if(this_dist == INT_MAX)
continue; //not reachable
if(this_dist < closest) {
closest = this_dist;
best_edge = e;
}
}
if(best_edge == NULL) {
//unable to find a path...
printf("Should have been able to find a path from %d to %d, but couldent.\n", n->node_id, cur_node_id);
}
*cur_res = best_edge;
}
}
/*
we have our node edges, our all pairs shortest path
our graphs, and our MST edge list.
now we can run A*
- our metric should use the all pairs shortest path to
determine the value for h.
- We want to favor edges from the MST over newly created edges,
so we will give such edges a lower weight, maybe by 20%?
*/
}
+366
View File
@@ -0,0 +1,366 @@
/*
Father Nitwit's Fear Pathing File Maker Thing
Copyright (C) 2005 Father Nitwit (eqemu@8ass.com)
I'll release thisunder the GPL, even though I hate the GPL.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
This is a modified quadtree that stores a list of all
nodes reachable within a defined distance from the bounds
of that quadtree node. Therefor this distance should be
the maximum distance used to search for a node.
In case this distance is not big enough, we also store a
complete list of reachable nodes at each quadtree level, so
the root has all nodes for sure. This makes it possible to
garuntee that we can find A node which is closest.
*/
#include "quadtree.h"
#include "apathing.h"
#include "../zone/map.h"
//#define SPLIT_DEBUG
QTNode::QTNode(Map *_map, float dist2, float Tminx, float Tmaxx, float Tminy, float Tmaxy) {
node1 = NULL;
node2 = NULL;
node3 = NULL;
node4 = NULL;
minx = Tminx;
maxx = Tmaxx;
miny = Tminy;
maxy = Tmaxy;
map = _map;
search_dist2 = dist2; //this is a distance-squared
final = false;
buildVertexes();
}
QTNode::~QTNode() {
clearNodes();
}
void QTNode::clearNodes() {
if(node1 != NULL)
delete node1;
if(node2 != NULL)
delete node2;
if(node3 != NULL)
delete node3;
if(node4 != NULL)
delete node4;
node1 = NULL;
node2 = NULL;
node3 = NULL;
node4 = NULL;
}
//assumes that both supplied arrays are big enough per countQTNodes/Facelists
void QTNode::fillBlocks(PathTree_Struct *heads, PathPointRef *flist, unsigned long &hindex, unsigned long &findex) {
PathTree_Struct *head = &heads[hindex];
hindex++;
head->minx = minx;
head->maxx = maxx;
head->miny = miny;
head->maxy = maxy;
head->flags = 0;
//printf("Node %u: (%.2f -> %.2f, %.2f -> %.2f)\n", hindex-1, head->minx, head->maxx, head->miny, head->maxy);
//rearranged to give all QT nodes a node list
head->nodelist.count = nodes.size();
head->nodelist.offset = findex;
//printf(" Final node with %u nodes, list offset %lu.\n", head->nodes.count, head->nodes.offset);
list<PathNode *>::iterator curs,end;
curs = nodes.begin();
end = nodes.end();
for(; curs != end; curs++) {
//printf("Got to node index %d (0x%x)\n", findex, *curs);
PathNode *cur = *curs;
flist[findex] = cur->node_id;
findex++;
}
// findex += head->nodes.count;
if(final) {
head->flags |= pathNodeFinal;
} else {
head->flags = 0;
//branch node.
if(node1 != NULL) {
head->nodes[0] = hindex;
node1->fillBlocks(heads, flist, hindex, findex);
} else {
head->nodes[0] = PATH_NODE_NONE;
}
if(node2 != NULL) {
head->nodes[1] = hindex;
node2->fillBlocks(heads, flist, hindex, findex);
} else {
head->nodes[1] = PATH_NODE_NONE;
}
if(node3 != NULL) {
head->nodes[2] = hindex;
node3->fillBlocks(heads, flist, hindex, findex);
} else {
head->nodes[2] = PATH_NODE_NONE;
}
if(node4 != NULL) {
head->nodes[3] = hindex;
node4->fillBlocks(heads, flist, hindex, findex);
} else {
head->nodes[3] = PATH_NODE_NONE;
}
}
}
unsigned long QTNode::countQTNodes() const {
unsigned long c = 1;
if(node1 != NULL)
c += node1->countQTNodes();
if(node2 != NULL)
c += node2->countQTNodes();
if(node3 != NULL)
c += node3->countQTNodes();
if(node4 != NULL)
c += node4->countQTNodes();
return(c);
}
/*unsigned long QTNode::countNodes() const {
unsigned long c = nodes.size();
if(node1 != NULL)
c += node1->countNodes();
if(node2 != NULL)
c += node2->countNodes();
if(node3 != NULL)
c += node3->countNodes();
if(node4 != NULL)
c += node4->countNodes();
return(c);
}*/
unsigned long QTNode::countPathNodes() const {
// unsigned long c = final? nodes.size() : 0;
unsigned long c = nodes.size();
if(node1 != NULL)
c += node1->countPathNodes();
if(node2 != NULL)
c += node2->countPathNodes();
if(node3 != NULL)
c += node3->countPathNodes();
if(node4 != NULL)
c += node4->countPathNodes();
return(c);
}
void QTNode::divideYourself(int depth) {
// printf("Dividing in box (%.2f -> %.2f, %.2f -> %.2f) at depth %d with %d nodes.\n",
// minx, maxx, miny, maxy, depth, nodes.size());
unsigned long cc;
cc = nodes.size();
#ifdef MAX_QUADRENT_NODES
if(cc <= MAX_QUADRENT_NODES) {
#ifdef SPLIT_DEBUG
printf("Stopping (nodecount) on box (%.2f -> %.2f, %.2f -> %.2f) at depth %d with %d nodes.\n",
minx, maxx, miny, maxy, depth, cc);
#endif
final = true;
return;
}
#endif
#ifdef MIN_QUADRENT_SIZE
if((maxx - minx) < MIN_QUADRENT_SIZE || (maxy - miny) < MIN_QUADRENT_SIZE) {
#ifdef SPLIT_DEBUG
printf("Stopping on box (size) (%.2f -> %.2f, %.2f -> %.2f) at depth %d with %d nodes.\n",
minx, maxx, miny, maxy, depth, cc);
#endif
final = true;
return;
}
#endif
doSplit();
//get counts on our split
float c1, c2, c3, c4;
c1 = node1? node1->nodes.size() : 0;
c2 = node2? node2->nodes.size() : 0;
c3 = node3? node3->nodes.size() : 0;
c4 = node4? node4->nodes.size() : 0;
#ifdef MIN_QUADRENT_GAIN
int miss = 0;
float gain1 = 1.0 - c1 / cc;
float gain2 = 1.0 - c2 / cc;
float gain3 = 1.0 - c3 / cc;
float gain4 = 1.0 - c4 / cc;
//see how many missed the gain mark
if(gain1 < MIN_QUADRENT_GAIN)
miss++;
if(gain2 < MIN_QUADRENT_GAIN)
miss++;
if(gain3 < MIN_QUADRENT_GAIN)
miss++;
if(gain4 < MIN_QUADRENT_GAIN)
miss++;
if(miss > MAX_QUADRENT_MISSES) {
#ifdef SPLIT_DEBUG
printf("Stopping (gain) on box (%.2f -> %.2f, %.2f -> %.2f) at depth %d with %d nodes.\n",
minx, maxx, miny, maxy, depth, cc);
#endif
final = true;
return;
}
#endif
//if all nodes pass through all quadrents, then we are done
//partially obsoleted by gain test.
if(c1 == c2 && c1 == c3 && c1 == c4) {
#ifdef SPLIT_DEBUG
printf("Stopping (empty) on box (%.2f -> %.2f, %.2f -> %.2f) at depth %d with %d nodes.\n",
minx, maxx, miny, maxy, depth, cc);
printf("Our counts: %.3f, %.3f, %.3f, %.3f\n", c1, c2, c3, c4);
#endif
final = true;
return;
}
//there are prolly some more intelligent stopping criteria...
depth++;
if(node1 != NULL)
node1->divideYourself(depth);
if(node2 != NULL)
node2->divideYourself(depth);
if(node3 != NULL)
node3->divideYourself(depth);
if(node4 != NULL)
node4->divideYourself(depth);
}
void QTNode::buildVertexes() {
v[0].x = v[1].x = v[2].x = v[3].x = minx;
v[4].x = v[5].x = v[6].x = v[7].x = maxx;
v[0].y = v[1].y = v[4].y = v[5].y = miny;
v[2].y = v[3].y = v[6].y = v[7].y = maxy;
v[0].z = v[3].z = v[4].z = v[7].z = -999999;
v[1].z = v[2].z = v[5].z = v[6].z = 9999999;
}
bool QTNode::IsInNode(const QTNode *n, const PathNode *o) {
//printf("IIN: (%.3f,%.3f) in (%.3f -> %.3f, %.3f -> %.3f)\n", o->x, o->y, n->minx, n->maxx, n->miny, n->maxy);
if( o->x >= n->minx && o->x < n->maxx
&& o->y >= n->miny && o->y < n->maxy )
return(true);
//well its not inside the node, so see if it is reachable from it
//4 points of this node
GPoint pt1(n->minx, n->miny, 0),
pt2(n->minx, n->maxy, 0),
pt3(n->maxx, n->miny, 0),
pt4(n->maxx, n->maxy, 0);
if( o->Dist2(&pt1) < search_dist2
|| o->Dist2(&pt2) < search_dist2
|| o->Dist2(&pt3) < search_dist2
|| o->Dist2(&pt4) < search_dist2)
return(true);
//not inside, and not reachable...
return(false);
}
void QTNode::doSplit() {
//find midpoints...
float midx = minx + (maxx - minx) / 2.0;
float midy = miny + (maxy - miny) / 2.0;
//ordering following definitions in map.h
node1 = new QTNode(map, search_dist2, midx, maxx, midy, maxy);
node2 = new QTNode(map, search_dist2, minx, midx, midy, maxy);
node3 = new QTNode(map, search_dist2, minx, midx, miny, midy);
node4 = new QTNode(map, search_dist2, midx, maxx, miny, midy);
if(node1 == NULL || node2 == NULL || node3 == NULL || node4 == NULL) {
printf("Error: unable to allocate new QTNode, giving up.\n");
return;
}
// unsigned long l;
// l = faces.size();
// for(r = 0; r < l; r++) {
// PathNode *cur = faces[r];
list<PathNode *>::iterator curs,end;
curs = nodes.begin();
end = nodes.end();
for(; curs != end; curs++) {
PathNode *cur = *curs;
if(IsInNode(node1, cur))
node1->nodes.push_back(cur);
if(IsInNode(node2, cur))
node2->nodes.push_back(cur);
if(IsInNode(node3, cur))
node3->nodes.push_back(cur);
if(IsInNode(node4, cur))
node4->nodes.push_back(cur);
}
//clean up empty sets.
if(node1->nodes.size() == 0) {
delete node1;
node1 = NULL;
}
if(node2->nodes.size() == 0) {
delete node2;
node2 = NULL;
}
if(node3->nodes.size() == 0) {
delete node3;
node3 = NULL;
}
if(node4->nodes.size() == 0) {
delete node4;
node4 = NULL;
}
}
+88
View File
@@ -0,0 +1,88 @@
#ifndef FPQUADTREE_H
#define FPQUADTREE_H
//pull in datatypes from zone's map.h
#include "../zone/pathing.h"
#include "gpoint.h"
/*
Father Nitwit's Fear Pathing File Maker Thing
*/
#include <stdio.h>
#include <vector>
#include <list>
using namespace std;
#define COUNT_MACTHES 1
//this is the version number to put in the map header
#undef PATHFILE_VERSION //override this from fearpath.h with our version
#define PATHFILE_VERSION 0x02000000
//quadtree stopping criteria, comment any to disable them
//you want to keep the nodes small since the fear space is very sparse
#define MAX_QUADRENT_NODES 4 //if box has fewer than this, stop
#define MIN_QUADRENT_SIZE 50.0f //if box has a dimention smaller than this, stop
#define MIN_QUADRENT_GAIN 0.1f //minimum split ratio before stopping
#define MAX_QUADRENT_MISSES 2 //maximum number of quads which can miss their gains
//1 or 2 make sense, others are less useful
class PathNode;
class Map;
//quadtree node container
class QTNode {
public:
QTNode(Map *_map, float _dist2, float Tminx, float Tmaxx, float Tminy, float Tmaxy);
~QTNode();
void clearNodes();
void doSplit();
void divideYourself(int depth);
void buildVertexes();
unsigned long countQTNodes() const; //counts QT nodes
unsigned long countPathNodes() const; //counts PathNodes
void fillBlocks(PathTree_Struct *heads, PathPointRef *flist, unsigned long &hindex, unsigned long &findex);
float minx;
float miny;
float maxx;
float maxy;
unsigned long nnodes;
list<PathNode *> nodes;
bool IsInNode(const QTNode *n, const PathNode *o);
/*
quadrent definitions:
quad 1 (node1):
x>=0, y>=0
quad 2 (node2):
x<0, y>=0
quad 3 (node3):
x<0, y<0
quad 4 (node4):
x>=0, y<0
*/
QTNode *node1;
QTNode *node2;
QTNode *node3;
QTNode *node4;
GPoint v[8];
bool final;
Map *map;
float search_dist2;
};
#endif
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
#shortnames update...
#echo "SELECT short_name FROM zone" | ~/eqemu/runmysql -B|grep -v _ >shortnames
mkdir -p images
mkdir -p output
for f in `cat shortnames`
do
if [ -r "$f.path" ]; then
echo "We allready have $f's path file. Remove it to rebuild"
continue;
fi
echo
echo
echo "********************************************************************************"
echo "Building $f"
./apath "$f" | tee "output/$f.txt"
mv "paths-${f}-mstree.png" images/
done
+131
View File
@@ -0,0 +1,131 @@
airplane
akanon
arena
arena2
befallen
beholder
blackburrow
burningwood
butcher
cabeast
cabwest
cauldron
cazicthule
charasis
chardok
citymist
cobaltscar
commons
crushbone
crystal
cshome
dalnir
dreadlands
droga
eastkarana
eastwastes
ecommons
emeraldjungle
erudnext
erudnint
erudsxing
everfrost
fearplane
feerrott
felwithea
felwitheb
fieldofbone
firiona
freporte
freportn
freportw
frontiermtns
frozenshadow
gfaydark
greatdivide
growthplane
gukbottom
gukta
guktop
halas
hateplane
hateplaneb
highkeep
highpass
hole
iceclad
innothule
jaggedpine
kael
kaesora
kaladima
kaladimb
karnor
kedge
kerraridge
kithicor
kurn
lakeofillomen
lakerathe
lavastorm
lfaydark
load
load2
mischiefplane
mistmoore
misty
najena
necropolis
nektulos
neriaka
neriakb
neriakc
northkarana
nro
nurga
oasis
oggok
oot
overthere
paineel
paw
permafrost
qcat
qey2hh1
qeynos
qeynos2
qeytoqrg
qrg
rathemtn
rivervale
runnyeye
sebilis
sirens
skyfire
skyshrine
sleeper
soldunga
soldungb
soltemple
southkarana
sro
steamfont
stonebrunt
swampofnohope
templeveeshan
thurgadina
thurgadinb
timorous
tox
trakanon
tutorial
tutoriala
tutorialb
unrest
veeshan
veksar
velketor
wakening
warrens
warslikswood
westwastes
@@ -0,0 +1,32 @@
#! /usr/bin/perl -W
#reads the output of `objdump -D eqgame.exe` from stdin
#reads eqstr_us.txt from .
open(F, "<eqstr_us.txt") or die("Unable to open ./eqstr_us.txt\n");
%strs = ();
while(<F>) {
s/\r?\n//g;
next unless(/^([0-9]+)\s+(.+)$/);
$strs{$1} = $2;
}
close(F);
while(<STDIN>) {
if (/push\s+(.*)/) {
push(@stack,$1);
shift @stack if ($#stack>4);
}
#address of DisplayStringID
if (/ ([0-9a-f]+):.*call 0x5DFA00/i) {
my $loc = $1;
if($stack[$#stack] =~ /(0x[0-9a-fA-F]+)/) {
my $sid = hex($1);
if(defined($strs{$sid})) {
printf("%s Sends %s\n",$loc,$strs{$sid});
} else {
printf("%s Sends %s\n",$loc,"UNDEFINED STRING");
}
}
}
}
@@ -0,0 +1,17 @@
#!/usr/bin/perl
print "#include \"idc.idc\"\n\nstatic main() {\n";
print "\tauto id;\n";
print "\tDelEnum(GetEnum(\"EQOpcode\"));\n";
print "\tid = AddEnum(GetEnumQty(), \"EQOpcode\", 0);\n";
while(<>) {
next unless(/^(OP_[^= \t]+)=(0x[0-9a-fA-F]+)/);
next if($2 eq "0x0000" || hex($2) == 0);
printf("\tAddConstEx(id, \"$1\", $2, -1);\n");
}
print "}\n\n";
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/perl
do $ARGV[0];
print "#include \"idc.idc\"\n\nstatic main() {\n";
foreach my $sig(@signatures) {
my $off = $sig->{offset} + 0x00400000;
my $name = $sig->{name};
my $op = $sig->{opcode};
printf("MakeName(0x%x, \"${name}_0x%x\");\n", $off, $op);
}
print "}\n\n";
@@ -0,0 +1,20 @@
#!/usr/bin/perl
#reads the output of locate_stringids.pl from stdin
#produces a .IDC file on stdout which we can feed to IDA
print "#include \"idc.idc\"\n\nstatic main() {\n";
while(<>) {
s/\r?\n//g;
next unless(/^([0-9a-fA-F]+) Sends (.*)/);
next if(hex($1) == 0);
my $off = hex($1);
my $str = substr($2, 0, 200);
$str =~ s/"/\\"/g;
printf("\tMakeComm($off, \"$str\");\n");
}
print "}\n\n";
+75
View File
@@ -0,0 +1,75 @@
#ifndef __OPENEQ_THREED__
#define __OPENEQ_THREED__
#include "3d_base.hpp"
class Octree_Node;
class Bone {
public:
char *name;
int bone1, bone2;
float x, y, z;
float e[4];
float scale[3];
int vert_count;
int *verts;
};
class Zone_Model {
public:
Zone_Model() {}
~Zone_Model() {}
Vertex **verts;
Polygon **polys;
Octree_Node *octree;
Texture **tex;
int vert_count, poly_count, tex_count;
};
class MobModel {
public:
MobModel() {}
~MobModel() {}
Vertex **verts;
Polygon **polys;
Texture **tex;
int vert_count, poly_count, tex_count;
Bone *bones;
int bone_count;
};
class Content_3D {
public:
Content_3D() { this->mob_model_count = 0; this->mob_count = 0; }
~Content_3D() {}
Model *GetModel(char *model_name);
void GenerateOctree();
void MergeTextures();
void MergeTexturesLazy();
Zone_Model *zone_model;
Model **models;
Placeable **placeable;
int model_count, plac_count; // Count of placeable object models and count of instances
MobModel **mob_models;
Placeable **mob_locs;
int mob_model_count, mob_count;
};
#endif
+73
View File
@@ -0,0 +1,73 @@
#ifndef __OPENEQ_THREED_BASE__
#define __OPENEQ_THREED_BASE__
#pragma pack(1)
#include "archive.hpp"
struct Light {
float x, y, z;
float r, g, b;
float rad;
} typedef Light;
struct Vertex {
float x, y, z;
float i, j, k;
float u, v;
int bone;
} typedef Vertex;
struct Polygon {
int flags;
int v1, v2, v3;
int tex;
} typedef Polygon;
struct Texture {
Archive *archive;
char frame_count;
char current_frame;
uint32 *tex;
char **filenames;
char flags;
} typedef Texture;
class Model {
public:
Model() {}
~Model() {}
Vertex **verts;
Polygon **polys;
Texture **tex;
int vert_count, poly_count, tex_count;
char *name;
};
class Placeable {
public:
float x, y, z;
float rx, ry, rz;
float scale[3];
int model;
char rendered;
Vertex bounds[8];
void CalculateBoundaries(Model *model);
};
#pragma pack()
#endif
+146
View File
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Azone"
ProjectGUID="{64F17C8F-6D9A-42E9-B2CE-DA5073885E72}"
RootNamespace="Azone"
Keyword="ManagedCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
ManagedExtensions="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG"
MinimalRebuild="FALSE"
BasicRuntimeChecks="0"
RuntimeLibrary="1"
WarningLevel="3"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="zlib.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
LinkIncremental="2"
IgnoreDefaultLibraryNames="MSVCRT"
GenerateDebugInformation="TRUE"
AssemblyDebug="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
ManagedExtensions="FALSE">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG"
MinimalRebuild="FALSE"
RuntimeLibrary="0"
WarningLevel="3"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\azone.cpp">
</File>
<File
RelativePath=".\s3d.c">
</File>
<File
RelativePath=".\wld.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\azone.h">
</File>
<File
RelativePath=".\s3d.h">
</File>
<File
RelativePath=".\types.h">
</File>
<File
RelativePath=".\wld.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
+24
View File
@@ -0,0 +1,24 @@
Father Nitwit's Zone file converter
purpose: convert 23d files into .map files for LOS
If there are any 3d math folks reading this who know how to figure out
if a 3d triangle passes through a 3d, infinitely tall box (bounded x,y),
please let me know. The code in the converter dosent work right now, and
has been 'commented' out with the return on line 717 of azone.cpp
This does not work on windows, if you get it working, please let me know how.
You need to use a unix box to convert your map files, then the .maps should work
on your windows server.
how to use it:
built it with make
upload your s3d files into a directory.
You do not need the _obj or _chr files, just the zone.s3d files.
copy the azone binary to that directory.
run it on each map file:
example: converting gfaydark
./azone gfaydark
this will read gfaydark.s3d and produce gfaydark.map
put these map files into Maps/ in your eqemu running directory.
+32
View File
@@ -0,0 +1,32 @@
#ifndef __OPENEQ_ARCHIVE_API__
#define __OPENEQ_ARCHIVE_API__
#include "global.hpp"
#include <stdio.h>
class Archive {
public:
Archive() {}
virtual ~Archive() {}
virtual int Open(FILE *fp) = 0;
virtual int Close() = 0;
virtual int GetFile(char *name, uchar **buf, int *len) = 0;
virtual const char *FindExtension(const char *ext) = 0;
char **filenames;
int count;
protected:
uchar *buffer;
int buf_len;
int status;
uint32 *files;
FILE *fp;
};
#endif
+362
View File
@@ -0,0 +1,362 @@
/*
Father Nitwit's Zone to map conversion program.
Copyright (C) 2004 Father Nitwit (eqemu@8ass.com)
This thing uses code from freaku, so whatever license that comes under
is relavent, if you care.
the rest of it is GPL, even though I hate the GPL.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef short SHORT;
typedef unsigned long DWORD;
#include <stdio.h>
#include <string.h>
#include <math.h>
//#include "EQWldData.h"
#include "awater.h"
#include "types.h"
#include "s3d.h"
#include "wld.h"
#include "archive.hpp"
#include "pfs.hpp"
#include "file_loader.hpp"
#include "zon.hpp"
#include "ter.hpp"
//this un-commented works with my map.cpp code correctly.
//with both of my inverts there commented.
#define INVERSEXY 1
#include <vector>
#include <map>
using namespace std;
//#define SPLIT_DEBUG
bool BuildWaterMap(const char *shortname, long DefaultRegionType);
void PrintBSP(BSP_Node *tree, long node_number);
long BSPFindRegion(BSP_Node *tree, long node_number, long region);
long BSPFindNode(BSP_Node *tree, long node_number, float x, float y, float z);
long BSPMarkRegion(BSP_Node *tree, long node_number, long region, int region_type);
long BSPCountNodes(BSP_Node *tree, long node_number);
int main(int argc, char *argv[]) {
long DefaultRegionType=RegionTypeWater;
if((argc < 2) ||
(argc > 3) ||
((argc == 3)&&(strcasecmp(argv[1],"-dl")))) {
printf("Usage: %s [-dl] (zone short name) to generate a water/lava map\n\n", argv[0]);
printf(" -dl = mark special regions as lava if not tagged in .WLD\n");
printf("\nIf -dl is omitted, untagged special regions will be marked as water\n");
return(1);
}
char bufm[250];
if(argc==3)
DefaultRegionType=RegionTypeLava;
sprintf(bufm, "%s.wtr", argv[argc-1]);
if(!BuildWaterMap(argv[argc-1],DefaultRegionType))
return(1);
return(0);
}
bool BuildWaterMap(const char *shortname, long DefaultRegionType) {
// char bufm[96];
char bufs[96], bufw[96];
long WaterOrLavaCount = 0;
//TODO: clean up a LOT of memory that the freaku code does not
// sprintf(bufm, "%s.map", shortname);
sprintf(bufs, "%s.s3d", shortname);
sprintf(bufw, "%s.wld", shortname);
s3d_object s3d/*, s3d_obj, s3d_chr*/;
wld_object wld/*, wld2, wld_obj, wld_chr*/;
unsigned char *buf;
FILE *s3df = fopen(bufs, "rb");
if(s3df == NULL) {
// One day we may try EQG, but not today.
printf("Unable to open s3d file '%s'.\n", bufs);
return(false);
}
printf("Loading %s...\n", bufs);
S3D_Init(&s3d, s3df);
S3D_GetFile(&s3d, bufw, &buf);
WLD_Init(&wld, buf, &s3d, 1);
BSP_Node *tree = NULL;
struct_Data29 *data29;
for(int i=0; i<wld.fragCount; i++) {
if(wld.frags[i]->type == 0x21) {
printf("We have a type 0x21 fragment\n");
tree = (BSP_Node *) wld.frags[i]->frag;
}
if(wld.frags[i]->type == 0x29) {
printf("We have a type 0x29 fragment. ");
data29 = (struct_Data29 *) wld.frags[i]->frag;
printf("It has %ld regions and is marked as type %d. ",
data29->region_count, data29->region_type);
switch(data29->region_type) {
case RegionTypeUnsupported: { printf("Unsupported\n"); break; }
case RegionTypeUntagged: {
printf("Untagged. We will set it to ");
if(DefaultRegionType==RegionTypeWater) {
printf("Water\n");
} else printf("Lava\n");
data29->region_type = DefaultRegionType;
WaterOrLavaCount++;
break;
}
case RegionTypeWater: { printf("Water\n"); WaterOrLavaCount++; break; }
case RegionTypeLava: { printf("Lava\n"); WaterOrLavaCount++; break; }
case RegionTypeZoneLine: { printf("Zoneline\n"); break; }
default: printf("UNKNOWN\n");
}
}
}
if(tree==NULL) {
printf("No BSP Tree. Bailing out\n");
return(false);
}
if(WaterOrLavaCount==0) {
printf("No water or lava in this zone. Nothing for us to do.\n");
return(false);
}
long BSPTreeSize = BSPCountNodes(tree, 1);
printf("There are %ld nodes in the BSP tree\n", BSPTreeSize);
// Now we mark each leaf in the BSP tree that is in a 'special area' with what type the area is
// Water, Lava, Zoneline etc
for(int i=0; i<wld.fragCount; i++) {
if(wld.frags[i]->type == 0x29) {
data29 = (struct_Data29 *) wld.frags[i]->frag;
for(long j=0; j<data29->region_count; j++) {
BSPMarkRegion(tree, 1,data29->region_array[j]+1, data29->region_type);
}
}
}
// Now write out the file
char bufm[250];
sprintf(bufm, "%s.wtr", shortname);
FILE *WaterFile = fopen(bufm, "wb");
if(WaterFile == NULL) {
printf("Failed to open %s for writing\n", bufm);
return(false);
}
const char *WFMagic = "EQEMUWATER";
const long WFVersion = 1;
if(fwrite(WFMagic, strlen(WFMagic), 1, WaterFile) != 1) {
printf("Error writing output file\n");
fclose(WaterFile);
return(false);
}
if(fwrite(&WFVersion, sizeof(WFVersion), 1, WaterFile) != 1) {
printf("Error writing output file\n");
fclose(WaterFile);
return(false);
}
if(fwrite(&BSPTreeSize, sizeof(BSPTreeSize), 1, WaterFile) != 1) {
printf("Error writing output file\n");
fclose(WaterFile);
return(false);
}
if(fwrite(tree, sizeof(BSP_Node), BSPTreeSize, WaterFile) != BSPTreeSize) {
printf("Error writing output file\n");
fclose(WaterFile);
return(false);
}
fclose(WaterFile);
return(true);
}
void PrintBSP(BSP_Node *tree, long node_number) {
printf("Node %ld, Left=%ld, Right=%ld\n",
node_number-1,
tree[node_number-1].left,
tree[node_number-1].right);
printf("Normals are %4.3f, %4.3f, %4.3f, SplitD is %4.3f\n",
tree[node_number-1].normal[0],
tree[node_number-1].normal[1],
tree[node_number-1].normal[2],
tree[node_number-1].splitdistance);
if(tree[node_number-1].left!=0) PrintBSP(tree, tree[node_number-1].left);
if(tree[node_number-1].right!=0) PrintBSP(tree, tree[node_number-1].right);
if((tree[node_number-1].left==0)&&
(tree[node_number-1].right==0)) {
printf("Region pointer is %ld\n", tree[node_number-1].region);
}
}
long BSPCountNodes(BSP_Node *tree, long node_number) {
long NodesInRightBranch = 0, NodesInLeftBranch = 0;
if((tree[node_number-1].left==0)&&
(tree[node_number-1].right==0)) return 1;
if(tree[node_number-1].left!=0) NodesInLeftBranch = BSPCountNodes(tree, (tree[node_number-1].left));
if(tree[node_number-1].right!=0) NodesInRightBranch = BSPCountNodes(tree, (tree[node_number-1].right));
return(NodesInRightBranch + NodesInLeftBranch + 1);
}
long BSPFindRegion(BSP_Node *tree, long node_number, long region) {
//printf("Find Region %ld in node %ld\n", region, node_number);
if(node_number<1) {
printf("Something went wrong\n");
exit(1);
}
if((tree[node_number-1].left==0)&&
(tree[node_number-1].right==0)) {
if(tree[node_number-1].region==region) return node_number;
}
long retnode ;
if(tree[node_number-1].left!=0) {
retnode = BSPFindRegion(tree, tree[node_number-1].left, region);
if(retnode != 0) return retnode ;
}
if(tree[node_number-1].right!=0) {
return BSPFindRegion(tree, tree[node_number-1].right, region);
}
return 0;
}
long BSPFindNode(BSP_Node *tree, long node_number, float x, float y, float z) {
float distance;
printf("BSP Find Node, currently in Node %ld\n", node_number);
// Are we at a leaf
if((tree[node_number-1].left==0)&&
(tree[node_number-1].right==0)) {
return tree[node_number-1].region;
}
// No, so determine which side of the split plane we are on
//
distance = (x * tree[node_number-1].normal[0]) +
(y * tree[node_number-1].normal[1]) +
(z * tree[node_number-1].normal[2]) +
tree[node_number-1].splitdistance;
printf("Distance is %4.3f\n", distance);
// Guess which side to go down
if(distance == 0.0f) {
printf("Distance is 0, don't know what to do!\n");
exit(1);
}
if(distance >0.0f) {
if(tree[node_number-1].left==0) {
printf("Pos and no left node, abort!\n");
exit(1);
}
return BSPFindNode(tree, tree[node_number-1].left,
x, y, z);
}
if(tree[node_number-1].right==0) {
printf("Neg and no right node, abort!\n");
exit(1);
}
return BSPFindNode(tree, tree[node_number-1].right,
x, y, z);
}
long BSPMarkRegion(BSP_Node *tree, long node_number, long region, int region_type) {
//printf("Find Region %ld in node %ld\n", region, node_number);
if(node_number<1) {
printf("Something went wrong\n");
exit(1);
}
if((tree[node_number-1].left==0)&&
(tree[node_number-1].right==0)) {
if(tree[node_number-1].region==region) {
tree[node_number-1].special=region_type;
return node_number;
}
}
long retnode ;
if(tree[node_number-1].left!=0) {
retnode = BSPMarkRegion(tree, tree[node_number-1].left, region, region_type);
if(retnode != 0) return retnode ;
}
if(tree[node_number-1].right!=0) {
return BSPMarkRegion(tree, tree[node_number-1].right, region, region_type);
}
return 0;
}
+10
View File
@@ -0,0 +1,10 @@
typedef enum {
RegionTypeUnsupported = -2,
RegionTypeUntagged = -1,
RegionTypeNormal = 0,
RegionTypeWater = 1,
RegionTypeLava = 2,
RegionTypeZoneLine = 3
} WaterRegionType;
File diff suppressed because it is too large Load Diff
+192
View File
@@ -0,0 +1,192 @@
#ifndef AZONE_H
#define AZONE_H
//pull in datatypes from zone's map.h
#include "../../zone/map.h"
/*
Father Nitwit's zone to map file converter.
*/
#include <stdio.h>
#include <vector>
#include <map>
using namespace std;
#define COUNT_MACTHES 1
//this is the version number to put in the map header
#undef MAP_VERSION //override this from map.h with our version
#define MAP_VERSION 0x01000000
//quadtree stopping criteria, comment any to disable them
#define MAX_QUADRENT_FACES 50 //if box has fewer than this, stop
#define MIN_QUADRENT_SIZE 100.0f //if box has a dimention smaller than this, stop
#define MIN_QUADRENT_GAIN 0.3f //minimum split ratio before stopping
#define MAX_QUADRENT_MISSES 2 //maximum number of quads which can miss their gains
//1 or 2 make sense, others are less useful
//attepmt to trim the data a little
#define MAX_Z 3000.0 //seems to be a lot of points above this
//if all points on poly are, kill it.
/*
This is used for the recursive node structure
unsigned shorts are adequate because, worst case
even in a zone that is 6000x6000 with a small node
size of 30x30, there are only 40000 nodes.
quadrent definitions:
quad 1 (nodes[0]):
x>=0, y>=0
quad 2 (nodes[1]):
x<0, y>=0
quad 3 (nodes[2]):
x<0, y<0
quad 4 (nodes[3]):
x>=0, y<0
*/
#define MAX_POLY_VTX 24 //arbitrary, im too lazy to figure it out
//cut a triangle at most 6 times....
struct POLYGON {
VERTEX /*w[MAX_POLY_VTX], */c[MAX_POLY_VTX];
int count; // w is world points, c is for camera points
};
class GPoint {
public:
GPoint();
GPoint(VERTEX &v);
GPoint(float x, float y, float z);
inline void operator()(float nx, float ny, float nz) { x = nx; y = ny; z = nz; }
GPoint cross(const GPoint &them) const;
float dot3(const GPoint &them) const;
float x;
float y;
float z;
};
GPoint operator-(const GPoint &v1, const GPoint &v2);
class GVector : public GPoint {
public:
GVector();
GVector(const GPoint &them);
GVector(float x, float y, float z, float w = 1.0f);
inline void operator()(float nx, float ny, float nz, float nw) { x = nx; y = ny; z = nz; W = nw; }
float dot4(const GVector &them) const;
float dot4(const GPoint &them) const;
void normalize();
float length();
float W;
};
struct FaceRecord {
FACE *face;
unsigned long index;
};
class QTNode;
class QTBuilder {
public:
QTBuilder();
~QTBuilder();
bool build(const char *shortname);
bool build_eqg(const char *shortname);
bool writeMap(const char *file);
bool FaceInNode(const QTNode *q, const FACE *f);
protected:
void AddFace(VERTEX &v1, VERTEX &v2, VERTEX &v3);
int ClipPolygon(POLYGON *poly, GVector *plane);
//dynamic during load
// vector<VERTEX> _VertexList;
vector<FACE> _FaceList;
//static once loaded
// unsigned long vertexCount;
unsigned long faceCount;
// VERTEX * vertexBlock;
FACE * faceBlock;
VERTEX tempvtx[MAX_POLY_VTX];
QTNode *_root;
static void NormalizeN(FACE *p);
#ifdef COUNT_MACTHES
unsigned long gEasyMatches;
unsigned long gEasyExcludes;
unsigned long gHardMatches;
unsigned long gHardExcludes;
#endif
};
//quadtree node container
class QTNode {
public:
QTNode(QTBuilder *builder, float Tminx, float Tmaxx, float Tminy, float Tmaxy);
~QTNode();
void clearNodes();
void doSplit();
void divideYourself(int depth);
void buildVertexes();
// bool writeFile(FILE *out);
unsigned long countNodes() const;
unsigned long countFacelists() const;
void fillBlocks(nodeHeader *heads, unsigned long *flist, unsigned long &hindex, unsigned long &findex);
float minx;
float miny;
float maxx;
float maxy;
unsigned long nfaces;
vector<FaceRecord> faces;
/*
quadrent definitions:
quad 1 (node1):
x>=0, y>=0
quad 2 (node2):
x<0, y>=0
quad 3 (node3):
x<0, y<0
quad 4 (node4):
x>=0, y<0
*/
QTNode *node1;
QTNode *node2;
QTNode *node3;
QTNode *node4;
GPoint v[8];
bool final;
protected:
QTBuilder *builder;
};
#endif
+31
View File
@@ -0,0 +1,31 @@
#include <stdio.h>
#include <string.h>
#include "file.hpp"
int GetFile(uchar **buffer, int *buf_len, char *base_path, char *file_name, Archive *archive) {
FILE *fp;
char *temp;
if(base_path) {
temp = new char[strlen(base_path) + strlen(file_name) + 2];
sprintf(temp, "%s/%s", base_path, file_name);
fp = fopen(temp, "rb");
delete[] temp;
if(!fp)
return 0;
fseek(fp, 0, SEEK_END);
*buf_len = ftell(fp);
fseek(fp, 0, SEEK_SET);
*buffer = new uchar[*buf_len];
fread(*buffer, 1, *buf_len, fp);
fclose(fp);
return 1;
}
else
return archive->GetFile(file_name, buffer, buf_len);
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef __OPENEQ_FILE__
#define __OPENEQ_FILE__
#include "archive.hpp"
int GetFile(uchar **buffer, int *buf_len, char *base_path, char *file_name, Archive *archive);
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef __OPENEQ_FL_API__
#define __OPENEQ_FL_API__
#include "archive.hpp"
#include "3d.hpp"
class FileLoader {
public:
FileLoader() {}
virtual ~FileLoader() {}
virtual int Open(char *base_path, char *zone_name, Archive *archive) = 0;
virtual int Close() = 0;
Content_3D model_data;
protected:
uchar *buffer;
int buf_len;
Archive *archive;
int status;
};
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef __OPENEQ_GLOBALS__
#define __OPENEQ_GLOBALS__
#ifdef WIN32
//#include <winsock.h>
#else
#include <netinet/in.h>
#endif
#ifndef NULL
#define NULL 0
#endif
typedef unsigned long uint32;
typedef long int32;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned char uint8;
typedef unsigned char uchar;
typedef char int8;
#endif
+43
View File
@@ -0,0 +1,43 @@
#ifndef __OPENEQ_OCTREE__
#define __OPENEQ_OCTREE__
#ifdef WIN32
#define Polygon Polygon_win32
#include <windows.h>
#undef Polygon
#endif
#include "3d_base.hpp"
class Octree_Node {
public:
Octree_Node();
Octree_Node(int poly_count, Polygon **polys, Vertex **verts, int plac_count, Placeable **plac);
Octree_Node(int poly_count, Polygon **polys, Vertex **verts, int plac_count, Placeable **plac, float min[3], float max[3]);
~Octree_Node();
void FindMinMax();
void Split(char level);
float min[3], max[3];
float x, y, z, size, sizes[3];
int poly_count;
Vertex **verts;
Polygon **polys;
int plac_count;
Placeable **plac;
GLuint li;
Octree_Node *nodes[8];
};
#define in_box(obj, x, y, z) \
( \
(x) >= (obj)->min[0] && (x) <= (obj)->max[0] && \
(y) >= (obj)->min[1] && (y) <= (obj)->max[1] &&\
(z) >= (obj)->min[2] && (z) <= (obj)->max[2] \
)
#endif
+222
View File
@@ -0,0 +1,222 @@
#include <string.h>
#include <zlib.h>
#include "pfs.hpp"
#ifdef WIN32
#include <winsock.h>
#endif
#pragma pack(1)
struct struct_header {
uint32 offset;
char magicCookie[4];
uint32 unknown;
} typedef struct_header;
struct struct_directory_header {
uint32 count;
} typedef struct_directory_header;
struct struct_directory {
uint32 crc, offset, size;
} typedef struct_directory;
struct struct_data_block {
uint32 deflen, inflen;
} typedef struct_data_block;
struct struct_fn_header {
uint32 fncount;
} typedef struct_fn_header;
struct struct_fn_entry {
uint32 fnlen;
} typedef struct_fn_entry;
#pragma pack()
inline void decompress(char *p, char *p2, int len, int uLen) {
int status;
z_stream d_stream;
d_stream.zalloc = (alloc_func)0;
d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
d_stream.next_in = (Bytef *) p;
d_stream.avail_in = len;
d_stream.next_out = (Bytef *) p2;
d_stream.avail_out = uLen;
inflateInit(&d_stream);
status = inflate(&d_stream, Z_NO_FLUSH);
inflateEnd(&d_stream);
}
inline void Lower(char *str) {
while(*str) {
if(*str >= 'A' && *str <= 'Z')
*str += 'a' - 'A';
++str;
}
}
PFSLoader::PFSLoader() {
// Set the status of the loader that nothing is loaded.
this->buffer = NULL;
this->buf_len = -1;
this->status = 0;
}
PFSLoader::~PFSLoader() {
this->Close();
}
int PFSLoader::Open(FILE *fp) {
struct_header s3d_header;
struct_directory_header s3d_dir_header;
struct_directory s3d_dir;
struct_data_block s3d_data;
struct_fn_header *s3d_fn_header;
struct_fn_entry *s3d_fn_entry;
uint32 *offsets;
char *temp, *temp2;
int i, j, pos, inf, tmp, running = 0;
fread(&s3d_header, sizeof(struct_header), 1, fp);
if(s3d_header.magicCookie[0] != 'P' || s3d_header.magicCookie[1] != 'F' || s3d_header.magicCookie[2] != 'S' || s3d_header.magicCookie[3] != ' ')
return 0;
this->fp = fp;
fseek(fp, s3d_header.offset, SEEK_SET);
fread(&s3d_dir_header, sizeof(struct_directory_header), 1, fp);
this->count = s3d_dir_header.count - 1;
this->filenames = new char *[s3d_dir_header.count];
this->files = new uint32[s3d_dir_header.count - 1];
offsets = new uint32[s3d_dir_header.count - 1];
for(i = 0; i < (int)s3d_dir_header.count; ++i) {
fread(&s3d_dir, sizeof(struct_directory), 1, fp);
if(s3d_dir.crc == ntohl(0xC90A5861)) {
pos = ftell(fp);
fseek(fp, s3d_dir.offset, SEEK_SET);
temp = new char[s3d_dir.size];
memset(temp, 0, s3d_dir.size);
inf = 0;
while(inf < (int)s3d_dir.size) {
fread(&s3d_data, sizeof(struct_data_block), 1, fp);
temp2 = new char[s3d_data.deflen];
fread(temp2, s3d_data.deflen, 1, fp);
decompress(temp2, temp + inf, s3d_data.deflen, s3d_data.inflen);
delete[] temp2;
inf += s3d_data.inflen;
}
fseek(fp, pos, SEEK_SET);
s3d_fn_header = (struct_fn_header *) temp;
pos = sizeof(struct_fn_header);
for(j = 0; j < (int)s3d_fn_header->fncount; ++j) {
s3d_fn_entry = (struct_fn_entry *) &temp[pos];
this->filenames[j] = new char[s3d_fn_entry->fnlen + 1];
this->filenames[j][s3d_fn_entry->fnlen] = 0;
memcpy(this->filenames[j], &temp[pos + sizeof(struct_fn_entry)], s3d_fn_entry->fnlen);
pos += sizeof(struct_fn_entry) + s3d_fn_entry->fnlen;
}
}
else {
this->files[running] = ftell(fp) - 12;
offsets[running] = s3d_dir.offset;
++running;
}
}
for(i = s3d_dir_header.count - 2; i > 0; i--) {
for(j = 0; j < i; j++) {
if(offsets[j] > offsets[j+1]) {
tmp = offsets[j];
offsets[j] = offsets[j + 1];
offsets[j + 1] = tmp;
tmp = this->files[j];
this->files[j] = this->files[j + 1];
this->files[j + 1] = tmp;
}
}
}
return 1;
}
int PFSLoader::Close() {
if(this->status) {
while(this->count > 0) {
delete this->filenames[this->count - 1];
--this->count;
}
delete[] this->filenames;
delete[] this->files;
}
else
return 0;
this->buffer = NULL;
this->buf_len = -1;
this->status = 0;
return 1;
}
const char *PFSLoader::FindExtension(const char *ext) {
int i;
int elen = strlen(ext);
for(i = 0; i < this->count; ++i) {
//printf("Look for %s: got %s\n", ext, this->filenames[i]);
int flen = strlen(this->filenames[i]);
if(flen <= elen)
continue;
if(!strcmp(this->filenames[i]+(flen-elen), ext))
return(this->filenames[i]);
}
return(NULL);
}
int PFSLoader::GetFile(char *name, uchar **buf, int *len) {
struct_directory s3d_dir;
struct_data_block s3d_data;
char *temp2;
long inf;
int i;
Lower(name);
for(i = 0; i < this->count; ++i) {
//printf("Look for %s: got %s\n", name, this->filenames[i]);
if(!strcmp(this->filenames[i], name)) {
fseek(this->fp, this->files[i], SEEK_SET);
fread(&s3d_dir, sizeof(struct_directory), 1, this->fp);
fseek(this->fp, s3d_dir.offset, SEEK_SET);
*buf = new uchar[s3d_dir.size];
inf = 0;
while(inf < (int)s3d_dir.size) {
fread(&s3d_data, sizeof(struct_data_block), 1, this->fp);
temp2 = new char[s3d_data.deflen];
fread(temp2, s3d_data.deflen, 1, this->fp);
decompress(temp2, (char *) *buf + inf, s3d_data.deflen, s3d_data.inflen);
delete[] temp2;
inf += s3d_data.inflen;
}
*len = inf;
return 1;
}
}
return 0;
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef __OPENEQ_PFS__
#define __OPENEQ_PFS__
#include <stdio.h>
#include "global.hpp"
#include "archive.hpp"
class PFSLoader : public Archive {
public:
PFSLoader();
~PFSLoader();
virtual int Open(FILE *fp);
virtual int Close();
virtual int GetFile(char *name, uchar **buf, int *len);
virtual const char *FindExtension(const char *ext);
};
#endif
+136
View File
@@ -0,0 +1,136 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
#include "s3d.h"
void decompress(char *p, char *p2, int len, int uLen) {
int status;
z_stream d_stream;
d_stream.zalloc = (alloc_func)0;
d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
d_stream.next_in = p;
d_stream.avail_in = len;
d_stream.next_out = p2;
d_stream.avail_out = uLen;
inflateInit(&d_stream);
status = inflate(&d_stream, Z_NO_FLUSH);
inflateEnd(&d_stream);
}
int S3D_Init(s3d_object *obj, FILE *fp) {
struct_header s3d_header;
struct_directory_header s3d_dir_header;
struct_directory s3d_dir;
struct_data_block s3d_data;
struct_fn_header *s3d_fn_header;
struct_fn_entry *s3d_fn_entry;
uint32 *offsets;
char *temp, *temp2;
int i, j, pos, inf, tmp, running = 0;
obj->fp = fp;
fread(&s3d_header, sizeof(struct_header), 1, fp);
if(s3d_header.magicCookie[0] != 'P' || s3d_header.magicCookie[1] != 'F' || s3d_header.magicCookie[2] != 'S' || s3d_header.magicCookie[3] != ' ')
return -1;
fseek(fp, s3d_header.offset, SEEK_SET);
fread(&s3d_dir_header, sizeof(struct_directory_header), 1, fp);
obj->count = s3d_dir_header.count;
obj->filenames = (char **) malloc(s3d_dir_header.count * sizeof(char *));
obj->files = (uint32 *) malloc((s3d_dir_header.count - 1) * sizeof(uint32));
offsets = (uint32 *) malloc((s3d_dir_header.count - 1) * sizeof(uint32));
for(i = 0; i < s3d_dir_header.count; ++i) {
fread(&s3d_dir, sizeof(struct_directory), 1, fp);
if(s3d_dir.crc == 0x61580AC9) {
pos = ftell(fp);
fseek(fp, s3d_dir.offset, SEEK_SET);
temp = (char *) malloc(s3d_dir.size);
memset(temp, 0, s3d_dir.size);
inf = 0;
while(inf < s3d_dir.size) {
fread(&s3d_data, sizeof(struct_data_block), 1, fp);
temp2 = (char *) malloc(s3d_data.deflen);
fread(temp2, s3d_data.deflen, 1, fp);
decompress(temp2, temp + inf, s3d_data.deflen, s3d_data.inflen);
free(temp2);
inf += s3d_data.inflen;
}
fseek(fp, pos, SEEK_SET);
s3d_fn_header = (struct_fn_header *) temp;
pos = sizeof(struct_fn_header);
for(j = 0; j < s3d_fn_header->fncount; ++j) {
s3d_fn_entry = (struct_fn_entry *) &temp[pos];
obj->filenames[j] = (char *) malloc(s3d_fn_entry->fnlen + 1);
obj->filenames[j][s3d_fn_entry->fnlen] = 0;
memcpy(obj->filenames[j], &temp[pos + sizeof(struct_fn_entry)], s3d_fn_entry->fnlen);
pos += sizeof(struct_fn_entry) + s3d_fn_entry->fnlen;
}
}
else {
obj->files[running] = ftell(fp) - 12;
offsets[running] = s3d_dir.offset;
++running;
}
}
for(i = s3d_dir_header.count - 2; i > 0; i--) {
for(j = 0; j < i; j++) {
if(offsets[j] > offsets[j+1]) {
tmp = offsets[j];
offsets[j] = offsets[j + 1];
offsets[j + 1] = tmp;
tmp = obj->files[j];
obj->files[j] = obj->files[j + 1];
obj->files[j + 1] = tmp;
}
}
}
return 0;
}
size_t S3D_GetFile(s3d_object *obj, char *filename, uchar **out) {
struct_directory s3d_dir;
struct_data_block s3d_data;
uchar *buf;
char *temp2;
long inf;
int i;
for(i = 0; i < obj->count; ++i) {
if(!strcmp(obj->filenames[i], filename)) {
fseek(obj->fp, obj->files[i], SEEK_SET);
fread(&s3d_dir, sizeof(struct_directory), 1, obj->fp);
fseek(obj->fp, s3d_dir.offset, SEEK_SET);
buf = (uchar *) malloc(s3d_dir.size);
inf = 0;
while(inf < s3d_dir.size) {
fread(&s3d_data, sizeof(struct_data_block), 1, obj->fp);
temp2 = (char *) malloc(s3d_data.deflen);
fread(temp2, s3d_data.deflen, 1, obj->fp);
decompress(temp2, (char *) buf + inf, s3d_data.deflen, s3d_data.inflen);
free(temp2);
inf += s3d_data.inflen;
}
*out = buf;
return inf;
}
}
return -1;
}
+51
View File
@@ -0,0 +1,51 @@
#ifndef __EQCLIENT_S3D_H_
#define __EQCLIENT_S3D_H_
#include <stdio.h>
#include "types.h"
typedef struct struct_header {
uint32 offset;
char magicCookie[4];
uint32 unknown;
} struct_header;
typedef struct struct_directory_header {
uint32 count;
} struct_directory_header;
typedef struct struct_directory {
uint32 crc, offset, size;
} struct_directory;
typedef struct struct_data_block {
uint32 deflen, inflen;
} struct_data_block;
typedef struct struct_fn_header {
uint32 fncount;
} struct_fn_header;
typedef struct struct_fn_entry {
uint32 fnlen;
} struct_fn_entry;
typedef struct s3d_object {
FILE *fp;
long count;
char **filenames;
uint32 *files;
} s3d_object;
#ifdef __cplusplus
extern "C" {
#endif
int S3D_Init(s3d_object *obj, FILE *fp);
size_t S3D_GetFile(s3d_object *obj, char *filename, uchar **out);
#ifdef __cplusplus
}
#endif
#endif
+413
View File
@@ -0,0 +1,413 @@
#include <stdio.h>
#ifdef WIN32 //vc++ chokes here without this
#include <string>
#else
#include <string.h>
#endif
#include <stdlib.h>
#include <iostream>
#include "file.hpp"
#include "ter.hpp"
using namespace std;
TERLoader::TERLoader() {
this->buffer = NULL;
this->buf_len = -1;
this->archive = NULL;
this->status = 0;
}
TERLoader::~TERLoader() {
this->Close();
}
void build_hex_line(const char *buffer, unsigned long length, unsigned long offset, char *out_buffer, unsigned char padding)
{
char *ptr=out_buffer;
int i;
char printable[17];
ptr+=sprintf(ptr,"%0*i:",padding,offset);
for(i=0;i<16; i++) {
if (i==8) {
strcpy(ptr," -");
ptr+=2;
}
if (i+offset < length) {
unsigned char c=*(const unsigned char *)(buffer+offset+i);
ptr+=sprintf(ptr," %02x",c);
printable[i]=isprint(c) ? c : '.';
} else {
ptr+=sprintf(ptr," ");
printable[i]=0;
}
}
sprintf(ptr," | %.16s",printable);
}
void print_hex(const char *data, unsigned long length) {
char buffer[80];
uint32 offset;
for(offset=0;offset<length;offset+=16) {
build_hex_line(data,length,offset,buffer,5);
printf("%s\n", buffer); //%s is to prevent % escapes in the ascii
}
}
int TERLoader::Open(char *base_path, char *zone_name, Archive *archive) {
ter_header *thdr;
ter_vertex *tver;
ter_vertex_v3 *tver3;
ter_triangle *ttri;
uchar *ter_orig, *ter_tmp;
int model = 0;
int i, j, mat_count = 0;
Zone_Model *zm;
material *mlist;
char var_len, val_len;
char *var, *val;
uchar *buffer;
int buf_len, bone_count;
char *filename;
if(zone_name[strlen(zone_name) - 4] == '.')
filename = zone_name;
else {
filename = new char[strlen(zone_name) + 5];
sprintf(filename, "%s.ter", zone_name);
}
if(!GetFile(&buffer, &buf_len, base_path, filename, archive)) {
if(filename != zone_name)
delete[] filename;
return 0;
}
printf("Writting TER to '%s'\n", filename);
FILE *ttt = fopen(filename, "wb");
fwrite(buffer, 1, buf_len, ttt);
fclose(ttt);
if(filename != zone_name)
delete[] filename;
thdr = (ter_header *) buffer;
mlist = new material[thdr->mat_count];
ter_orig = buffer;
if(thdr->magic[0] != 'E' || thdr->magic[1] != 'Q' || thdr->magic[2] != 'G')
return 0;
if(thdr->magic[3] == 'M') {
printf("Model File encountered in TER loader!\n");
return(0);
}
else if(thdr->magic[3] == 'T') {
buffer += sizeof(ter_header);
} else
return 0;
ter_tmp = buffer + thdr->list_len;
if(thdr->version == 3)
{
if(sizeof(ter_header) + thdr->list_len + (thdr->vert_count * sizeof(ter_vertex_v3)) + (thdr->tri_count * sizeof(ter_triangle)) > (unsigned int)buf_len)
{
printf("Buffer Range Check Failed.\n");
return 0;
}
}
else
{
if(sizeof(ter_header) + thdr->list_len + (thdr->vert_count * sizeof(ter_vertex)) + (thdr->tri_count * sizeof(ter_triangle)) > (unsigned int)buf_len)
{
printf("Buffer Range Check Failed(v3).\n");
return 0;
}
}
for(i = 0; i < (int)thdr->mat_count; ++i) {
mlist[i].name = NULL;
mlist[i].basetex = NULL;
}
int line_count = 0;
j = 0;
while(buffer < ter_tmp) {
val_len = strlen((char *) buffer);
val = (char *) buffer;
buffer += val_len + 1;
var_len = strlen((char *) buffer);
var = (char *) buffer;
line_count++;
// printf("%s %s\n", val, var);
if(strlen(var) == 0 || strlen(val) == 0) {
++buffer;
continue;
}
if(!strcmp(val, "e_fShininess0")) {
// Shiny!
continue;
}
else if(!strcmp(var, "e_TextureDiffuse0")) {
mlist[j].basetex = new char[val_len + 1];
memcpy(mlist[j].basetex, val, val_len + 1);
++mat_count;
// printf("%i: Basetex: %s\n", j + 1, mlist[j].basetex);
++j;
}
else if(val[0] != 'e' && val[1] != '_' && ((var[0] != 'e' && var[1] != '_') || !strcmp(val, "e_fShininess0"))) {
if(val[val_len - 3] == '.') {
mlist[j].name = new char[var_len + 1];
memcpy(mlist[j].name, var, var_len + 1);
}
else {
mlist[j].name = new char[val_len + 1];
memcpy(mlist[j].name, val, val_len + 1);
continue;
}
// printf("Named: %s\n", mlist[j].name);
}
buffer += var_len + 1;
}
printf("%s: Material count: %d, list len=%d, line count=%d\n", zone_name, thdr->mat_count, thdr->list_len, line_count);
this->model_data.zone_model = new Zone_Model;
zm = this->model_data.zone_model;
zm->vert_count = thdr->vert_count;
zm->poly_count = thdr->tri_count;
zm->verts = new Vertex *[zm->vert_count];
zm->polys = new Polygon *[zm->poly_count];
this->model_data.plac_count = 0;
this->model_data.model_count = 0;
//this is not always correct!
// Derision. Fix offset calculation for EQG version 2
//
//#define DEBUGTER
buffer = ter_orig + thdr->list_len + sizeof(ter_header);
if(thdr->magic[3] == 'M') buffer = buffer + 4;
#ifdef DEBUGTER
printf("Starting offset is %8X\n", buffer-ter_orig);
#endif
for(int b=0; b<thdr->mat_count; b++) {
unsigned long property_count = *((unsigned long *)(buffer+12));
#ifdef DEBUGTER
printf("Property count is %d\n", property_count); fflush(stdout);
#endif
buffer += 16;
for (int a=0; a<property_count; a++)
buffer += 12;
}
#ifdef DEBUGTER
printf("Offset is %8X\n", buffer - ter_orig);
#endif
printf("Orig Delta %d 0x%x\n", buffer-ter_tmp, buffer-ter_tmp);
/*
* This is the biggest hack pile of crap ever... but I am tired of trying to
* figure out this file format, so im just looking at the files for the offsets
* myself.
*
*/
/*if(string("ter_broodlands.ter") == zone_name) {
buffer = ter_orig + 0x382BB - 4;
// zm->vert_count = (0x2ABF90-0x382BB-4)/sizeof(ter_vertex);
} else if(string("ter_volcano.ter") == zone_name) {
if(thdr->mat_count == 19320) {
buffer = ter_orig + 0x39BB66;
} else {
buffer = ter_orig + 0x38BF0;
}
} else if(string("ter_guildhall.ter") == zone_name) {
buffer = ter_orig + 0x3080 - 2;
} else if(string("ter_guildlobby.ter") == zone_name) {
buffer = ter_orig + 0x4190 + 19;
} else if(string("ter_harbingers.ter") == zone_name) {
buffer = ter_orig + 0x1178;
} else if(string("ter_main.ter") == zone_name) {
//stillmoona
buffer = ter_orig + 0x71944+4;
} else if(string("ter_easterntemple.ter") == zone_name) {
//stillmoonb
buffer = ter_orig + 0xE340-2;
} else if(string("ter_abyss01.ter") == zone_name) {
//thenest
buffer = ter_orig + 0xCA244;
} else if(string("ter_stormtower01.ter") == zone_name) {
//thundercrest
buffer = ter_orig + 0x62230-4;
}*/
/* buffer = ter_orig + 0x382BB - 4;
printf("Good Delta %d 0x%x\n", buffer-ter_tmp, buffer-ter_tmp);*/
/*
uchar *pptr2 = (buffer - (sizeof(ter_vertex)*1));
printf("v dump start: 0x%x\n", (pptr2-ter_orig));
print_hex((const char *)pptr2, (buffer-pptr2)+sizeof(ter_vertex)*10);
*/
printf("%d verts start at %d (0x%x)\n", zm->vert_count, (buffer-ter_orig), (buffer-ter_orig));
print_hex((const char *)(buffer-16), sizeof(ter_vertex)*3+16);
for(i = 0; i < zm->vert_count; ++i) {
if(thdr->version == 3)
{
tver3 = (ter_vertex_v3 *) buffer;
zm->verts[i] = new Vertex;
zm->verts[i]->x = tver3->x;
zm->verts[i]->y = tver3->y;
zm->verts[i]->z = tver3->z;
zm->verts[i]->u = tver3->u;
zm->verts[i]->v = tver3->v;
buffer += sizeof(ter_vertex_v3);
}
else
{
tver = (ter_vertex *) buffer;
zm->verts[i] = new Vertex;
zm->verts[i]->x = tver->x;
zm->verts[i]->y = tver->y;
zm->verts[i]->z = tver->z;
zm->verts[i]->u = tver->u;
zm->verts[i]->v = tver->v;
buffer += sizeof(ter_vertex);
}
}
/* uchar *pptr = (buffer);
printf("dump tri start: 0x%x\n", (pptr-ter_orig));
print_hex((const char *)(pptr-16), 16+sizeof(ter_triangle)*10);
int skipped = 0;
j = 0;
printf("%d tris start at %d (0x%x)\n", zm->poly_count, (buffer-ter_orig), (buffer-ter_orig));*/
printf("dump tri start: 0x%x\n", (buffer));
print_hex((const char *)(buffer-16), 16+sizeof(ter_triangle)*10);
printf("%d tris start at %d (0x%x)\n", zm->poly_count, (buffer), (buffer));
uint8 errored = 0;
int skipped = 0;
j = 0;
for(i = 0; i < zm->poly_count; ++i) {
ttri = (ter_triangle *) buffer;
if(ttri->group == -1) {
skipped++;
buffer += sizeof(ter_triangle);
continue;
}
zm->polys[j] = new Polygon;
//printf(" v1=%d, v2=%d, v3=%d, g=%d, unk=%d\n", ttri->v1, ttri->v2, ttri->v3, ttri->group, ttri->unk);
if(ttri->v1 >= zm->vert_count && errored < 10) {
printf("Tri %d/%d (s %d) @0x%x: invalid v1: %d >= %d\n", i, zm->poly_count, skipped, (buffer-ter_orig), ttri->v1, zm->vert_count);
errored++;
}
if(ttri->v2 >= zm->vert_count && errored < 10) {
printf("Tri %d/%d (s %d) @0x%x: invalid v2: %d >= %d\n", i, zm->poly_count, skipped, (buffer-ter_orig), ttri->v2, zm->vert_count);
errored++;
}
if(ttri->v3 >= zm->vert_count && errored < 10) {
printf("Tri %d/%d (s %d) @0x%x: invalid v3: %d >= %d\n", i, zm->poly_count, skipped, (buffer-ter_orig), ttri->v3, zm->vert_count);
errored++;
}
if(ttri->v1 == 0x80000 && ttri->v1 >= zm->vert_count) {
zm->polys[j]->v1 = 0;
zm->polys[j]->v2 = 0;
zm->polys[j]->v3 = 0;
} else {
zm->polys[j]->v1 = ttri->v1;
zm->polys[j]->v2 = ttri->v2;
zm->polys[j]->v3 = ttri->v3;
if(ttri->group == -1)
zm->polys[j]->tex = thdr->mat_count;
else
zm->polys[j]->tex = ttri->group;
}
++j;
buffer += sizeof(ter_triangle);
}
printf("Skipped %d, %d total\n", skipped, zm->poly_count);
zm->poly_count = j;
zm->tex_count = thdr->mat_count;
zm->tex = new Texture *[thdr->mat_count];
for(i = 0; i < (int)thdr->mat_count; ++i) {
zm->tex[i] = new Texture;
zm->tex[i]->frame_count = 1;
zm->tex[i]->filenames = new char *[1];
if(mlist[i].basetex) {
zm->tex[i]->filenames[0] = new char[strlen(mlist[i].basetex) + 1];
memcpy(zm->tex[i]->filenames[0], mlist[i].basetex, strlen(mlist[i].basetex) + 1);
delete[] mlist[i].basetex;
}
else if(mlist[i].name) {
zm->tex[i]->filenames[0] = new char[strlen(mlist[i].name) + 1];
memcpy(zm->tex[i]->filenames[0], mlist[i].name, strlen(mlist[i].name) + 1);
delete[] mlist[i].name;
}
}
// zm->tex[thdr->mat_count] = new Texture;
// zm->tex[thdr->mat_count]->filename = NULL;
delete[] mlist;
this->status = 1;
return 1;
}
int TERLoader::Close() {
Zone_Model *zm = this->model_data.zone_model;
int i;
if(!this->status)
return 1;
for(i = 0; i < zm->vert_count; ++i)
delete zm->verts[i];
for(i = 0; i < zm->poly_count; ++i)
delete zm->polys[i];
for(i = 0; i < zm->tex_count; ++i) {
delete[] zm->tex[i]->filenames[0];
delete[] zm->tex[i]->filenames;
delete zm->tex[i];
}
delete[] zm->verts;
delete[] zm->polys;
delete this->model_data.zone_model;
return 1;
}
+51
View File
@@ -0,0 +1,51 @@
#ifndef __OPENEQ_TER__
#define __OPENEQ_TER__
#include "global.hpp"
#include "file_loader.hpp"
#pragma pack(1)
struct ter_header {
char magic[4];
unsigned long version, list_len, mat_count, vert_count, tri_count;
} typedef ter_header;
struct ter_vertex {
float x, y, z;
float i, j, k;
float u, v;
} typedef ter_vertex;
struct ter_triangle {
long v1, v2, v3;
long group;
long unk;
} typedef ter_triangle;
struct ter_vertex_v3 {
float x, y, z;
float i, j, k;
float unk1, unk2, unk3;
float u, v;
} typedef ter_vertex_v3;
struct material {
char *name;
char *basetex;
char var_count;
char **var_names;
char **var_vals;
} typedef material;
#pragma pack()
class TERLoader : public FileLoader {
public:
TERLoader();
~TERLoader();
virtual int Open(char *base_path, char *zone_name, Archive *archive);
virtual int Close();
};
#endif
+16
View File
@@ -0,0 +1,16 @@
#ifndef __EQCLIENT_TYPES_H_
#define __EQCLIENT_TYPES_H_
typedef unsigned long uint32;
typedef long int32;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned char uint8;
typedef unsigned char uchar;
typedef char int8;
#define null 0
#endif
+480
View File
@@ -0,0 +1,480 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "s3d.h"
#include "wld.h"
// #include "mob.h"
// #define FRAG_DEBUG
int WLD_GetObjectMesh(wld_object *obj, char *name, Mesh **mesh);
#define WORD_A(c) sizeof(short) * (c)
#define LONG_A(c) sizeof(long) * (c)
#define WORD_P(offset) *((short *) (buf + pos + (offset)))
#define LONG_P(offset) *((long *) (buf + pos + (offset)))
uchar encarr[] = {0x95, 0x3A, 0xC5, 0x2A, 0x95, 0x7A, 0x95, 0x6A};
void decode(uchar *str, int len) { int i; for(i = 0; i < len; ++i) str[i] ^= encarr[i % 8]; }
FRAGMENT_FUNC(Data03) {
int i, pos, nameLen,r;
WLDTexture *tex = (WLDTexture *) malloc(sizeof(WLDTexture));
tex->count = *((long *) buf) + 1;
tex->flags = (int *) malloc(sizeof(int) * tex->count);
tex->filenames = (char **) malloc(sizeof(char *) * tex->count);
*obj = (void *) tex;
#ifdef FRAG_DEBUG
printf("Data03: %p %p\n", obj, *obj);
#endif
pos = sizeof(long);
for(i = 0; i < tex->count; ++i) {
nameLen = *((short *) (buf + pos));
tex->filenames[i] = (char *) malloc(nameLen + 1);
memcpy(tex->filenames[i], (char *) (buf + pos + sizeof(short)), nameLen + 1);
decode(tex->filenames[i], nameLen);
for(r = 0; r < nameLen; r++) {
(tex->filenames[i])[r] = tolower((tex->filenames[i])[r]);
}
// Lower(tex->filenames[i]);
}
return 0;
}
FRAGMENT_FUNC(Data04) {
int flags, i, pos;
WLDTexture *tex = (WLDTexture *) malloc(sizeof(WLDTexture));
tex->count = *((long *) (buf + sizeof(long)));
tex->flags = (int *) malloc(sizeof(int) * tex->count);
tex->filenames = (char **) malloc(sizeof(char *) * tex->count);
*obj = (void *) tex;
#ifdef FRAG_DEBUG
printf("Data04: %p %p\n", obj, *obj);
#endif
flags = *((long *) buf);
pos = sizeof(long) * 2;
if(flags & (1 << 2))
pos += sizeof(long);
if(flags & (1 << 3))
pos += sizeof(long);
for(i = 0; i < 1 /* tex->count */; ++i) {
tex->flags[i] = flags;
tex->filenames[i] = ((WLDTexture *) wld->frags[*((long *) (buf + pos)) - 1]->frag)->filenames[i];
pos += sizeof(long);
}
return 0;
}
FRAGMENT_FUNC(Data05) {
*obj = wld->frags[*((long *) buf) - 1]->frag;
#ifdef FRAG_DEBUG
printf("Data05: %p %p\n", obj, *obj);
#endif
return 0;
}
FRAGMENT_FUNC(Data15) {
char *name, *temp;
WLDPlaceable *place = (WLDPlaceable *) malloc(sizeof(WLDPlaceable));
struct_Data15 *hdr = (struct_Data15 *) buf;
if(((signed long) -hdr->ref) < (signed long) 0)
return -1;
name = (char *) malloc(strlen(&wld->sHash[-hdr->ref]) - 9 + 1);
memcpy(name, &wld->sHash[-hdr->ref], strlen(&wld->sHash[-hdr->ref]) - 9);
name[strlen(&wld->sHash[-hdr->ref]) - 9] = 0;
temp = (char *) malloc(strlen(name) + 13);
sprintf(temp, "%s_DMSPRITEDEF", name);
WLD_GetObjectMesh(wld, temp, &place->mesh);
if(!place->mesh) {
printf("Object not found: %s. Original Name: %s. Cut Name: %s\n", temp, &wld->sHash[-hdr->ref], name);
return 0;
}
free(name);
place->trans[0] = hdr->trans[0];
place->trans[1] = hdr->trans[1];
place->trans[2] = hdr->trans[2];
place->rot[0] = hdr->rot[2] / 512.f * 360.f;
place->rot[1] = hdr->rot[1] / 512.f * 360.f;
place->rot[2] = hdr->rot[0] / 512.f * 360.f;
place->scale[0] = hdr->scale[2];
place->scale[1] = hdr->scale[1];
place->scale[2] = hdr->scale[0];
if(wld->placeable == null)
wld->placeable_cur = wld->placeable = (Placeable_LL *) malloc(sizeof(Placeable_LL));
else
wld->placeable_cur = wld->placeable_cur->next = (Placeable_LL *) malloc(sizeof(Placeable_LL));
wld->placeable_cur->obj = place;
wld->placeable_cur->next = null;
return 0;
}
FRAGMENT_FUNC(Data21) {
struct_Data21 *data;
long count = *((long *) buf);
long i;
BSP_Node *tree = (BSP_Node *) malloc(count * sizeof(BSP_Node));
// Build the BSP Tree
//
for(i = 0; i < count; ++i) {
tree[i].node_number=i;
data = (struct_Data21 *) (buf + (i * sizeof(struct_Data21)) + 4);
tree[i].normal[0] = data->normal[0];
tree[i].normal[1] = data->normal[1];
tree[i].normal[2] = data->normal[2];
tree[i].splitdistance = data->splitdistance;
tree[i].region = data->region;
tree[i].left = data->node[0];
tree[i].right = data->node[1];
}
*obj = (void *) tree;
return 0;
}
FRAGMENT_FUNC(Data22) {
int pos;
uchar *data6area ;
struct_Data22 *data = (struct_Data22 *) buf;
if(!wld->loadBSP)
return -1;
pos = sizeof(struct_Data22) + (12 * data->size1) + (8 * data->size2);
// Derision: We don't need any of the data from this fragment for determining the water/lava
// areas, however I left the following code here for possible future use.
// The four floats are the x,y,z of the centre of the region and the max distance of any point
// in the region from the centre.
data6area = buf + pos;
data6area = data6area + ((data->size5) * 7 * 4);
unsigned short d6size = *((unsigned short *) data6area);
data6area = data6area + 2; // Move past d6 size
data6area = data6area + d6size; // Move past RLE data ? Hopefully;
float f1, f2, f3, f4;
f1 = *((float *) data6area);
f2 = *((float *) (data6area+4));
f3 = *((float *) (data6area+8));
f4 = *((float *) (data6area+12));
//if(data->flags==0x181) printf("Frag 36 reference?: %ld\n", *((long *) (data6area+20)));
return 0;
}
FRAGMENT_FUNC(Data29) {
long a,flags, numregions, lenstr;
struct_Data29 *data29 = (struct_Data29 *) malloc(sizeof(struct_Data29));
*obj = (void *) data29;
flags = *buf;
numregions = *((long *)(buf+4));
data29->region_count = numregions ;
data29->region_array = (long *)malloc(numregions * sizeof(long));
for(a=0;a<numregions;a++) {
data29->region_array[a] = *((long *)(buf+8+(a*4)));
}
lenstr = *((long *)(buf+8+(numregions*4)));
data29->strlen=lenstr;
if(lenstr==0) {
data29->region_type = -1 ; // Flag the type as unknown. Later processing will set it to a default type.
return 0 ;
}
data29->str = (char *)malloc(lenstr);
char *encstr;
encstr = buf+8+(++a*4);
decode(encstr, lenstr);
strcpy(data29->str, encstr);
if(lenstr>=2)
if(!strncmp(encstr,"WT",2)) data29->region_type = 1; // Water
else if(!strncmp(encstr,"LA",2)) data29->region_type = 2; // Lava
else if(!strncmp(encstr,"DR",2)) data29->region_type = 3; // Zone Line ?
else data29->region_type = -2; // Flag this so that it doesn't get set to the default water or lava
// later, because it is neither.
//
return 0 ;
}
FRAGMENT_FUNC(Data30) {
WLDTexture *temp;
int params;
params = *((long *) (buf + 4));
if(!params || !*((long *) (buf + 20))) {
*obj = (void *) malloc(sizeof(WLDTexture));
temp = (WLDTexture *) *obj;
temp->count = 1;
temp->filenames = (char **) malloc(sizeof(char *));
temp->filenames[0] = "collide.dds";
temp->flags = (int *) malloc(sizeof(int));
temp->flags[0] = 0;
}
else {
if(!*((long *) buf))
*obj = wld->frags[*((long *) (buf + 28)) - 1]->frag;
else
*obj = wld->frags[*((long *) (buf + 20)) - 1]->frag;
((WLDTexture *) *obj)->params = params;
}
#ifdef FRAG_DEBUG
printf("Data30: %p %p\n", obj, *obj);
#endif
return 0;
}
FRAGMENT_FUNC(Data31) {
int i, pos;
WLDTexture *tex = (WLDTexture *) malloc(sizeof(WLDTexture));
tex->count = *((long *) (buf + sizeof(long)));
tex->flags = (int *) malloc(sizeof(int) * tex->count);
tex->filenames = (char **) malloc(sizeof(char *) * tex->count);
*obj = (void *) tex;
#ifdef FRAG_DEBUG
printf("Data31: %p %p\n", obj, *obj);
#endif
pos = sizeof(long) * 2;
for(i = 0; i < tex->count; ++i) {
tex->flags[i] = ((WLDTexture *) wld->frags[*((long *) (buf + pos)) - 1]->frag)->flags[0];
tex->filenames[i] = ((WLDTexture *) wld->frags[*((long *) (buf + pos)) - 1]->frag)->filenames[0];
tex->params = ((WLDTexture *) wld->frags[*((long *) (buf + pos)) - 1]->frag)->params;
pos += sizeof(long);
}
return 0;
}
FRAGMENT_FUNC(Data36) {
struct_Data36 *header = (struct_Data36 *) buf;
WLDVertex *verti = (WLDVertex *) malloc(header->vertexCount * sizeof(WLDVertex));
Poly *poly = (Poly *) malloc(header->polygonsCount * sizeof(Poly));
WLDPolygon *p;
TexCoordsNew *tex_new;
TexCoordsOld *tex_old;
Vert *v;
Mesh *mesh = (Mesh *) malloc(sizeof(Mesh));
int i, j, polyCount, vertCount, texIndex, skinIndex, pc, pos = sizeof(struct_Data36);
float scale = 1.0f / (float) (1 << header->scale);
mesh->name = -frag_name;
mesh->tex = ((WLDTexture *) wld->frags[header->fragment1 - 1]->frag);
mesh->polygonCount = header->polygonsCount;
mesh->vertexCount = header->vertexCount;
for(i = 0; i < header->vertexCount; ++i) {
v = (Vert *) (buf + pos);
verti[i].x = header->centerX + v->x * scale;
verti[i].y = header->centerY + v->y * scale;
verti[i].z = header->centerZ + v->z * scale;
pos += sizeof(Vert);
}
if(wld->_new) {
for(i = 0; i < header->texCoordsCount; ++i) {
tex_new = (TexCoordsNew *) (buf + pos);
verti[i].u = tex_new->tx / 256.0f;
verti[i].v = tex_new->tz / 256.0f;
pos += sizeof(TexCoordsNew);
}
}
else {
for(i = 0; i < header->texCoordsCount; ++i) {
tex_old = (TexCoordsOld *) (buf + pos);
verti[i].u = tex_old->tx / 256.0f;
verti[i].v = tex_old->tz / 256.0f;
pos += sizeof(TexCoordsOld);
}
}
pos += 3 * header->normalsCount;
pos += 4 * header->colorCount;
for(i = 0; i < header->polygonsCount; ++i) {
p = (WLDPolygon *) (buf + pos);
poly[i].flags = p->flags;
poly[i].v1 = p->v1;
poly[i].v2 = p->v2;
poly[i].v3 = p->v3;
pos += sizeof(WLDPolygon);
}
pc = 0;
for(i = 0; i < header->size6; ++i) {
vertCount = *((short *) (buf + pos));
skinIndex = *((short *) (buf + pos + 2));
for(j = 0; j < vertCount; ++j, ++pc) {
verti[pc].skin = skinIndex;
}
pos += 4;
}
pc = 0;
for(i = 0; i < header->polygonTexCount; ++i) {
polyCount = *((short *) (buf + pos));
texIndex = *((short *) (buf + pos + 2));
for(j = 0; j < polyCount; ++j, ++pc)
poly[pc].tex = texIndex;
pos += 4;
}
mesh->verti = verti;
mesh->poly = poly;
*obj = (void *) mesh;
#ifdef FRAG_DEBUG
printf("Data36: %p %p\n", obj, *obj);
#endif
return 0;
}
int WLD_Init(wld_object *obj, uchar *wld, s3d_object *s3d, char loadBSP) {
int pos, i, status;
void *frag_obj;
struct_wld_header *header;
struct_wld_basic_frag *frag;
obj->wld = wld;
obj->s3d = s3d;
header = (struct_wld_header *) wld;
pos = sizeof(struct_wld_header);
if(header->magic != 0x54503d02)
return -1;
if(header->version == 0x00015500)
obj->_new = 0;
else
obj->_new = 1;
obj->sHash = wld + pos;
decode(obj->sHash, header->stringHashSize);
obj->frags = (struct_frag **) malloc(sizeof(struct_frag *) * header->fragmentCount);
obj->fragCount = header->fragmentCount;
obj->loadBSP = loadBSP;
obj->placeable = null;
pos += header->stringHashSize;
for(i = 0; i < header->fragmentCount; ++i) {
frag = (struct_wld_basic_frag *) (wld + pos);
obj->frags[i] = (struct_frag *) malloc(sizeof(struct_frag));
switch(frag->id) {
case 0x35: status = -1; break;
case 0x03: FRAGMENT(Data03); break;
case 0x04: FRAGMENT(Data04); break;
case 0x05: FRAGMENT(Data05); break;
case 0x15: FRAGMENT(Data15); break;
case 0x21: FRAGMENT(Data21); break;
case 0x22: FRAGMENT(Data22); break;
case 0x29: FRAGMENT(Data29); break;
case 0x30: FRAGMENT(Data30); break;
case 0x31: FRAGMENT(Data31); break;
case 0x36: FRAGMENT(Data36); break;
}
#ifdef FRAG_DEBUG
if(frag->id != 0x35)
printf("Init: %i - %p\n", i, frag_obj);
#endif
obj->frags[i]->type = frag->id;
obj->frags[i]->name = frag->nameRef;
obj->frags[i]->frag = frag_obj;
pos += sizeof(struct_wld_basic_frag) + frag->size - 4;
}
return 0;
}
int WLD_GetObjectMesh(wld_object *obj, char *name, Mesh **mesh) {
int i;
for(i = 0; i < obj->objs->fragCount; ++i) {
if(obj->objs->frags[i]->type != 0x36)
continue;
if(!strcmp(&obj->objs->sHash[-obj->objs->frags[i]->name], name)) {
*mesh = (Mesh *) obj->objs->frags[i]->frag;
return 0;
}
}
return -1;
}
int WLD_GetZoneMesh(wld_object *obj, ZoneMesh *mesh) {
Mesh *temp = NULL;
int i, j;
int polygonCount = 0, vertexCount = 0;
for(i = 0; i < obj->fragCount; ++i) {
if(obj->frags[i]->type != 0x36)
continue;
temp = (Mesh *) obj->frags[i]->frag;
polygonCount += temp->polygonCount;
vertexCount += temp->vertexCount;
}
mesh->polygonCount = polygonCount;
mesh->vertexCount = vertexCount;
mesh->poly = (Poly **) malloc(sizeof(Poly *) * polygonCount);
mesh->verti = (WLDVertex **) malloc(sizeof(WLDVertex *) * vertexCount);
polygonCount = 0;
vertexCount = 0;
if(temp != NULL)
mesh->tex = temp->tex;
for(i = 0; i < obj->fragCount; ++i) {
if(obj->frags[i]->type != 0x36)
continue;
temp = (Mesh *) obj->frags[i]->frag;
for(j = 0; j < temp->polygonCount; ++j) {
mesh->poly[polygonCount + j] = &temp->poly[j];
mesh->poly[polygonCount + j]->v1 += vertexCount;
mesh->poly[polygonCount + j]->v2 += vertexCount;
mesh->poly[polygonCount + j]->v3 += vertexCount;
}
for(j = 0; j < temp->vertexCount; ++j) {
mesh->verti[vertexCount + j] = &temp->verti[j];
}
polygonCount += temp->polygonCount;
vertexCount += temp->vertexCount;
}
return 0;
}
+195
View File
@@ -0,0 +1,195 @@
#ifndef __EQCLIENT_WLD_H_
#define __EQCLIENT_WLD_H_
#include "s3d.h"
#include "types.h"
#define FRAGMENT(name) status = name(&frag_obj, obj, (wld + pos + sizeof(struct_wld_basic_frag)), frag->size, frag->nameRef)
#define FRAGMENT_FUNC(name) int name(void **obj, wld_object *wld, uchar *buf, int len, int frag_name)
typedef struct struct_wld_header {
long magic;
long version;
long fragmentCount;
long header3;
long header4;
long stringHashSize;
long header6;
} struct_wld_header;
typedef struct struct_wld_basic_frag {
long size;
long id;
long nameRef;
} struct_wld_basic_frag;
typedef struct struct_Data36 {
long flags;
long fragment1;
long fragment2;
long fragment3;
long fragment4;
float centerX;
float centerY;
float centerZ;
long params2[3]; // 48
float maxDist;
float minX;
float minY;
float minZ;
float maxX;
float maxY;
float maxZ; // 24
short int vertexCount;
short int texCoordsCount;
short int normalsCount;
short int colorCount;
short int polygonsCount;
short int size6;
short int polygonTexCount;
short int vertexTexCount;
short int size9;
short int scale; // 20
} struct_Data36;
struct Data10 {
long flags, size1, fragment;
};
typedef struct WLDVertex {
double x, y, z;
float u, v;
short skin;
} WLDVertex;
typedef struct Vert {
signed short int x, y, z;
} Vert;
typedef struct TexCoordsNew {
signed long tx, tz;
} TexCoordsNew;
typedef struct TexCoordsOld {
signed short int tx, tz;
} TexCoordsOld;
typedef struct VertexNormal {
signed char nx, ny, nz;
} VertexNormal;
typedef struct VertexColor {
char color[4];
} VertexColor;
typedef struct WLDPolygon {
short int flags, v1, v2, v3;
} WLDPolygon;
typedef struct Poly {
long int flags, v1, v2, v3, tex;
} Poly;
typedef struct WLDTexture {
int count;
int *flags;
int params;
char **filenames;
uint32 *textures;
} WLDTexture;
typedef struct Mesh {
long name;
long polygonCount;
long vertexCount;
WLDVertex *verti;
Poly *poly;
WLDTexture *tex;
} Mesh;
typedef struct ZoneMesh {
long name;
long polygonCount;
long vertexCount;
WLDVertex **verti;
Poly **poly;
WLDTexture *tex;
} ZoneMesh;
typedef struct struct_frag {
long type;
long name;
void *frag;
}struct_frag;
typedef struct struct_Data21 {
float normal[3], splitdistance;
long region, node[2];
} struct_Data21;
typedef struct struct_Data22 {
long flags, fragment1, size1, size2, params1, size3, size4, params2, size5, size6;
} struct_Data22;
typedef struct struct_Data29 {
long region_count;
long *region_array;
long strlen;
char *str;
int region_type; // We fill this in with -1 for unknown, 1 for water, 2 for lava
} struct_Data29;
/*typedef struct BSP_Region {
} BSP_Region;*/
typedef struct BSP_Node {
long node_number;
float normal[3], splitdistance;
long region;
int special;
long left, right;
} BSP_Node;
typedef struct struct_Data15 {
uint32 ref, flags, fragment1;
float trans[3], rot[3];
float scale[3];
uint32 fragment2, flags2;
} struct_Data15;
typedef struct WLDPlaceable {
float trans[3], rot[3], scale[3];
Mesh *mesh;
} WLDPlaceable;
typedef struct Placeable_LL {
WLDPlaceable *obj;
struct Placeable_LL *next;
} Placeable_LL;
typedef struct wld_object {
int fragCount;
char loadBSP;
uchar *wld;
uchar *sHash;
uint8 _new;
s3d_object *s3d;
Placeable_LL *placeable, *placeable_cur;
struct wld_object *objs;
struct_frag **frags;
} wld_object;
#ifdef __cplusplus
extern "C" {
#endif
int WLD_Init(wld_object *obj, uchar *wld, s3d_object *s3d, char loadBSP);
int WLD_GetZoneMesh(wld_object *obj, ZoneMesh *mesh);
#ifdef __cplusplus
}
#endif
#endif
+299
View File
@@ -0,0 +1,299 @@
#include <stdio.h>
#include <string.h>
#include "3d.hpp"
#include "zon.hpp"
ZonLoader::ZonLoader() {
this->buffer = NULL;
this->buf_len = -1;
this->archive = NULL;
this->status = 0;
}
ZonLoader::~ZonLoader() {
this->Close();
}
int ZonLoader::Open(char *base_path, char *zone_name, Archive *archive) {
uchar *buffer;
int buf_len;
Texture **tex;
int tex_count, tex_tmp, *tex_map;
int i, j, k, l, len;
char **model_names;
char *filename;
uchar *zon_tmp, *zon_orig;
float rot_change = 180.0f / 3.14159f;
// float rot_change = 1.0f;
float base[3];
// filename = new char[strlen(zone_name) + 5];
// sprintf(filename, "%s.zon", zone_name);
const char *fn = archive->FindExtension(".zon");
if(fn == NULL) {
printf("Unable to find a .zon file in %s\n", zone_name);
//try looking just for the .ter file...
const char *tfn = archive->FindExtension(".ter");
if(tfn == NULL)
return(0);
if(this->terloader.Open(NULL, (char *) tfn, archive) == 0) {
printf("failed to direct load TER file in %s\n", zone_name);
return(0);
}
printf("Got direct TER, it is %p\n", terloader.model_data.zone_model);
this->model_data.zone_model = terloader.model_data.zone_model;
return 1;
}
filename = new char[strlen(fn)+1];
strcpy(filename, fn);
if(!archive->GetFile(filename, &buffer, &buf_len)) {
printf("Unable to load '%s' from '%s'\n", filename, zone_name);
delete[] filename;
return 0;
}
printf("Writting ZON to '%s'\n", filename);
FILE *ttt = fopen(filename, "wb");
fwrite(buffer, 1, buf_len, ttt);
fclose(ttt);
delete[] filename;
zon_header *hdr = (zon_header *) buffer;
zon_placeable *plac;
if(hdr->magic[0] != 'E' || hdr->magic[1] != 'Q' || hdr->magic[2] != 'G' || hdr->magic[3] != 'Z') {
printf("Bad file header in ZON %s\n", zone_name);
return 0;
}
buffer += sizeof(zon_header);
//search for a nice TER file...
uchar *buf_end = buffer + buf_len;
while(buffer < buf_end) {
if(strstr((const char *) buffer, ".ter") != NULL || strstr((const char *) buffer, ".TER") != NULL) {
if(this->terloader.Open(NULL, (char *) buffer, archive) == 0) {
printf("failed to load TER file in %s\n", zone_name);
return(0);
}
printf("Got TER, it is %p\n", terloader.model_data.zone_model);
this->model_data.zone_model = terloader.model_data.zone_model;
break;
}
buffer += strlen((const char *) buffer)+1;
}
return 1;
/*******************************************/
zon_orig = buffer;
zon_tmp = buffer + hdr->list_len;
buffer += strlen((char *) buffer) + 1;
i = 0;
while(buffer < zon_tmp) {
len = strlen((char *) buffer);
if(buffer[len - 4] == '.')
++i;
buffer += len + 1;
}
this->model_data.model_count = i;
model_names = new char *[this->model_data.model_count];
this->model_data.models = new Model *[this->model_data.model_count];
buffer = zon_orig;
buffer += strlen((char *) buffer) + 1;
i = 0;
while(buffer < zon_tmp) {
len = strlen((char *) buffer);
if(buffer[len - 4] == '.') {
model_names[i] = (char *) buffer;
++i;
}
buffer += len + 1;
}
buffer = zon_orig + hdr->list_len + hdr->unid * 4;
this->model_data.plac_count = hdr->obj_count - 1;
this->model_data.plac_count = 0;
// this->model_data.placeable = new Placeable *[this->model_data.plac_count];
this->model_data.placeable = 0;
plac = (zon_placeable *) buffer;
base[0] = plac->x;
base[1] = plac->y;
base[2] = plac->z;
printf("(%f %f %f) (%f %f %f)\n", plac->x, plac->y, plac->z, plac->rz, plac->ry, plac->rx);
buffer += sizeof(zon_placeable);
for(i = 0; i < this->model_data.plac_count; ++i) {
plac = (zon_placeable *) buffer;
zon_tmp = zon_orig + plac->loc;
this->model_data.placeable[i] = new Placeable;
this->model_data.placeable[i]->x = plac->x;
this->model_data.placeable[i]->y = plac->y;
this->model_data.placeable[i]->z = plac->z;
this->model_data.placeable[i]->rx = plac->rz * rot_change;
this->model_data.placeable[i]->ry = plac->ry * rot_change;
this->model_data.placeable[i]->rz = plac->rx * rot_change;
this->model_data.placeable[i]->scale[0] = plac->scale;
this->model_data.placeable[i]->scale[1] = plac->scale;
this->model_data.placeable[i]->scale[2] = plac->scale;
this->model_data.placeable[i]->model = -1;
#ifdef DEBUG_MODE
printf("%s (%f %f %f) (%f %f %f) %f\n",
zon_tmp,
this->model_data.placeable[i]->x,
this->model_data.placeable[i]->y,
this->model_data.placeable[i]->z,
this->model_data.placeable[i]->rx,
this->model_data.placeable[i]->ry,
this->model_data.placeable[i]->rz,
this->model_data.placeable[i]->scale);
#endif
while(zon_tmp[strlen((char *) zon_tmp) - 4] != '.')
zon_tmp += strlen((char *) zon_tmp) + 1;
for(j = 0; j < this->model_data.model_count; ++j) {
if(!strcmp(model_names[j], (char *) zon_tmp)) {
this->model_data.placeable[i]->model = j;
break;
}
}
buffer += sizeof(zon_placeable);
}
// model_loaders = new TERLoader[this->model_data.model_count];
model_loaders = 0;
tex_count = this->model_data.zone_model->tex_count;
for(j = 0; j < this->model_data.model_count; ++j) {
model_loaders[j].Open(NULL, model_names[j], archive);
this->model_data.models[j] = new Model;
this->model_data.models[j]->vert_count = model_loaders[j].model_data.zone_model->vert_count;
this->model_data.models[j]->poly_count = model_loaders[j].model_data.zone_model->poly_count;
this->model_data.models[j]->tex_count = model_loaders[j].model_data.zone_model->tex_count;
this->model_data.models[j]->verts = model_loaders[j].model_data.zone_model->verts;
this->model_data.models[j]->polys = model_loaders[j].model_data.zone_model->polys;
this->model_data.models[j]->tex = model_loaders[j].model_data.zone_model->tex;
tex_tmp = 1;
for(i = 0; i < this->model_data.models[j]->tex_count; ++i) {
for(k = 0; k < this->model_data.zone_model->tex_count; ++k) {
if((!this->model_data.zone_model->tex[k]->filenames[0] && !this->model_data.models[j]->tex[i]->filenames[0]) ||
(this->model_data.zone_model->tex[k]->filenames[0] &&
this->model_data.models[j]->tex[i]->filenames[0] &&
!strcmp(this->model_data.zone_model->tex[k]->filenames[0], this->model_data.models[j]->tex[i]->filenames[0]))) {
tex_tmp = 0;
break;
}
}
if(tex_tmp)
++tex_count;
else {
for(k = 0; k < j; ++k) {
for(l = 0; l < this->model_data.models[k]->tex_count; ++l) {
if(this->model_data.models[k]->tex[l]->filenames[0] == this->model_data.models[j]->tex[i]->filenames[0] ||
(this->model_data.models[k]->tex[l]->filenames[0] &&
this->model_data.models[j]->tex[i]->filenames[0] &&
!strcmp(this->model_data.models[k]->tex[l]->filenames[0], this->model_data.models[j]->tex[i]->filenames[0]))) {
tex_tmp = 0;
break;
}
}
}
if(tex_tmp)
++tex_count;
}
}
}
printf("%i\n", tex_count);
tex = new Texture *[tex_count];
tex_count = this->model_data.zone_model->tex_count;
tex_tmp = 1;
for(i = 0; i < tex_count; ++i)
tex[i] = this->model_data.zone_model->tex[i];
for(i = 0; i < this->model_data.model_count; ++i) {
for(j = 0; j < this->model_data.models[i]->tex_count; ++j) {
for(k = 0; k < tex_count; ++k) {
if(tex[k]->filenames[0] == this->model_data.models[i]->tex[j]->filenames[0] ||
(tex[k]->filenames[0] &&
this->model_data.models[i]->tex[j]->filenames[0] &&
!strcmp(tex[k]->filenames[0], this->model_data.models[i]->tex[j]->filenames[0]))) {
tex_tmp = 0;
break;
}
}
if(tex_tmp) {
tex[tex_count] = this->model_data.models[i]->tex[j];
++tex_count;
}
}
}
for(i = 0; i < this->model_data.model_count; ++i) {
tex_map = new int[this->model_data.models[i]->tex_count];
for(j = 0; j < this->model_data.models[i]->tex_count; ++j) {
tex_map[j] = 0;
for(k = 0; k < tex_count; ++k) {
if(tex[k]->filenames[0] == this->model_data.models[i]->tex[j]->filenames[0] ||
(tex[k]->filenames[0] &&
this->model_data.models[i]->tex[j]->filenames[0] &&
!strcmp(tex[k]->filenames[0], this->model_data.models[i]->tex[j]->filenames[0]))) {
tex_map[j] = k;
break;
}
}
}
for(j = 0; j < this->model_data.models[i]->poly_count; ++j)
this->model_data.models[i]->polys[j]->tex = tex_map[this->model_data.models[i]->polys[j]->tex];
delete[] tex_map;
}
delete[] this->model_data.zone_model->tex;
this->model_data.zone_model->tex = tex;
this->model_data.zone_model->tex_count = tex_count;
this->status = 1;
return 1;
}
// ... in my pants.
int ZonLoader::Close() {
int i;
if(!this->status)
return 1;
this->terloader.Close();
for(i = 0; i < this->model_data.model_count; ++i)
this->model_loaders[i].Close();
delete[] this->model_loaders;
return 1;
}
+42
View File
@@ -0,0 +1,42 @@
#ifndef __OPENEQ_ZON__
#define __OPENEQ_ZON__
#include "ter.hpp"
/* Big thanks to jbb on the ZON stuff! */
#pragma pack(1)
struct zon_header {
char magic[4]; // Constant at EQGZ
long version; // Constant at 2
long list_len; // Length of the list to follow.
long unid; // Number of 4 byte entries in an unidentified table.
long obj_count; // Placeable object count.
long unk[2]; // Unknown.
} typedef zon_header;
struct zon_placeable {
long id;
long loc;
float x, y, z;
float rx, ry, rz;
float scale;
} typedef zon_placeable;
#pragma pack()
class ZonLoader : public FileLoader {
public:
ZonLoader();
~ZonLoader();
virtual int Open(char *base_path, char *zone_name, Archive *archive);
virtual int Close();
private:
TERLoader terloader;
TERLoader *model_loaders;
};
#endif
+16
View File
@@ -0,0 +1,16 @@
#Mysql flags, for linuxthreads
#MYSQL_FLAGS=`mysql_config --cflags`
#MYSQL_LIB=`mysql_config --libs`
MYSQL_FLAGS=-I'/usr/local/include/mysql'
MYSQL_LIBS=-L'/usr/local/lib/mysql' -llmysqlclient -lz -lcrypt -lm
#linux threads flags:
LTFLAGS=-I/usr/local/include/pthread/linuxthreads -D_GNU_SOURCE -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE
LTLDFLAGS=-llthread -llstdc++ -llsupc++ -llgcc_r -L/usr/local/lib
CXXFLAGS=-ggdb -O -pipe -Wall -I. -I../common -fno-inline -DFREEBSD $(LTFLAGS) $(MYSQL_FLAGS)
LDFLAGS=-lpcap -lz -rdynamic -O2 -ggdb -pipe -L/usr/local/lib $(LTLDFLAGS)
include Makefile.common
+24
View File
@@ -0,0 +1,24 @@
GOBJS=.obj/Mutex.o .obj/unix.o \
.obj/dbcore.o
all: export_char import_char
export_char: $(GOBJS) export_char.o
g++ -I.. $^ $(LDFLAGS) $(MYSQL_LIBS) -o $@
import_char: $(GOBJS) import_char.o
g++ -I.. $^ $(LDFLAGS) $(MYSQL_LIBS) -o $@
clean:
rm -f import_char export_char *.o
.obj/%.o: ../../common/%.cpp ../../common/%.h
mkdir -p .obj
g++ -I.. $(CXXFLAGS) -c $< -o $@
%.o: %.cpp %.h
mkdir -p .obj
g++ -I.. $(CXXFLAGS) -c $< -o $@
+77
View File
@@ -0,0 +1,77 @@
#ifndef CHAR_FORMAT_H
#define CHAR_FORMAT_H
#include "../common/types.h"
#define CHAR_MAGIC 0xaa77e598
#pragma pack(1)
struct CharHeader {
uint32 char_magic;
//character_ data
char name[64];
float x;
float y;
float z;
char zone_name[32];
uint16 zone_id;
uint32 profile_length;
uint32 extprofile_length;
//faction_values
uint32 faction_value_count;
//inventory
uint32 inventory_count;
//sharedbank
uint32 sharedbank_count;
//quest_globals
uint32 quest_globals_count;
/*
Variable length fields:
byte PlayerProfile[profile_length];
byte ExtendedProfile[extprofile_length];
FactionValueRecord faction_values[faction_value_count];
InventoryEntry inventory[inventory_count];
InventoryEntry sharedbank[sharedbank_count];
QuestGlobalEntry quest_globals[quest_globals_count];
*/
};
struct FactionValueRecord {
sint32 faction_id;
sint32 current_value;
};
struct InventoryEntry {
uint16 slotid;
uint32 itemid;
sint16 charges;
uint32 colors;
uint32 augs[5];
uint8 instnodrop;
};
struct QuestGlobalEntry {
sint32 npcid;
sint32 zoneid;
char name[66];
char value[66];
sint32 expdate;
};
#pragma pack()
#endif
+110
View File
@@ -0,0 +1,110 @@
# Microsoft Developer Studio Project File - Name="charmove" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=charmove - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "charmove.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "charmove.mak" CFG="charmove - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "charmove - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "charmove - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "charmove - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "." /I ".." /I "../common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib zlib.lib mysqlclient.lib /nologo /subsystem:console /machine:I386 /libpath:"c:\mysql\lib\opt" /libpath:"c:\eqemu\lib"
!ELSEIF "$(CFG)" == "charmove - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib zlib.lib mysqlclient.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"c:\mysql\lib\opt" /libpath:"c:\eqemu\lib"
!ENDIF
# Begin Target
# Name "charmove - Win32 Release"
# Name "charmove - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\common\dbcore.cpp
# End Source File
# Begin Source File
SOURCE=.\export_char.cpp
# End Source File
# Begin Source File
SOURCE=..\..\common\Mutex.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
+263
View File
@@ -0,0 +1,263 @@
#include "../common/types.h"
//#include "../common/eq_packet_structs.h"
#include <stdio.h>
#include <mysql.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
using namespace std;
#include "../common/dbcore.h"
#include "char_format.h"
void usage() {
printf("Usage: export_char [list|charid] [outfile]\n");
printf(" if charid is 'list' then all char IDs will be listed with names\n");
printf(" note: this will not work on char ID 0\n");
exit(1);
}
int main(int argc, char *argv[]) {
const char *outfile;
if(argc != 3)
usage();
int charid = atoi(argv[1]);
if(charid == 0)
usage();
outfile = argv[2];
char *query = new char[1024];
char host[200], user[200], passwd[200], database[200];
int32 port=0;
bool compression = false;
bool items[6] = {false, false, false, false, false, false};
if(!DBcore::ReadDBINI(host, user, passwd, database, port, compression, items)) {
exit(1);
}
if (!items[0] || !items[1] || !items[2] || !items[3])
{
printf ("Incomplete DB.INI file.\n");
exit (1);
}
MYSQL m;
mysql_init(&m);
if(!mysql_real_connect(&m, host, user, passwd, database, 0, NULL, 0)) {
printf("Unable to connect 1: %s.\n", mysql_error(&m));
return(1);
}
CharHeader header;
char *ppbuffer;
char *eppbuffer;
/* FactionValueRecord *factions;
InventoryEntry *inventory;
InventoryEntry *sharedbank;
QuestGlobalEntry *qglobals;*/
sprintf(query, "SELECT name,profile,extprofile,x,y,z,zonename,zoneid FROM character_ WHERE id=%d", charid);
if(mysql_query(&m, query) != 0) {
printf("Unable to query.\n");
return(1);
}
MYSQL_RES *res = mysql_use_result(&m);
if(res == NULL) {
printf("Unable to use character_ res.\n");
return(1);
}
MYSQL_ROW row;
row = mysql_fetch_row(res);
if(row == NULL) {
printf("Unable to find a char with id %d\n", charid);
return(1);
}
unsigned long* lengths;
lengths = mysql_fetch_lengths(res);
header.char_magic = CHAR_MAGIC;
strcpy(header.name, row[0]);
header.profile_length = lengths[1];
header.extprofile_length = lengths[2];
header.x = atof(row[3]);
header.y = atof(row[4]);
header.z = atof(row[5]);
strcpy(header.zone_name, row[6]);
header.zone_id = atoi(row[7]);
//copy in blobs
ppbuffer = new char[header.profile_length];
eppbuffer = new char[header.extprofile_length];
memcpy(ppbuffer, row[1], header.profile_length);
memcpy(eppbuffer, row[2], header.extprofile_length);
mysql_free_result(res);
//query faction
sprintf(query, "SELECT faction_id,current_value FROM faction_values WHERE char_id=%d", charid);
if(mysql_query(&m, query) != 0) {
printf("Unable to query faction: %s\n", mysql_error(&m));
return(1);
}
res = mysql_use_result(&m);
if(res == NULL) {
printf("Unable to use faction res.\n");
return(1);
}
vector<FactionValueRecord> fr;
while((row = mysql_fetch_row(res))) {
FactionValueRecord r;
r.faction_id = atoi(row[0]);
r.current_value = atoi(row[1]);
fr.push_back(r);
}
mysql_free_result(res);
//query inventory
sprintf(query, "SELECT slotid,itemid,charges,color,augslot1,augslot2,augslot3,augslot4,augslot5,instnodrop FROM inventory WHERE charid=%d", charid);
if(mysql_query(&m, query) != 0) {
printf("Unable to query inventory: %s\n", mysql_error(&m));
return(1);
}
res = mysql_use_result(&m);
if(res == NULL) {
printf("Unable to use inventory res.\n");
return(1);
}
vector<InventoryEntry> inv;
while((row = mysql_fetch_row(res))) {
InventoryEntry r;
r.slotid = atoi(row[0]);
r.itemid = atoi(row[1]);
r.charges = atoi(row[2]);
r.colors = atoi(row[3]);
r.augs[0] = atoi(row[4]);
r.augs[1] = atoi(row[5]);
r.augs[2] = atoi(row[6]);
r.augs[3] = atoi(row[7]);
r.augs[4] = atoi(row[8]);
inv.push_back(r);
}
mysql_free_result(res);
//query shared bank
sprintf(query, "SELECT slotid,itemid,charges,augslot1,augslot2,augslot3,augslot4,augslot5 FROM sharedbank,character_ WHERE sharedbank.acctid = character_.account_id AND character_.id=%d", charid);
if(mysql_query(&m, query) != 0) {
printf("Unable to query shared bank: %s\n", mysql_error(&m));
return(1);
}
res = mysql_use_result(&m);
if(res == NULL) {
printf("Unable to use shared bank res.\n");
return(1);
}
vector<InventoryEntry> sb;
while((row = mysql_fetch_row(res))) {
InventoryEntry r;
r.slotid = atoi(row[0]);
r.itemid = atoi(row[1]);
r.charges = atoi(row[2]);
r.augs[0] = atoi(row[3]);
r.augs[1] = atoi(row[4]);
r.augs[2] = atoi(row[5]);
r.augs[3] = atoi(row[6]);
r.augs[4] = atoi(row[7]);
sb.push_back(r);
}
mysql_free_result(res);
//query quest_globals
sprintf(query, "SELECT npcid,zoneid,name,value,expdate FROM quest_globals WHERE charid=%d", charid);
if(mysql_query(&m, query) != 0) {
printf("Unable to query quest globals: %s\n", mysql_error(&m));
return(1);
}
res = mysql_use_result(&m);
if(res == NULL) {
printf("Unable to use quest globals res.\n");
return(1);
}
vector<QuestGlobalEntry> qg;
while((row = mysql_fetch_row(res))) {
QuestGlobalEntry r;
r.npcid = atoi(row[0]);
r.zoneid = atoi(row[1]);
strcpy(r.name, row[2]);
strcpy(r.value, row[3]);
r.expdate = atoi(row[4]);
qg.push_back(r);
}
mysql_free_result(res);
mysql_close(&m);
FILE *outf = fopen(outfile, "wb");
if(outf == NULL) {
printf("Unable to open output file %s\n", outfile);
return(1);
}
//fill in our counters
header.faction_value_count = fr.size();
header.inventory_count = inv.size();
header.sharedbank_count = sb.size();
header.quest_globals_count = qg.size();
//write header
fwrite(&header, 1, sizeof(header), outf);
//write out pp and epp
fwrite(ppbuffer, 1, header.profile_length, outf);
fwrite(eppbuffer, 1, header.extprofile_length, outf);
//write out our variable length segments
vector<FactionValueRecord>::iterator curfr, endfr;
curfr = fr.begin();
endfr = fr.end();
for(; curfr != endfr; curfr++) {
FactionValueRecord &r = *curfr;
fwrite(&r, 1, sizeof(FactionValueRecord), outf);
}
vector<InventoryEntry>::iterator curi, endi;
curi = inv.begin();
endi = inv.end();
for(; curi != endi; curi++) {
InventoryEntry &i = *curi;
fwrite(&i, 1, sizeof(InventoryEntry), outf);
}
curi = sb.begin();
endi = sb.end();
for(; curi != endi; curi++) {
InventoryEntry &i = *curi;
fwrite(&i, 1, sizeof(InventoryEntry), outf);
}
vector<QuestGlobalEntry>::iterator curqg, endqg;
curqg = qg.begin();
endqg = qg.end();
for(; curqg != endqg; curqg++) {
QuestGlobalEntry &r = *curqg;
fwrite(&r, 1, sizeof(QuestGlobalEntry), outf);
}
fclose(outf);
return(0);
}
+190
View File
@@ -0,0 +1,190 @@
#include "../common/types.h"
//#include "../common/eq_packet_structs.h"
#include <stdio.h>
#include <mysql.h>
#include <stdlib.h>
#include <string.h>
#include "../common/dbcore.h"
#include "char_format.h"
void usage() {
printf("Usage: import_char [accountid] [infile]\n");
exit(1);
}
int main(int argc, char *argv[]) {
const char *infile;
if(argc != 3)
usage();
int accountid = atoi(argv[1]);
if(accountid == 0)
usage();
infile = argv[2];
char *query = new char[1024000];
char *cursor;
char host[200], user[200], passwd[200], database[200];
int32 port=0;
bool compression = false;
bool items[6] = {false, false, false, false, false, false};
if(!DBcore::ReadDBINI(host, user, passwd, database, port, compression, items)) {
exit(1);
}
if (!items[0] || !items[1] || !items[2] || !items[3])
{
printf ("Incomplete DB.INI file.\n");
exit (1);
}
MYSQL m;
mysql_init(&m);
if(!mysql_real_connect(&m, host, user, passwd, database, 0, NULL, 0)) {
printf("Unable to connect 1: %s.\n", mysql_error(&m));
return(1);
}
CharHeader header;
char *ppbuffer;
char *eppbuffer;
FactionValueRecord *factions;
InventoryEntry *inventory;
InventoryEntry *sharedbank;
QuestGlobalEntry *qglobals;
FILE *inf = fopen(infile, "rb");
if(inf == NULL) {
printf("Unable to open infile %s\n", infile);
return(1);
}
if(fread(&header, sizeof(header), 1, inf) != 1) {
printf("Error reading header.\n");
return(1);
}
ppbuffer = new char[header.profile_length];
eppbuffer = new char[header.extprofile_length];
factions = new FactionValueRecord[header.faction_value_count];
inventory = new InventoryEntry[header.inventory_count];
sharedbank = new InventoryEntry[header.sharedbank_count];
qglobals = new QuestGlobalEntry[header.quest_globals_count];
//read all the shit in
if(fread(ppbuffer, header.profile_length, 1, inf) != 1) {
printf("Error reading pp.\n");
return(1);
}
if(fread(eppbuffer, header.extprofile_length, 1, inf) != 1) {
printf("Error reading epp.\n");
return(1);
}
if(fread(factions, sizeof(FactionValueRecord), header.faction_value_count, inf) != header.faction_value_count) {
printf("Error reading factions.\n");
return(1);
}
if(fread(inventory, sizeof(InventoryEntry), header.inventory_count, inf) != header.inventory_count) {
printf("Error reading inventory.\n");
return(1);
}
if(fread(sharedbank, sizeof(InventoryEntry), header.sharedbank_count, inf) != header.sharedbank_count) {
printf("Error reading sharedbank.\n");
return(1);
}
if(fread(qglobals, sizeof(QuestGlobalEntry), header.quest_globals_count, inf) != header.quest_globals_count) {
printf("Error reading quest globals.\n");
return(1);
}
fclose(inf);
cursor = query;
cursor += sprintf(cursor, "INSERT INTO character_ "
"(account_id,name,profile,extprofile,x,y,z,zonename,zoneid)"
"VALUES(%d,'%s','", accountid, header.name );
cursor += mysql_real_escape_string(&m, cursor, (const char *) ppbuffer, header.profile_length);
cursor += sprintf(cursor, "','");
cursor += mysql_real_escape_string(&m, cursor, (const char *) eppbuffer, header.extprofile_length);
sprintf(cursor, "',%f,%f,%f,'%s',%d)", header.x, header.y, header.z, header.zone_name, header.zone_id);
if(mysql_query(&m, query) != 0) {
printf("Unable to insert character: %s\n", mysql_error(&m));
return(1);
}
int charid = mysql_insert_id(&m);
uint32 r;
//faction
for(r = 0; r < header.faction_value_count; r++) {
sprintf(query, "INSERT INTO faction_values (char_id,faction_id,current_value)"
" VALUES(%d,%d,%d)", charid, factions[r].faction_id, factions[r].current_value);
if(mysql_query(&m, query) != 0) {
printf("Unable to insert faction: %s\n", mysql_error(&m));
return(1);
}
}
//inventory
for(r = 0; r < header.inventory_count; r++) {
sprintf(query, "INSERT INTO inventory (charid,slotid,itemid,charges,color,augslot1,augslot2,augslot3,augslot4,augslot5,instnodrop)"
" VALUES(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)", charid,
inventory[r].slotid, inventory[r].itemid, inventory[r].charges, inventory[r].colors,
inventory[r].augs[0], inventory[r].augs[1], inventory[r].augs[2], inventory[r].augs[3],
inventory[r].augs[4], inventory[r].instnodrop
);
if(mysql_query(&m, query) != 0) {
printf("Unable to insert faction: %s\n", mysql_error(&m));
return(1);
}
}
//shared bank
//this is far from perfect since this is per-account, works great with empty shard bank...
for(r = 0; r < header.sharedbank_count; r++) {
sprintf(query, "INSERT INTO sharedbank (acctid,slotid,itemid,charges,augslot1,augslot2,augslot3,augslot4,augslot5)"
" VALUES(%d,%d,%d,%d,%d,%d,%d,%d,%d)", accountid,
sharedbank[r].slotid, sharedbank[r].itemid, sharedbank[r].charges,
sharedbank[r].augs[0], sharedbank[r].augs[1], sharedbank[r].augs[2], sharedbank[r].augs[3], sharedbank[r].augs[4]
);
if(mysql_query(&m, query) != 0) {
//ignore errors on insert
printf("Shared bank warning: %s\n", mysql_error(&m));
// return(1);
}
}
//quest globals
for(r = 0; r < header.quest_globals_count; r++) {
cursor = query;
cursor += sprintf(cursor, "INSERT INTO quest_globals (charid,npcid,zoneid,name,value,expdate)"
" VALUES(%d,%d,%d,'", charid, qglobals[r].npcid, qglobals[r].zoneid);
cursor += mysql_real_escape_string(&m, cursor, (const char *) qglobals[r].name, strlen(qglobals[r].name));
cursor += sprintf(cursor, "','");
cursor += mysql_real_escape_string(&m, cursor, (const char *) qglobals[r].value, strlen(qglobals[r].value));
sprintf(cursor, "',%d)", qglobals[r].expdate);
if(mysql_query(&m, query) != 0) {
printf("Unable to insert quest global: %s\n", mysql_error(&m));
return(1);
}
}
mysql_close(&m);
printf("Successfully imported %s as character id %d\n", header.name, charid);
return(0);
}
+30
View File
@@ -0,0 +1,30 @@
#! /usr/bin/perl
print<<EOF;
#include "debug.h"
#include <map>
#include <string>
using namespace std;
map<unsigned long, string> opcode_map;
string get_opcode_name(unsigned long opcode)
{
map<unsigned long, string>::iterator itr;;
return (itr=opcode_map.find(opcode))!=opcode_map.end() ? itr->second : "OP_Unknown";
}
EOF
printf("void load_opcode_names()\n{\n");
open(OPS,"$ARGV[0]") || die;
while($_=<OPS>) {
if (/^#define\s+(\S+)\s+(\S+)/) {
if ($2 ne "0x9999") {
printf("\topcode_map[%s]=\"%s\";\n",$2,$1);
}
}
}
close(OPS);
printf("}\n");
+75
View File
@@ -0,0 +1,75 @@
// HexRichEdit.cpp : implementation file
//
#include "stdafx.h"
#include "hexvis.h"
#include "HexRichEdit.h"
#include "hexvisDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// HexRichEdit
HexRichEdit::HexRichEdit()
: parent(NULL)
{
}
HexRichEdit::~HexRichEdit()
{
}
BEGIN_MESSAGE_MAP(HexRichEdit, CRichEditCtrl)
//{{AFX_MSG_MAP(HexRichEdit)
ON_WM_KEYDOWN()
ON_WM_KEYUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// HexRichEdit message handlers
void HexRichEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch(nChar) {
case VK_LEFT:
if(parent != NULL)
parent->PrevByte();
return;
case VK_UP:
if(parent != NULL)
parent->PrevLine();
return;
case VK_RIGHT:
if(parent != NULL)
parent->NextByte();
return;
case VK_DOWN:
if(parent != NULL)
parent->NextLine();
return;
}
CRichEditCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
void HexRichEdit::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch(nChar) {
case VK_LEFT:
case VK_UP:
case VK_RIGHT:
case VK_DOWN:
return; /* just make sure these dont get processed */
}
// TODO: Add your message handler code here and/or call default
CRichEditCtrl::OnKeyUp(nChar, nRepCnt, nFlags);
}
+52
View File
@@ -0,0 +1,52 @@
#if !defined(AFX_HEXRICHEDIT_H__29F129EE_0086_45A7_8A61_7ACCB6507BCE__INCLUDED_)
#define AFX_HEXRICHEDIT_H__29F129EE_0086_45A7_8A61_7ACCB6507BCE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// HexRichEdit.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// HexRichEdit window
class CHexvisDlg;
class HexRichEdit : public CRichEditCtrl
{
// Construction
public:
HexRichEdit();
// Attributes
public:
CHexvisDlg *parent;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(HexRichEdit)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~HexRichEdit();
// Generated message map functions
protected:
//{{AFX_MSG(HexRichEdit)
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_HEXRICHEDIT_H__29F129EE_0086_45A7_8A61_7ACCB6507BCE__INCLUDED_)
+8
View File
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// hexvis.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
+27
View File
@@ -0,0 +1,27 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__2BA1C837_5B64_460A_9580_0ECEDF126247__INCLUDED_)
#define AFX_STDAFX_H__2BA1C837_5B64_460A_9580_0ECEDF126247__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__2BA1C837_5B64_460A_9580_0ECEDF126247__INCLUDED_)
+95
View File
@@ -0,0 +1,95 @@
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CHexvisDlg
LastTemplate=CRichEditCtrl
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "hexvis.h"
ClassCount=4
Class1=CHexvisApp
Class2=CHexvisDlg
Class3=CAboutDlg
ResourceCount=3
Resource1=IDD_ABOUTBOX
Resource2=IDR_MAINFRAME
Class4=HexRichEdit
Resource3=IDD_HEXVIS_DIALOG
[CLS:CHexvisApp]
Type=0
HeaderFile=hexvis.h
ImplementationFile=hexvis.cpp
Filter=N
[CLS:CHexvisDlg]
Type=0
HeaderFile=hexvisDlg.h
ImplementationFile=hexvisDlg.cpp
Filter=D
BaseClass=CDialog
VirtualFilter=dWC
LastObject=CHexvisDlg
[CLS:CAboutDlg]
Type=0
HeaderFile=hexvisDlg.h
ImplementationFile=hexvisDlg.cpp
Filter=D
[DLG:IDD_ABOUTBOX]
Type=1
Class=CAboutDlg
ControlCount=4
Control1=IDC_STATIC,static,1342177283
Control2=IDC_STATIC,static,1342308480
Control3=IDC_STATIC,static,1342308352
Control4=IDOK,button,1342373889
[DLG:IDD_HEXVIS_DIALOG]
Type=1
Class=CHexvisDlg
ControlCount=31
Control1=IDC_PACKET_BODY,RICHEDIT,1353781700
Control2=IDC_PROCESS,button,1342242817
Control3=IDC_CLEAR,button,1342242816
Control4=IDC_LOAD_FILE,button,1342242816
Control5=IDC_SEARCH_NUMBER,edit,1350631552
Control6=IDC_FIND_NUMBER,button,1342242816
Control7=IDC_STATIC,button,1342177287
Control8=IDC_STATIC,static,1342308352
Control9=IDC_BYTE,edit,1350633600
Control10=IDC_STATIC,static,1342308352
Control11=IDC_SHORT_BE,edit,1350633600
Control12=IDC_SHORT_LE,edit,1350633600
Control13=IDC_STATIC,static,1342308352
Control14=IDC_LONG_BE,edit,1350633600
Control15=IDC_LONG_LE,edit,1350633600
Control16=IDC_STATIC,static,1342308352
Control17=IDC_UNIX_TIME,edit,1350633600
Control18=IDC_STATIC,static,1342308352
Control19=IDC_REAL,edit,1350633600
Control20=IDC_STATIC,static,1342308352
Control21=IDC_INT64_BE,edit,1350633600
Control22=IDC_INT64_LE,edit,1350633600
Control23=IDC_STATIC,static,1342308352
Control24=IDC_STRING,edit,1350633600
Control25=IDC_STATIC,static,1342308352
Control26=IDC_OFFSET,edit,1350633600
Control27=IDC_STATIC,static,1342308352
Control28=IDC_STATIC,static,1342308352
Control29=IDC_BIN_REP,edit,1350633600
Control30=IDC_STATE,static,1342308352
Control31=IDC_COPY_TO_CLIP,button,1342242816
[CLS:HexRichEdit]
Type=0
HeaderFile=HexRichEdit.h
ImplementationFile=HexRichEdit.cpp
BaseClass=CRichEditCtrl
Filter=W
VirtualFilter=WC
LastObject=HexRichEdit
+75
View File
@@ -0,0 +1,75 @@
// hexvis.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "hexvis.h"
#include "hexvisDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CHexvisApp
BEGIN_MESSAGE_MAP(CHexvisApp, CWinApp)
//{{AFX_MSG_MAP(CHexvisApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHexvisApp construction
CHexvisApp::CHexvisApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CHexvisApp object
CHexvisApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CHexvisApp initialization
BOOL CHexvisApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
AfxInitRichEdit();
CHexvisDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
+154
View File
@@ -0,0 +1,154 @@
# Microsoft Developer Studio Project File - Name="hexvis" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=hexvis - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "hexvis.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "hexvis.mak" CFG="hexvis - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "hexvis - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "hexvis - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "hexvis - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "hexvis - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "hexvis - Win32 Release"
# Name "hexvis - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\HexRichEdit.cpp
# End Source File
# Begin Source File
SOURCE=.\hexvis.cpp
# End Source File
# Begin Source File
SOURCE=.\hexvis.rc
# End Source File
# Begin Source File
SOURCE=.\hexvisDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\HexRichEdit.h
# End Source File
# Begin Source File
SOURCE=.\hexvis.h
# End Source File
# Begin Source File
SOURCE=.\hexvisDlg.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\hexvis.ico
# End Source File
# Begin Source File
SOURCE=.\res\hexvis.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project
+29
View File
@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "hexvis"=.\hexvis.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
+49
View File
@@ -0,0 +1,49 @@
// hexvis.h : main header file for the HEXVIS application
//
#if !defined(AFX_HEXVIS_H__4CCA845D_D36E_41F3_A82B_A1D8A2360F84__INCLUDED_)
#define AFX_HEXVIS_H__4CCA845D_D36E_41F3_A82B_A1D8A2360F84__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CHexvisApp:
// See hexvis.cpp for the implementation of this class
//
class CHexvisApp : public CWinApp
{
public:
CHexvisApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHexvisApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CHexvisApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_HEXVIS_H__4CCA845D_D36E_41F3_A82B_A1D8A2360F84__INCLUDED_)
+239
View File
@@ -0,0 +1,239 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\hexvis.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\hexvis.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About hexvis"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "hexvis Version 1.2",IDC_STATIC,40,10,119,8,SS_NOPREFIX
LTEXT "Copyright (C) 2006",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END
IDD_HEXVIS_DIALOG DIALOGEX 0, 0, 387, 314
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "hexvis"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "",IDC_PACKET_BODY,"RICHEDIT",ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_NOHIDESEL |
ES_WANTRETURN | WS_BORDER | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP,7,7,373,107
DEFPUSHBUTTON "Process",IDC_PROCESS,330,116,50,12
PUSHBUTTON "Clear",IDC_CLEAR,263,116,50,12
PUSHBUTTON "Load File",IDC_LOAD_FILE,330,135,50,12
EDITTEXT IDC_SEARCH_NUMBER,39,128,63,12,ES_AUTOHSCROLL
PUSHBUTTON "Find",IDC_FIND_NUMBER,107,128,26,12
GROUPBOX "Field Values",IDC_STATIC,7,151,373,151
LTEXT "Byte:",IDC_STATIC,154,166,20,8
EDITTEXT IDC_BYTE,175,163,62,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Short:",IDC_STATIC,24,183,21,8
EDITTEXT IDC_SHORT_BE,50,180,99,14,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_SHORT_LE,50,197,99,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Long:",IDC_STATIC,154,182,19,8
EDITTEXT IDC_LONG_BE,175,180,199,14,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_LONG_LE,175,197,199,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "UNIX Time:",IDC_STATIC,11,216,38,8
EDITTEXT IDC_UNIX_TIME,50,214,324,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Real:",IDC_STATIC,24,233,21,8
EDITTEXT IDC_REAL,50,231,324,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "INT64:",IDC_STATIC,22,250,21,8
EDITTEXT IDC_INT64_BE,50,248,324,14,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_INT64_LE,50,265,324,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "String:",IDC_STATIC,23,283,21,8
EDITTEXT IDC_STRING,50,282,324,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Offset:",IDC_STATIC,23,168,23,8
EDITTEXT IDC_OFFSET,50,163,99,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Number:",IDC_STATIC,7,130,28,8
LTEXT "Binary:",IDC_STATIC,250,165,21,8
EDITTEXT IDC_BIN_REP,274,163,100,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Paste text above an process",IDC_STATE,7,117,191,8
PUSHBUTTON "Copy",IDC_COPY_TO_CLIP,263,134,50,12
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "hexvis MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "hexvis\0"
VALUE "LegalCopyright", "Copyright (C) 2006\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "hexvis.EXE\0"
VALUE "ProductName", "hexvis Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_HEXVIS_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 380
VERTGUIDE, 50
VERTGUIDE, 374
TOPMARGIN, 7
BOTTOMMARGIN, 307
HORZGUIDE, 128
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About hexvis..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\hexvis.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
File diff suppressed because it is too large Load Diff
+100
View File
@@ -0,0 +1,100 @@
// hexvisDlg.h : header file
//
#if !defined(AFX_HEXVISDLG_H__CA785941_36B6_4928_A1EB_B189A9AE2EA2__INCLUDED_)
#define AFX_HEXVISDLG_H__CA785941_36B6_4928_A1EB_B189A9AE2EA2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "HexRichEdit.h"
#include <vector>
/////////////////////////////////////////////////////////////////////////////
// CHexvisDlg dialog
class CHexvisDlg : public CDialog
{
// Construction
public:
CHexvisDlg(CWnd* pParent = NULL); // standard constructor
void PrevByte();
void NextByte();
void PrevLine();
void NextLine();
// Dialog Data
//{{AFX_DATA(CHexvisDlg)
enum { IDD = IDD_HEXVIS_DIALOG };
CStatic m_status;
CEdit m_binRep;
CEdit m_searchNumber;
CEdit m_offset;
CEdit m_unix_time;
CEdit m_string;
CEdit m_short_le;
CEdit m_short_be;
CEdit m_real;
HexRichEdit m_packetBody;
CEdit m_long_le;
CEdit m_long_be;
CEdit m_int64_le;
CEdit m_int64_be;
CEdit m_byte;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHexvisDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
bool m_processed;
int m_offsetStart;
int m_activeByte;
std::vector<unsigned char> m_digits;
std::vector<unsigned long> m_lineStarts;
void ProcessLine(const char *line, int len);
bool _ProcessDigits(const char *startnum, int numlen);
void DisplayDigits();
void AnalyzeBytes(int byte);
void SelectByte(int byte);
void build_hex_line(const char *buffer, unsigned long length, unsigned long offset, unsigned char padding);
typedef struct {
unsigned __int64 intval;
double dval;
float fval;
} FindSpec;
bool FindNumber(int offset, const FindSpec *f);
// Generated message map functions
//{{AFX_MSG(CHexvisDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnProcess();
afx_msg void OnUpdatePacketBody();
afx_msg void OnSelchangePacketBody(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClear();
afx_msg void OnFindNumber();
afx_msg void OnLoadFile();
afx_msg void OnCopyToClip();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_HEXVISDLG_H__CA785941_36B6_4928_A1EB_B189A9AE2EA2__INCLUDED_)
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+13
View File
@@ -0,0 +1,13 @@
//
// HEXVIS.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
+40
View File
@@ -0,0 +1,40 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by hexvis.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_HEXVIS_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_PACKET_BODY 1000
#define IDC_PROCESS 1001
#define IDC_BYTE 1002
#define IDC_SHORT_BE 1003
#define IDC_SHORT_LE 1004
#define IDC_LONG_BE 1005
#define IDC_LONG_LE 1006
#define IDC_UNIX_TIME 1007
#define IDC_REAL 1008
#define IDC_INT64_BE 1009
#define IDC_INT64_LE 1010
#define IDC_STRING 1011
#define IDC_OFFSET 1012
#define IDC_CLEAR 1013
#define IDC_SEARCH_NUMBER 1014
#define IDC_FIND_NUMBER 1015
#define IDC_BIN_REP 1016
#define IDC_STATE 1017
#define IDC_LOAD_FILE 1018
#define IDC_COPY_TO_CLIP 1019
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1018
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
@@ -0,0 +1,80 @@
alter table items change unknown021 UNK012 int NOT NULL DEFAULT '0';
alter table items change unknown022 UNK013 int NOT NULL DEFAULT '0';
alter table items change unknown023 benefitflag int NOT NULL DEFAULT '0';
alter table items change unknown064 UNK054 int NOT NULL DEFAULT '0';
alter table items change unknown070 UNK059 int NOT NULL DEFAULT '0';
alter table items change unknown072 UNK061 int NOT NULL DEFAULT '0';
alter table items change combatskill extradmgskill int NOT NULL DEFAULT '0';
alter table items change combatskilldmg extradmgamt int NOT NULL DEFAULT '0';
alter table items change booktype book int NOT NULL DEFAULT '0';
alter table items change unknown108 booktype int NOT NULL DEFAULT '0';
alter table items change banedmgamt2 banedmgraceamt int NOT NULL DEFAULT '0';
alter table items change augmentrestriction augrestrict int NOT NULL DEFAULT '0';
alter table items change tribute favor int NOT NULL DEFAULT '0';
alter table items change attackbonus attack int NOT NULL DEFAULT '0';
alter table items change hpregen regen int NOT NULL DEFAULT '0';
alter table items change hastepercent haste int NOT NULL DEFAULT '0';
alter table items change unknown125 recastdelay int NOT NULL DEFAULT '0';
alter table items change unknown126 recasttype int NOT NULL DEFAULT '0';
alter table items change unknown127 guildfavor int NOT NULL DEFAULT '0';
alter table items change distiller augdistiller int NOT NULL DEFAULT '0';
alter table items change unknown129 UNK117 int NOT NULL DEFAULT '0';
alter table items change unknown130 UNK118 int NOT NULL DEFAULT '0';
alter table items change attuneable old_attuneable int NOT NULL DEFAULT '0';
alter table items change unknown131 attuneable int NOT NULL DEFAULT '0';
alter table items change unknown132 nopet int NOT NULL DEFAULT '0';
alter table items add UNK121 int NOT NULL DEFAULT '0';
alter table items add pointtype int NOT NULL DEFAULT '0';
alter table items add potionbelt int NOT NULL DEFAULT '0';
alter table items add UNK124 int NOT NULL DEFAULT '0';
alter table items add stacksize int NOT NULL DEFAULT '0';
alter table items change hasteproclvl level int NOT NULL DEFAULT '0';
alter table items change spellid clickeffect int NOT NULL DEFAULT '0';
alter table items change focusid focuseffect int NOT NULL DEFAULT '0';
alter table items change effecttype clicktype int NOT NULL DEFAULT '0';
alter table items change level clicklevel int NOT NULL DEFAULT '0';
alter table items add UNK129 int NOT NULL DEFAULT '0';
alter table items add proceffect int NOT NULL DEFAULT '0';
alter table items add proctype int NOT NULL DEFAULT '0';
alter table items add proclevel int NOT NULL DEFAULT '0';
alter table items add UNK133 int NOT NULL DEFAULT '0';
alter table items add worneffect int NOT NULL DEFAULT '0';
alter table items add worntype int NOT NULL DEFAULT '0';
alter table items add wornlevel int NOT NULL DEFAULT '0';
alter table items add UNK137 int NOT NULL DEFAULT '0';
alter table items add focustype int NOT NULL DEFAULT '0';
alter table items add focuslevel int NOT NULL DEFAULT '0';
alter table items add UNK141 int NOT NULL DEFAULT '0';
alter table items add scrolleffect int NOT NULL DEFAULT '0';
alter table items add scrolltype int NOT NULL DEFAULT '0';
alter table items add scrolllevel int NOT NULL DEFAULT '0';
alter table items add UNK145 int NOT NULL DEFAULT '0';
alter table items change cost price int NOT NULL DEFAULT '0';
alter table items change casttime2 casttime_ int NOT NULL DEFAULT '0';
alter table items change proc_rate_mod procrate int NOT NULL DEFAULT '0';
alter table items change charmformula charmfileid varchar(32) NOT NULL DEFAULT '';
alter table items modify filename varchar(32) NOT NULL DEFAULT '';
alter table items change ldonpointtheme ldontheme int NOT NULL DEFAULT '0';
alter table items change ldonpointcost ldonprice int NOT NULL DEFAULT '0';
alter table items change gmflag fvnodrop int NOT NULL DEFAULT '0';
alter table items add serialized datetime;
alter table items add verified datetime;
alter table items add serialization text;
alter table items add source varchar(20) NOT NULL;
alter table items add UNK033 int NOT NULL DEFAULT '0';
alter table items drop column charges;
alter table items drop column unknown001;
alter table items drop column collected_slot_id;
alter table items drop column merchantprice;
alter table items drop column unknown004;
alter table items drop column collected_inst_id;
alter table items drop column unknown006;
alter table items drop column spellcharges;
alter table items drop column old_attuneable;
update items set proctype=clicktype,proceffect=clickeffect,proclevel=clicklevel,clicktype=0,clickeffect=0,clicklevel=0 where clickeffect>0 and clicktype =0;
update items set worntype=clicktype,proceffect=clickeffect,proclevel=clicklevel,clicktype=0,clickeffect=0,clicklevel=0 where clickeffect>0 and clicktype =2;
update items set focustype=6 where focuseffect>0;
update items set scrolltype=7,scrolleffect=clickeffect,scrolllevel=clicklevel,clicktype=0,clickeffect=0,clicklevel=0 where clickeffect>0 and itemtype =20;
+22
View File
@@ -0,0 +1,22 @@
--Obsolete if you have the latest items db.
ALTER TABLE `items` ADD `attackbonus` INT(11) DEFAULT "0" NOT NULL AFTER `astr`;
ALTER TABLE `items` CHANGE `unknown108` `augmentrestriction` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` CHANGE `unknown107` `banedmgamt2` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` ADD `charges` INT(11) DEFAULT "0" NOT NULL AFTER `casttime2`;
ALTER TABLE `items` CHANGE `unknown076` `combatskill` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` CHANGE `unknown077` `combatskilldmg` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` ADD `damageshield` INT(11) DEFAULT "0" NOT NULL AFTER `damage`;
ALTER TABLE `items` ADD `dotshielding` INT(11) DEFAULT "0" NOT NULL AFTER `damageshield`;
ALTER TABLE `items` ADD `endur` INT(11) DEFAULT "0" NOT NULL AFTER `damageshield`;
ALTER TABLE `items` ADD `hastepercent` INT(11) DEFAULT "0" NOT NULL AFTER `gmflag`;
ALTER TABLE `items` ADD `hpregen` INT(11) DEFAULT "0" NOT NULL AFTER `hp`;
ALTER TABLE `items` CHANGE `unknown099` `ldonsold` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` ADD `manaregen` INT(11) DEFAULT "0" NOT NULL AFTER `mana`;
ALTER TABLE `items` CHANGE `unknown004` `merchantprice` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` CHANGE `unknown070` `proc_rate_mod` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` ADD `unknown003` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` ADD `unknown006` INT(11) DEFAULT "0" NOT NULL;
ALTER TABLE `items` ADD `unknown007` INT(11) DEFAULT "0" NOT NULL;
update items set filename='' where filename='0';
update items set charmfile='' where charmfile='0';
+9
View File
@@ -0,0 +1,9 @@
//NOTE: you must have a space after the * of a return value
unsigned int field_count();
unsigned long affected_rows();
unsigned long insert_id();
unsigned int get_errno();
Const_char * error();
EQDBRes * query(Const_char *q);
Const_char * escape_string(Const_char *from); //NOT THREAD SAFE! (m_escapeBuffer)
+37
View File
@@ -0,0 +1,37 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef const char Const_char;
#ifdef EMBPERL
#include "../common/debug.h"
#include "../common/useperl.h"
#include "EQDB.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = EQDB PACKAGE = EQDB
PROTOTYPES: ENABLE
+7
View File
@@ -0,0 +1,7 @@
unsigned long num_rows() { return (res) ? mysql_num_rows(res) : 0; }
unsigned long num_fields() { return (res) ? mysql_num_fields(res) : 0; }
void DESTROY() { }
void finish() { if (res) mysql_free_result(res); res=NULL; };
vector<string> fetch_row_array();
map<string,string> fetch_row_hash();
unsigned long * fetch_lengths() { return (res) ? mysql_fetch_lengths(res) : 0; }
+33
View File
@@ -0,0 +1,33 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef const char Const_char;
#ifdef EMBPERL
#include "../common/debug.h"
#include "../common/useperl.h"
#include "EQDBRes.h"
MODULE = EQDBRes PACKAGE = EQDBRes
PROTOTYPES: ENABLE
+19
View File
@@ -0,0 +1,19 @@
Const_char * GetName() const { return(m_name.c_str()); }
int GetStaticCount() const { return(m_zones.size()); }
bool IsConnected() const; //is this launcher connected to world
void DeleteLauncher(); //kill this launcher and all its zones.
void RestartZone(Const_char *zone_ref);
void StopZone(Const_char *zone_ref);
void StartZone(Const_char *zone_ref);
bool BootStaticZone(Const_char *short_name, uint16 port);
bool ChangeStaticZone(Const_char *short_name, uint16 port);
bool DeleteStaticZone(Const_char *short_name);
bool SetDynamicCount(int count);
int GetDynamicCount() const;
vector<string> ListZones(); //returns an array of zone refs
map<string,string> GetZoneDetails(Const_char *zone_ref);
+37
View File
@@ -0,0 +1,37 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef const char Const_char;
#ifdef EMBPERL
#include "../common/debug.h"
#include "EQWParser.h"
#include "EQLConfig.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = EQLConfig PACKAGE = EQLConfig
PROTOTYPES: ENABLE
+36
View File
@@ -0,0 +1,36 @@
//NOTE: you must have a space after the * of a return value
Const_char * GetConfig(Const_char *var_name);
void LockWorld();
void UnlockWorld();
bool LSConnected();
void LSReconnect();
int CountZones();
vector<string> ListBootedZones(); //returns an array of zone_refs (opaque)
map<string,string> GetZoneDetails(Const_char *zone_ref); //returns a hash ref of details
int CountPlayers();
vector<string> ListPlayers(Const_char *zone_name = ""); //returns an array of player refs (opaque)
map<string,string> GetPlayerDetails(Const_char *player_ref); //returns a hash ref of details
int CountLaunchers(bool active_only);
// vector<string> ListActiveLaunchers(); //returns an array of launcher names
vector<string> ListLaunchers(); //returns an array of launcher names
EQLConfig * GetLauncher(Const_char *launcher_name); //returns the EQLConfig object for the specified launcher.
void CreateLauncher(Const_char *launcher_name, int dynamic_count);
// EQLConfig * FindLauncher(Const_char *zone_ref);
//Guild routines, mostly wrappers around guild_mgr
int32 CreateGuild(const char* name, int32 leader_char_id);
bool DeleteGuild(int32 guild_id);
bool RenameGuild(int32 guild_id, const char* name);
bool SetGuildMOTD(int32 guild_id, const char* motd, const char *setter);
bool SetGuildLeader(int32 guild_id, int32 leader_char_id);
bool SetGuild(int32 charid, int32 guild_id, int8 rank);
bool SetGuildRank(int32 charid, int8 rank);
bool SetBankerFlag(int32 charid, bool is_banker);
bool SetTributeFlag(int32 charid, bool enabled);
bool SetPublicNote(int32 charid, const char *note);
+37
View File
@@ -0,0 +1,37 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef const char Const_char;
#ifdef EMBPERL
#include "../common/debug.h"
#include "EQWParser.h"
#include "EQW.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = EQW PACKAGE = EQW
PROTOTYPES: ENABLE
+14
View File
@@ -0,0 +1,14 @@
Const_char * get(Const_char *name, Const_char *default_value = "") const;
int getInt(Const_char *name, int default_value = 0) const;
float getFloat(Const_char *name, float default_value = 0.0) const;
//returns a database-safe string
Const_char * getEscaped(Const_char *name, Const_char *default_value = "") const;
map<string,string> get_all() const;
void redirect(Const_char *URL);
void SetResponseCode(Const_char *code);
void header(Const_char *name, Const_char *value);
+37
View File
@@ -0,0 +1,37 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef const char Const_char;
#ifdef EMBPERL
#include "../common/debug.h"
#include "EQWParser.h"
#include "HTTPRequest.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = HTTPRequest PACKAGE = HTTPRequest
PROTOTYPES: ENABLE
+28
View File
@@ -0,0 +1,28 @@
int32 GetCharID() { return charid; }
int32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); }
inline void Lock() { pLocked = true; }
inline void UnLock() { pLocked = false; }
inline bool IsLocked() { return pLocked; }
inline void ResetLooter() { BeingLootedBy = 0xFFFFFFFF; }
inline int32 GetDBID() { return dbid; }
inline char* GetOwnerName() { return orgname;}
void SetDecayTimer(int32 decaytime);
bool IsEmpty();
void AddItem(uint32 itemnum, int8 charges, sint16 slot = 0);
uint32 GetWornItem(sint16 equipSlot) const;
void RemoveItem(int16 lootslot);
void SetCash(int16 in_copper, int16 in_silver, int16 in_gold, int16 in_platinum);
void RemoveCash();
int32 CountItems();
void Delete();
uint32 GetCopper() { return copper; }
uint32 GetSilver() { return silver; }
uint32 GetGold() { return gold; }
uint32 GetPlatinum() { return platinum; }
void Summon(Client* client, bool spell);
void CastRezz(int16 spellid, Mob* Caster);
void CompleteRezz();
bool CanMobLoot(int charid);
void AllowMobLoot(Mob *them, int8 slot);
void AddLooter(Mob *who);
bool IsRezzed() { return isrezzed; }
+37
View File
@@ -0,0 +1,37 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/debug.h"
#include "embperl.h"
#include "PlayerCorpse.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = Corpse PACKAGE = Corpse
PROTOTYPES: ENABLE
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
if [ ! -h ./miniperl ]; then
echo "You must have a link in this dir to perl named ./miniperl"
exit 1
fi
./convert client.h Client
./convert entity.h EntityList
./convert mob.h Mob
./convert npc.h NPC
./convert PlayerCorpse.h Corpse
./convert groups.h Group
./convert perlpacket.h PerlPacket
./export ../../world/EQW.h EQW.h
./convert EQW.h EQW
./export ../../common/EQDB.h EQDB.h
./convert EQDB.h EQDB
./export ../../common/EQDBRes.h EQDBRes.h
./convert EQDBRes.h EQDBRes
./export ../../world/HTTPRequest.h HTTPRequest.h
./convert HTTPRequest.h HTTPRequest
./export ../../world/EQLConfig.h EQLConfig.h
./convert EQLConfig.h EQLConfig
echo "Putting files in place..."
./put
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
xsubpp -typemap class.typemap class.xs
+442
View File
@@ -0,0 +1,442 @@
#our object types
EQLConfig * T_PTROBJ
EQDB * T_PTROBJ
EQDBRes * T_PTROBJ
Client * T_PTROBJ
NPC * T_PTROBJ
Mob * T_PTROBJ
Group * T_PTROBJ
Corpse * T_PTROBJ
EntityList * T_PTROBJ
PerlPacket * T_PTROBJ
EQW * T_PTROBJ
HTTPRequest * T_PTROBJ
Const_char * T_PV
#some nice c++ types
vector<string> T_STRINGARRAY
map<string,string> T_STRINGMAP
#our int types
FACTION_VALUE T_IV
EmuAppearance T_UV
SkillType T_UV
Mob::eStandingPetOrder T_IV
int32 T_UV
int16 T_UV
int8 T_UV
uint32 T_UV
uint16 T_UV
uint8 T_UV
sint32 T_IV
sint16 T_IV
sint8 T_IV
int * T_INTARRAY
unsigned long * T_INTARRAY
# basic C types
int T_IV
unsigned T_UV
unsigned int T_UV
long T_IV
unsigned long T_UV
unsigned long long T_UV
short T_IV
unsigned short T_UV
char T_CHAR
unsigned char T_U_CHAR
char * T_PV
unsigned char * T_PV
const char * T_PV
caddr_t T_PV
wchar_t * T_PV
wchar_t T_IV
# bool_t is defined in <rpc/rpc.h>
bool_t T_IV
size_t T_UV
ssize_t T_IV
time_t T_NV
unsigned long * T_OPAQUEPTR
char ** T_PACKEDARRAY
void * T_PTR
Time_t * T_PV
SV * T_SV
SVREF T_SVREF
AV * T_AVREF
HV * T_HVREF
CV * T_CVREF
IV T_IV
UV T_UV
NV T_NV
I32 T_IV
I16 T_IV
I8 T_IV
STRLEN T_UV
U32 T_U_LONG
U16 T_U_SHORT
U8 T_UV
Result T_U_CHAR
Boolean T_BOOL
float T_FLOAT
double T_DOUBLE
SysRet T_SYSRET
SysRetLong T_SYSRET
FILE * T_STDIO
PerlIO * T_INOUT
FileHandle T_PTROBJ
InputStream T_IN
InOutStream T_INOUT
OutputStream T_OUT
bool T_BOOL
#############################################################################
INPUT
T_SV
$var = $arg
T_SVREF
if (SvROK($arg))
$var = (SV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not a reference\");
T_AVREF
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV)
$var = (AV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not an array reference\");
T_HVREF
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVHV)
$var = (HV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not a hash reference\");
T_CVREF
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVCV)
$var = (CV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not a code reference\");
T_SYSRET
$var NOT IMPLEMENTED
T_UV
$var = ($type)SvUV($arg)
T_IV
$var = ($type)SvIV($arg)
T_INT
$var = (int)SvIV($arg)
T_ENUM
$var = ($type)SvIV($arg)
T_BOOL
$var = (bool)SvTRUE($arg)
T_U_INT
$var = (unsigned int)SvUV($arg)
T_SHORT
$var = (short)SvIV($arg)
T_U_SHORT
$var = (unsigned short)SvUV($arg)
T_LONG
$var = (long)SvIV($arg)
T_U_LONG
$var = (unsigned long)SvUV($arg)
T_CHAR
$var = (char)*SvPV_nolen($arg)
T_U_CHAR
$var = (unsigned char)SvUV($arg)
T_FLOAT
$var = (float)SvNV($arg)
T_NV
$var = ($type)SvNV($arg)
T_DOUBLE
$var = (double)SvNV($arg)
T_PV
$var = ($type)SvPV_nolen($arg)
T_PTR
$var = INT2PTR($type,SvIV($arg))
T_PTRREF
if (SvROK($arg)) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"$var is not a reference\");
if($var == NULL)
Perl_croak(aTHX_ \"$var is NULL, avoiding crash.\");
T_REF_IV_REF
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = *INT2PTR($type *, tmp);
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\");
T_REF_IV_PTR
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\");
if($var == NULL)
Perl_croak(aTHX_ \"$var is NULL, avoiding crash.\");
T_PTROBJ
if (sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\");
if($var == NULL)
Perl_croak(aTHX_ \"$var is NULL, avoiding crash.\");
T_PTRDESC
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
${type}_desc = (\U${type}_DESC\E*) tmp;
$var = ${type}_desc->ptr;
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\");
if($var == NULL)
Perl_croak(aTHX_ \"$var is NULL, avoiding crash.\");
T_REFREF
if (SvROK($arg)) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = *INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"$var is not a reference\");
if($var == NULL)
Perl_croak(aTHX_ \"$var is NULL, avoiding crash.\");
T_REFOBJ
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = *INT2PTR($type,tmp);
}
else
Perl_croak(aTHX_ \"$var is not of type ${ntype}\");
if($var == NULL)
Perl_croak(aTHX_ \"$var is NULL, avoiding crash.\");
T_OPAQUE
$var = *($type *)SvPV_nolen($arg)
T_OPAQUEPTR
$var = ($type)SvPV_nolen($arg)
T_PACKED
$var = XS_unpack_$ntype($arg)
T_PACKEDARRAY
$var = XS_unpack_$ntype($arg)
T_CALLBACK
$var = make_perl_cb_$type($arg)
T_ARRAY
U32 ix_$var = $argoff;
$var = $ntype(items -= $argoff);
while (items--) {
DO_ARRAY_ELEM;
ix_$var++;
}
/* this is the number of elements in the array */
ix_$var -= $argoff
T_INTARRAY
AV *av_$var;
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV)
av_$var = (AV*)SvRV($arg);
else
Perl_croak(aTHX_ \"$var is not an array reference\");
I32 len_$var = av_len(av_$var) + 1;
I32 ix_$var;
$var = new $ntype\[len_$var\];
for(ix_$var = 0; ix_$var < len_$var; ix_$var ++) {
SV **tmp = av_fetch(av_$var, ix_$var, 0);
if(tmp == NULL || *tmp == NULL) {
$var\[ix_$var\] = 0;
continue;
}
$var\[ix_$var\] = ($ntype)SvIV(*tmp);
}
T_STDIO
$var = PerlIO_findFILE(IoIFP(sv_2io($arg)))
T_IN
$var = IoIFP(sv_2io($arg))
T_INOUT
$var = IoIFP(sv_2io($arg))
T_OUT
$var = IoOFP(sv_2io($arg))
T_STRINGARRAY
$var NOT IMPLEMENTED
T_STRINGMAP
$var NOT IMPLEMENTED
#############################################################################
OUTPUT
T_SV
$arg = $var;
T_SVREF
$arg = newRV((SV*)$var);
T_AVREF
$arg = newRV((SV*)$var);
T_HVREF
$arg = newRV((SV*)$var);
T_CVREF
$arg = newRV((SV*)$var);
T_IV
sv_setiv($arg, (IV)$var);
T_UV
sv_setuv($arg, (UV)$var);
T_INT
sv_setiv($arg, (IV)$var);
T_SYSRET
if ($var != -1) {
if ($var == 0)
sv_setpvn($arg, "0 but true", 10);
else
sv_setiv($arg, (IV)$var);
}
T_ENUM
sv_setiv($arg, (IV)$var);
T_BOOL
$arg = boolSV($var);
T_U_INT
sv_setuv($arg, (UV)$var);
T_SHORT
sv_setiv($arg, (IV)$var);
T_U_SHORT
sv_setuv($arg, (UV)$var);
T_LONG
sv_setiv($arg, (IV)$var);
T_U_LONG
sv_setuv($arg, (UV)$var);
T_CHAR
sv_setpvn($arg, (char *)&$var, 1);
T_U_CHAR
sv_setuv($arg, (UV)$var);
T_FLOAT
sv_setnv($arg, (double)$var);
T_NV
sv_setnv($arg, (NV)$var);
T_DOUBLE
sv_setnv($arg, (double)$var);
T_PV
sv_setpv((SV*)$arg, $var);
T_PTR
sv_setiv($arg, PTR2IV($var));
T_PTRREF
sv_setref_pv($arg, Nullch, (void*)$var);
T_REF_IV_REF
sv_setref_pv($arg, \"${ntype}\", (void*)new $ntype($var));
T_REF_IV_PTR
sv_setref_pv($arg, \"${ntype}\", (void*)$var);
T_PTROBJ
sv_setref_pv($arg, \"${ntype}\", (void*)$var);
T_PTRDESC
sv_setref_pv($arg, \"${ntype}\", (void*)new\U${type}_DESC\E($var));
T_REFREF
NOT_IMPLEMENTED
T_REFOBJ
NOT IMPLEMENTED
T_OPAQUE
sv_setpvn($arg, (char *)&$var, sizeof($var));
T_OPAQUEPTR
sv_setpvn($arg, (char *)$var, sizeof(*$var));
T_PACKED
XS_pack_$ntype($arg, $var);
T_PACKEDARRAY
XS_pack_$ntype($arg, $var, count_$ntype);
T_DATAUNIT
sv_setpvn($arg, $var.chp(), $var.size());
T_CALLBACK
sv_setpvn($arg, $var.context.value().chp(),
$var.context.value().size());
T_ARRAY
{
U32 ix_$var;
EXTEND(SP,size_$var);
for (ix_$var = 0; ix_$var < size_$var; ix_$var++) {
ST(ix_$var) = sv_newmortal();
DO_ARRAY_ELEM
}
}
T_STDIO
{
GV *gv = newGVgen("$Package");
PerlIO *fp = PerlIO_importFILE($var,0);
if ( fp && do_open(gv, "+<&", 3, FALSE, 0, 0, fp) )
sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
else
$arg = &PL_sv_undef;
}
T_IN
{
GV *gv = newGVgen("$Package");
if ( do_open(gv, "<&", 2, FALSE, 0, 0, $var) )
sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
else
$arg = &PL_sv_undef;
}
T_INOUT
{
GV *gv = newGVgen("$Package");
if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) )
sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
else
$arg = &PL_sv_undef;
}
T_OUT
{
GV *gv = newGVgen("$Package");
if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) )
sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
else
$arg = &PL_sv_undef;
}
T_STRINGARRAY
{
U32 ix_$var;
/* pop crap off the stack we dont really want */
POPs;
POPs;
/* grow the stack to the number of elements being returned */
EXTEND(SP, $var.size());
for (ix_$var = 0; ix_$var < $var.size(); ix_$var++) {
const string &it = $var\[ix_$var\];
ST(ix_$var) = sv_newmortal();
sv_setpvn(ST(ix_$var), it.c_str(), it.length());
}
/* hackish, but im over it. The normal xsubpp return will be right below this */
XSRETURN($var.size());
}
T_STRINGMAP
if (RETVAL.begin()!=RETVAL.end())
{
//NOTE: we are leaking the original $arg right now
HV *hv = newHV();
sv_2mortal((SV*)hv);
$arg = newRV((SV*)hv);
map<string,string>::const_iterator cur, end;
cur = $var.begin();
end = $var.end();
for(; cur != end; cur++) {
/* get the element from the hash, creating if needed (will be needed) */
SV**ele = hv_fetch(hv, cur->first.c_str(), cur->first.length(), TRUE);
if(ele == NULL) {
Perl_croak(aTHX_ \"Unable to create a hash element for $var\");
break;
}
/* put our string in the SV associated with this element in the hash */
sv_setpvn(*ele, cur->second.c_str(), cur->second.length());
}
}
+177
View File
@@ -0,0 +1,177 @@
//BEGIN CLIENT METHODS
void SendSound();
bool Save(int8 iCommitNow);
void SaveBackup();
inline bool Connected();
inline bool InZone();
inline void Kick();
inline void Disconnect();
inline bool IsLD();
void WorldKick();
inline int8 GetAnon();
void Duck();
void Stand();
void SetGM(bool toggle);
void SetPVP(bool toggle);
inline bool GetPVP();
inline bool GetGM();
inline void SetBaseClass(uint32 i);
inline void SetBaseRace(uint32 i);
inline void SetBaseGender(uint32 i);
inline int8 GetBaseFace();
inline int8 GetLanguageSkill(int16 n);
inline Const_char * GetLastName();
inline int32 GetLDoNPoints();
inline int8 GetBaseSTR();
inline int8 GetBaseSTA();
inline int8 GetBaseCHA();
inline int8 GetBaseDEX();
inline int8 GetBaseINT();
inline int8 GetBaseAGI();
inline int8 GetBaseWIS();
int16 GetWeight();
inline uint32 GetEXP();
bool UpdateLDoNPoints(sint32 points, int32 theme);
inline void SetDeity(uint32 i);
void AddEXP(uint32 add_exp, int8 conlevel = 0xFF, bool resexp = false);
void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp=false);
void SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f);
void MovePC(int32 zoneID, float x, float y, float z, float heading);
void ChangeLastName(const char* in_lastname);
FACTION_VALUE GetFactionLevel(int32 char_id, int32 npc_id, int32 p_race, int32 p_class, int32 p_deity, sint32 pFaction, Mob* tnpc);
void SetFactionLevel(int32 char_id, int32 npc_id, int8 char_class, int8 char_race, int8 char_deity);
void SetFactionLevel2(int32 char_id, sint32 faction_id, int8 char_class, int8 char_race, int8 char_deity, sint32 value);
sint16 GetRawItemAC();
inline int32 AccountID();
inline Const_char * AccountName();
inline sint16 Admin();
inline int32 CharacterID();
void UpdateAdmin(bool iFromDB = true);
void UpdateWho(int8 remove = 0);
inline int8 GuildRank();
inline int32 GuildID();
int8 GetFace();
bool TakeMoneyFromPP(uint32 copper);
void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold,uint32 platinum,bool updateclient);
bool TGB() {return tgb;}
int16 GetSkillPoints() {return m_pp.points;}
void SetSkillPoints(int inp) {m_pp.points = inp;}
void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } }
void IncreaseLanguageSkill(int skill_id, int value = 1) { if (skill_id < 26) { m_pp.languages[skill_id] += value; } }
virtual uint16 GetSkill(SkillType skill_id) const { if (skill_id <= HIGHEST_SKILL) { return((itembonuses.skillmod[skill_id] > 0)? m_pp.skills[skill_id]*(100 + itembonuses.skillmod[skill_id])/100 : m_pp.skills[skill_id]); } return 0; }
uint32 GetRawSkill(SkillType skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; }
bool HasSkill(SkillType skill_id) const;
bool CanHaveSkill(SkillType skill_id) const;
void SetSkill(SkillType skill_num, int8 value); // socket 12-29-01
void AddSkill(SkillType skillid, int8 value);
void CheckSpecializeIncrease(int16 spell_id);
bool CheckIncreaseSkill(SkillType skillid, int chancemodi = 0);
void SetLanguageSkill(int langid, int value);
int8 MaxSkill(SkillType skillid);
void GMKill();
inline bool IsMedding();
inline int16 GetDuelTarget();
inline bool IsDueling();
inline void SetDuelTarget(int16 set_id);
inline void SetDueling(bool duel);
void ResetAA();
void MemSpell(int16 spell_id, int slot, bool update_client = true);
void UnmemSpell(int slot, bool update_client = true);
void UnmemSpellAll(bool update_client = true);
void ScribeSpell(int16 spell_id, int slot, bool update_client = true);
void UnscribeSpell(int slot, bool update_client = true);
void UnscribeSpellAll(bool update_client = true);
inline bool IsSitting();
inline bool IsBecomeNPC();
inline int8 GetBecomeNPCLevel();
inline void SetBecomeNPC(bool flag);
inline void SetBecomeNPCLevel(int8 level);
bool LootToStack(uint32 itemid);
void SetFeigned(bool in_feigned);
inline bool GetFeigned();
inline bool AutoSplitEnabled();
void SetHorseId(int16 horseid_in);
int16 GetHorseId();
uint32 NukeItem(uint32 itemnum);
void SetTint(sint16 slot_id, uint32 color);
void SetMaterial(sint16 slot_id, uint32 item_id);
void Undye();
uint32 GetItemIDAt(sint16 slot_id);
void DeleteItemInInventory(sint16 slot_id, sint8 quantity = 0, bool client_update = false);
void SummonItem(uint32 item_id, sint8 charges = 0);
void SetStats(int8 type,sint16 increase_val);
void IncStats(int8 type,sint16 increase_val);
void DropItem(sint16 slot_id);
void BreakInvis();
Group* GetGroup();
void LeaveGroup();
bool Hungry();
bool Thirsty();
int16 GetInstrumentMod(int16 spell_id);
bool DecreaseByID(int32 type, int8 amt);
int8 SlotConvert2(int8 slot);
void Escape();
void RemoveNoRent();
void RangedAttack(Mob* other);
void ThrowingAttack(Mob* other);
void GoFish();
void ForageItem();
float CalcPriceMod(Mob* other = 0, bool reverse = false);
void ResetTrade();
bool UseDiscipline(int32 spell_id, int32 target);
sint32 GetCharacterFactionLevel(sint32 faction_id);
void SetZoneFlag(uint32 zone_id);
void ClearZoneFlag(uint32 zone_id);
bool HasZoneFlag(uint32 zone_id) const;
void SendZoneFlagInfo(Client *to) const;
void LoadZoneFlags();
void SetAATitle(const char *txt);
//TODO: inventory and ptimers interfaces
//I think there are two GetAA methods in client
+36
View File
@@ -0,0 +1,36 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/debug.h"
#include "embperl.h"
#include "client.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = Client PACKAGE = Client
PROTOTYPES: ENABLE
+44
View File
@@ -0,0 +1,44 @@
#!/bin/sh
if [ ! -r "$1" -o -z "$2" ]; then
echo "Usage: $0 headerfile classname"
fi
name=`basename "$1" .h`
name="perl_${name}"
echo "Starting conversion of $2" >&2
{
cat "$1.xs"
cat "$1" \
| sed -e 's/inline//g' -e 's/const//g' -e 's/virtual//g' \
-e 's/{.*}/;/g' -e 's#//.*$##g' \
-e 's/(void)/()/g' \
| tr -d '[&;]' \
| perl -p -e "s/^\\s+(.+)[ \\t]([a-zA-Z0-9_]*)\\(/&\$1&$2::\$2(/g" \
| tr '&' '\n'
} > tmp
{
xsubpp -typemap class.typemap tmp \
| sed -e "s/\"$2::/\"/g" \
-e 's/("\([a-zA-Z0-9_]*\)"/(strcpy(buf, "\1")/g' \
-e 's/ / /g' -e 's/ / /g' \
-e 's#char\* file = __FILE__;#char file[256];^ strncpy(file, __FILE__, 256);^ file[255] = '\0';^ ^ if(items != 1)^ fprintf(stderr, "boot_quest does not take any arguments.");^ char buf[128];^^ //add the strcpy stuff to get rid of const warnings....^^#g' \
-e 's/Ptr//g' \
-e 's/Mob__e/Mob::e/g' \
| tr '^' '\n' \
| grep -v "^#line"
echo "#endif //EMBPERL_XS_CLASSES"
echo
} > "$name.cpp"
#rm -f tmp
+62
View File
@@ -0,0 +1,62 @@
Mob* GetMobID(int16 id);
Mob* GetMob(const char* name);
Mob* GetMobByNpcTypeID(int32 get_id);
Client* GetClientByName(const char *name);
Client* GetClientByAccID(int32 accid);
Client* GetClientByID(int16 id);
Client* GetClientByCharID(int32 iCharID);
Client* GetClientByWID(int32 iWID);
Group* GetGroupByMob(Mob* mob);
Group* GetGroupByClient(Client* client);
Group* GetGroupByID(int32 id);
Group* GetGroupByLeaderName(char* leader);
Corpse* GetCorpseByOwner(Client* client);
Corpse* GetCorpseByID(int16 id);
Corpse* GetCorpseByName(char* name);
void ClearClientPetitionQueue();
bool CanAddHateForMob(Mob *p);
void Clear();
bool RemoveMob(int16 delete_id);
bool RemoveClient(int16 delete_id);
bool RemoveNPC(int16 delete_id);
bool RemoveGroup(int32 delete_id);
bool RemoveCorpse(int16 delete_id);
bool RemoveDoor(int16 delete_id);
bool RemoveTrap(int16 delete_id);
bool RemoveObject(int16 delete_id);
void RemoveAllMobs();
void RemoveAllClients();
void RemoveAllNPCs();
void RemoveAllGroups();
void RemoveAllCorpses();
void RemoveAllDoors();
void RemoveAllTraps();
void RemoveAllObjects();
void Message(int32 to_guilddbid, int32 type, const char* message, ...);
void MessageStatus(int32 to_guilddbid, int to_minstatus, int32 type, const char* message, ...);
void MessageClose(Mob* sender, bool skipsender, float dist, int32 type, const char* message, ...);
void RemoveFromTargets(Mob* mob);
void ReplaceWithTarget(Mob* pOldMob, Mob*pNewTarget);
void OpenDoorsNear(NPC* opener);
char* MakeNameUnique(char* name);
static char* RemoveNumbers(char* name);
// signal quest command support
void SignalMobsByNPCID(int32 npc_type, int signal_id);
void RemoveEntity(int16 id);
sint32 DeleteNPCCorpses();
sint32 DeletePlayerCorpses();
void HalveAggro(Mob* who);
void DoubleAggro(Mob* who);
void ClearFeignAggro(Mob* targ);
bool Fighting(Mob* targ);
void RemoveFromHateLists(Mob* mob, bool settoone = false);
void MessageGroup(Mob* sender, bool skipclose, int32 type, const char* message, ...);
+37
View File
@@ -0,0 +1,37 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/debug.h"
#include "embperl.h"
#include "entity.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = EntityList PACKAGE = EntityList
PROTOTYPES: ENABLE
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
FROM="$1"
TO="$2"
if [ ! -r "$1" -o -z "$2" ]; then
echo "Usage: $0 [src] [dest]"
fi
grep -A100000 "BEGIN PERL EXPORT" "$FROM" \
| grep -B 100000 "END PERL EXPORT" \
| grep -v "PERL EXPORT" >"$TO"
+17
View File
@@ -0,0 +1,17 @@
void DisbandGroup();
bool IsGroupMember(Mob* client);
void CastGroupSpell(Mob* caster,uint16 spellid);
void SplitExp(uint32 exp, Mob* other);
void GroupMessage(Mob* sender,const char* message);
int32 GetTotalGroupDamage(Mob* other);
void SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum);
void SetLeader(Mob* newleader){ leader=newleader; };
Mob* GetLeader(){ return leader; };
char* GetLeaderName(){ return membername[0]; };
void SendHPPacketsTo(Mob* newmember);
void SendHPPacketsFrom(Mob* newmember);
bool IsLeader(Mob* leadertest) { return leadertest==leader; };
int8 GroupCount();
int32 GetHighestLevel();
void TeleportGroup(Mob* sender, int32 zoneID, float x, float y, float z, float heading);
inline const int32 GetID() const { return id; }
+37
View File
@@ -0,0 +1,37 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/debug.h"
#include "embperl.h"
#include "groups.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = Group PACKAGE = Group
PROTOTYPES: ENABLE
+249
View File
@@ -0,0 +1,249 @@
//BEGIN ENTITY METHODS
virtual bool IsClient() { return false; }
virtual bool IsNPC() { return false; }
virtual bool IsMob() { return false; }
virtual bool IsCorpse() { return false; }
virtual bool IsPlayerCorpse() { return false; }
virtual bool IsNPCCorpse() { return false; }
virtual bool IsObject() { return false; }
// virtual bool IsGroup() { return false; }
virtual bool IsDoor() { return false; }
virtual bool IsTrap() { return false; }
virtual bool IsBeacon() { return false; }
Client* CastToClient();
NPC* CastToNPC();
Mob* CastToMob();
Corpse* CastToCorpse();
// Object* CastToObject();
// Group* CastToGroup();
// Doors* CastToDoors();
// Trap* CastToTrap();
// Beacon* CastToBeacon();
//BEGIN MOB METHODS
int16& GetID();
virtual Const_char * GetName();
void Depop(bool StartSpawnTimer = true);
void RogueAssassinate(Mob* other);
bool BehindMob(Mob* other = 0, float playerx = 0.0f, float playery = 0.0f);
void SetLevel(uint8 in_level, bool command = false);
uint32 GetSkill(SkillType skill_num);
void SendWearChange(int8 material_slot);
sint32 GetEquipment(int8 material_slot); // returns item id
sint32 GetEquipmentMaterial(int8 material_slot);
sint32 GetEquipmentColor(int8 material_slot);
bool IsMoving();
void GoToBind();
void Gate();
bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false)
virtual void Damage(Mob* from, sint32 damage, int16 spell_id, SkillType attack_skill, bool avoidable = true, sint8 buffslot = -1, bool iBuffTic = false) {};
void Heal();
void SetMaxHP();
int32 GetLevelCon(int8 iOtherLevel);
void SetHP(sint32 hp);
void DoAnim(const int animnum, int type=1);
void ChangeSize(float in_size, bool bNoRestriction = false);
void GMMove(float x, float y, float z, float heading = 0.01);
void SendPosUpdate(int8 iSendToSelf = 0);
void SendPosition();
bool HasProcs();
//bool CheckLos(Mob* other);
bool IsInvisible(Mob *other = 0);
void SetInvisible(bool state);
bool FindBuff(int16 spellid);
bool FindType(int8 type, bool bOffensive = false, int16 threshold = 100);
sint8 GetBuffSlotFromType(int8 type);
void MakePet(int16 spell_id, const char* pettype, const char *name=NULL);
virtual inline int16 GetBaseRace();
virtual inline int8 GetBaseGender();
virtual inline int8 GetDeity();
inline const int16& GetRace();
inline const int8& GetGender();
inline const int8& GetTexture();
inline const int8& GetHelmTexture();
inline const int8& GetClass();
inline const uint8& GetLevel();
Const_char * GetCleanName();
inline Mob* GetTarget();
virtual inline void SetTarget(Mob* mob);
virtual inline float GetHPRatio();
bool IsWarriorClass();
virtual inline const sint32& GetHP();
virtual inline const sint32& GetMaxHP();
virtual float GetWalkspeed();
virtual float GetRunspeed();
virtual int GetCasterLevel(int16 spell_id);
virtual inline const sint32& GetMaxMana();
virtual inline const sint32& GetMana();
virtual void SetMana(sint32 amount);
virtual inline float GetManaRatio();
inline virtual int16 GetAC();
inline virtual int16 GetATK();
inline virtual sint16 GetSTR();
inline virtual sint16 GetSTA();
inline virtual sint16 GetDEX();
inline virtual sint16 GetAGI();
inline virtual sint16 GetINT();
inline virtual sint16 GetWIS();
inline virtual sint16 GetCHA();
inline virtual sint16 GetMR();
inline virtual sint16 GetFR();
inline virtual sint16 GetDR();
inline virtual sint16 GetPR();
inline virtual sint16 GetCR();
inline virtual sint16 GetMaxSTR();
inline virtual sint16 GetMaxSTA();
inline virtual sint16 GetMaxDEX();
inline virtual sint16 GetMaxAGI();
inline virtual sint16 GetMaxINT();
inline virtual sint16 GetMaxWIS();
inline virtual sint16 GetMaxCHA();
virtual float GetActSpellRange(int16 spell_id, float range);
virtual sint32 GetActSpellDamage(int16 spell_id, sint32 value);
virtual sint32 GetActSpellHealing(int16 spell_id, sint32 value);
virtual sint32 GetActSpellCost(int16 spell_id, sint32 cost);
virtual sint32 GetActSpellDuration(int16 spell_id, sint32 duration);
virtual sint32 GetActSpellCasttime(int16 spell_id, sint32 casttime);
double ResistSpell(uint8 ressit_type, int16 spell_id, Mob *caster);
uint16 GetSpecializeSkillValue(int16 spell_id) const;
int32 GetNPCTypeID();
bool IsTargeted();
inline const float& GetX();
inline const float& GetY();
inline const float& GetZ();
inline const float& GetHeading();
inline const float& GetSize();
void SetFollowID(int32 id);
int32 GetFollowID();
virtual void Message(int32 type, const char* message, ...);
virtual void Message_StringID(int32 type, int32 string_id, int32 distance = 0);
void Say(const char *format, ...);
void Shout(const char *format, ...);
void Emote(const char *format, ...);
void InterruptSpell(int16 spellid = 0xFFFF);
virtual void CastSpell(int16 spell_id, int16 target_id, int16 slot = 10, sint32 casttime = -1, sint32 mana_cost = -1);
bool IsImmuneToSpell(int16 spell_id, Mob *caster);
void BuffFadeBySpellID(int16 spell_id);
void BuffFadeByEffect(int effectid, int skipslot = -1);
void BuffFadeAll();
void BuffFadeBySlot(int slot, bool iRecalcBonuses = true);
int CanBuffStack(int16 spellid, int8 caster_level, bool iFailIfOverwrite = false);
inline bool IsCasting();
int16 CastingSpellID();
void SetAppearance(EmuAppearance app, bool iIgnoreSelf = true);
inline EmuAppearance GetAppearance();
inline const int8& GetRunAnimSpeed();
inline void SetRunAnimSpeed(sint8 in);
void SetPetID(int16 NewPetID);
inline const int16& GetPetID();
void SetOwnerID(int16 NewOwnerID);
inline const int16& GetOwnerID();
inline const int16& GetPetType();
inline const int8& GetBodyType();
virtual void Stun(int duration);
void Spin();
void Kill();
inline void SetInvul(bool invul);
inline bool GetInvul();
inline void SetExtraHaste(int Haste);
virtual int GetHaste();
int GetMonkHandToHandDamage(void);
bool CanThisClassDoubleAttack(void);
bool CanThisClassDualWield(void);
bool CanThisClassRiposte(void);
bool CanThisClassDodge(void);
bool CanThisClassParry(void);
int GetMonkHandToHandDelay(void);
int8 GetClassLevelFactor();
void Mesmerize();
inline bool IsMezzed();
inline bool IsStunned();
void StartEnrage();
bool IsEnraged();
FACTION_VALUE GetReverseFactionCon(Mob* iOther);
inline const bool& IsAIControlled();
inline const float& GetAggroRange();
inline const float& GetAssistRange();
inline void SetPetOrder(Mob::eStandingPetOrder i);
inline const Mob::eStandingPetOrder& GetPetOrder();
inline const bool& IsRoamer();
inline const bool IsRooted();
void AddToHateList(Mob* other, sint32 hate = 0, sint32 damage = 0, bool iYellForHelp = true, bool bFrenzy = false, bool iBuffTic = false);
void SetHate(Mob* other, sint32 hate = 0, sint32 damage = 0);
int32 GetHateAmount(Mob* tmob, bool is_dam = false);
int32 GetDamageAmount(Mob* tmob);
Mob* GetHateTop();
Mob* GetHateDamageTop(Mob* other);
Mob* GetHateRandom();
bool IsEngaged();
bool HateSummon();
void FaceTarget(Mob* MobToFace = 0, bool update = false);
void SetHeading(float iHeading);
void WipeHateList();
inline bool CheckAggro(Mob* other);
sint8 CalculateHeadingToTarget(float in_x, float in_y);
bool CalculateNewPosition(float x, float y, float z, float speed, bool checkZ = false);
bool CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ = false);
float CalculateDistance(float x, float y, float z);
void SendTo(float new_x, float new_y, float new_z);
void SendToFixZ(float new_x, float new_y, float new_z);
void NPCSpecialAttacks(const char* parse, int permtag);
inline int32& DontHealMeBefore();
inline int32& DontBuffMeBefore();
inline int32& DontDotMeBefore();
inline int32& DontRootMeBefore();
inline int32& DontSnareMeBefore();
sint16 GetResist(int8 type);
Mob* GetShieldTarget();
void SetShieldTarget(Mob* mob);
bool Charmed();
int32 GetLevelHP(int8 tlevel);
int32 GetZoneID() const;
int16 CheckAggroAmount(int16 spellid);
int16 CheckHealAggroAmount(int16 spellid);
virtual int32 GetAA(int32 aa_id);
bool DivineAura();
void AddFeignMemory(Client* attacker);
void RemoveFromFeignMemory(Client* attacker);
void ClearFeignMemory();
//END MOB METHODS
+39
View File
@@ -0,0 +1,39 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/debug.h"
#include "embperl.h"
typedef const char Const_char;
#include "mob.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = Mob PACKAGE = Mob
PROTOTYPES: ENABLE
+63
View File
@@ -0,0 +1,63 @@
void SignalNPC(int _signal_id);
FACTION_VALUE CheckNPCFactionAlly(sint32 other_faction);
void AddItem(int32 itemid, int8 charges, int8 slot = 0);
void AddLootTable();
void RemoveItem(uint16 item_id, int16 quantity = 0, int16 slot = 0);
void ClearItemList();
void AddCash(int16 in_copper, int16 in_silver, int16 in_gold, int16 in_platinum);
void RemoveCash();
int32 CountLoot();
inline int32 GetLoottableID() { return loottable_id; }
inline uint32 GetCopper() { return copper; }
inline uint32 GetSilver() { return silver; }
inline uint32 GetGold() { return gold; }
inline uint32 GetPlatinum() { return platinum; }
inline void SetCopper(uint32 amt) { copper = amt; }
inline void SetSilver(uint32 amt) { silver = amt; }
inline void SetGold(uint32 amt) { gold = amt; }
inline void SetPlatinum(uint32 amt) { platinum = amt; }
void SetGrid(int16 grid_){ grid=grid_; }
void SetSp2(int32 sg2){ spawn_group=sg2; }
int16 GetWaypointMax(){ return wp_m; }
sint16 GetGrid(){ return grid; }
int32 GetSp2(){ return spawn_group; }
inline const sint32& GetNPCFactionID() { return npc_faction_id; }
inline sint32 GetPrimaryFaction() { return primary_faction; }
sint32 GetNPCHate(Mob* in_ent) {return hate_list.GetEntHate(in_ent);}
bool IsOnHatelist(Mob*p) { return hate_list.IsOnHateList(p);}
void SetNPCFactionID(sint32 in) { npc_faction_id = in; database.GetFactionIdsForNPC(npc_faction_id, &faction_list, &primary_faction); }
int16 GetMaxDMG() {return max_dmg;}
bool IsAnimal() { return(bodytype == 21); }
int16 GetPetSpellID() {return pet_spell_id;}
void SetPetSpellID(int16 amt) {pet_spell_id = amt;}
int32 GetMaxDamage(int8 tlevel);
void SetTaunting(bool tog) {taunting = tog;}
void PickPocket(Client* thief);
void StartSwarmTimer(int32 duration) { swarm_timer.Start(duration); }
void DoClassAttacks(Mob *target);
int GetMaxWp() const { return max_wp; }
void DisplayWaypointInfo(Client *to);
void CalculateNewWaypoint();
// int8 CalculateHeadingToNextWaypoint();
// float CalculateDistanceToNextWaypoint();
void AssignWaypoints(int32 grid);
void SetWaypointPause();
void UpdateWaypoint(int wp_index);
// quest wandering commands
void StopWandering();
void ResumeWandering();
void PauseWandering(int pausetime);
void MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot);
void NextGuardPosition();
void SaveGuardSpot(bool iClearGuardSpot = false);
inline bool IsGuarding() const { return(guard_heading != 0); }
void AI_SetRoambox(float iDist, float iMaxX, float iMinX, float iMaxY, float iMinY, int32 iDelay = 2500);
const int32& GetNPCSpellsID();
+39
View File
@@ -0,0 +1,39 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/debug.h"
#include "embperl.h"
typedef const char Const_char;
#include "npc.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = NPC PACKAGE = NPC
PROTOTYPES: ENABLE
+28
View File
@@ -0,0 +1,28 @@
PerlPacket *
PerlPacket::new(const char *opcode = "OP_Unknown", uint32 len = 0);
void DESTROY();
bool SetOpcode(const char *opcode);
void Resize(uint32 len);
//sending functions
void SendTo(Client *who);
void SendToAll();
//editing
void Zero();
void FromArray(int *numbers, uint32 length);
void SetByte(uint32 pos, uint8 val);
void SetShort(uint32 pos, uint16 val);
void SetLong(uint32 pos, uint32 val);
void SetFloat(uint32 pos, float val);
void SetString(uint32 pos, char *str);
void SetEQ1319(uint32 pos, float part13, float part19);
void SetEQ1913(uint32 pos, float part19, float part13);
//reading
uint8 GetByte(uint32 pos);
uint16 GetShort(uint32 pos);
uint32 GetLong(uint32 pos);
float GetFloat(uint32 pos);
+36
View File
@@ -0,0 +1,36 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/debug.h"
#include "embperl.h"
#include "perlpacket.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
MODULE = PerlPacket PACKAGE = PerlPacket
PROTOTYPES: ENABLE
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
cp perl_PlayerCorpse.cpp perl_client.cpp perl_entity.cpp perl_groups.cpp \
perl_mob.cpp perl_npc.cpp perl_perlpacket.cpp \
../../zone/
cp perl_EQW.cpp perl_HTTPRequest.cpp perl_EQLConfig.cpp ../../world/
cp perl_EQDB.cpp perl_EQDBRes.cpp ../../common/
+16
View File
@@ -0,0 +1,16 @@
#Mysql flags, for linuxthreads
#MYSQL_FLAGS=`mysql_config --cflags`
#MYSQL_LIB=`mysql_config --libs`
MYSQL_FLAGS=-I'/usr/local/include/mysql'
MYSQL_LIBS=-L'/usr/local/lib/mysql' -llmysqlclient -lz -lcrypt -lm
#linux threads flags:
LTFLAGS=-I/usr/local/include/pthread/linuxthreads -D_GNU_SOURCE -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE
LTLDFLAGS=-llthread -llstdc++ -llsupc++ -llgcc_r -L/usr/local/lib
CXXFLAGS=-ggdb -O -pipe -Wall -I. -I../common -fno-inline -DFREEBSD $(LTFLAGS) $(MYSQL_FLAGS)
LDFLAGS=-lpcap -lz -rdynamic -O2 -ggdb -pipe -L/usr/local/lib $(LTLDFLAGS)
include Makefile.common
@@ -0,0 +1,26 @@
#objects for EQ extractor
PPOBJS=ppconvert.o .obj/Mutex.o .obj/unix.o \
.obj/dbcore.o
JOE= ExtractDB.o .obj/MiscFunctions.o Explorers.o ../common/misc.o \
StructExplorer.o ../common/packet_dump.o ../common/buildfile.o \
patches/versions.o patches/patch_021505.o patches/patch_current.o \
patches/patch_local.o patches/patch_121504.o
all: ppconvert
ppconvert: $(PPOBJS)
g++ -I.. $^ $(LDFLAGS) $(MYSQL_LIBS) -o $@
clean:
rm -f ppconvert $(PPOBJS)
.obj/%.o: ../../common/%.cpp ../../common/%.h
mkdir -p .obj
g++ -I.. $(CXXFLAGS) -c $< -o $@
%.o: %.cpp %.h
mkdir -p .obj
g++ -I.. $(CXXFLAGS) -c $< -o $@

Some files were not shown because too many files have changed in this diff Show More