1 /// NWN constants (not nwscript builtin constants) 2 module nwn.constants; 3 4 import std.stdint; 5 version(unittest) import std.exception: assertThrown, assertNotThrown; 6 7 /// Neverwinter nights version (1/2) 8 enum NwnVersion{ 9 NWN1, 10 NWN2 11 } 12 13 /// NWN resource type 14 /// used in erf and bif file formats 15 enum ResourceType: uint16_t{ 16 invalid = 0xFFFF, /// Invalid resource type 17 res = 0, /// 18 bmp = 1, /// Windows BMP file 19 mve = 2, /// 20 tga = 3, /// TGA image format 21 wav = 4, /// WAV sound file 22 wfx = 5, /// 23 plt = 6, /// Bioware Packed Layered Texture, used for player character skins, allows for multiple color layers 24 ini = 7, /// Windows INI file format 25 bmu = 8, /// MP3 or BMU audio file 26 mpg = 9, /// 27 txt = 10, /// Text file 28 plh = 2000, /// 29 tex = 2001, /// LaTeX? (guess) 30 mdl = 2002, /// Aurora model 31 thg = 2003, /// 32 fnt = 2005, /// 33 lua = 2007, /// LUA scripts? (guess) 34 slt = 2008, /// 35 nss = 2009, /// NWScript Source 36 ncs = 2010, /// NWScript Compiled Script 37 mod = 2011, /// Module archive (erf-like) 38 are = 2012, /// BioWare Aurora Engine Area file. Contains information on what tiles are located in an area, as well as other static area properties that cannot change via scripting. For each .are file in a .mod, there must also be a corresponding .git and .gic file having the same ResRef. 39 set = 2013, /// BioWare Aurora Engine Tileset 40 ifo = 2014, /// Module Info File. See the IFO Format document. 41 bic = 2015, /// Character/Creature 42 wok = 2016, /// Walkmesh 43 twoda = 2017, /// 2-D Array (2DA) 44 tlk = 2018, /// Talk table 45 txi = 2022, /// Extra Texture Info 46 git = 2023, /// Game Instance File 47 bti = 2024, /// 48 uti = 2025, /// Item Blueprint 49 btc = 2026, /// 50 utc = 2027, /// Creature Blueprint 51 dlg = 2029, /// Conversation File 52 itp = 2030, /// Tile/Blueprint Palette File 53 btt = 2031, /// 54 utt = 2032, /// Trigger Blueprint 55 dds = 2033, /// Compressed texture file 56 bts = 2034, /// 57 uts = 2035, /// Sound Blueprint 58 ltr = 2036, /// Letter-combo probability info for name generation 59 gff = 2037, /// Generic File Format. Used when undesirable to create a new file extension for a resource, but the resource is a GFF. (Examples of GFFs include itp, utc, uti, ifo, are, git) 60 fac = 2038, /// Faction File 61 bte = 2039, /// 62 ute = 2040, /// Encounter Blueprint 63 btd = 2041, /// 64 utd = 2042, /// Door Blueprint 65 btp = 2043, /// 66 utp = 2044, /// Placeable Object Blueprint 67 dft = 2045, /// Default Values file. Used by area properties dialog 68 gic = 2046, /// Game Instance Comments. Comments on instances are not used by the game, only the toolset, so they are stored in a gic instead of in the git with the other instance properties. 69 gui = 2047, /// Graphical User Interface layout used by game 70 css = 2048, /// Cascading Style Sheet? (guess) 71 ccs = 2049, /// 72 btm = 2050, /// 73 utm = 2051, /// Store/Merchant Blueprint 74 dwk = 2052, /// Door walkmesh 75 pwk = 2053, /// Placeable Object walkmesh 76 btg = 2054, /// 77 utg = 2055, /// 78 jrl = 2056, /// Journal File 79 sav = 2057, /// 80 utw = 2058, /// Waypoint Blueprint. See Waypoint GFF document. 81 fourpc = 2059,/// DirectX texture file 82 ssf = 2060, /// Sound Set File. See Sound Set File Format document 83 hak = 2061, /// HAK ERF resource container 84 nwm = 2062, /// 85 bik = 2063, /// BIK Video 86 ndb = 2064, /// Script Debugger File 87 ptm = 2065, /// Plot Manager file/Plot Instance 88 ptt = 2066, /// Plot Wizard Blueprint 89 bak = 2067, /// 90 osc = 3000, /// 91 usc = 3001, /// 92 trn = 3002, /// Area terrain info 93 utr = 3003, /// Tree blueprint 94 uen = 3004, /// 95 ult = 3005, /// Light blueprint 96 sef = 3006, /// Special Effect XML File (NWN2) 97 pfx = 3007, /// Particle effect XML file (NWN2) 98 cam = 3008, /// Campaign definition GFF file 99 lfx = 3009, /// Lightning effect XML file (NWN2) 100 bfx = 3010, /// Beam effect XML file (NWN2) 101 upe = 3011, /// Encounter blueprint 102 ros = 3012, /// 103 rst = 3013, /// 104 ifx = 3014, /// Linear particle effect XML file (NWN2) 105 pfb = 3015, /// Prefab definition file 106 zip = 3016, /// Compressed zip file 107 wmp = 3017, /// 108 bbx = 3018, /// Billboard effect XML file (NWN2) 109 tfx = 3019, /// Trail effect XML file (NWN2) 110 wlk = 3020, /// Walkmesh 3D object 111 xml = 3021, /// XML 112 scc = 3022, /// 113 ptx = 3033, /// 114 ltx = 3034, /// Lightning effect XML file (NWN2) 115 trx = 3035, /// Baked terrain data 116 mdb = 4000, /// 3D MDB object 117 mda = 4001, /// 118 spt = 4002, /// Lipsync files (NWN2) 119 gr2 = 4003, /// Skeleton file 120 fxa = 4004, /// 121 fxe = 4005, /// 122 jpg = 4007, /// Jpeg image 123 pwc = 4008, /// Persistent World Content? (guess) / ERF resource archive 124 ids = 9996, /// 125 erf = 9997, /// Encapsulated Resource Format 126 bif = 9998, /// NWN1 resource container 127 key = 9999, /// 128 } 129 130 /// 131 ResourceType fileExtensionToResourceType(in string fileExtension){ 132 import std.string: toLower; 133 import std.conv: to, ConvException; 134 135 auto rtu = fileExtension.toLower; 136 if(rtu == "2da") return ResourceType.twoda; 137 if(rtu == "4pc") return ResourceType.fourpc; 138 if(rtu == "mp3") return ResourceType.bmu; 139 140 try return rtu.to!ResourceType; 141 catch(ConvException) return ResourceType.invalid; 142 } 143 unittest{ 144 assert(fileExtensionToResourceType("txt")==ResourceType.txt); 145 assert(fileExtensionToResourceType("2da")==ResourceType.twoda); 146 assert(fileExtensionToResourceType("oia")==ResourceType.invalid); 147 } 148 149 /// 150 string resourceTypeToFileExtension(in ResourceType resourceType){ 151 import std.conv: to; 152 switch(resourceType){ 153 case ResourceType.twoda: return "2da"; 154 case ResourceType.fourpc: return "4pc"; 155 default: return resourceType.to!string; 156 } 157 } 158 unittest{ 159 assert(resourceTypeToFileExtension(ResourceType.txt)=="txt"); 160 assert(resourceTypeToFileExtension(ResourceType.twoda)=="2da"); 161 assert(resourceTypeToFileExtension(ResourceType.invalid)=="invalid"); 162 } 163 164 165 /// Language 166 enum Language{ 167 English=0,/// 168 French=1,/// 169 German=2,/// 170 Italian=3,/// 171 Spanish=4,/// 172 Polish=5,/// 173 Korean=128,/// 174 ChineseTrad=129,/// 175 ChineseSimp=130,/// 176 Japanese=131,/// 177 } 178 179 /// Gender 180 enum Gender{ 181 Male = 0,/// 182 Female = 1,/// 183 } 184 185 /// Language & gender 186 enum LanguageGender{ 187 EnglishMale=0,/// 188 EnglishFemale=1,/// 189 FrenchMale=2,/// 190 FrenchFemale=3,/// 191 GermanMale=4,/// 192 GermanFemale=5,/// 193 ItalianMale=6,/// 194 ItalianFemale=7,/// 195 SpanishMale=8,/// 196 SpanishFemale=9,/// 197 PolishMale=10,/// 198 PolishFemale=11,/// 199 KoreanMale=256,/// 200 KoreanFemale=257,/// 201 ChineseTradMale=258,/// 202 ChineseTradFemale=259,/// 203 ChineseSimpMale=260,/// 204 ChineseSimpFemale=261,/// 205 JapaneseMale=262,/// 206 JapaneseFemale=263,/// 207 }