mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-06 08:08:28 +08:00
1 line
763 KiB
Plaintext
1 line
763 KiB
Plaintext
{"version":3,"sources":["data_formats/vector.ts","enums.ts","domain/items.ts","domain/NpcType.ts","domain/ObjectType.ts","domain/index.ts","Loadable.ts","stores/ApplicationStore.ts","stores/ServerMap.ts","stores/ItemTypeStore.ts","stores/DpsCalcStore.ts","ui/BigSelect.tsx","ui/dps_calc/DpsCalcComponent.tsx","ui/ErrorBoundary.tsx","stores/HuntMethodStore.ts","stores/ItemDropStore.ts","stores/HuntOptimizerStore.ts","ui/hunt_optimizer/WantedItemsComponent.tsx","ui/BigTable.tsx","ui/SectionIdIcon.tsx","ui/hunt_optimizer/OptimizationResultComponent.tsx","ui/time.ts","ui/hunt_optimizer/OptimizerComponent.tsx","ui/hunt_optimizer/MethodsComponent.tsx","ui/hunt_optimizer/HuntOptimizerComponent.tsx","data_formats/index.ts","data_formats/cursor/index.ts","data_formats/cursor/ArrayBufferCursor.ts","data_formats/parsing/rel.ts","data_formats/parsing/area_collision_geometry.ts","data_formats/parsing/iff.ts","data_formats/parsing/ninja/njcm.ts","data_formats/parsing/ninja/xj.ts","data_formats/parsing/ninja/index.ts","data_formats/parsing/area_geometry.ts","rendering/index.ts","rendering/xj_model_to_geometry.ts","rendering/areas.ts","stores/binary_assets.ts","stores/AreaStore.ts","data_formats/cursor/ResizableBufferCursor.ts","data_formats/cursor/WritableResizableBufferCursor.ts","data_formats/ResizableBuffer.ts","data_formats/compression/prs/compress.ts","data_formats/compression/prs/decompress.ts","data_formats/parsing/quest/bin.ts","data_formats/parsing/quest/dat.ts","data_formats/cursor/WritableArrayBufferCursor.ts","data_formats/parsing/quest/qst.ts","data_formats/parsing/quest/index.ts","rendering/entities.ts","rendering/models.ts","data_formats/parsing/ninja/texture.ts","rendering/textures.ts","stores/EntityStore.ts","read_file.ts","stores/QuestEditorStore.ts","ui/quest_editor/EntityInfoComponent.tsx","ui/quest_editor/QuestInfoComponent.tsx","rendering/QuestRenderer.ts","ui/RendererComponent.tsx","rendering/Renderer.ts","data_formats/parsing/ninja/motion.ts","ui/quest_editor/QuestEditorComponent.tsx","rendering/animation.ts","stores/ModelViewerStore.ts","rendering/ModelRenderer.ts","ui/viewer/models/AnimationSelectionComponent.tsx","ui/viewer/models/ModelSelectionComponent.tsx","rendering/TextureRenderer.ts","ui/viewer/models/ModelViewerComponent.tsx","stores/TextureViewerStore.ts","ui/viewer/textures/TextureViewerComponent.tsx","ui/ApplicationComponent.tsx","ui/viewer/ViewerComponent.tsx","index.tsx"],"names":["Vec2","x","y","Object","classCallCheck","this","createClass","key","value","v","Vec3","z","enum_values","e","values","number_values","filter","length","EnumMap","enum_","initial_value","keys","Map","_iteratorNormalCompletion","_didIteratorError","_iteratorError","undefined","_step","_iterator","Symbol","iterator","next","done","set","err","return","get","WeaponItemType","id","name","min_atp","max_atp","ata","max_grind","required_atp","ArmorItemType","atp","min_evp","max_evp","min_dfp","max_dfp","mst","hp","lck","ShieldItemType","UnitItemType","ToolItemType","WeaponItem","_class","type","initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","grind","applyDecoratedDescriptor","prototype","observable","configurable","enumerable","writable","initializer","computed","getOwnPropertyDescriptor","NpcType","code","simple_name","ultimate_name","episode","enemy","rare_type","Number","isInteger","Error","concat","by_code_map","map","by_ep_and_name","check_episode","Unknown","FemaleFat","FemaleMacho","FemaleTall","MaleDwarf","MaleFat","MaleMacho","MaleOld","BlueSoldier","RedSoldier","Principal","Tekker","GuildLady","Scientist","Nurse","Irene","ItemShop","Nurse2","Hildebear","Hildeblue","RagRappy","AlRappy","Monest","Mothmant","SavageWolf","BarbarousWolf","Booma","Gobooma","Gigobooma","Dragon","GrassAssassin","PoisonLily","NarLily","NanoDragon","EvilShark","PalShark","GuilShark","PofuillySlime","PouillySlime","PanArms","Migium","Hidoom","DeRolLe","Dubchic","Gilchic","Garanz","SinowBeat","SinowGold","Canadine","Canane","Dubswitch","VolOpt","Delsaber","ChaosSorcerer","DarkGunner","DeathGunner","ChaosBringer","DarkBelra","Dimenian","LaDimenian","SoDimenian","Bulclaw","Bulk","Claw","DarkFalz","Hildebear2","Hildeblue2","RagRappy2","LoveRappy","StRappy","HalloRappy","EggRappy","Monest2","Mothmant2","PoisonLily2","NarLily2","GrassAssassin2","Dimenian2","LaDimenian2","SoDimenian2","DarkBelra2","BarbaRay","SavageWolf2","BarbarousWolf2","PanArms2","Migium2","Hidoom2","Dubchic2","Gilchic2","Garanz2","Dubswitch2","Delsaber2","ChaosSorcerer2","GolDragon","SinowBerill","SinowSpigell","Merillia","Meriltas","Mericarol","Mericus","Merikle","UlGibbon","ZolGibbon","Gibbles","Gee","GiGue","IllGill","DelLily","Epsilon","GalGryphon","Deldepth","Delbiter","Dolmolm","Dolmdarl","Morfos","Recobox","Recon","SinowZoa","SinowZele","OlgaFlow","SandRappy","DelRappy","Astark","SatelliteLizard","Yowie","MerissaA","MerissaAA","Girtablulu","Zu","Pazuzu","Boota","ZeBoota","BaBoota","Dorphon","DorphonEclair","Goran","PyroGoran","GoranDetonator","SaintMilion","Shambertin","Kondrieu","NpcTypes","EnemyNpcTypes","ObjectType","pso_id","psoId","PlayerSet","Particle","Teleporter","Warp","LightCollision","Item","EnvSound","FogCollision","EventCollision","CharaCollision","ElementalTrap","StatusTrap","HealTrap","LargeElementalTrap","ObjRoomID","Sensor","UnknownItem16","Lensflare","ScriptCollision","HealRing","MapCollision","ScriptCollisionA","ItemLight","RadarCollision","FogCollisionSW","BossTeleporter","ImageBoard","QuestWarp","Epilogue","UnknownItem29","UnknownItem30","UnknownItem31","BoxDetectObject","SymbolChatObject","TouchPlateObject","TargetableObject","EffectObject","CountDownObject","UnknownItem38","UnknownItem39","UnknownItem40","UnknownItem41","MenuActivation","TelepipeLocation","BGMCollision","MainRagolTeleporter","LobbyTeleporter","PrincipalWarp","ShopDoor","HuntersGuildDoor","TeleporterDoor","MedicalCenterDoor","Elevator","EasterEgg","ValentinesHeart","ChristmasTree","ChristmasWreath","HalloweenPumpkin","TwentyFirstCentury","Sonic","WelcomeBoard","Firework","LobbyScreenDoor","MainRagolTeleporterBattleInNextArea","LabTeleporterDoor","Pioneer2InvisibleTouchplate","ForestDoor","ForestSwitch","LaserFence","LaserSquareFence","ForestLaserFenceSwitch","LightRays","BlueButterfly","Probe","RandomTypeBox1","ForestWeatherStation","Battery","ForestConsole","BlackSlidingDoor","RicoMessagePod","EnergyBarrier","ForestRisingBridge","SwitchNoneDoor","EnemyBoxGrey","FixedTypeBox","EnemyBoxBrown","EmptyTypeBox","LaserFenseEx","LaserSquareFenceEx","FloorPanel1","Caves4ButtonDoor","CavesNormalDoor","CavesSmashingPillar","CavesSign1","CavesSign2","CavesSign3","HexagalTank","BrownPlatform","WarningLightObject","Rainbow","FloatingJelifish","FloatingDragonfly","CavesSwitchDoor","RobotRechargeStation","CavesCakeShop","Caves1SmallRedRock","Caves1MediumRedRock","Caves1LargeRedRock","Caves2SmallRock1","Caves2MediumRock1","Caves2LargeRock1","Caves2SmallRock2","Caves2MediumRock2","Caves2LargeRock2","Caves3SmallRock","Caves3MediumRock","Caves3LargeRock","FloorPanel2","DestructableRockCaves1","DestructableRockCaves2","DestructableRockCaves3","MinesDoor","FloorPanel3","MinesSwitchDoor","LargeCryoTube","ComputerLikeCalus","GreenScreenOpeningAndClosing","FloatingRobot","FloatingBlueLight","SelfDestructingObject1","SelfDestructingObject2","SelfDestructingObject3","SparkMachine","MinesLargeFlashingCrate","RuinsSeal","RuinsTeleporter","RuinsWarpSiteToSite","RuinsSwitch","FloorPanel4","Ruins1Door","Ruins3Door","Ruins2Door","Ruins11ButtonDoor","Ruins21ButtonDoor","Ruins31ButtonDoor","Ruins4ButtonDoor","Ruins2ButtonDoor","RuinsSensor","RuinsFenceSwitch","RuinsLaserFence4x2","RuinsLaserFence6x2","RuinsLaserFence4x4","RuinsLaserFence6x4","RuinsPoisonBlob","RuinsPilarTrap","PopupTrapNoTech","RuinsCrystal","Monument","RuinsRock1","RuinsRock2","RuinsRock3","RuinsRock4","RuinsRock5","RuinsRock6","RuinsRock7","Poison","FixedBoxTypeRuins","RandomBoxTypeRuins","EnemyTypeBoxYellow","EnemyTypeBoxBlue","EmptyTypeBoxBlue","DestructableRock","PopupTrapsTechs","FlyingWhiteBird","Tower","FloatingRocks","FloatingSoul","Butterfly","LobbyGameMenu","LobbyWarpObject","Lobby1EventObjectDefaultTree","UnknownItem387","UnknownItem388","UnknownItem389","LobbyEventObjectStaticPumpkin","LobbyEventObject3ChristmasWindows","LobbyEventObjectRedAndWhiteCurtain","UnknownItem393","UnknownItem394","LobbyFishTank","LobbyEventObjectButterflies","UnknownItem400","GreyWallLow","SpaceshipDoor","GreyWallHigh","TempleNormalDoor","BreakableWallWallButUnbreakable","BrokenCilinderAndRubble","ThreeBrokenWallPiecesOnFloor","HighBrickCilinder","LyingCilinder","BrickConeWithFlatTop","BreakableTempleWall","TempleMapDetect","SmallBrownBrickRisingBridge","LongRisingBridgeWithPinkHighEdges","FourSwitchTempleDoor","FourButtonSpaceshipDoor","ItemBoxCca","TeleporterEp2","CCADoor","SpecialBoxCCA","BigCCADoor","BigCCADoorSwitch","LittleRock","Little3StoneWall","Medium3StoneWall","SpiderPlant","CCAAreaTeleporter","UnknownItem523","WhiteBird","OrangeBird","Saw","LaserDetect","UnknownItem529","UnknownItem530","Seagull","Fish","SeabedDoorWithBlueEdges","SeabedDoorAlwaysOpenNonTriggerable","LittleCryotube","WideGlassWallBreakable","BlueFloatingRobot","RedFloatingRobot","Dolphin","CaptureTrap","VRLink","UnknownItem576","WarpInBarbaRayRoom","UnknownItem672","GeeNest","LabComputerConsole","LabComputerConsoleGreenScreen","ChairYelllowPillow","OrangeWallWithHoleInMiddle","GreyWallWithHoleInMiddle","LongTable","GBAStation","TalkLinkToSupport","InstaWarp","LabInvisibleObject","LabGlassWindowDoor","UnknownItem700","LabCelingWarp","Ep4LightSource","Cacti","BigBrownRock","BreakableBrownRock","UnknownItem832","UnknownItem833","PoisonPlant","UnknownItem897","UnknownItem898","OozingDesertPlant","UnknownItem901","BigBlackRocks","UnknownItem903","UnknownItem904","UnknownItem905","UnknownItem906","FallingRock","DesertPlantHasCollision","DesertFixedTypeBoxBreakableCrystals","UnknownItem910","BeeHive","UnknownItem912","Heat","TopOfSaintMillionEgg","UnknownItem961","Server","RARE_ENEMY_PROB","KONDRIEU_PROB","Episode","SectionId","Difficulty","SectionIds","LoadableState","Difficulties","Section","position","y_axis_rotation","sin_y_axis_rotation","cos_y_axis_rotation","Math","sin","cos","Quest","domain_class","short_description","long_description","area_variants","objects","npcs","dat_unknowns","bin_data","domain_descriptor","domain_descriptor2","domain_descriptor3","_descriptor4","_descriptor5","_descriptor6","_descriptor7","_descriptor8","Array","QuestEntity","_class3","area_id","section_id","rotation","_descriptor9","_section_id","_descriptor10","_descriptor11","_descriptor12","_descriptor13","getPrototypeOf","section","_this$position","rel_x","rel_y","rel_z","sec_pos","rot_z","QuestObject","_class5","_QuestEntity","dat","_this","possibleConstructorReturn","call","_descriptor14","assertThisInitialized","inherits","QuestNpc","_class7","_QuestEntity2","_this2","_descriptor15","Area","order","AreaVariant","_class9","area","_descriptor16","EnemyDrop","difficulty","npc_type","item_type","anything_rate","rare_rate","rate","HuntMethod","_class11","quest","default_time","enemy_counts","_descriptor17","user_time","SimpleQuest","PlayerModel","head_style_count","hair_styles_count","hair_styles_with_accessory","PlayerAnimation","Loadable","Loadable_class","load","Loadable_descriptor","Loadable_descriptor2","Loadable_descriptor3","_load","Loadable_descriptor4","_value","load_value","_load_value","asyncToGenerator","regenerator_default","a","mark","_callee","wrap","_context","prev","is_loading","abrupt","_promise","_state","Initializing","sent","Nominal","_error","t0","stop","apply","arguments","Uninitialized","defer","Reloading","Promise","resolve","application_store","Ephinea","ServerMap","ServerMap_class","_EnumMap","current_server","ItemTypeStore","ItemTypeStore_class","id_to_item_type","ItemTypeStore_descriptor","_ref","server","response","data","item_types","item_type_dto","fetch","process","toLowerCase","json","class","minAtp","maxAtp","maxGrind","requiredAtp","minEvp","maxEvp","minDfp","maxDfp","push","t1","finish","_x","item_type_stores","store","Weapon","item","shifta_factor","grind_atp","shifta_atp","armor_atp","shield_atp","base_atp","base_shifta_atp","final_min_atp","enemy_dfp","final_max_atp","min_normal_damage","max_normal_damage","NORMAL_DAMAGE_FACTOR","min_heavy_damage","max_heavy_damage","dps_calc_store","add_weapon","weapons","current","it","armor_type","shield_type","char_atp","mag_pow","shifta_lvl","array","BigSelect","_PureComponent","react_default","createElement","commonjs_default","assign","className","props","PureComponent","DpsCalcComponent","observer","DpsCalcComponent_class","_Component","_getPrototypeOf2","_len","args","_key","selected","get_by_id","armor_changed","shield_changed","BigSelect_BigSelect","placeholder","options","weapon_types","wt","label","onChange","weapon","i","input_number","size","min","max","step","toFixed","avg_normal_damage","avg_heavy_damage","armor_types","at","shield_types","st","Component","ErrorBoundary","state","has_error","es_alert","message","children","with_error_boundary","ComponentErrorBoundary","ErrorBoundary_ErrorBoundary","displayName","logger","Logger","hunt_method_store","storage_disposer","load_from_local_storage","methods","method_user_times_json","localStorage","getItem","user_times","JSON","parse","method","autorun","store_in_local_storage","error","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_step2","_iterator2","setItem","stringify","quests","total_count","_i","_Object$entries","entries","enemyCounts","_ref3","_ref2","slicedToArray","count","by_code","test","load_hunt_methods","EnemyDropTable","table","item_type_to_drops","drop","drops","item_type_id","ItemDropStore","_dec","ref","ItemDropStore_class","ItemDropStore_descriptor","item_drop_stores","item_type_store","drop_dto","promise","warn","itemTypeId","sectionId","set_drop","dropRate","rareRate","enemy_drops","WantedItem","HuntOptimizerStore_class","amount","HuntOptimizerStore_descriptor","HuntOptimizerStore_descriptor2","OptimalResult","wanted_items","optimal_methods","OptimalMethod","section_ids","method_name","method_episode","method_time","runs","item_counts","total_time","hunt_optimizer_store","HuntOptimizerStore","HuntOptimizerStore_descriptor3","HuntOptimizerStore_descriptor4","optimize","drop_table","constraints","wanted","variables","variable_details","_method","counts","_iteratorNormalCompletion3","_didIteratorError3","_iteratorError3","_iterator3","_step3","_ref9","_ref5","_count","old_count","counts_list","pan_arms_count","split_counts","pan_arms_2_count","_split_counts","_counts","split_pan_arms","_iteratorNormalCompletion4","_didIteratorError4","_iteratorError4","_iterator4","_step4","_iteratorNormalCompletion5","_didIteratorError5","_iteratorError5","_iterator5","_step5","variable","add_variable","_iteratorNormalCompletion6","_didIteratorError6","_iteratorError6","_iterator6","_step6","_ref8","_ref7","result","_ref10","variable_name","runs_or_other","details","_method2","_difficulty","_split_pan_arms","_variable","items","_i2","_Object$entries2","_ref13","_ref12","_item_name","expected_amount","_iteratorNormalCompletion8","_didIteratorError8","_iteratorError8","_iterator8","_step8","_iteratorNormalCompletion7","_didIteratorError7","_iteratorError7","_iterator7","_step7","sid","match_found","_i3","_Object$keys","_item_name2","Set","w","delete","time","get_drop","has","t2","full_method_name","t3","t4","t5","solver","Solve","opType","feasible","item_name","t6","t7","toConsumableArray","initialize","_callee2","_context2","_callee3","wanted_items_json","item_store","wi","_iteratorNormalCompletion9","_didIteratorError9","_iteratorError9","_iterator9","_step9","_ref17","itemKindId","_context3","replace","_ref18","itemType","item_drop_store","get_drops_for_item_type","WantedItemsComponent","WantedItemsComponent_class","help_visible","add_wanted","find","remove_wanted","findIndex","splice","table_remove_cell_renderer","rowData","es_button","icon","onClick","no_rows_renderer","on_help_visible_change","visible","setState","helpVisible","slice","popover","content","Help","trigger","onVisibleChange","style","width","huntable_item_types","marginLeft","es","height","headerHeight","rowHeight","rowCount","rowGetter","index","noRowsRenderer","dataKey","cellRenderer","_ref4","WantedItemsComponent_WantedAmountCell","wantedItem","flexGrow","cellDataGetter","WantedAmountCell","wanted_amount_changed","_this3","BigTable","sort_columns","column_width","columns","cell_renderer","cell","sort_indicator","title","columnIndex","rowIndex","column","classes","sortable","sort","direction","SortDirection","ASC","viewBox","d","fill","class_name","footer","row_count","footer_value","footer_tooltip","record","tooltip","on_click","header_clicked","join","old_index","sc","old","DESC","unshift","fixedRowCount","overscanRowCount","overscan_row_count","columnWidth","columnCount","fixedColumnCount","fixed_column_count","overscanColumnCount","overscan_column_count","classNameTopLeftGrid","classNameTopRightGrid","updateTigger","update_trigger","SectionIdIcon","_ref$size","display","backgroundImage","backgroundSize","OptimizationResultComponent","_class2","BigTable_BigTable","total_runs","hours","h","floor","m","round","toString","padStart","hours_to_string","_loop","totalCount","OptimizationResultComponent_class","OptimizerComponent","WantedItemsComponent_WantedItemsComponent","OptimizationResultComponent_OptimizationResultComponent","MethodsComponent","MethodsComponent_temp","MethodsComponent_class2","sorts","b","cmp","localeCompare","MethodsComponent_TimeComponent","MethodsComponent_class","TimeComponent","change","hour","minute","time_picker","moment","format","allowClear","suffixIcon","React","TabPane","tabs","Endianness","ASCII_DECODER","TextDecoder","UTF_16BE_DECODER","UTF_16LE_DECODER","ASCII_ENCODER","TextEncoder","UTF_16BE_ENCODER","UTF_16LE_ENCODER","ArrayBufferCursor","buffer","endianness","offset","byteLength","_position","little_endian","dv","utf16_decoder","utf16_encoder","DataView","byteOffset","Little","Big","seek_start","u8_at","getUint8","r","u16_at","getUint16","u32_at","getUint32","i8_at","getInt8","i16_at","getInt16","i32_at","getInt32","f32_at","getFloat32","n","f32","wrapper","max_byte_length","null_terminated","drop_remaining","string_length","index_of_u8","view","decode","index_of_u16","Uint8Array","max_pos","parse_rel","cursor","parse_index","seek_end","index_offset","u32","index_size","seek","data_offset","compact_offsets","u16_array","expanded_offset","compact_offset","parse_indices","parse_area_collision_geometry","main_offset_table_offset","object","meshes","bytes_left","start_pos","block_trailer_offset","mesh","vertices","triangles","vertex_count","vertex_table_offset","triangle_count","triangle_table_offset","v1","u16","v2","v3","flags","n_x","n_y","n_z","indices","normal","parse_iff","chunks","take","NjcmChunkType","parse_njcm_model","cached_chunk_offsets","vlist_offset","plist_offset","bounding_sphere_center","vec3_f32","bounding_sphere_radius","parse_chunks","chunk","Vertex","vertex","bone_weight","bone_weight_status","calc_continue","texture_id","Tiny","Strip","triangle_strips","collision_sphere_center","collision_sphere_radius","wide_end_chunks","loop","type_id","u8","chunk_start_position","Null","Bits","cache_index","CachePolygonList","cached_offset","DrawPolygonList","texture_bits_and_id","flip_u","flip_v","clamp_u","clamp_v","mipmap_d_adjust","filter_mode","super_sample","Material","parse_vertex_chunk","Volume","parse_triangle_strip_chunk","End","chunk_type_id","render_flags","ignore_light","ignore_specular","ignore_ambient","use_alpha","double_side","flat_shading","environment_mapping","user_offset_and_strip_count","user_flags_size","strip_count","has_tex_coords","has_color","has_normal","has_double_tex_coords","strips","winding_flag_and_index_count","i16","clockwise_winding","index_count","abs","j","tex_coords","objectSpread","parse_xj_model","_model$meshes","_model$meshes2","vertex_info_table_offset","vertex_info_count","triangle_strip_table_offset","triangle_strip_count","transparent_triangle_strip_table_offset","transparent_triangle_strip_count","model","collision_sphere_position","vertex_type","vertex_size","uv","vec2_f32","parse_triangle_strip_table","triangle_strip_list_offset","material_table_offset","material_table_size","index_list_offset","material_properties","parse_triangle_strip_material_properties","alpha_src","alpha_dst","rgba","diffuse_r","diffuse_g","diffuse_b","diffuse_a","ANGLE_TO_RAD","PI","NJCM","NjObject","evaluation_flags","scale","bone_cache","_bone_count","id_ref","get_bone_internal","Infinity","bone_id","bone","skip","break_child_trace","child","parse_nj","parse_ninja","parse_xj","parse_model","context","flatMap","parse_sibling_objects","eval_flags","no_translate","no_rotate","no_scale","hidden","zxy_rotation_order","shape_skip","model_offset","pos_x","pos_y","pos_z","rotation_x","i32","rotation_y","rotation_z","scale_x","scale_y","scale_z","child_offset","sibling_offset","siblings","parse_geometry_table","table_offset","table_entry_count","models","geometry_offset","vec3_to_threejs","Vector3","DEFAULT_NORMAL","DEFAULT_UV","xj_model_to_geometry","matrix","positions","normals","uvs","groups","normal_matrix","Matrix3","getNormalMatrix","p","applyMatrix4","applyMatrix3","tuv","current_mat_idx","start_index_count","clockwise","c","pa","pb","pc","na","nb","nc","clone","sub","cross","negate","dot","last_group","material_index","start","AssetType","materials","MeshBasicMaterial","color","transparent","opacity","MeshLambertMaterial","side","DoubleSide","wireframe_materials","wireframe","area_collision_geometry_to_object_3d","group","Group","collision_mesh","geom","Geometry","color_index","faces","Face3","Mesh","renderOrder","add","wireframe_mesh","get_area_collision_data","area_version","get_area_asset","get_npc_data","_x2","_get_npc_data","url","npc_type_to_url","get_asset","get_object_data","_x3","_x4","_get_object_data","object_type","object_type_to_url","get_player_data","_x5","_x6","_x7","_get_player_data","player_class","body_part","no","player_class_to_url","get_player_animation_data","_x8","_get_player_animation_data","_callee4","animation_id","_context4","area_base_names","area_variant","episode_base_names","_episode_base_names$a","base_name","variants","variant","String","area_version_to_base_url","reject","then","arrayBuffer","_area$area_variants","varis","_","sections_cache","render_geometry_cache","collision_geometry_cache","area_store","AreaStore","areas","variant_id","sections","load_area_sections_and_render_geometry","object_3d","get_area_render_data","Matrix4","geometry","BufferGeometry","addAttribute","Float32BufferAttribute","setIndex","Uint16BufferAttribute","sec","userData","area_geometry_to_sections_and_object_3d","section_count","section_table_offset","section_position","section_rotation","simple_geometry_offset_table_offset","simple_geometry_offset_count","parse_area_geometry","ResizableBufferCursor","_offset","_size","check_offset","check_size","sub_view","backing_buffer","byte_size","WritableResizableBufferCursor","_ResizableBufferCurso","ensure_size","setUint8","setUint16","setUint32","setInt32","setFloat32","other","copy_to_uint8_array","str","byte_length","encode","byte","write_u8","needed","ResizableBuffer","initial_capacity","_buffer","_data_view","ArrayBuffer","ensure_capacity","min_new_size","capacity","new_size","new_buffer","compress","src","ctx","Context","hash_table","HashTable","set_bit","copy_literal","put","hash","_ctx$find_longest_mat","find_longest_match","_ctx$find_longest_mat2","mlen","_ctx$find_longest_mat3","_ctx$find_longest_mat4","offset2","mlen2","write_literal","add_intermediates","write_eof","dst","MAX_WINDOW","WINDOW_MASK","HASH_SIZE","flag_bits_left","flag_offset","bit","pos","write_final_flags","s2","len","s1","lazy","entry","hash_to_offset","longest_length","longest_match","match_length","entry_2","set_prev","masked_offset_to_prev","prevOffset","decompress","read_flag_bit","copy_u8","read_u8","read_u16","offset_copy","buf_size","buf","write_cursor","parse_bin","lenient","object_code_offset","function_offset_table_offset","quest_id","language","quest_name","string_utf16","function_offset_count","function_offsets","instructions","main_opcode","opcode","opsize","list","f8_opcode_list","f9_opcode_list","opcode_list","_list$opcode","mnemonic","mask","full_opcode","toUpperCase","opargs","parse_instruction_arguments","parse_object_code","array_buffer","args_size","old_pos","outer","charAt","OBJECT_SIZE","NPC_SIZE","WritableArrayBufferCursor","_ArrayBufferCursor","parse_qst","version","version_a","version_b","headers","file_name","string_ascii","file_name_2","parse_headers","files","expected_sizes","start_position","chunk_no","file","expected_size","chunk_nos","chunk_position","from","actual_size","ceil","contained_files","parse_files","header","name_2","write_qst","params","total_size","f","reduce","write_u16","write_string_ascii","write_u32","dot_pos","lastIndexOf","write_file_headers","write_file_chunk","write_file_chunks","write_u8_array","parse_quest","qst","dat_file","bin_file","trim","endsWith","objs","unknowns","entity_type","entities_size","object_count","unknown1","u8_array","unknown2","unknown3","unknown","bytes_read","npc_count","unknown4","skin","unknown5","parse_dat","prs","bin","func_0_ops","operations","func_offset","func_found","func_ops","operation","get_func_operations","npc","obj","bb_maps","op","bb_map","area_variants_array","get_variant","get_area_variants","set_episode","debug","get_episode","obj_data","_obj_data$position","rot","from_pso_id","npc_data","_npc_data$position","regular","get_npc_type","parse_npc_data","write_quest_qst","grouped_objs","groupBy","obj_area_ids","parseInt","area_objs","write_f32","write_i32","grouped_npcs","npc_area_ids","area_npcs","write_dat","type_data","npc_type_to_dat_data","ext_start","base_file_name","OBJECT_COLOR","NPC_COLOR","create_object_mesh","textures","create_mesh","create_npc_mesh","entity","max_mat_idx","g","materialIndex","tex","alphaTest","_entity$position","DUMMY_MATERIAL","DEFAULT_MATERIAL","DEFAULT_SKINNED_MATERIAL","skinning","NO_TRANSLATION","NO_ROTATION","Quaternion","NO_SCALE","ninja_object_to_buffer_geometry","Object3DCreator","create_buffer_geometry","VerticesHolder","vertices_stack","bones","bone_indices","bone_weights","object_to_geometry","addGroup","computeBoundingSphere","computeBoundingBox","SkinnedMesh","bind","Skeleton","parent_bone","parent_matrix","_object$evaluation_fl","euler","Euler","compose","setFromEuler","premultiply","Bone","setRotationFromEuler","model_to_geometry","is_njcm_model","njcm_model_to_geometry","new_vertices","mesh_vertex","_this$bone_indices","_this$bone_weights","mat_idx","XVMH","XVRT","parse_xvm","header_chunk","texture_count","parse_header","format_1","format_2","parse_texture","xvm_to_textures","xvm","xvm_texture_to_texture","data_size","RGBA_S3TC_DXT1_Format","RGBA_S3TC_DXT3_Format","texture_3js","CompressedTexture","minFilter","LinearFilter","wrapS","MirroredRepeatWrapping","wrapT","needsUpdate","DEFAULT_ENTITY","CylinderBufferGeometry","translate","DEFAULT_ENTITY_PROMISE","DEFAULT_ENTITY_TEX","DEFAULT_ENTITY_TEX_PROMISE","npc_cache","npc_tex_cache","object_cache","object_tex_cache","EntityStore_i","_arr","entity_store","nj_objects","catch","Texture","read_file","_read_file","reader","FileReader","addEventListener","readAsArrayBuffer","quest_editor_store","set_quest","action","reset_quest_state","current_quest","current_area","set_selected_entity","selected_entity","set_current_area_id","load_file","object_geom","object_tex","npc_geom","npc_tex","get_area_sections","o","get_object_geometry","get_object_tex","set_section_on_visible_quest_entity","get_npc_geometry","get_npc_tex","delegateYield","_section$position","sec_x","sec_y","sec_z","rot_x","s","runInAction","save_current_quest_to_file","document","href","URL","createObjectURL","Blob","download","body","appendChild","click","revokeObjectURL","removeChild","EntityInfoComponent","EntityInfoComponent_class","colSpan","EntityInfoComponent_CoordRow","position_type","coord","CoordRow","changed","pos_type","precision","QuestInfoComponent","npc_counts","val","extra_canadines","npc_count_rows","extra","renderer","RendererComponent","modifyDom","div","set_size","clientWidth","clientHeight","dom_element","onResize","wrapper_div","parentNode","window","removeEventListener","on_will_unmount","OrbitControls","OrbitControlsCreator","THREE","Renderer","camera","controls","scene","Scene","light_holder","WebGLRenderer","antialias","render_scheduled","light","HemisphereLight","schedule_render","requestAnimationFrame","call_render","render","setPixelRatio","devicePixelRatio","domElement","mouseButtons","ORBIT","MOUSE","RIGHT","PAN","LEFT","background","Color","setSize","look_at","reset","copy","lookAt","coords","Vector2","getSize","offsetX","offsetY","NjInterpolation","NjKeyframeTrackType","QuestRenderer","_Renderer","PerspectiveCamera","raycaster","Raycaster","entity_reaction_disposers","collision_geometry","Object3D","render_geometry","obj_geometry","npc_geometry","hovered_data","selected_data","on_mouse_down","old_selected_data","pick_entity","pointer_pos_to_device_coords","get_color","material","manipulating","enabled","on_mouse_up","on_mouse_move","pointer_pos","buttons","shiftKey","setFromCamera","ray","negative_world_dir","getWorldDirection","plane","Plane","setFromNormalAndCoplanarPoint","normalize","grab_offset","intersection_point","intersectPlane","y_delta","drag_y","drag_adjust","_this$pick_terrain","pick_terrain","intersection","point","old_data","set_quest_and_area","update_geometry","aspect","updateProjectionMatrix","esm_get","_update_geometry","dispose_entity_reactions","remove","update_entity_geometry","get_area_collision_geometry","reset_camera","get_area_render_geometry","entity_geometry","when","disposer","_this$raycaster$inter","intersectObjects","nearest_object","_this$raycaster$inter3","nearest_npc","distance","_this$raycaster$inter5","terrain","origin","terrains","face","setY","render_terrains","rt","is_npc","QuestEditorComponent","QuestEditorComponent_class","save_dialog_open","save_dialog_filename","save_as_clicked","filename","save_dialog_filename_changed","save_dialog_affirmed","save_dialog_cancelled","QuestEditorComponent_Toolbar","onSaveAsClicked","QuestInfoComponent_QuestInfoComponent","RendererComponent_RendererComponent","EntityInfoComponent_EntityInfoComponent","QuestEditorComponent_SaveAsForm","is_open","on_filename_change","on_ok","on_cancel","Toolbar","set_filename","info","originFileObj","upload","accept","showUploadList","customRequest","es_select","Option","SaveAsForm","name_changed","currentTarget","modal","Fragment","onOk","onCancel","es_form","layout","input","autoFocus","maxLength","NMDM","parse_njm","bone_count","chunk_size","parse_motion","parse_njm_v2","offset1","action_offset","motion_offset","parse_action","parse_njm_bb","mdata_offset","frame_count","inp_fn","interpolation","element_count","motion_data_list","motion_data","tracks","keyframe_offsets","keyframe_counts","shift","Position","keyframes","parse_motion_data_f","Rotation","parse_motion_data_a","Scale","frames","frame","keyframe_count","_frames","parse_motion_data_a_wide","PSO_FRAME_RATE","create_animation_clip","nj_object","nj_motion","Spline","InterpolateSmooth","InterpolateLinear","forEach","get_bone","times","keyframe","quat","QuaternionKeyframeTrack","VectorKeyframeTrack","AnimationClip","nj_object_cache","nj_motion_cache","model_viewer_store","animations","clock","Clock","has_skeleton","set_animation_frame_rate","animation","mixer","timeScale","animation_frame_rate","set_animation_frame","animation_frame_count","animation_frame","load_model","get_player_ninja_object","set_model","current_bone_count","load_animation","get_nj_motion","current_model","set_animation","_model","njm","set_textures","pause_animation","paused","animation_playing","toggle_animation_playing","update_animation_frame","clip","current_obj3d","stopAllAction","AnimationMixer","player_animation","clipAction","play","duration","skeleton","player_model","uncacheRoot","current_player_model","set_obj3d","bb_size","create_skinned_mesh","ninja_object_to_skinned_mesh","ninja_object_to_mesh","boundingBox","translateY","head_part","ninja_object","get_all_assets","body_data","head_data","head","add_to_bone","hair_data","hair","accessory_data","accessory","AnimationSelectionComponent","AnimationSelectionComponent_class","ModelSelectionComponent","es_list","itemLayout","dataSource","renderItem","Meta","ModelRenderer","skeleton_helper","show_skeleton","update","getDelta","quaternion","SkeletonHelper","linewidth","ModelViewerComponent","ModelViewerComponent_class","ModelViewerComponent_Toolbar","ModelSelectionComponent_ModelSelectionComponent","AnimationSelectionComponent_AnimationSelectionComponent","es_switch","checked","texture_viewer_store","current_xvm","TextureRenderer","OrthographicCamera","quad_meshes","render_textures","total_width","total_height","tex_3js","quad_mesh","create_quad","enableRotate","_this$scene","left","right","top","bottom","quad","PlaneGeometry","faceVertexUvs","TextureViewerComponent","TextureViewerComponent_Toolbar","Viewer","ViewerComponent","tab","ModelViewerComponent_ModelViewerComponent","TextureViewerComponent_TextureViewerComponent","QuestEditor","HuntOptimizer","OptimizerComponent_OptimizerComponent","MethodsComponent_MethodsComponent","DpsCalc","ApplicationComponent","ApplicationComponent_class","_React$Component","tool","init_tool","menu_clicked","tool_component","menu","selectedKeys","mode","defaultValue","param","location","search","split","startsWith","useDefaults","defaultLevel","ReactDOM","ApplicationComponent_ApplicationComponent","getElementById"],"mappings":"guBAAaA,EAAb,WAII,SAAAA,EAAYC,EAAWC,GAAYC,OAAAC,EAAA,EAAAD,CAAAE,KAAAL,GAAAK,KAHnCJ,OAGkC,EAAAI,KAFlCH,OAEkC,EAC9BG,KAAKJ,EAAIA,EACTI,KAAKH,EAAIA,EANjB,OAAAC,OAAAG,EAAA,EAAAH,CAAAH,EAAA,EAAAO,IAAA,MAAAC,MAAA,SASQC,GAGA,OAFAJ,KAAKJ,GAAKQ,EAAER,EACZI,KAAKH,GAAKO,EAAEP,EACLG,OAZf,CAAAE,IAAA,QAAAC,MAAA,WAgBQ,OAAO,IAAIR,EAAKK,KAAKJ,EAAGI,KAAKH,OAhBrCF,EAAA,GAoBaU,EAAb,WAKI,SAAAA,EAAYT,EAAWC,EAAWS,GAAYR,OAAAC,EAAA,EAAAD,CAAAE,KAAAK,GAAAL,KAJ9CJ,OAI6C,EAAAI,KAH7CH,OAG6C,EAAAG,KAF7CM,OAE6C,EACzCN,KAAKJ,EAAIA,EACTI,KAAKH,EAAIA,EACTG,KAAKM,EAAIA,EARjB,OAAAR,OAAAG,EAAA,EAAAH,CAAAO,EAAA,EAAAH,IAAA,MAAAC,MAAA,SAWQC,GAIA,OAHAJ,KAAKJ,GAAKQ,EAAER,EACZI,KAAKH,GAAKO,EAAEP,EACZG,KAAKM,GAAKF,EAAEE,EACLN,OAff,CAAAE,IAAA,QAAAC,MAAA,WAmBQ,OAAO,IAAIE,EAAKL,KAAKJ,EAAGI,KAAKH,EAAGG,KAAKM,OAnB7CD,EAAA,GCpBO,SAASE,EAAeC,GAC3B,IAAMC,EAASX,OAAOW,OAAOD,GACvBE,EAAgBD,EAAOE,OAAO,SAAAP,GAAC,MAAiB,kBAANA,IAEhD,OAAIM,EAAcE,OACNF,EAEAD,EAO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AAD,MAA0B7X,SAAS8X,eAAe","file":"static/js/main.840f3b07.chunk.js","sourcesContent":["export class Vec2 {\r\n x: number;\r\n y: number;\r\n\r\n constructor(x: number, y: number) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n add(v: Vec2): Vec2 {\r\n this.x += v.x;\r\n this.y += v.y;\r\n return this;\r\n }\r\n\r\n clone(): Vec2 {\r\n return new Vec2(this.x, this.y);\r\n }\r\n}\r\n\r\nexport class Vec3 {\r\n x: number;\r\n y: number;\r\n z: number;\r\n\r\n constructor(x: number, y: number, z: number) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n }\r\n\r\n add(v: Vec3): Vec3 {\r\n this.x += v.x;\r\n this.y += v.y;\r\n this.z += v.z;\r\n return this;\r\n }\r\n\r\n clone(): Vec3 {\r\n return new Vec3(this.x, this.y, this.z);\r\n }\r\n}\r\n","export function enum_values<E>(e: any): E[] {\r\n const values = Object.values(e);\r\n const number_values = values.filter(v => typeof v === \"number\");\r\n\r\n if (number_values.length) {\r\n return (number_values as any) as E[];\r\n } else {\r\n return (values as any) as E[];\r\n }\r\n}\r\n\r\n/**\r\n * Map with a guaranteed value per enum key.\r\n */\r\nexport class EnumMap<K, V> {\r\n private keys: K[];\r\n private values = new Map<K, V>();\r\n\r\n constructor(enum_: any, initial_value: (key: K) => V) {\r\n this.keys = enum_values(enum_);\r\n\r\n for (const key of this.keys) {\r\n this.values.set(key, initial_value(key));\r\n }\r\n }\r\n\r\n get(key: K): V {\r\n return this.values.get(key)!;\r\n }\r\n}\r\n","import { observable, computed } from \"mobx\";\r\n\r\n//\r\n// Item types.\r\n// Instances of these classes contain the data that is the same for every item of a specific type.\r\n// E.g. all spread needles are called \"Spread Needle\" and they all have the same ATA.\r\n//\r\n\r\nexport interface ItemType {\r\n readonly id: number;\r\n readonly name: string;\r\n}\r\n\r\nexport class WeaponItemType implements ItemType {\r\n constructor(\r\n readonly id: number,\r\n readonly name: string,\r\n readonly min_atp: number,\r\n readonly max_atp: number,\r\n readonly ata: number,\r\n readonly max_grind: number,\r\n readonly required_atp: number\r\n ) {}\r\n}\r\n\r\nexport class ArmorItemType implements ItemType {\r\n constructor(\r\n readonly id: number,\r\n readonly name: string,\r\n readonly atp: number,\r\n readonly ata: number,\r\n readonly min_evp: number,\r\n readonly max_evp: number,\r\n readonly min_dfp: number,\r\n readonly max_dfp: number,\r\n readonly mst: number,\r\n readonly hp: number,\r\n readonly lck: number\r\n ) {}\r\n}\r\n\r\nexport class ShieldItemType implements ItemType {\r\n constructor(\r\n readonly id: number,\r\n readonly name: string,\r\n readonly atp: number,\r\n readonly ata: number,\r\n readonly min_evp: number,\r\n readonly max_evp: number,\r\n readonly min_dfp: number,\r\n readonly max_dfp: number,\r\n readonly mst: number,\r\n readonly hp: number,\r\n readonly lck: number\r\n ) {}\r\n}\r\n\r\nexport class UnitItemType implements ItemType {\r\n constructor(readonly id: number, readonly name: string) {}\r\n}\r\n\r\nexport class ToolItemType implements ItemType {\r\n constructor(readonly id: number, readonly name: string) {}\r\n}\r\n\r\n//\r\n// Item instances.\r\n// Instances of these classes contain the data that is unique to each item.\r\n// E.g. a specific spread needle dropped by an enemy or in an inventory.\r\n//\r\n\r\nexport interface Item {\r\n readonly type: ItemType;\r\n}\r\n\r\nexport class WeaponItem implements Item {\r\n /**\r\n * Integer from 0 to 100.\r\n */\r\n @observable attribute: number = 0;\r\n /**\r\n * Integer from 0 to 100.\r\n */\r\n @observable hit: number = 0;\r\n @observable grind: number = 0;\r\n\r\n @computed get grind_atp(): number {\r\n return 2 * this.grind;\r\n }\r\n\r\n constructor(readonly type: WeaponItemType) {}\r\n}\r\n\r\nexport class ArmorItem implements Item {\r\n constructor(readonly type: ArmorItemType) {}\r\n}\r\n\r\nexport class ShieldItem implements Item {\r\n constructor(readonly type: ShieldItemType) {}\r\n}\r\n\r\nexport class UnitItem implements Item {\r\n constructor(readonly type: UnitItemType) {}\r\n}\r\n\r\nexport class ToolItem implements Item {\r\n constructor(readonly type: ToolItemType) {}\r\n}\r\n","import { Episode, check_episode } from \".\";\r\n\r\nexport class NpcType {\r\n readonly id: number;\r\n /**\r\n * Matches the constant name. E.g. the code of NpcType.Zu is \"Zu\".\r\n * Uniquely identifies an NPC.\r\n */\r\n readonly code: string;\r\n /**\r\n * Unique name. E.g. a Delsaber would have (Ep. II) appended to its name.\r\n */\r\n readonly name: string;\r\n /**\r\n * Name used in the game.\r\n * Might conflict with other NPC names (e.g. Delsaber from ep. I and ep. II).\r\n */\r\n readonly simple_name: string;\r\n readonly ultimate_name: string;\r\n readonly episode?: number;\r\n readonly enemy: boolean;\r\n rare_type?: NpcType;\r\n\r\n constructor(\r\n id: number,\r\n code: string,\r\n name: string,\r\n simple_name: string,\r\n ultimate_name: string,\r\n episode: number | undefined,\r\n enemy: boolean\r\n ) {\r\n if (!Number.isInteger(id) || id < 0)\r\n throw new Error(`Expected id to be an integer greater than or equal to 0, got ${id}.`);\r\n if (!code) throw new Error(\"code is required.\");\r\n if (!name) throw new Error(\"name is required.\");\r\n if (!simple_name) throw new Error(\"simple_name is required.\");\r\n if (!ultimate_name) throw new Error(\"ultimate_name is required.\");\r\n if (episode != null && episode !== 1 && episode !== 2 && episode !== 4)\r\n throw new Error(`episode should be undefined, 1, 2 or 4, got ${episode}.`);\r\n if (typeof enemy !== \"boolean\") throw new Error(\"enemy is required.\");\r\n\r\n this.id = id;\r\n this.code = code;\r\n this.simple_name = simple_name;\r\n this.ultimate_name = ultimate_name;\r\n this.name = name;\r\n this.episode = episode;\r\n this.enemy = enemy;\r\n\r\n NpcType.by_code_map.set(code, this);\r\n\r\n if (episode) {\r\n const map = NpcType.by_ep_and_name[episode];\r\n\r\n if (map) {\r\n map.set(simple_name, this);\r\n map.set(ultimate_name, this);\r\n }\r\n }\r\n }\r\n\r\n private static by_code_map = new Map<string, NpcType>();\r\n\r\n private static by_ep_and_name = [\r\n undefined,\r\n new Map<string, NpcType>(),\r\n new Map<string, NpcType>(),\r\n undefined,\r\n new Map<string, NpcType>(),\r\n ];\r\n\r\n static by_code(code: string): NpcType | undefined {\r\n return this.by_code_map.get(code);\r\n }\r\n\r\n /**\r\n * Uniquely identifies an NPC. Tries to match on simple_name and ultimate_name.\r\n */\r\n static by_name_and_episode(name: string, episode: Episode): NpcType | undefined {\r\n check_episode(episode);\r\n return this.by_ep_and_name[episode]!.get(name);\r\n }\r\n\r\n //\r\n // Unknown NPCs\r\n //\r\n\r\n static Unknown: NpcType;\r\n\r\n //\r\n // Friendly NPCs\r\n //\r\n\r\n static FemaleFat: NpcType;\r\n static FemaleMacho: NpcType;\r\n static FemaleTall: NpcType;\r\n static MaleDwarf: NpcType;\r\n static MaleFat: NpcType;\r\n static MaleMacho: NpcType;\r\n static MaleOld: NpcType;\r\n static BlueSoldier: NpcType;\r\n static RedSoldier: NpcType;\r\n static Principal: NpcType;\r\n static Tekker: NpcType;\r\n static GuildLady: NpcType;\r\n static Scientist: NpcType;\r\n static Nurse: NpcType;\r\n static Irene: NpcType;\r\n static ItemShop: NpcType;\r\n static Nurse2: NpcType;\r\n\r\n //\r\n // Enemy NPCs\r\n //\r\n\r\n // Episode I Forest\r\n\r\n static Hildebear: NpcType;\r\n static Hildeblue: NpcType;\r\n static RagRappy: NpcType;\r\n static AlRappy: NpcType;\r\n static Monest: NpcType;\r\n static Mothmant: NpcType;\r\n static SavageWolf: NpcType;\r\n static BarbarousWolf: NpcType;\r\n static Booma: NpcType;\r\n static Gobooma: NpcType;\r\n static Gigobooma: NpcType;\r\n static Dragon: NpcType;\r\n\r\n // Episode I Caves\r\n\r\n static GrassAssassin: NpcType;\r\n static PoisonLily: NpcType;\r\n static NarLily: NpcType;\r\n static NanoDragon: NpcType;\r\n static EvilShark: NpcType;\r\n static PalShark: NpcType;\r\n static GuilShark: NpcType;\r\n static PofuillySlime: NpcType;\r\n static PouillySlime: NpcType;\r\n static PanArms: NpcType;\r\n static Migium: NpcType;\r\n static Hidoom: NpcType;\r\n static DeRolLe: NpcType;\r\n\r\n // Episode I Mines\r\n\r\n static Dubchic: NpcType;\r\n static Gilchic: NpcType;\r\n static Garanz: NpcType;\r\n static SinowBeat: NpcType;\r\n static SinowGold: NpcType;\r\n static Canadine: NpcType;\r\n static Canane: NpcType;\r\n static Dubswitch: NpcType;\r\n static VolOpt: NpcType;\r\n\r\n // Episode I Ruins\r\n\r\n static Delsaber: NpcType;\r\n static ChaosSorcerer: NpcType;\r\n static DarkGunner: NpcType;\r\n static DeathGunner: NpcType;\r\n static ChaosBringer: NpcType;\r\n static DarkBelra: NpcType;\r\n static Dimenian: NpcType;\r\n static LaDimenian: NpcType;\r\n static SoDimenian: NpcType;\r\n static Bulclaw: NpcType;\r\n static Bulk: NpcType;\r\n static Claw: NpcType;\r\n static DarkFalz: NpcType;\r\n\r\n // Episode II VR Temple\r\n\r\n static Hildebear2: NpcType;\r\n static Hildeblue2: NpcType;\r\n static RagRappy2: NpcType;\r\n static LoveRappy: NpcType;\r\n static StRappy: NpcType;\r\n static HalloRappy: NpcType;\r\n static EggRappy: NpcType;\r\n static Monest2: NpcType;\r\n static Mothmant2: NpcType;\r\n static PoisonLily2: NpcType;\r\n static NarLily2: NpcType;\r\n static GrassAssassin2: NpcType;\r\n static Dimenian2: NpcType;\r\n static LaDimenian2: NpcType;\r\n static SoDimenian2: NpcType;\r\n static DarkBelra2: NpcType;\r\n static BarbaRay: NpcType;\r\n\r\n // Episode II VR Spaceship\r\n\r\n static SavageWolf2: NpcType;\r\n static BarbarousWolf2: NpcType;\r\n static PanArms2: NpcType;\r\n static Migium2: NpcType;\r\n static Hidoom2: NpcType;\r\n static Dubchic2: NpcType;\r\n static Gilchic2: NpcType;\r\n static Garanz2: NpcType;\r\n static Dubswitch2: NpcType;\r\n static Delsaber2: NpcType;\r\n static ChaosSorcerer2: NpcType;\r\n static GolDragon: NpcType;\r\n\r\n // Episode II Central Control Area\r\n\r\n static SinowBerill: NpcType;\r\n static SinowSpigell: NpcType;\r\n static Merillia: NpcType;\r\n static Meriltas: NpcType;\r\n static Mericarol: NpcType;\r\n static Mericus: NpcType;\r\n static Merikle: NpcType;\r\n static UlGibbon: NpcType;\r\n static ZolGibbon: NpcType;\r\n static Gibbles: NpcType;\r\n static Gee: NpcType;\r\n static GiGue: NpcType;\r\n static IllGill: NpcType;\r\n static DelLily: NpcType;\r\n static Epsilon: NpcType;\r\n static GalGryphon: NpcType;\r\n\r\n // Episode II Seabed\r\n\r\n static Deldepth: NpcType;\r\n static Delbiter: NpcType;\r\n static Dolmolm: NpcType;\r\n static Dolmdarl: NpcType;\r\n static Morfos: NpcType;\r\n static Recobox: NpcType;\r\n static Recon: NpcType;\r\n static SinowZoa: NpcType;\r\n static SinowZele: NpcType;\r\n static OlgaFlow: NpcType;\r\n\r\n // Episode IV\r\n\r\n static SandRappy: NpcType;\r\n static DelRappy: NpcType;\r\n static Astark: NpcType;\r\n static SatelliteLizard: NpcType;\r\n static Yowie: NpcType;\r\n static MerissaA: NpcType;\r\n static MerissaAA: NpcType;\r\n static Girtablulu: NpcType;\r\n static Zu: NpcType;\r\n static Pazuzu: NpcType;\r\n static Boota: NpcType;\r\n static ZeBoota: NpcType;\r\n static BaBoota: NpcType;\r\n static Dorphon: NpcType;\r\n static DorphonEclair: NpcType;\r\n static Goran: NpcType;\r\n static PyroGoran: NpcType;\r\n static GoranDetonator: NpcType;\r\n static SaintMilion: NpcType;\r\n static Shambertin: NpcType;\r\n static Kondrieu: NpcType;\r\n}\r\n\r\n(function() {\r\n let id = 0;\r\n\r\n //\r\n // Unknown NPCs\r\n //\r\n\r\n NpcType.Unknown = new NpcType(\r\n id++,\r\n \"Unknown\",\r\n \"Unknown\",\r\n \"Unknown\",\r\n \"Unknown\",\r\n undefined,\r\n false\r\n );\r\n\r\n //\r\n // Friendly NPCs\r\n //\r\n\r\n NpcType.FemaleFat = new NpcType(\r\n id++,\r\n \"FemaleFat\",\r\n \"Female Fat\",\r\n \"Female Fat\",\r\n \"Female Fat\",\r\n undefined,\r\n false\r\n );\r\n NpcType.FemaleMacho = new NpcType(\r\n id++,\r\n \"FemaleMacho\",\r\n \"Female Macho\",\r\n \"Female Macho\",\r\n \"Female Macho\",\r\n undefined,\r\n false\r\n );\r\n NpcType.FemaleTall = new NpcType(\r\n id++,\r\n \"FemaleTall\",\r\n \"Female Tall\",\r\n \"Female Tall\",\r\n \"Female Tall\",\r\n undefined,\r\n false\r\n );\r\n NpcType.MaleDwarf = new NpcType(\r\n id++,\r\n \"MaleDwarf\",\r\n \"Male Dwarf\",\r\n \"Male Dwarf\",\r\n \"Male Dwarf\",\r\n undefined,\r\n false\r\n );\r\n NpcType.MaleFat = new NpcType(\r\n id++,\r\n \"MaleFat\",\r\n \"Male Fat\",\r\n \"Male Fat\",\r\n \"Male Fat\",\r\n undefined,\r\n false\r\n );\r\n NpcType.MaleMacho = new NpcType(\r\n id++,\r\n \"MaleMacho\",\r\n \"Male Macho\",\r\n \"Male Macho\",\r\n \"Male Macho\",\r\n undefined,\r\n false\r\n );\r\n NpcType.MaleOld = new NpcType(\r\n id++,\r\n \"MaleOld\",\r\n \"Male Old\",\r\n \"Male Old\",\r\n \"Male Old\",\r\n undefined,\r\n false\r\n );\r\n NpcType.BlueSoldier = new NpcType(\r\n id++,\r\n \"BlueSoldier\",\r\n \"Blue Soldier\",\r\n \"Blue Soldier\",\r\n \"Blue Soldier\",\r\n undefined,\r\n false\r\n );\r\n NpcType.RedSoldier = new NpcType(\r\n id++,\r\n \"RedSoldier\",\r\n \"Red Soldier\",\r\n \"Red Soldier\",\r\n \"Red Soldier\",\r\n undefined,\r\n false\r\n );\r\n NpcType.Principal = new NpcType(\r\n id++,\r\n \"Principal\",\r\n \"Principal\",\r\n \"Principal\",\r\n \"Principal\",\r\n undefined,\r\n false\r\n );\r\n NpcType.Tekker = new NpcType(id++, \"Tekker\", \"Tekker\", \"Tekker\", \"Tekker\", undefined, false);\r\n NpcType.GuildLady = new NpcType(\r\n id++,\r\n \"GuildLady\",\r\n \"Guild Lady\",\r\n \"Guild Lady\",\r\n \"Guild Lady\",\r\n undefined,\r\n false\r\n );\r\n NpcType.Scientist = new NpcType(\r\n id++,\r\n \"Scientist\",\r\n \"Scientist\",\r\n \"Scientist\",\r\n \"Scientist\",\r\n undefined,\r\n false\r\n );\r\n NpcType.Nurse = new NpcType(id++, \"Nurse\", \"Nurse\", \"Nurse\", \"Nurse\", undefined, false);\r\n NpcType.Irene = new NpcType(id++, \"Irene\", \"Irene\", \"Irene\", \"Irene\", undefined, false);\r\n NpcType.ItemShop = new NpcType(\r\n id++,\r\n \"ItemShop\",\r\n \"Item Shop\",\r\n \"Item Shop\",\r\n \"Item Shop\",\r\n undefined,\r\n false\r\n );\r\n NpcType.Nurse2 = new NpcType(id++, \"Nurse2\", \"Nurse (Ep. II)\", \"Nurse\", \"Nurse\", 2, false);\r\n\r\n //\r\n // Enemy NPCs\r\n //\r\n\r\n // Episode I Forest\r\n\r\n NpcType.Hildebear = new NpcType(\r\n id++,\r\n \"Hildebear\",\r\n \"Hildebear\",\r\n \"Hildebear\",\r\n \"Hildelt\",\r\n 1,\r\n true\r\n );\r\n NpcType.Hildeblue = new NpcType(\r\n id++,\r\n \"Hildeblue\",\r\n \"Hildeblue\",\r\n \"Hildeblue\",\r\n \"Hildetorr\",\r\n 1,\r\n true\r\n );\r\n NpcType.Hildebear.rare_type = NpcType.Hildeblue;\r\n NpcType.RagRappy = new NpcType(id++, \"RagRappy\", \"Rag Rappy\", \"Rag Rappy\", \"El Rappy\", 1, true);\r\n NpcType.AlRappy = new NpcType(id++, \"AlRappy\", \"Al Rappy\", \"Al Rappy\", \"Pal Rappy\", 1, true);\r\n NpcType.RagRappy.rare_type = NpcType.AlRappy;\r\n NpcType.Monest = new NpcType(id++, \"Monest\", \"Monest\", \"Monest\", \"Mothvist\", 1, true);\r\n NpcType.Mothmant = new NpcType(id++, \"Mothmant\", \"Mothmant\", \"Mothmant\", \"Mothvert\", 1, true);\r\n NpcType.SavageWolf = new NpcType(\r\n id++,\r\n \"SavageWolf\",\r\n \"Savage Wolf\",\r\n \"Savage Wolf\",\r\n \"Gulgus\",\r\n 1,\r\n true\r\n );\r\n NpcType.BarbarousWolf = new NpcType(\r\n id++,\r\n \"BarbarousWolf\",\r\n \"Barbarous Wolf\",\r\n \"Barbarous Wolf\",\r\n \"Gulgus-Gue\",\r\n 1,\r\n true\r\n );\r\n NpcType.Booma = new NpcType(id++, \"Booma\", \"Booma\", \"Booma\", \"Bartle\", 1, true);\r\n NpcType.Gobooma = new NpcType(id++, \"Gobooma\", \"Gobooma\", \"Gobooma\", \"Barble\", 1, true);\r\n NpcType.Gigobooma = new NpcType(id++, \"Gigobooma\", \"Gigobooma\", \"Gigobooma\", \"Tollaw\", 1, true);\r\n NpcType.Dragon = new NpcType(id++, \"Dragon\", \"Dragon\", \"Dragon\", \"Sil Dragon\", 1, true);\r\n\r\n // Episode I Caves\r\n\r\n NpcType.GrassAssassin = new NpcType(\r\n id++,\r\n \"GrassAssassin\",\r\n \"Grass Assassin\",\r\n \"Grass Assassin\",\r\n \"Crimson Assassin\",\r\n 1,\r\n true\r\n );\r\n NpcType.PoisonLily = new NpcType(\r\n id++,\r\n \"PoisonLily\",\r\n \"Poison Lily\",\r\n \"Poison Lily\",\r\n \"Ob Lily\",\r\n 1,\r\n true\r\n );\r\n NpcType.NarLily = new NpcType(id++, \"NarLily\", \"Nar Lily\", \"Nar Lily\", \"Mil Lily\", 1, true);\r\n NpcType.PoisonLily.rare_type = NpcType.NarLily;\r\n NpcType.NanoDragon = new NpcType(\r\n id++,\r\n \"NanoDragon\",\r\n \"Nano Dragon\",\r\n \"Nano Dragon\",\r\n \"Nano Dragon\",\r\n 1,\r\n true\r\n );\r\n NpcType.EvilShark = new NpcType(\r\n id++,\r\n \"EvilShark\",\r\n \"Evil Shark\",\r\n \"Evil Shark\",\r\n \"Vulmer\",\r\n 1,\r\n true\r\n );\r\n NpcType.PalShark = new NpcType(id++, \"PalShark\", \"Pal Shark\", \"Pal Shark\", \"Govulmer\", 1, true);\r\n NpcType.GuilShark = new NpcType(\r\n id++,\r\n \"GuilShark\",\r\n \"Guil Shark\",\r\n \"Guil Shark\",\r\n \"Melqueek\",\r\n 1,\r\n true\r\n );\r\n NpcType.PofuillySlime = new NpcType(\r\n id++,\r\n \"PofuillySlime\",\r\n \"Pofuilly Slime\",\r\n \"Pofuilly Slime\",\r\n \"Pofuilly Slime\",\r\n 1,\r\n true\r\n );\r\n NpcType.PouillySlime = new NpcType(\r\n id++,\r\n \"PouillySlime\",\r\n \"Pouilly Slime\",\r\n \"Pouilly Slime\",\r\n \"Pouilly Slime\",\r\n 1,\r\n true\r\n );\r\n NpcType.PofuillySlime.rare_type = NpcType.PouillySlime;\r\n NpcType.PanArms = new NpcType(id++, \"PanArms\", \"Pan Arms\", \"Pan Arms\", \"Pan Arms\", 1, true);\r\n NpcType.Migium = new NpcType(id++, \"Migium\", \"Migium\", \"Migium\", \"Migium\", 1, true);\r\n NpcType.Hidoom = new NpcType(id++, \"Hidoom\", \"Hidoom\", \"Hidoom\", \"Hidoom\", 1, true);\r\n NpcType.DeRolLe = new NpcType(id++, \"DeRolLe\", \"De Rol Le\", \"De Rol Le\", \"Dal Ra Lie\", 1, true);\r\n\r\n // Episode I Mines\r\n\r\n NpcType.Dubchic = new NpcType(id++, \"Dubchic\", \"Dubchic\", \"Dubchic\", \"Dubchich\", 1, true);\r\n NpcType.Gilchic = new NpcType(id++, \"Gilchic\", \"Gilchic\", \"Gilchic\", \"Gilchich\", 1, true);\r\n NpcType.Garanz = new NpcType(id++, \"Garanz\", \"Garanz\", \"Garanz\", \"Baranz\", 1, true);\r\n NpcType.SinowBeat = new NpcType(\r\n id++,\r\n \"SinowBeat\",\r\n \"Sinow Beat\",\r\n \"Sinow Beat\",\r\n \"Sinow Blue\",\r\n 1,\r\n true\r\n );\r\n NpcType.SinowGold = new NpcType(\r\n id++,\r\n \"SinowGold\",\r\n \"Sinow Gold\",\r\n \"Sinow Gold\",\r\n \"Sinow Red\",\r\n 1,\r\n true\r\n );\r\n NpcType.Canadine = new NpcType(id++, \"Canadine\", \"Canadine\", \"Canadine\", \"Canabin\", 1, true);\r\n NpcType.Canane = new NpcType(id++, \"Canane\", \"Canane\", \"Canane\", \"Canune\", 1, true);\r\n NpcType.Dubswitch = new NpcType(\r\n id++,\r\n \"Dubswitch\",\r\n \"Dubswitch\",\r\n \"Dubswitch\",\r\n \"Dubswitch\",\r\n 1,\r\n true\r\n );\r\n NpcType.VolOpt = new NpcType(id++, \"VolOpt\", \"Vol Opt\", \"Vol Opt\", \"Vol Opt ver.2\", 1, true);\r\n\r\n // Episode I Ruins\r\n\r\n NpcType.Delsaber = new NpcType(id++, \"Delsaber\", \"Delsaber\", \"Delsaber\", \"Delsaber\", 1, true);\r\n NpcType.ChaosSorcerer = new NpcType(\r\n id++,\r\n \"ChaosSorcerer\",\r\n \"Chaos Sorcerer\",\r\n \"Chaos Sorcerer\",\r\n \"Gran Sorcerer\",\r\n 1,\r\n true\r\n );\r\n NpcType.DarkGunner = new NpcType(\r\n id++,\r\n \"DarkGunner\",\r\n \"Dark Gunner\",\r\n \"Dark Gunner\",\r\n \"Dark Gunner\",\r\n 1,\r\n true\r\n );\r\n NpcType.DeathGunner = new NpcType(\r\n id++,\r\n \"DeathGunner\",\r\n \"Death Gunner\",\r\n \"Death Gunner\",\r\n \"Death Gunner\",\r\n 1,\r\n true\r\n );\r\n NpcType.ChaosBringer = new NpcType(\r\n id++,\r\n \"ChaosBringer\",\r\n \"Chaos Bringer\",\r\n \"Chaos Bringer\",\r\n \"Dark Bringer\",\r\n 1,\r\n true\r\n );\r\n NpcType.DarkBelra = new NpcType(\r\n id++,\r\n \"DarkBelra\",\r\n \"Dark Belra\",\r\n \"Dark Belra\",\r\n \"Indi Belra\",\r\n 1,\r\n true\r\n );\r\n NpcType.Dimenian = new NpcType(id++, \"Dimenian\", \"Dimenian\", \"Dimenian\", \"Arlan\", 1, true);\r\n NpcType.LaDimenian = new NpcType(\r\n id++,\r\n \"LaDimenian\",\r\n \"La Dimenian\",\r\n \"La Dimenian\",\r\n \"Merlan\",\r\n 1,\r\n true\r\n );\r\n NpcType.SoDimenian = new NpcType(\r\n id++,\r\n \"SoDimenian\",\r\n \"So Dimenian\",\r\n \"So Dimenian\",\r\n \"Del-D\",\r\n 1,\r\n true\r\n );\r\n NpcType.Bulclaw = new NpcType(id++, \"Bulclaw\", \"Bulclaw\", \"Bulclaw\", \"Bulclaw\", 1, true);\r\n NpcType.Bulk = new NpcType(id++, \"Bulk\", \"Bulk\", \"Bulk\", \"Bulk\", 1, true);\r\n NpcType.Claw = new NpcType(id++, \"Claw\", \"Claw\", \"Claw\", \"Claw\", 1, true);\r\n NpcType.DarkFalz = new NpcType(\r\n id++,\r\n \"DarkFalz\",\r\n \"Dark Falz\",\r\n \"Dark Falz\",\r\n \"Dark Falz\",\r\n 1,\r\n true\r\n );\r\n\r\n // Episode II VR Temple\r\n\r\n NpcType.Hildebear2 = new NpcType(\r\n id++,\r\n \"Hildebear2\",\r\n \"Hildebear (Ep. II)\",\r\n \"Hildebear\",\r\n \"Hildelt\",\r\n 2,\r\n true\r\n );\r\n NpcType.Hildeblue2 = new NpcType(\r\n id++,\r\n \"Hildeblue2\",\r\n \"Hildeblue (Ep. II)\",\r\n \"Hildeblue\",\r\n \"Hildetorr\",\r\n 2,\r\n true\r\n );\r\n NpcType.Hildebear2.rare_type = NpcType.Hildeblue2;\r\n NpcType.RagRappy2 = new NpcType(\r\n id++,\r\n \"RagRappy2\",\r\n \"Rag Rappy (Ep. II)\",\r\n \"Rag Rappy\",\r\n \"El Rappy\",\r\n 2,\r\n true\r\n );\r\n NpcType.LoveRappy = new NpcType(\r\n id++,\r\n \"LoveRappy\",\r\n \"Love Rappy\",\r\n \"Love Rappy\",\r\n \"Love Rappy\",\r\n 2,\r\n true\r\n );\r\n NpcType.RagRappy2.rare_type = NpcType.LoveRappy;\r\n NpcType.StRappy = new NpcType(id++, \"StRappy\", \"St. Rappy\", \"St. Rappy\", \"St. Rappy\", 2, true);\r\n NpcType.HalloRappy = new NpcType(\r\n id++,\r\n \"HalloRappy\",\r\n \"Hallo Rappy\",\r\n \"Hallo Rappy\",\r\n \"Hallo Rappy\",\r\n 2,\r\n true\r\n );\r\n NpcType.EggRappy = new NpcType(\r\n id++,\r\n \"EggRappy\",\r\n \"Egg Rappy\",\r\n \"Egg Rappy\",\r\n \"Egg Rappy\",\r\n 2,\r\n true\r\n );\r\n NpcType.Monest2 = new NpcType(\r\n id++,\r\n \"Monest2\",\r\n \"Monest (Ep. II)\",\r\n \"Monest\",\r\n \"Mothvist\",\r\n 2,\r\n true\r\n );\r\n NpcType.Mothmant2 = new NpcType(id++, \"Mothmant2\", \"Mothmant\", \"Mothmant\", \"Mothvert\", 2, true);\r\n NpcType.PoisonLily2 = new NpcType(\r\n id++,\r\n \"PoisonLily2\",\r\n \"Poison Lily (Ep. II)\",\r\n \"Poison Lily\",\r\n \"Ob Lily\",\r\n 2,\r\n true\r\n );\r\n NpcType.NarLily2 = new NpcType(\r\n id++,\r\n \"NarLily2\",\r\n \"Nar Lily (Ep. II)\",\r\n \"Nar Lily\",\r\n \"Mil Lily\",\r\n 2,\r\n true\r\n );\r\n NpcType.PoisonLily2.rare_type = NpcType.NarLily2;\r\n NpcType.GrassAssassin2 = new NpcType(\r\n id++,\r\n \"GrassAssassin2\",\r\n \"Grass Assassin (Ep. II)\",\r\n \"Grass Assassin\",\r\n \"Crimson Assassin\",\r\n 2,\r\n true\r\n );\r\n NpcType.Dimenian2 = new NpcType(\r\n id++,\r\n \"Dimenian2\",\r\n \"Dimenian (Ep. II)\",\r\n \"Dimenian\",\r\n \"Arlan\",\r\n 2,\r\n true\r\n );\r\n NpcType.LaDimenian2 = new NpcType(\r\n id++,\r\n \"LaDimenian2\",\r\n \"La Dimenian (Ep. II)\",\r\n \"La Dimenian\",\r\n \"Merlan\",\r\n 2,\r\n true\r\n );\r\n NpcType.SoDimenian2 = new NpcType(\r\n id++,\r\n \"SoDimenian2\",\r\n \"So Dimenian (Ep. II)\",\r\n \"So Dimenian\",\r\n \"Del-D\",\r\n 2,\r\n true\r\n );\r\n NpcType.DarkBelra2 = new NpcType(\r\n id++,\r\n \"DarkBelra2\",\r\n \"Dark Belra (Ep. II)\",\r\n \"Dark Belra\",\r\n \"Indi Belra\",\r\n 2,\r\n true\r\n );\r\n NpcType.BarbaRay = new NpcType(\r\n id++,\r\n \"BarbaRay\",\r\n \"Barba Ray\",\r\n \"Barba Ray\",\r\n \"Barba Ray\",\r\n 2,\r\n true\r\n );\r\n\r\n // Episode II VR Spaceship\r\n\r\n NpcType.SavageWolf2 = new NpcType(\r\n id++,\r\n \"SavageWolf2\",\r\n \"Savage Wolf (Ep. II)\",\r\n \"Savage Wolf\",\r\n \"Gulgus\",\r\n 2,\r\n true\r\n );\r\n NpcType.BarbarousWolf2 = new NpcType(\r\n id++,\r\n \"BarbarousWolf2\",\r\n \"Barbarous Wolf (Ep. II)\",\r\n \"Barbarous Wolf\",\r\n \"Gulgus-Gue\",\r\n 2,\r\n true\r\n );\r\n NpcType.PanArms2 = new NpcType(\r\n id++,\r\n \"PanArms2\",\r\n \"Pan Arms (Ep. II)\",\r\n \"Pan Arms\",\r\n \"Pan Arms\",\r\n 2,\r\n true\r\n );\r\n NpcType.Migium2 = new NpcType(id++, \"Migium2\", \"Migium (Ep. II)\", \"Migium\", \"Migium\", 2, true);\r\n NpcType.Hidoom2 = new NpcType(id++, \"Hidoom2\", \"Hidoom (Ep. II)\", \"Hidoom\", \"Hidoom\", 2, true);\r\n NpcType.Dubchic2 = new NpcType(\r\n id++,\r\n \"Dubchic2\",\r\n \"Dubchic (Ep. II)\",\r\n \"Dubchic\",\r\n \"Dubchich\",\r\n 2,\r\n true\r\n );\r\n NpcType.Gilchic2 = new NpcType(\r\n id++,\r\n \"Gilchic2\",\r\n \"Gilchic (Ep. II)\",\r\n \"Gilchic\",\r\n \"Gilchich\",\r\n 2,\r\n true\r\n );\r\n NpcType.Garanz2 = new NpcType(id++, \"Garanz2\", \"Garanz (Ep. II)\", \"Garanz\", \"Baranz\", 2, true);\r\n NpcType.Dubswitch2 = new NpcType(\r\n id++,\r\n \"Dubswitch2\",\r\n \"Dubswitch (Ep. II)\",\r\n \"Dubswitch\",\r\n \"Dubswitch\",\r\n 2,\r\n true\r\n );\r\n NpcType.Delsaber2 = new NpcType(\r\n id++,\r\n \"Delsaber2\",\r\n \"Delsaber (Ep. II)\",\r\n \"Delsaber\",\r\n \"Delsaber\",\r\n 2,\r\n true\r\n );\r\n NpcType.ChaosSorcerer2 = new NpcType(\r\n id++,\r\n \"ChaosSorcerer2\",\r\n \"Chaos Sorcerer (Ep. II)\",\r\n \"Chaos Sorcerer\",\r\n \"Gran Sorcerer\",\r\n 2,\r\n true\r\n );\r\n NpcType.GolDragon = new NpcType(\r\n id++,\r\n \"GolDragon\",\r\n \"Gol Dragon\",\r\n \"Gol Dragon\",\r\n \"Gol Dragon\",\r\n 2,\r\n true\r\n );\r\n\r\n // Episode II Central Control Area\r\n\r\n NpcType.SinowBerill = new NpcType(\r\n id++,\r\n \"SinowBerill\",\r\n \"Sinow Berill\",\r\n \"Sinow Berill\",\r\n \"Sinow Berill\",\r\n 2,\r\n true\r\n );\r\n NpcType.SinowSpigell = new NpcType(\r\n id++,\r\n \"SinowSpigell\",\r\n \"Sinow Spigell\",\r\n \"Sinow Spigell\",\r\n \"Sinow Spigell\",\r\n 2,\r\n true\r\n );\r\n NpcType.Merillia = new NpcType(id++, \"Merillia\", \"Merillia\", \"Merillia\", \"Merillia\", 2, true);\r\n NpcType.Meriltas = new NpcType(id++, \"Meriltas\", \"Meriltas\", \"Meriltas\", \"Meriltas\", 2, true);\r\n NpcType.Mericarol = new NpcType(\r\n id++,\r\n \"Mericarol\",\r\n \"Mericarol\",\r\n \"Mericarol\",\r\n \"Mericarol\",\r\n 2,\r\n true\r\n );\r\n NpcType.Mericus = new NpcType(id++, \"Mericus\", \"Mericus\", \"Mericus\", \"Mericus\", 2, true);\r\n NpcType.Merikle = new NpcType(id++, \"Merikle\", \"Merikle\", \"Merikle\", \"Merikle\", 2, true);\r\n NpcType.UlGibbon = new NpcType(\r\n id++,\r\n \"UlGibbon\",\r\n \"Ul Gibbon\",\r\n \"Ul Gibbon\",\r\n \"Ul Gibbon\",\r\n 2,\r\n true\r\n );\r\n NpcType.ZolGibbon = new NpcType(\r\n id++,\r\n \"ZolGibbon\",\r\n \"Zol Gibbon\",\r\n \"Zol Gibbon\",\r\n \"Zol Gibbon\",\r\n 2,\r\n true\r\n );\r\n NpcType.Gibbles = new NpcType(id++, \"Gibbles\", \"Gibbles\", \"Gibbles\", \"Gibbles\", 2, true);\r\n NpcType.Gee = new NpcType(id++, \"Gee\", \"Gee\", \"Gee\", \"Gee\", 2, true);\r\n NpcType.GiGue = new NpcType(id++, \"GiGue\", \"Gi Gue\", \"Gi Gue\", \"Gi Gue\", 2, true);\r\n NpcType.IllGill = new NpcType(id++, \"IllGill\", \"Ill Gill\", \"Ill Gill\", \"Ill Gill\", 2, true);\r\n NpcType.DelLily = new NpcType(id++, \"DelLily\", \"Del Lily\", \"Del Lily\", \"Del Lily\", 2, true);\r\n NpcType.Epsilon = new NpcType(id++, \"Epsilon\", \"Epsilon\", \"Epsilon\", \"Epsilon\", 2, true);\r\n NpcType.GalGryphon = new NpcType(\r\n id++,\r\n \"GalGryphon\",\r\n \"Gal Gryphon\",\r\n \"Gal Gryphon\",\r\n \"Gal Gryphon\",\r\n 2,\r\n true\r\n );\r\n\r\n // Episode II Seabed\r\n\r\n NpcType.Deldepth = new NpcType(id++, \"Deldepth\", \"Deldepth\", \"Deldepth\", \"Deldepth\", 2, true);\r\n NpcType.Delbiter = new NpcType(id++, \"Delbiter\", \"Delbiter\", \"Delbiter\", \"Delbiter\", 2, true);\r\n NpcType.Dolmolm = new NpcType(id++, \"Dolmolm\", \"Dolmolm\", \"Dolmolm\", \"Dolmolm\", 2, true);\r\n NpcType.Dolmdarl = new NpcType(id++, \"Dolmdarl\", \"Dolmdarl\", \"Dolmdarl\", \"Dolmdarl\", 2, true);\r\n NpcType.Morfos = new NpcType(id++, \"Morfos\", \"Morfos\", \"Morfos\", \"Morfos\", 2, true);\r\n NpcType.Recobox = new NpcType(id++, \"Recobox\", \"Recobox\", \"Recobox\", \"Recobox\", 2, true);\r\n NpcType.Recon = new NpcType(id++, \"Recon\", \"Recon\", \"Recon\", \"Recon\", 2, true);\r\n NpcType.SinowZoa = new NpcType(\r\n id++,\r\n \"SinowZoa\",\r\n \"Sinow Zoa\",\r\n \"Sinow Zoa\",\r\n \"Sinow Zoa\",\r\n 2,\r\n true\r\n );\r\n NpcType.SinowZele = new NpcType(\r\n id++,\r\n \"SinowZele\",\r\n \"Sinow Zele\",\r\n \"Sinow Zele\",\r\n \"Sinow Zele\",\r\n 2,\r\n true\r\n );\r\n NpcType.OlgaFlow = new NpcType(\r\n id++,\r\n \"OlgaFlow\",\r\n \"Olga Flow\",\r\n \"Olga Flow\",\r\n \"Olga Flow\",\r\n 2,\r\n true\r\n );\r\n\r\n // Episode IV\r\n\r\n NpcType.SandRappy = new NpcType(\r\n id++,\r\n \"SandRappy\",\r\n \"Sand Rappy\",\r\n \"Sand Rappy\",\r\n \"Sand Rappy\",\r\n 4,\r\n true\r\n );\r\n NpcType.DelRappy = new NpcType(\r\n id++,\r\n \"DelRappy\",\r\n \"Del Rappy\",\r\n \"Del Rappy\",\r\n \"Del Rappy\",\r\n 4,\r\n true\r\n );\r\n NpcType.SandRappy.rare_type = NpcType.DelRappy;\r\n NpcType.Astark = new NpcType(id++, \"Astark\", \"Astark\", \"Astark\", \"Astark\", 4, true);\r\n NpcType.SatelliteLizard = new NpcType(\r\n id++,\r\n \"SatelliteLizard\",\r\n \"Satellite Lizard\",\r\n \"Satellite Lizard\",\r\n \"Satellite Lizard\",\r\n 4,\r\n true\r\n );\r\n NpcType.Yowie = new NpcType(id++, \"Yowie\", \"Yowie\", \"Yowie\", \"Yowie\", 4, true);\r\n NpcType.MerissaA = new NpcType(\r\n id++,\r\n \"MerissaA\",\r\n \"Merissa A\",\r\n \"Merissa A\",\r\n \"Merissa A\",\r\n 4,\r\n true\r\n );\r\n NpcType.MerissaAA = new NpcType(\r\n id++,\r\n \"MerissaAA\",\r\n \"Merissa AA\",\r\n \"Merissa AA\",\r\n \"Merissa AA\",\r\n 4,\r\n true\r\n );\r\n NpcType.MerissaA.rare_type = NpcType.MerissaAA;\r\n NpcType.Girtablulu = new NpcType(\r\n id++,\r\n \"Girtablulu\",\r\n \"Girtablulu\",\r\n \"Girtablulu\",\r\n \"Girtablulu\",\r\n 4,\r\n true\r\n );\r\n NpcType.Zu = new NpcType(id++, \"Zu\", \"Zu\", \"Zu\", \"Zu\", 4, true);\r\n NpcType.Pazuzu = new NpcType(id++, \"Pazuzu\", \"Pazuzu\", \"Pazuzu\", \"Pazuzu\", 4, true);\r\n NpcType.Zu.rare_type = NpcType.Pazuzu;\r\n NpcType.Boota = new NpcType(id++, \"Boota\", \"Boota\", \"Boota\", \"Boota\", 4, true);\r\n NpcType.ZeBoota = new NpcType(id++, \"ZeBoota\", \"Ze Boota\", \"Ze Boota\", \"Ze Boota\", 4, true);\r\n NpcType.BaBoota = new NpcType(id++, \"BaBoota\", \"Ba Boota\", \"Ba Boota\", \"Ba Boota\", 4, true);\r\n NpcType.Dorphon = new NpcType(id++, \"Dorphon\", \"Dorphon\", \"Dorphon\", \"Dorphon\", 4, true);\r\n NpcType.DorphonEclair = new NpcType(\r\n id++,\r\n \"DorphonEclair\",\r\n \"Dorphon Eclair\",\r\n \"Dorphon Eclair\",\r\n \"Dorphon Eclair\",\r\n 4,\r\n true\r\n );\r\n NpcType.Dorphon.rare_type = NpcType.DorphonEclair;\r\n NpcType.Goran = new NpcType(id++, \"Goran\", \"Goran\", \"Goran\", \"Goran\", 4, true);\r\n NpcType.PyroGoran = new NpcType(\r\n id++,\r\n \"PyroGoran\",\r\n \"Pyro Goran\",\r\n \"Pyro Goran\",\r\n \"Pyro Goran\",\r\n 4,\r\n true\r\n );\r\n NpcType.GoranDetonator = new NpcType(\r\n id++,\r\n \"GoranDetonator\",\r\n \"Goran Detonator\",\r\n \"Goran Detonator\",\r\n \"Goran Detonator\",\r\n 4,\r\n true\r\n );\r\n NpcType.SaintMilion = new NpcType(\r\n id++,\r\n \"SaintMilion\",\r\n \"Saint-Milion\",\r\n \"Saint-Milion\",\r\n \"Saint-Milion\",\r\n 4,\r\n true\r\n );\r\n NpcType.Shambertin = new NpcType(\r\n id++,\r\n \"Shambertin\",\r\n \"Shambertin\",\r\n \"Shambertin\",\r\n \"Shambertin\",\r\n 4,\r\n true\r\n );\r\n NpcType.Kondrieu = new NpcType(id++, \"Kondrieu\", \"Kondrieu\", \"Kondrieu\", \"Kondrieu\", 4, true);\r\n NpcType.SaintMilion.rare_type = NpcType.Kondrieu;\r\n NpcType.Shambertin.rare_type = NpcType.Kondrieu;\r\n})();\r\n\r\nexport const NpcTypes: NpcType[] = [\r\n //\r\n // Unknown NPCs\r\n //\r\n\r\n NpcType.Unknown,\r\n\r\n //\r\n // Friendly NPCs\r\n //\r\n\r\n NpcType.FemaleFat,\r\n NpcType.FemaleMacho,\r\n NpcType.FemaleTall,\r\n NpcType.MaleDwarf,\r\n NpcType.MaleFat,\r\n NpcType.MaleMacho,\r\n NpcType.MaleOld,\r\n NpcType.BlueSoldier,\r\n NpcType.RedSoldier,\r\n NpcType.Principal,\r\n NpcType.Tekker,\r\n NpcType.GuildLady,\r\n NpcType.Scientist,\r\n NpcType.Nurse,\r\n NpcType.Irene,\r\n NpcType.ItemShop,\r\n NpcType.Nurse2,\r\n\r\n //\r\n // Enemy NPCs\r\n //\r\n\r\n // Episode I Forest\r\n\r\n NpcType.Hildebear,\r\n NpcType.Hildeblue,\r\n NpcType.RagRappy,\r\n NpcType.AlRappy,\r\n NpcType.Monest,\r\n NpcType.Mothmant,\r\n NpcType.SavageWolf,\r\n NpcType.BarbarousWolf,\r\n NpcType.Booma,\r\n NpcType.Gobooma,\r\n NpcType.Gigobooma,\r\n NpcType.Dragon,\r\n\r\n // Episode I Caves\r\n\r\n NpcType.GrassAssassin,\r\n NpcType.PoisonLily,\r\n NpcType.NarLily,\r\n NpcType.NanoDragon,\r\n NpcType.EvilShark,\r\n NpcType.PalShark,\r\n NpcType.GuilShark,\r\n NpcType.PofuillySlime,\r\n NpcType.PouillySlime,\r\n NpcType.PanArms,\r\n NpcType.Migium,\r\n NpcType.Hidoom,\r\n NpcType.DeRolLe,\r\n\r\n // Episode I Mines\r\n\r\n NpcType.Dubchic,\r\n NpcType.Gilchic,\r\n NpcType.Garanz,\r\n NpcType.SinowBeat,\r\n NpcType.SinowGold,\r\n NpcType.Canadine,\r\n NpcType.Canane,\r\n NpcType.Dubswitch,\r\n NpcType.VolOpt,\r\n\r\n // Episode I Ruins\r\n\r\n NpcType.Delsaber,\r\n NpcType.ChaosSorcerer,\r\n NpcType.DarkGunner,\r\n NpcType.DeathGunner,\r\n NpcType.ChaosBringer,\r\n NpcType.DarkBelra,\r\n NpcType.Dimenian,\r\n NpcType.LaDimenian,\r\n NpcType.SoDimenian,\r\n NpcType.Bulclaw,\r\n NpcType.Bulk,\r\n NpcType.Claw,\r\n NpcType.DarkFalz,\r\n\r\n // Episode II VR Temple\r\n\r\n NpcType.Hildebear2,\r\n NpcType.Hildeblue2,\r\n NpcType.RagRappy2,\r\n NpcType.LoveRappy,\r\n NpcType.StRappy,\r\n NpcType.HalloRappy,\r\n NpcType.EggRappy,\r\n NpcType.Monest2,\r\n NpcType.Mothmant2,\r\n NpcType.PoisonLily2,\r\n NpcType.NarLily2,\r\n NpcType.GrassAssassin2,\r\n NpcType.Dimenian2,\r\n NpcType.LaDimenian2,\r\n NpcType.SoDimenian2,\r\n NpcType.DarkBelra2,\r\n NpcType.BarbaRay,\r\n\r\n // Episode II VR Spaceship\r\n\r\n NpcType.SavageWolf2,\r\n NpcType.BarbarousWolf2,\r\n NpcType.PanArms2,\r\n NpcType.Migium2,\r\n NpcType.Hidoom2,\r\n NpcType.Dubchic2,\r\n NpcType.Gilchic2,\r\n NpcType.Garanz2,\r\n NpcType.Dubswitch2,\r\n NpcType.Delsaber2,\r\n NpcType.ChaosSorcerer2,\r\n NpcType.GolDragon,\r\n\r\n // Episode II Central Control Area\r\n\r\n NpcType.SinowBerill,\r\n NpcType.SinowSpigell,\r\n NpcType.Merillia,\r\n NpcType.Meriltas,\r\n NpcType.Mericarol,\r\n NpcType.Mericus,\r\n NpcType.Merikle,\r\n NpcType.UlGibbon,\r\n NpcType.ZolGibbon,\r\n NpcType.Gibbles,\r\n NpcType.Gee,\r\n NpcType.GiGue,\r\n NpcType.IllGill,\r\n NpcType.DelLily,\r\n NpcType.Epsilon,\r\n NpcType.GalGryphon,\r\n\r\n // Episode II Seabed\r\n\r\n NpcType.Deldepth,\r\n NpcType.Delbiter,\r\n NpcType.Dolmolm,\r\n NpcType.Dolmdarl,\r\n NpcType.Morfos,\r\n NpcType.Recobox,\r\n NpcType.Recon,\r\n NpcType.SinowZoa,\r\n NpcType.SinowZele,\r\n NpcType.OlgaFlow,\r\n\r\n // Episode IV\r\n\r\n NpcType.SandRappy,\r\n NpcType.DelRappy,\r\n NpcType.Astark,\r\n NpcType.SatelliteLizard,\r\n NpcType.Yowie,\r\n NpcType.MerissaA,\r\n NpcType.MerissaAA,\r\n NpcType.Girtablulu,\r\n NpcType.Zu,\r\n NpcType.Pazuzu,\r\n NpcType.Boota,\r\n NpcType.ZeBoota,\r\n NpcType.BaBoota,\r\n NpcType.Dorphon,\r\n NpcType.DorphonEclair,\r\n NpcType.Goran,\r\n NpcType.PyroGoran,\r\n NpcType.GoranDetonator,\r\n NpcType.SaintMilion,\r\n NpcType.Shambertin,\r\n NpcType.Kondrieu,\r\n];\r\n\r\nexport const EnemyNpcTypes = NpcTypes.filter(type => type.enemy);\r\n","export class ObjectType {\r\n id: number;\r\n pso_id?: number;\r\n name: string;\r\n\r\n constructor(id: number, pso_id: number | undefined, name: string) {\r\n if (!Number.isInteger(id) || id < 1)\r\n throw new Error(`Expected id to be an integer greater than or equal to 1, got ${id}.`);\r\n if (pso_id != null && (!Number.isInteger(pso_id) || pso_id < 0))\r\n throw new Error(\r\n `Expected pso_id to be null or an integer greater than or equal to 0, got ${pso_id}.`\r\n );\r\n if (!name) throw new Error(\"name is required.\");\r\n\r\n this.id = id;\r\n this.pso_id = pso_id;\r\n this.name = name;\r\n }\r\n\r\n static Unknown: ObjectType;\r\n static PlayerSet: ObjectType;\r\n static Particle: ObjectType;\r\n static Teleporter: ObjectType;\r\n static Warp: ObjectType;\r\n static LightCollision: ObjectType;\r\n static Item: ObjectType;\r\n static EnvSound: ObjectType;\r\n static FogCollision: ObjectType;\r\n static EventCollision: ObjectType;\r\n static CharaCollision: ObjectType;\r\n static ElementalTrap: ObjectType;\r\n static StatusTrap: ObjectType;\r\n static HealTrap: ObjectType;\r\n static LargeElementalTrap: ObjectType;\r\n static ObjRoomID: ObjectType;\r\n static Sensor: ObjectType;\r\n static UnknownItem16: ObjectType;\r\n static Lensflare: ObjectType;\r\n static ScriptCollision: ObjectType;\r\n static HealRing: ObjectType;\r\n static MapCollision: ObjectType;\r\n static ScriptCollisionA: ObjectType;\r\n static ItemLight: ObjectType;\r\n static RadarCollision: ObjectType;\r\n static FogCollisionSW: ObjectType;\r\n static BossTeleporter: ObjectType;\r\n static ImageBoard: ObjectType;\r\n static QuestWarp: ObjectType;\r\n static Epilogue: ObjectType;\r\n static UnknownItem29: ObjectType;\r\n static UnknownItem30: ObjectType;\r\n static UnknownItem31: ObjectType;\r\n static BoxDetectObject: ObjectType;\r\n static SymbolChatObject: ObjectType;\r\n static TouchPlateObject: ObjectType;\r\n static TargetableObject: ObjectType;\r\n static EffectObject: ObjectType;\r\n static CountDownObject: ObjectType;\r\n static UnknownItem38: ObjectType;\r\n static UnknownItem39: ObjectType;\r\n static UnknownItem40: ObjectType;\r\n static UnknownItem41: ObjectType;\r\n static MenuActivation: ObjectType;\r\n static TelepipeLocation: ObjectType;\r\n static BGMCollision: ObjectType;\r\n static MainRagolTeleporter: ObjectType;\r\n static LobbyTeleporter: ObjectType;\r\n static PrincipalWarp: ObjectType;\r\n static ShopDoor: ObjectType;\r\n static HuntersGuildDoor: ObjectType;\r\n static TeleporterDoor: ObjectType;\r\n static MedicalCenterDoor: ObjectType;\r\n static Elevator: ObjectType;\r\n static EasterEgg: ObjectType;\r\n static ValentinesHeart: ObjectType;\r\n static ChristmasTree: ObjectType;\r\n static ChristmasWreath: ObjectType;\r\n static HalloweenPumpkin: ObjectType;\r\n static TwentyFirstCentury: ObjectType;\r\n static Sonic: ObjectType;\r\n static WelcomeBoard: ObjectType;\r\n static Firework: ObjectType;\r\n static LobbyScreenDoor: ObjectType;\r\n static MainRagolTeleporterBattleInNextArea: ObjectType;\r\n static LabTeleporterDoor: ObjectType;\r\n static Pioneer2InvisibleTouchplate: ObjectType;\r\n static ForestDoor: ObjectType;\r\n static ForestSwitch: ObjectType;\r\n static LaserFence: ObjectType;\r\n static LaserSquareFence: ObjectType;\r\n static ForestLaserFenceSwitch: ObjectType;\r\n static LightRays: ObjectType;\r\n static BlueButterfly: ObjectType;\r\n static Probe: ObjectType;\r\n static RandomTypeBox1: ObjectType;\r\n static ForestWeatherStation: ObjectType;\r\n static Battery: ObjectType;\r\n static ForestConsole: ObjectType;\r\n static BlackSlidingDoor: ObjectType;\r\n static RicoMessagePod: ObjectType;\r\n static EnergyBarrier: ObjectType;\r\n static ForestRisingBridge: ObjectType;\r\n static SwitchNoneDoor: ObjectType;\r\n static EnemyBoxGrey: ObjectType;\r\n static FixedTypeBox: ObjectType;\r\n static EnemyBoxBrown: ObjectType;\r\n static EmptyTypeBox: ObjectType;\r\n static LaserFenseEx: ObjectType;\r\n static LaserSquareFenceEx: ObjectType;\r\n static FloorPanel1: ObjectType;\r\n static Caves4ButtonDoor: ObjectType;\r\n static CavesNormalDoor: ObjectType;\r\n static CavesSmashingPillar: ObjectType;\r\n static CavesSign1: ObjectType;\r\n static CavesSign2: ObjectType;\r\n static CavesSign3: ObjectType;\r\n static HexagalTank: ObjectType;\r\n static BrownPlatform: ObjectType;\r\n static WarningLightObject: ObjectType;\r\n static Rainbow: ObjectType;\r\n static FloatingJelifish: ObjectType;\r\n static FloatingDragonfly: ObjectType;\r\n static CavesSwitchDoor: ObjectType;\r\n static RobotRechargeStation: ObjectType;\r\n static CavesCakeShop: ObjectType;\r\n static Caves1SmallRedRock: ObjectType;\r\n static Caves1MediumRedRock: ObjectType;\r\n static Caves1LargeRedRock: ObjectType;\r\n static Caves2SmallRock1: ObjectType;\r\n static Caves2MediumRock1: ObjectType;\r\n static Caves2LargeRock1: ObjectType;\r\n static Caves2SmallRock2: ObjectType;\r\n static Caves2MediumRock2: ObjectType;\r\n static Caves2LargeRock2: ObjectType;\r\n static Caves3SmallRock: ObjectType;\r\n static Caves3MediumRock: ObjectType;\r\n static Caves3LargeRock: ObjectType;\r\n static FloorPanel2: ObjectType;\r\n static DestructableRockCaves1: ObjectType;\r\n static DestructableRockCaves2: ObjectType;\r\n static DestructableRockCaves3: ObjectType;\r\n static MinesDoor: ObjectType;\r\n static FloorPanel3: ObjectType;\r\n static MinesSwitchDoor: ObjectType;\r\n static LargeCryoTube: ObjectType;\r\n static ComputerLikeCalus: ObjectType;\r\n static GreenScreenOpeningAndClosing: ObjectType;\r\n static FloatingRobot: ObjectType;\r\n static FloatingBlueLight: ObjectType;\r\n static SelfDestructingObject1: ObjectType;\r\n static SelfDestructingObject2: ObjectType;\r\n static SelfDestructingObject3: ObjectType;\r\n static SparkMachine: ObjectType;\r\n static MinesLargeFlashingCrate: ObjectType;\r\n static RuinsSeal: ObjectType;\r\n static RuinsTeleporter: ObjectType;\r\n static RuinsWarpSiteToSite: ObjectType;\r\n static RuinsSwitch: ObjectType;\r\n static FloorPanel4: ObjectType;\r\n static Ruins1Door: ObjectType;\r\n static Ruins3Door: ObjectType;\r\n static Ruins2Door: ObjectType;\r\n static Ruins11ButtonDoor: ObjectType;\r\n static Ruins21ButtonDoor: ObjectType;\r\n static Ruins31ButtonDoor: ObjectType;\r\n static Ruins4ButtonDoor: ObjectType;\r\n static Ruins2ButtonDoor: ObjectType;\r\n static RuinsSensor: ObjectType;\r\n static RuinsFenceSwitch: ObjectType;\r\n static RuinsLaserFence4x2: ObjectType;\r\n static RuinsLaserFence6x2: ObjectType;\r\n static RuinsLaserFence4x4: ObjectType;\r\n static RuinsLaserFence6x4: ObjectType;\r\n static RuinsPoisonBlob: ObjectType;\r\n static RuinsPilarTrap: ObjectType;\r\n static PopupTrapNoTech: ObjectType;\r\n static RuinsCrystal: ObjectType;\r\n static Monument: ObjectType;\r\n static RuinsRock1: ObjectType;\r\n static RuinsRock2: ObjectType;\r\n static RuinsRock3: ObjectType;\r\n static RuinsRock4: ObjectType;\r\n static RuinsRock5: ObjectType;\r\n static RuinsRock6: ObjectType;\r\n static RuinsRock7: ObjectType;\r\n static Poison: ObjectType;\r\n static FixedBoxTypeRuins: ObjectType;\r\n static RandomBoxTypeRuins: ObjectType;\r\n static EnemyTypeBoxYellow: ObjectType;\r\n static EnemyTypeBoxBlue: ObjectType;\r\n static EmptyTypeBoxBlue: ObjectType;\r\n static DestructableRock: ObjectType;\r\n static PopupTrapsTechs: ObjectType;\r\n static FlyingWhiteBird: ObjectType;\r\n static Tower: ObjectType;\r\n static FloatingRocks: ObjectType;\r\n static FloatingSoul: ObjectType;\r\n static Butterfly: ObjectType;\r\n static LobbyGameMenu: ObjectType;\r\n static LobbyWarpObject: ObjectType;\r\n static Lobby1EventObjectDefaultTree: ObjectType;\r\n static UnknownItem387: ObjectType;\r\n static UnknownItem388: ObjectType;\r\n static UnknownItem389: ObjectType;\r\n static LobbyEventObjectStaticPumpkin: ObjectType;\r\n static LobbyEventObject3ChristmasWindows: ObjectType;\r\n static LobbyEventObjectRedAndWhiteCurtain: ObjectType;\r\n static UnknownItem393: ObjectType;\r\n static UnknownItem394: ObjectType;\r\n static LobbyFishTank: ObjectType;\r\n static LobbyEventObjectButterflies: ObjectType;\r\n static UnknownItem400: ObjectType;\r\n static GreyWallLow: ObjectType;\r\n static SpaceshipDoor: ObjectType;\r\n static GreyWallHigh: ObjectType;\r\n static TempleNormalDoor: ObjectType;\r\n static BreakableWallWallButUnbreakable: ObjectType;\r\n static BrokenCilinderAndRubble: ObjectType;\r\n static ThreeBrokenWallPiecesOnFloor: ObjectType;\r\n static HighBrickCilinder: ObjectType;\r\n static LyingCilinder: ObjectType;\r\n static BrickConeWithFlatTop: ObjectType;\r\n static BreakableTempleWall: ObjectType;\r\n static TempleMapDetect: ObjectType;\r\n static SmallBrownBrickRisingBridge: ObjectType;\r\n static LongRisingBridgeWithPinkHighEdges: ObjectType;\r\n static FourSwitchTempleDoor: ObjectType;\r\n static FourButtonSpaceshipDoor: ObjectType;\r\n static ItemBoxCca: ObjectType;\r\n static TeleporterEp2: ObjectType;\r\n static CCADoor: ObjectType;\r\n static SpecialBoxCCA: ObjectType;\r\n static BigCCADoor: ObjectType;\r\n static BigCCADoorSwitch: ObjectType;\r\n static LittleRock: ObjectType;\r\n static Little3StoneWall: ObjectType;\r\n static Medium3StoneWall: ObjectType;\r\n static SpiderPlant: ObjectType;\r\n static CCAAreaTeleporter: ObjectType;\r\n static UnknownItem523: ObjectType;\r\n static WhiteBird: ObjectType;\r\n static OrangeBird: ObjectType;\r\n static Saw: ObjectType;\r\n static LaserDetect: ObjectType;\r\n static UnknownItem529: ObjectType;\r\n static UnknownItem530: ObjectType;\r\n static Seagull: ObjectType;\r\n static Fish: ObjectType;\r\n static SeabedDoorWithBlueEdges: ObjectType;\r\n static SeabedDoorAlwaysOpenNonTriggerable: ObjectType;\r\n static LittleCryotube: ObjectType;\r\n static WideGlassWallBreakable: ObjectType;\r\n static BlueFloatingRobot: ObjectType;\r\n static RedFloatingRobot: ObjectType;\r\n static Dolphin: ObjectType;\r\n static CaptureTrap: ObjectType;\r\n static VRLink: ObjectType;\r\n static UnknownItem576: ObjectType;\r\n static WarpInBarbaRayRoom: ObjectType;\r\n static UnknownItem672: ObjectType;\r\n static GeeNest: ObjectType;\r\n static LabComputerConsole: ObjectType;\r\n static LabComputerConsoleGreenScreen: ObjectType;\r\n static ChairYelllowPillow: ObjectType;\r\n static OrangeWallWithHoleInMiddle: ObjectType;\r\n static GreyWallWithHoleInMiddle: ObjectType;\r\n static LongTable: ObjectType;\r\n static GBAStation: ObjectType;\r\n static TalkLinkToSupport: ObjectType;\r\n static InstaWarp: ObjectType;\r\n static LabInvisibleObject: ObjectType;\r\n static LabGlassWindowDoor: ObjectType;\r\n static UnknownItem700: ObjectType;\r\n static LabCelingWarp: ObjectType;\r\n static Ep4LightSource: ObjectType;\r\n static Cacti: ObjectType;\r\n static BigBrownRock: ObjectType;\r\n static BreakableBrownRock: ObjectType;\r\n static UnknownItem832: ObjectType;\r\n static UnknownItem833: ObjectType;\r\n static PoisonPlant: ObjectType;\r\n static UnknownItem897: ObjectType;\r\n static UnknownItem898: ObjectType;\r\n static OozingDesertPlant: ObjectType;\r\n static UnknownItem901: ObjectType;\r\n static BigBlackRocks: ObjectType;\r\n static UnknownItem903: ObjectType;\r\n static UnknownItem904: ObjectType;\r\n static UnknownItem905: ObjectType;\r\n static UnknownItem906: ObjectType;\r\n static FallingRock: ObjectType;\r\n static DesertPlantHasCollision: ObjectType;\r\n static DesertFixedTypeBoxBreakableCrystals: ObjectType;\r\n static UnknownItem910: ObjectType;\r\n static BeeHive: ObjectType;\r\n static UnknownItem912: ObjectType;\r\n static Heat: ObjectType;\r\n static TopOfSaintMillionEgg: ObjectType;\r\n static UnknownItem961: ObjectType;\r\n\r\n static from_pso_id(psoId: number): ObjectType {\r\n switch (psoId) {\r\n default:\r\n return ObjectType.Unknown;\r\n\r\n case 0:\r\n return ObjectType.PlayerSet;\r\n case 1:\r\n return ObjectType.Particle;\r\n case 2:\r\n return ObjectType.Teleporter;\r\n case 3:\r\n return ObjectType.Warp;\r\n case 4:\r\n return ObjectType.LightCollision;\r\n case 5:\r\n return ObjectType.Item;\r\n case 6:\r\n return ObjectType.EnvSound;\r\n case 7:\r\n return ObjectType.FogCollision;\r\n case 8:\r\n return ObjectType.EventCollision;\r\n case 9:\r\n return ObjectType.CharaCollision;\r\n case 10:\r\n return ObjectType.ElementalTrap;\r\n case 11:\r\n return ObjectType.StatusTrap;\r\n case 12:\r\n return ObjectType.HealTrap;\r\n case 13:\r\n return ObjectType.LargeElementalTrap;\r\n case 14:\r\n return ObjectType.ObjRoomID;\r\n case 15:\r\n return ObjectType.Sensor;\r\n case 16:\r\n return ObjectType.UnknownItem16;\r\n case 17:\r\n return ObjectType.Lensflare;\r\n case 18:\r\n return ObjectType.ScriptCollision;\r\n case 19:\r\n return ObjectType.HealRing;\r\n case 20:\r\n return ObjectType.MapCollision;\r\n case 21:\r\n return ObjectType.ScriptCollisionA;\r\n case 22:\r\n return ObjectType.ItemLight;\r\n case 23:\r\n return ObjectType.RadarCollision;\r\n case 24:\r\n return ObjectType.FogCollisionSW;\r\n case 25:\r\n return ObjectType.BossTeleporter;\r\n case 26:\r\n return ObjectType.ImageBoard;\r\n case 27:\r\n return ObjectType.QuestWarp;\r\n case 28:\r\n return ObjectType.Epilogue;\r\n case 29:\r\n return ObjectType.UnknownItem29;\r\n case 30:\r\n return ObjectType.UnknownItem30;\r\n case 31:\r\n return ObjectType.UnknownItem31;\r\n case 32:\r\n return ObjectType.BoxDetectObject;\r\n case 33:\r\n return ObjectType.SymbolChatObject;\r\n case 34:\r\n return ObjectType.TouchPlateObject;\r\n case 35:\r\n return ObjectType.TargetableObject;\r\n case 36:\r\n return ObjectType.EffectObject;\r\n case 37:\r\n return ObjectType.CountDownObject;\r\n case 38:\r\n return ObjectType.UnknownItem38;\r\n case 39:\r\n return ObjectType.UnknownItem39;\r\n case 40:\r\n return ObjectType.UnknownItem40;\r\n case 41:\r\n return ObjectType.UnknownItem41;\r\n case 64:\r\n return ObjectType.MenuActivation;\r\n case 65:\r\n return ObjectType.TelepipeLocation;\r\n case 66:\r\n return ObjectType.BGMCollision;\r\n case 67:\r\n return ObjectType.MainRagolTeleporter;\r\n case 68:\r\n return ObjectType.LobbyTeleporter;\r\n case 69:\r\n return ObjectType.PrincipalWarp;\r\n case 70:\r\n return ObjectType.ShopDoor;\r\n case 71:\r\n return ObjectType.HuntersGuildDoor;\r\n case 72:\r\n return ObjectType.TeleporterDoor;\r\n case 73:\r\n return ObjectType.MedicalCenterDoor;\r\n case 74:\r\n return ObjectType.Elevator;\r\n case 75:\r\n return ObjectType.EasterEgg;\r\n case 76:\r\n return ObjectType.ValentinesHeart;\r\n case 77:\r\n return ObjectType.ChristmasTree;\r\n case 78:\r\n return ObjectType.ChristmasWreath;\r\n case 79:\r\n return ObjectType.HalloweenPumpkin;\r\n case 80:\r\n return ObjectType.TwentyFirstCentury;\r\n case 81:\r\n return ObjectType.Sonic;\r\n case 82:\r\n return ObjectType.WelcomeBoard;\r\n case 83:\r\n return ObjectType.Firework;\r\n case 84:\r\n return ObjectType.LobbyScreenDoor;\r\n case 85:\r\n return ObjectType.MainRagolTeleporterBattleInNextArea;\r\n case 86:\r\n return ObjectType.LabTeleporterDoor;\r\n case 87:\r\n return ObjectType.Pioneer2InvisibleTouchplate;\r\n case 128:\r\n return ObjectType.ForestDoor;\r\n case 129:\r\n return ObjectType.ForestSwitch;\r\n case 130:\r\n return ObjectType.LaserFence;\r\n case 131:\r\n return ObjectType.LaserSquareFence;\r\n case 132:\r\n return ObjectType.ForestLaserFenceSwitch;\r\n case 133:\r\n return ObjectType.LightRays;\r\n case 134:\r\n return ObjectType.BlueButterfly;\r\n case 135:\r\n return ObjectType.Probe;\r\n case 136:\r\n return ObjectType.RandomTypeBox1;\r\n case 137:\r\n return ObjectType.ForestWeatherStation;\r\n case 138:\r\n return ObjectType.Battery;\r\n case 139:\r\n return ObjectType.ForestConsole;\r\n case 140:\r\n return ObjectType.BlackSlidingDoor;\r\n case 141:\r\n return ObjectType.RicoMessagePod;\r\n case 142:\r\n return ObjectType.EnergyBarrier;\r\n case 143:\r\n return ObjectType.ForestRisingBridge;\r\n case 144:\r\n return ObjectType.SwitchNoneDoor;\r\n case 145:\r\n return ObjectType.EnemyBoxGrey;\r\n case 146:\r\n return ObjectType.FixedTypeBox;\r\n case 147:\r\n return ObjectType.EnemyBoxBrown;\r\n case 149:\r\n return ObjectType.EmptyTypeBox;\r\n case 150:\r\n return ObjectType.LaserFenseEx;\r\n case 151:\r\n return ObjectType.LaserSquareFenceEx;\r\n case 192:\r\n return ObjectType.FloorPanel1;\r\n case 193:\r\n return ObjectType.Caves4ButtonDoor;\r\n case 194:\r\n return ObjectType.CavesNormalDoor;\r\n case 195:\r\n return ObjectType.CavesSmashingPillar;\r\n case 196:\r\n return ObjectType.CavesSign1;\r\n case 197:\r\n return ObjectType.CavesSign2;\r\n case 198:\r\n return ObjectType.CavesSign3;\r\n case 199:\r\n return ObjectType.HexagalTank;\r\n case 200:\r\n return ObjectType.BrownPlatform;\r\n case 201:\r\n return ObjectType.WarningLightObject;\r\n case 203:\r\n return ObjectType.Rainbow;\r\n case 204:\r\n return ObjectType.FloatingJelifish;\r\n case 205:\r\n return ObjectType.FloatingDragonfly;\r\n case 206:\r\n return ObjectType.CavesSwitchDoor;\r\n case 207:\r\n return ObjectType.RobotRechargeStation;\r\n case 208:\r\n return ObjectType.CavesCakeShop;\r\n case 209:\r\n return ObjectType.Caves1SmallRedRock;\r\n case 210:\r\n return ObjectType.Caves1MediumRedRock;\r\n case 211:\r\n return ObjectType.Caves1LargeRedRock;\r\n case 212:\r\n return ObjectType.Caves2SmallRock1;\r\n case 213:\r\n return ObjectType.Caves2MediumRock1;\r\n case 214:\r\n return ObjectType.Caves2LargeRock1;\r\n case 215:\r\n return ObjectType.Caves2SmallRock2;\r\n case 216:\r\n return ObjectType.Caves2MediumRock2;\r\n case 217:\r\n return ObjectType.Caves2LargeRock2;\r\n case 218:\r\n return ObjectType.Caves3SmallRock;\r\n case 219:\r\n return ObjectType.Caves3MediumRock;\r\n case 220:\r\n return ObjectType.Caves3LargeRock;\r\n case 222:\r\n return ObjectType.FloorPanel2;\r\n case 223:\r\n return ObjectType.DestructableRockCaves1;\r\n case 224:\r\n return ObjectType.DestructableRockCaves2;\r\n case 225:\r\n return ObjectType.DestructableRockCaves3;\r\n case 256:\r\n return ObjectType.MinesDoor;\r\n case 257:\r\n return ObjectType.FloorPanel3;\r\n case 258:\r\n return ObjectType.MinesSwitchDoor;\r\n case 259:\r\n return ObjectType.LargeCryoTube;\r\n case 260:\r\n return ObjectType.ComputerLikeCalus;\r\n case 261:\r\n return ObjectType.GreenScreenOpeningAndClosing;\r\n case 262:\r\n return ObjectType.FloatingRobot;\r\n case 263:\r\n return ObjectType.FloatingBlueLight;\r\n case 264:\r\n return ObjectType.SelfDestructingObject1;\r\n case 265:\r\n return ObjectType.SelfDestructingObject2;\r\n case 266:\r\n return ObjectType.SelfDestructingObject3;\r\n case 267:\r\n return ObjectType.SparkMachine;\r\n case 268:\r\n return ObjectType.MinesLargeFlashingCrate;\r\n case 304:\r\n return ObjectType.RuinsSeal;\r\n case 320:\r\n return ObjectType.RuinsTeleporter;\r\n case 321:\r\n return ObjectType.RuinsWarpSiteToSite;\r\n case 322:\r\n return ObjectType.RuinsSwitch;\r\n case 323:\r\n return ObjectType.FloorPanel4;\r\n case 324:\r\n return ObjectType.Ruins1Door;\r\n case 325:\r\n return ObjectType.Ruins3Door;\r\n case 326:\r\n return ObjectType.Ruins2Door;\r\n case 327:\r\n return ObjectType.Ruins11ButtonDoor;\r\n case 328:\r\n return ObjectType.Ruins21ButtonDoor;\r\n case 329:\r\n return ObjectType.Ruins31ButtonDoor;\r\n case 330:\r\n return ObjectType.Ruins4ButtonDoor;\r\n case 331:\r\n return ObjectType.Ruins2ButtonDoor;\r\n case 332:\r\n return ObjectType.RuinsSensor;\r\n case 333:\r\n return ObjectType.RuinsFenceSwitch;\r\n case 334:\r\n return ObjectType.RuinsLaserFence4x2;\r\n case 335:\r\n return ObjectType.RuinsLaserFence6x2;\r\n case 336:\r\n return ObjectType.RuinsLaserFence4x4;\r\n case 337:\r\n return ObjectType.RuinsLaserFence6x4;\r\n case 338:\r\n return ObjectType.RuinsPoisonBlob;\r\n case 339:\r\n return ObjectType.RuinsPilarTrap;\r\n case 340:\r\n return ObjectType.PopupTrapNoTech;\r\n case 341:\r\n return ObjectType.RuinsCrystal;\r\n case 342:\r\n return ObjectType.Monument;\r\n case 345:\r\n return ObjectType.RuinsRock1;\r\n case 346:\r\n return ObjectType.RuinsRock2;\r\n case 347:\r\n return ObjectType.RuinsRock3;\r\n case 348:\r\n return ObjectType.RuinsRock4;\r\n case 349:\r\n return ObjectType.RuinsRock5;\r\n case 350:\r\n return ObjectType.RuinsRock6;\r\n case 351:\r\n return ObjectType.RuinsRock7;\r\n case 352:\r\n return ObjectType.Poison;\r\n case 353:\r\n return ObjectType.FixedBoxTypeRuins;\r\n case 354:\r\n return ObjectType.RandomBoxTypeRuins;\r\n case 355:\r\n return ObjectType.EnemyTypeBoxYellow;\r\n case 356:\r\n return ObjectType.EnemyTypeBoxBlue;\r\n case 357:\r\n return ObjectType.EmptyTypeBoxBlue;\r\n case 358:\r\n return ObjectType.DestructableRock;\r\n case 359:\r\n return ObjectType.PopupTrapsTechs;\r\n case 368:\r\n return ObjectType.FlyingWhiteBird;\r\n case 369:\r\n return ObjectType.Tower;\r\n case 370:\r\n return ObjectType.FloatingRocks;\r\n case 371:\r\n return ObjectType.FloatingSoul;\r\n case 372:\r\n return ObjectType.Butterfly;\r\n case 384:\r\n return ObjectType.LobbyGameMenu;\r\n case 385:\r\n return ObjectType.LobbyWarpObject;\r\n case 386:\r\n return ObjectType.Lobby1EventObjectDefaultTree;\r\n case 387:\r\n return ObjectType.UnknownItem387;\r\n case 388:\r\n return ObjectType.UnknownItem388;\r\n case 389:\r\n return ObjectType.UnknownItem389;\r\n case 390:\r\n return ObjectType.LobbyEventObjectStaticPumpkin;\r\n case 391:\r\n return ObjectType.LobbyEventObject3ChristmasWindows;\r\n case 392:\r\n return ObjectType.LobbyEventObjectRedAndWhiteCurtain;\r\n case 393:\r\n return ObjectType.UnknownItem393;\r\n case 394:\r\n return ObjectType.UnknownItem394;\r\n case 395:\r\n return ObjectType.LobbyFishTank;\r\n case 396:\r\n return ObjectType.LobbyEventObjectButterflies;\r\n case 400:\r\n return ObjectType.UnknownItem400;\r\n case 401:\r\n return ObjectType.GreyWallLow;\r\n case 402:\r\n return ObjectType.SpaceshipDoor;\r\n case 403:\r\n return ObjectType.GreyWallHigh;\r\n case 416:\r\n return ObjectType.TempleNormalDoor;\r\n case 417:\r\n return ObjectType.BreakableWallWallButUnbreakable;\r\n case 418:\r\n return ObjectType.BrokenCilinderAndRubble;\r\n case 419:\r\n return ObjectType.ThreeBrokenWallPiecesOnFloor;\r\n case 420:\r\n return ObjectType.HighBrickCilinder;\r\n case 421:\r\n return ObjectType.LyingCilinder;\r\n case 422:\r\n return ObjectType.BrickConeWithFlatTop;\r\n case 423:\r\n return ObjectType.BreakableTempleWall;\r\n case 424:\r\n return ObjectType.TempleMapDetect;\r\n case 425:\r\n return ObjectType.SmallBrownBrickRisingBridge;\r\n case 426:\r\n return ObjectType.LongRisingBridgeWithPinkHighEdges;\r\n case 427:\r\n return ObjectType.FourSwitchTempleDoor;\r\n case 448:\r\n return ObjectType.FourButtonSpaceshipDoor;\r\n case 512:\r\n return ObjectType.ItemBoxCca;\r\n case 513:\r\n return ObjectType.TeleporterEp2;\r\n case 514:\r\n return ObjectType.CCADoor;\r\n case 515:\r\n return ObjectType.SpecialBoxCCA;\r\n case 516:\r\n return ObjectType.BigCCADoor;\r\n case 517:\r\n return ObjectType.BigCCADoorSwitch;\r\n case 518:\r\n return ObjectType.LittleRock;\r\n case 519:\r\n return ObjectType.Little3StoneWall;\r\n case 520:\r\n return ObjectType.Medium3StoneWall;\r\n case 521:\r\n return ObjectType.SpiderPlant;\r\n case 522:\r\n return ObjectType.CCAAreaTeleporter;\r\n case 523:\r\n return ObjectType.UnknownItem523;\r\n case 524:\r\n return ObjectType.WhiteBird;\r\n case 525:\r\n return ObjectType.OrangeBird;\r\n case 527:\r\n return ObjectType.Saw;\r\n case 528:\r\n return ObjectType.LaserDetect;\r\n case 529:\r\n return ObjectType.UnknownItem529;\r\n case 530:\r\n return ObjectType.UnknownItem530;\r\n case 531:\r\n return ObjectType.Seagull;\r\n case 544:\r\n return ObjectType.Fish;\r\n case 545:\r\n return ObjectType.SeabedDoorWithBlueEdges;\r\n case 546:\r\n return ObjectType.SeabedDoorAlwaysOpenNonTriggerable;\r\n case 547:\r\n return ObjectType.LittleCryotube;\r\n case 548:\r\n return ObjectType.WideGlassWallBreakable;\r\n case 549:\r\n return ObjectType.BlueFloatingRobot;\r\n case 550:\r\n return ObjectType.RedFloatingRobot;\r\n case 551:\r\n return ObjectType.Dolphin;\r\n case 552:\r\n return ObjectType.CaptureTrap;\r\n case 553:\r\n return ObjectType.VRLink;\r\n case 576:\r\n return ObjectType.UnknownItem576;\r\n case 640:\r\n return ObjectType.WarpInBarbaRayRoom;\r\n case 672:\r\n return ObjectType.UnknownItem672;\r\n case 688:\r\n return ObjectType.GeeNest;\r\n case 689:\r\n return ObjectType.LabComputerConsole;\r\n case 690:\r\n return ObjectType.LabComputerConsoleGreenScreen;\r\n case 691:\r\n return ObjectType.ChairYelllowPillow;\r\n case 692:\r\n return ObjectType.OrangeWallWithHoleInMiddle;\r\n case 693:\r\n return ObjectType.GreyWallWithHoleInMiddle;\r\n case 694:\r\n return ObjectType.LongTable;\r\n case 695:\r\n return ObjectType.GBAStation;\r\n case 696:\r\n return ObjectType.TalkLinkToSupport;\r\n case 697:\r\n return ObjectType.InstaWarp;\r\n case 698:\r\n return ObjectType.LabInvisibleObject;\r\n case 699:\r\n return ObjectType.LabGlassWindowDoor;\r\n case 700:\r\n return ObjectType.UnknownItem700;\r\n case 701:\r\n return ObjectType.LabCelingWarp;\r\n case 768:\r\n return ObjectType.Ep4LightSource;\r\n case 769:\r\n return ObjectType.Cacti;\r\n case 770:\r\n return ObjectType.BigBrownRock;\r\n case 771:\r\n return ObjectType.BreakableBrownRock;\r\n case 832:\r\n return ObjectType.UnknownItem832;\r\n case 833:\r\n return ObjectType.UnknownItem833;\r\n case 896:\r\n return ObjectType.PoisonPlant;\r\n case 897:\r\n return ObjectType.UnknownItem897;\r\n case 898:\r\n return ObjectType.UnknownItem898;\r\n case 899:\r\n return ObjectType.OozingDesertPlant;\r\n case 901:\r\n return ObjectType.UnknownItem901;\r\n case 902:\r\n return ObjectType.BigBlackRocks;\r\n case 903:\r\n return ObjectType.UnknownItem903;\r\n case 904:\r\n return ObjectType.UnknownItem904;\r\n case 905:\r\n return ObjectType.UnknownItem905;\r\n case 906:\r\n return ObjectType.UnknownItem906;\r\n case 907:\r\n return ObjectType.FallingRock;\r\n case 908:\r\n return ObjectType.DesertPlantHasCollision;\r\n case 909:\r\n return ObjectType.DesertFixedTypeBoxBreakableCrystals;\r\n case 910:\r\n return ObjectType.UnknownItem910;\r\n case 911:\r\n return ObjectType.BeeHive;\r\n case 912:\r\n return ObjectType.UnknownItem912;\r\n case 913:\r\n return ObjectType.Heat;\r\n case 960:\r\n return ObjectType.TopOfSaintMillionEgg;\r\n case 961:\r\n return ObjectType.UnknownItem961;\r\n }\r\n }\r\n}\r\n\r\n(function() {\r\n let id = 1;\r\n\r\n ObjectType.Unknown = new ObjectType(id++, undefined, \"Unknown\");\r\n\r\n ObjectType.PlayerSet = new ObjectType(id++, 0, \"Player Set\");\r\n ObjectType.Particle = new ObjectType(id++, 1, \"Particle\");\r\n ObjectType.Teleporter = new ObjectType(id++, 2, \"Teleporter\");\r\n ObjectType.Warp = new ObjectType(id++, 3, \"Warp\");\r\n ObjectType.LightCollision = new ObjectType(id++, 4, \"Light Collision\");\r\n ObjectType.Item = new ObjectType(id++, 5, \"Item\");\r\n ObjectType.EnvSound = new ObjectType(id++, 6, \"Env Sound\");\r\n ObjectType.FogCollision = new ObjectType(id++, 7, \"Fog Collision\");\r\n ObjectType.EventCollision = new ObjectType(id++, 8, \"Event Collision\");\r\n ObjectType.CharaCollision = new ObjectType(id++, 9, \"Chara Collision\");\r\n ObjectType.ElementalTrap = new ObjectType(id++, 10, \"Elemental Trap\");\r\n ObjectType.StatusTrap = new ObjectType(id++, 11, \"Status Trap\");\r\n ObjectType.HealTrap = new ObjectType(id++, 12, \"Heal Trap\");\r\n ObjectType.LargeElementalTrap = new ObjectType(id++, 13, \"Large Elemental Trap\");\r\n ObjectType.ObjRoomID = new ObjectType(id++, 14, \"Obj Room ID\");\r\n ObjectType.Sensor = new ObjectType(id++, 15, \"Sensor\");\r\n ObjectType.UnknownItem16 = new ObjectType(id++, 16, \"Unknown Item (16)\");\r\n ObjectType.Lensflare = new ObjectType(id++, 17, \"Lensflare\");\r\n ObjectType.ScriptCollision = new ObjectType(id++, 18, \"Script Collision\");\r\n ObjectType.HealRing = new ObjectType(id++, 19, \"Heal Ring\");\r\n ObjectType.MapCollision = new ObjectType(id++, 20, \"Map Collision\");\r\n ObjectType.ScriptCollisionA = new ObjectType(id++, 21, \"Script Collision A\");\r\n ObjectType.ItemLight = new ObjectType(id++, 22, \"Item Light\");\r\n ObjectType.RadarCollision = new ObjectType(id++, 23, \"Radar Collision\");\r\n ObjectType.FogCollisionSW = new ObjectType(id++, 24, \"Fog Collision SW\");\r\n ObjectType.BossTeleporter = new ObjectType(id++, 25, \"Boss Teleporter\");\r\n ObjectType.ImageBoard = new ObjectType(id++, 26, \"Image Board\");\r\n ObjectType.QuestWarp = new ObjectType(id++, 27, \"Quest Warp\");\r\n ObjectType.Epilogue = new ObjectType(id++, 28, \"Epilogue\");\r\n ObjectType.UnknownItem29 = new ObjectType(id++, 29, \"Unknown Item (29)\");\r\n ObjectType.UnknownItem30 = new ObjectType(id++, 30, \"Unknown Item (30)\");\r\n ObjectType.UnknownItem31 = new ObjectType(id++, 31, \"Unknown Item (31)\");\r\n ObjectType.BoxDetectObject = new ObjectType(id++, 32, \"Box Detect Object\");\r\n ObjectType.SymbolChatObject = new ObjectType(id++, 33, \"Symbol Chat Object\");\r\n ObjectType.TouchPlateObject = new ObjectType(id++, 34, \"Touch plate Object\");\r\n ObjectType.TargetableObject = new ObjectType(id++, 35, \"Targetable Object\");\r\n ObjectType.EffectObject = new ObjectType(id++, 36, \"Effect object\");\r\n ObjectType.CountDownObject = new ObjectType(id++, 37, \"Count Down Object\");\r\n ObjectType.UnknownItem38 = new ObjectType(id++, 38, \"Unknown Item (38)\");\r\n ObjectType.UnknownItem39 = new ObjectType(id++, 39, \"Unknown Item (39)\");\r\n ObjectType.UnknownItem40 = new ObjectType(id++, 40, \"Unknown Item (40)\");\r\n ObjectType.UnknownItem41 = new ObjectType(id++, 41, \"Unknown Item (41)\");\r\n ObjectType.MenuActivation = new ObjectType(id++, 64, \"Menu activation\");\r\n ObjectType.TelepipeLocation = new ObjectType(id++, 65, \"Telepipe Location\");\r\n ObjectType.BGMCollision = new ObjectType(id++, 66, \"BGM Collision\");\r\n ObjectType.MainRagolTeleporter = new ObjectType(id++, 67, \"Main Ragol Teleporter\");\r\n ObjectType.LobbyTeleporter = new ObjectType(id++, 68, \"Lobby Teleporter\");\r\n ObjectType.PrincipalWarp = new ObjectType(id++, 69, \"Principal warp\");\r\n ObjectType.ShopDoor = new ObjectType(id++, 70, \"Shop Door\");\r\n ObjectType.HuntersGuildDoor = new ObjectType(id++, 71, \"Hunter's Guild Door\");\r\n ObjectType.TeleporterDoor = new ObjectType(id++, 72, \"Teleporter Door\");\r\n ObjectType.MedicalCenterDoor = new ObjectType(id++, 73, \"Medical Center Door\");\r\n ObjectType.Elevator = new ObjectType(id++, 74, \"Elevator\");\r\n ObjectType.EasterEgg = new ObjectType(id++, 75, \"Easter Egg\");\r\n ObjectType.ValentinesHeart = new ObjectType(id++, 76, \"Valentines Heart\");\r\n ObjectType.ChristmasTree = new ObjectType(id++, 77, \"Christmas Tree\");\r\n ObjectType.ChristmasWreath = new ObjectType(id++, 78, \"Christmas Wreath\");\r\n ObjectType.HalloweenPumpkin = new ObjectType(id++, 79, \"Halloween Pumpkin\");\r\n ObjectType.TwentyFirstCentury = new ObjectType(id++, 80, \"21st Century\");\r\n ObjectType.Sonic = new ObjectType(id++, 81, \"Sonic\");\r\n ObjectType.WelcomeBoard = new ObjectType(id++, 82, \"Welcome Board\");\r\n ObjectType.Firework = new ObjectType(id++, 83, \"Firework\");\r\n ObjectType.LobbyScreenDoor = new ObjectType(id++, 84, \"Lobby Screen Door\");\r\n ObjectType.MainRagolTeleporterBattleInNextArea = new ObjectType(\r\n id++,\r\n 85,\r\n \"Main Ragol Teleporter (Battle in next area?)\"\r\n );\r\n ObjectType.LabTeleporterDoor = new ObjectType(id++, 86, \"Lab Teleporter Door\");\r\n ObjectType.Pioneer2InvisibleTouchplate = new ObjectType(\r\n id++,\r\n 87,\r\n \"Pioneer 2 Invisible Touchplate\"\r\n );\r\n ObjectType.ForestDoor = new ObjectType(id++, 128, \"Forest Door\");\r\n ObjectType.ForestSwitch = new ObjectType(id++, 129, \"Forest Switch\");\r\n ObjectType.LaserFence = new ObjectType(id++, 130, \"Laser Fence\");\r\n ObjectType.LaserSquareFence = new ObjectType(id++, 131, \"Laser Square Fence\");\r\n ObjectType.ForestLaserFenceSwitch = new ObjectType(id++, 132, \"Forest Laser Fence Switch\");\r\n ObjectType.LightRays = new ObjectType(id++, 133, \"Light rays\");\r\n ObjectType.BlueButterfly = new ObjectType(id++, 134, \"Blue Butterfly\");\r\n ObjectType.Probe = new ObjectType(id++, 135, \"Probe\");\r\n ObjectType.RandomTypeBox1 = new ObjectType(id++, 136, \"Random Type Box 1\");\r\n ObjectType.ForestWeatherStation = new ObjectType(id++, 137, \"Forest Weather Station\");\r\n ObjectType.Battery = new ObjectType(id++, 138, \"Battery\");\r\n ObjectType.ForestConsole = new ObjectType(id++, 139, \"Forest Console\");\r\n ObjectType.BlackSlidingDoor = new ObjectType(id++, 140, \"Black Sliding Door\");\r\n ObjectType.RicoMessagePod = new ObjectType(id++, 141, \"Rico Message Pod\");\r\n ObjectType.EnergyBarrier = new ObjectType(id++, 142, \"Energy Barrier\");\r\n ObjectType.ForestRisingBridge = new ObjectType(id++, 143, \"Forest Rising Bridge\");\r\n ObjectType.SwitchNoneDoor = new ObjectType(id++, 144, \"Switch (none door)\");\r\n ObjectType.EnemyBoxGrey = new ObjectType(id++, 145, \"Enemy Box (Grey)\");\r\n ObjectType.FixedTypeBox = new ObjectType(id++, 146, \"Fixed Type Box\");\r\n ObjectType.EnemyBoxBrown = new ObjectType(id++, 147, \"Enemy Box (Brown)\");\r\n ObjectType.EmptyTypeBox = new ObjectType(id++, 149, \"Empty Type Box\");\r\n ObjectType.LaserFenseEx = new ObjectType(id++, 150, \"Laser Fense Ex\");\r\n ObjectType.LaserSquareFenceEx = new ObjectType(id++, 151, \"Laser Square Fence Ex\");\r\n ObjectType.FloorPanel1 = new ObjectType(id++, 192, \"Floor Panel 1\");\r\n ObjectType.Caves4ButtonDoor = new ObjectType(id++, 193, \"Caves 4 Button door\");\r\n ObjectType.CavesNormalDoor = new ObjectType(id++, 194, \"Caves Normal door\");\r\n ObjectType.CavesSmashingPillar = new ObjectType(id++, 195, \"Caves Smashing Pillar\");\r\n ObjectType.CavesSign1 = new ObjectType(id++, 196, \"Caves Sign 1\");\r\n ObjectType.CavesSign2 = new ObjectType(id++, 197, \"Caves Sign 2\");\r\n ObjectType.CavesSign3 = new ObjectType(id++, 198, \"Caves Sign 3\");\r\n ObjectType.HexagalTank = new ObjectType(id++, 199, \"Hexagal Tank\");\r\n ObjectType.BrownPlatform = new ObjectType(id++, 200, \"Brown Platform\");\r\n ObjectType.WarningLightObject = new ObjectType(id++, 201, \"Warning Light Object\");\r\n ObjectType.Rainbow = new ObjectType(id++, 203, \"Rainbow\");\r\n ObjectType.FloatingJelifish = new ObjectType(id++, 204, \"Floating Jelifish\");\r\n ObjectType.FloatingDragonfly = new ObjectType(id++, 205, \"Floating Dragonfly\");\r\n ObjectType.CavesSwitchDoor = new ObjectType(id++, 206, \"Caves Switch Door\");\r\n ObjectType.RobotRechargeStation = new ObjectType(id++, 207, \"Robot Recharge Station\");\r\n ObjectType.CavesCakeShop = new ObjectType(id++, 208, \"Caves Cake Shop\");\r\n ObjectType.Caves1SmallRedRock = new ObjectType(id++, 209, \"Caves 1 Small Red Rock\");\r\n ObjectType.Caves1MediumRedRock = new ObjectType(id++, 210, \"Caves 1 Medium Red Rock\");\r\n ObjectType.Caves1LargeRedRock = new ObjectType(id++, 211, \"Caves 1 Large Red Rock\");\r\n ObjectType.Caves2SmallRock1 = new ObjectType(id++, 212, \"Caves 2 Small Rock 1\");\r\n ObjectType.Caves2MediumRock1 = new ObjectType(id++, 213, \"Caves 2 Medium Rock 1\");\r\n ObjectType.Caves2LargeRock1 = new ObjectType(id++, 214, \"Caves 2 Large Rock 1\");\r\n ObjectType.Caves2SmallRock2 = new ObjectType(id++, 215, \"Caves 2 Small Rock 2\");\r\n ObjectType.Caves2MediumRock2 = new ObjectType(id++, 216, \"Caves 2 Medium Rock 2\");\r\n ObjectType.Caves2LargeRock2 = new ObjectType(id++, 217, \"Caves 2 Large Rock 2\");\r\n ObjectType.Caves3SmallRock = new ObjectType(id++, 218, \"Caves 3 Small Rock\");\r\n ObjectType.Caves3MediumRock = new ObjectType(id++, 219, \"Caves 3 Medium Rock\");\r\n ObjectType.Caves3LargeRock = new ObjectType(id++, 220, \"Caves 3 Large Rock\");\r\n ObjectType.FloorPanel2 = new ObjectType(id++, 222, \"Floor Panel 2\");\r\n ObjectType.DestructableRockCaves1 = new ObjectType(id++, 223, \"Destructable Rock (Caves 1)\");\r\n ObjectType.DestructableRockCaves2 = new ObjectType(id++, 224, \"Destructable Rock (Caves 2)\");\r\n ObjectType.DestructableRockCaves3 = new ObjectType(id++, 225, \"Destructable Rock (Caves 3)\");\r\n ObjectType.MinesDoor = new ObjectType(id++, 256, \"Mines Door\");\r\n ObjectType.FloorPanel3 = new ObjectType(id++, 257, \"Floor Panel 3\");\r\n ObjectType.MinesSwitchDoor = new ObjectType(id++, 258, \"Mines Switch Door\");\r\n ObjectType.LargeCryoTube = new ObjectType(id++, 259, \"Large Cryo-Tube\");\r\n ObjectType.ComputerLikeCalus = new ObjectType(id++, 260, \"Computer (like calus)\");\r\n ObjectType.GreenScreenOpeningAndClosing = new ObjectType(\r\n id++,\r\n 261,\r\n \"Green Screen opening and closing\"\r\n );\r\n ObjectType.FloatingRobot = new ObjectType(id++, 262, \"Floating Robot\");\r\n ObjectType.FloatingBlueLight = new ObjectType(id++, 263, \"Floating Blue Light\");\r\n ObjectType.SelfDestructingObject1 = new ObjectType(id++, 264, \"Self Destructing Object 1\");\r\n ObjectType.SelfDestructingObject2 = new ObjectType(id++, 265, \"Self Destructing Object 2\");\r\n ObjectType.SelfDestructingObject3 = new ObjectType(id++, 266, \"Self Destructing Object 3\");\r\n ObjectType.SparkMachine = new ObjectType(id++, 267, \"Spark Machine\");\r\n ObjectType.MinesLargeFlashingCrate = new ObjectType(id++, 268, \"Mines Large Flashing Crate\");\r\n ObjectType.RuinsSeal = new ObjectType(id++, 304, \"Ruins Seal\");\r\n ObjectType.RuinsTeleporter = new ObjectType(id++, 320, \"Ruins Teleporter\");\r\n ObjectType.RuinsWarpSiteToSite = new ObjectType(id++, 321, \"Ruins Warp (Site to site)\");\r\n ObjectType.RuinsSwitch = new ObjectType(id++, 322, \"Ruins Switch\");\r\n ObjectType.FloorPanel4 = new ObjectType(id++, 323, \"Floor Panel 4\");\r\n ObjectType.Ruins1Door = new ObjectType(id++, 324, \"Ruins 1 Door\");\r\n ObjectType.Ruins3Door = new ObjectType(id++, 325, \"Ruins 3 Door\");\r\n ObjectType.Ruins2Door = new ObjectType(id++, 326, \"Ruins 2 Door\");\r\n ObjectType.Ruins11ButtonDoor = new ObjectType(id++, 327, \"Ruins 1-1 Button Door\");\r\n ObjectType.Ruins21ButtonDoor = new ObjectType(id++, 328, \"Ruins 2-1 Button Door\");\r\n ObjectType.Ruins31ButtonDoor = new ObjectType(id++, 329, \"Ruins 3-1 Button Door\");\r\n ObjectType.Ruins4ButtonDoor = new ObjectType(id++, 330, \"Ruins 4-Button Door\");\r\n ObjectType.Ruins2ButtonDoor = new ObjectType(id++, 331, \"Ruins 2-Button Door\");\r\n ObjectType.RuinsSensor = new ObjectType(id++, 332, \"Ruins Sensor\");\r\n ObjectType.RuinsFenceSwitch = new ObjectType(id++, 333, \"Ruins Fence Switch\");\r\n ObjectType.RuinsLaserFence4x2 = new ObjectType(id++, 334, \"Ruins Laser Fence 4x2\");\r\n ObjectType.RuinsLaserFence6x2 = new ObjectType(id++, 335, \"Ruins Laser Fence 6x2\");\r\n ObjectType.RuinsLaserFence4x4 = new ObjectType(id++, 336, \"Ruins Laser Fence 4x4\");\r\n ObjectType.RuinsLaserFence6x4 = new ObjectType(id++, 337, \"Ruins Laser Fence 6x4\");\r\n ObjectType.RuinsPoisonBlob = new ObjectType(id++, 338, \"Ruins poison Blob\");\r\n ObjectType.RuinsPilarTrap = new ObjectType(id++, 339, \"Ruins Pilar Trap\");\r\n ObjectType.PopupTrapNoTech = new ObjectType(id++, 340, \"Popup Trap (No Tech)\");\r\n ObjectType.RuinsCrystal = new ObjectType(id++, 341, \"Ruins Crystal\");\r\n ObjectType.Monument = new ObjectType(id++, 342, \"Monument\");\r\n ObjectType.RuinsRock1 = new ObjectType(id++, 345, \"Ruins Rock 1\");\r\n ObjectType.RuinsRock2 = new ObjectType(id++, 346, \"Ruins Rock 2\");\r\n ObjectType.RuinsRock3 = new ObjectType(id++, 347, \"Ruins Rock 3\");\r\n ObjectType.RuinsRock4 = new ObjectType(id++, 348, \"Ruins Rock 4\");\r\n ObjectType.RuinsRock5 = new ObjectType(id++, 349, \"Ruins Rock 5\");\r\n ObjectType.RuinsRock6 = new ObjectType(id++, 350, \"Ruins Rock 6\");\r\n ObjectType.RuinsRock7 = new ObjectType(id++, 351, \"Ruins Rock 7\");\r\n ObjectType.Poison = new ObjectType(id++, 352, \"Poison\");\r\n ObjectType.FixedBoxTypeRuins = new ObjectType(id++, 353, \"Fixed Box Type (Ruins)\");\r\n ObjectType.RandomBoxTypeRuins = new ObjectType(id++, 354, \"Random Box Type (Ruins)\");\r\n ObjectType.EnemyTypeBoxYellow = new ObjectType(id++, 355, \"Enemy Type Box (Yellow)\");\r\n ObjectType.EnemyTypeBoxBlue = new ObjectType(id++, 356, \"Enemy Type Box (Blue)\");\r\n ObjectType.EmptyTypeBoxBlue = new ObjectType(id++, 357, \"Empty Type Box (Blue)\");\r\n ObjectType.DestructableRock = new ObjectType(id++, 358, \"Destructable Rock\");\r\n ObjectType.PopupTrapsTechs = new ObjectType(id++, 359, \"Popup Traps (techs)\");\r\n ObjectType.FlyingWhiteBird = new ObjectType(id++, 368, \"Flying White Bird\");\r\n ObjectType.Tower = new ObjectType(id++, 369, \"Tower\");\r\n ObjectType.FloatingRocks = new ObjectType(id++, 370, \"Floating Rocks\");\r\n ObjectType.FloatingSoul = new ObjectType(id++, 371, \"Floating Soul\");\r\n ObjectType.Butterfly = new ObjectType(id++, 372, \"Butterfly\");\r\n ObjectType.LobbyGameMenu = new ObjectType(id++, 384, \"Lobby Game menu\");\r\n ObjectType.LobbyWarpObject = new ObjectType(id++, 385, \"Lobby Warp Object\");\r\n ObjectType.Lobby1EventObjectDefaultTree = new ObjectType(\r\n id++,\r\n 386,\r\n \"Lobby 1 Event Object (Default Tree)\"\r\n );\r\n ObjectType.UnknownItem387 = new ObjectType(id++, 387, \"Unknown Item (387)\");\r\n ObjectType.UnknownItem388 = new ObjectType(id++, 388, \"Unknown Item (388)\");\r\n ObjectType.UnknownItem389 = new ObjectType(id++, 389, \"Unknown Item (389)\");\r\n ObjectType.LobbyEventObjectStaticPumpkin = new ObjectType(\r\n id++,\r\n 390,\r\n \"Lobby Event Object (Static Pumpkin)\"\r\n );\r\n ObjectType.LobbyEventObject3ChristmasWindows = new ObjectType(\r\n id++,\r\n 391,\r\n \"Lobby Event Object (3 Christmas Windows)\"\r\n );\r\n ObjectType.LobbyEventObjectRedAndWhiteCurtain = new ObjectType(\r\n id++,\r\n 392,\r\n \"Lobby Event Object (Red and White Curtain)\"\r\n );\r\n ObjectType.UnknownItem393 = new ObjectType(id++, 393, \"Unknown Item (393)\");\r\n ObjectType.UnknownItem394 = new ObjectType(id++, 394, \"Unknown Item (394)\");\r\n ObjectType.LobbyFishTank = new ObjectType(id++, 395, \"Lobby Fish Tank\");\r\n ObjectType.LobbyEventObjectButterflies = new ObjectType(\r\n id++,\r\n 396,\r\n \"Lobby Event Object (Butterflies)\"\r\n );\r\n ObjectType.UnknownItem400 = new ObjectType(id++, 400, \"Unknown Item (400)\");\r\n ObjectType.GreyWallLow = new ObjectType(id++, 401, \"grey wall low\");\r\n ObjectType.SpaceshipDoor = new ObjectType(id++, 402, \"Spaceship Door\");\r\n ObjectType.GreyWallHigh = new ObjectType(id++, 403, \"grey wall high\");\r\n ObjectType.TempleNormalDoor = new ObjectType(id++, 416, \"Temple Normal Door\");\r\n ObjectType.BreakableWallWallButUnbreakable = new ObjectType(\r\n id++,\r\n 417,\r\n '\"breakable wall wall, but unbreakable\"'\r\n );\r\n ObjectType.BrokenCilinderAndRubble = new ObjectType(id++, 418, \"Broken cilinder and rubble\");\r\n ObjectType.ThreeBrokenWallPiecesOnFloor = new ObjectType(\r\n id++,\r\n 419,\r\n \"3 broken wall pieces on floor\"\r\n );\r\n ObjectType.HighBrickCilinder = new ObjectType(id++, 420, \"high brick cilinder\");\r\n ObjectType.LyingCilinder = new ObjectType(id++, 421, \"lying cilinder\");\r\n ObjectType.BrickConeWithFlatTop = new ObjectType(id++, 422, \"brick cone with flat top\");\r\n ObjectType.BreakableTempleWall = new ObjectType(id++, 423, \"breakable temple wall\");\r\n ObjectType.TempleMapDetect = new ObjectType(id++, 424, \"Temple Map Detect\");\r\n ObjectType.SmallBrownBrickRisingBridge = new ObjectType(\r\n id++,\r\n 425,\r\n \"small brown brick rising bridge\"\r\n );\r\n ObjectType.LongRisingBridgeWithPinkHighEdges = new ObjectType(\r\n id++,\r\n 426,\r\n \"long rising bridge (with pink high edges)\"\r\n );\r\n ObjectType.FourSwitchTempleDoor = new ObjectType(id++, 427, \"4 switch temple door\");\r\n ObjectType.FourButtonSpaceshipDoor = new ObjectType(id++, 448, \"4 button spaceship door\");\r\n ObjectType.ItemBoxCca = new ObjectType(id++, 512, \"item box cca\");\r\n ObjectType.TeleporterEp2 = new ObjectType(id++, 513, \"Teleporter (Ep 2)\");\r\n ObjectType.CCADoor = new ObjectType(id++, 514, \"CCA Door\");\r\n ObjectType.SpecialBoxCCA = new ObjectType(id++, 515, \"Special Box CCA\");\r\n ObjectType.BigCCADoor = new ObjectType(id++, 516, \"Big CCA Door\");\r\n ObjectType.BigCCADoorSwitch = new ObjectType(id++, 517, \"Big CCA Door Switch\");\r\n ObjectType.LittleRock = new ObjectType(id++, 518, \"Little Rock\");\r\n ObjectType.Little3StoneWall = new ObjectType(id++, 519, \"Little 3 Stone Wall\");\r\n ObjectType.Medium3StoneWall = new ObjectType(id++, 520, \"Medium 3 stone wall\");\r\n ObjectType.SpiderPlant = new ObjectType(id++, 521, \"Spider Plant\");\r\n ObjectType.CCAAreaTeleporter = new ObjectType(id++, 522, \"CCA Area Teleporter\");\r\n ObjectType.UnknownItem523 = new ObjectType(id++, 523, \"Unknown Item (523)\");\r\n ObjectType.WhiteBird = new ObjectType(id++, 524, \"White Bird\");\r\n ObjectType.OrangeBird = new ObjectType(id++, 525, \"Orange Bird\");\r\n ObjectType.Saw = new ObjectType(id++, 527, \"Saw\");\r\n ObjectType.LaserDetect = new ObjectType(id++, 528, \"Laser Detect\");\r\n ObjectType.UnknownItem529 = new ObjectType(id++, 529, \"Unknown Item (529)\");\r\n ObjectType.UnknownItem530 = new ObjectType(id++, 530, \"Unknown Item (530)\");\r\n ObjectType.Seagull = new ObjectType(id++, 531, \"Seagull\");\r\n ObjectType.Fish = new ObjectType(id++, 544, \"Fish\");\r\n ObjectType.SeabedDoorWithBlueEdges = new ObjectType(id++, 545, \"Seabed Door (with blue edges)\");\r\n ObjectType.SeabedDoorAlwaysOpenNonTriggerable = new ObjectType(\r\n id++,\r\n 546,\r\n \"Seabed door (always open, non-triggerable)\"\r\n );\r\n ObjectType.LittleCryotube = new ObjectType(id++, 547, \"Little Cryotube\");\r\n ObjectType.WideGlassWallBreakable = new ObjectType(id++, 548, \"Wide Glass Wall (breakable)\");\r\n ObjectType.BlueFloatingRobot = new ObjectType(id++, 549, \"Blue floating robot\");\r\n ObjectType.RedFloatingRobot = new ObjectType(id++, 550, \"Red floating robot\");\r\n ObjectType.Dolphin = new ObjectType(id++, 551, \"Dolphin\");\r\n ObjectType.CaptureTrap = new ObjectType(id++, 552, \"Capture Trap\");\r\n ObjectType.VRLink = new ObjectType(id++, 553, \"VR link\");\r\n ObjectType.UnknownItem576 = new ObjectType(id++, 576, \"Unknown Item (576)\");\r\n ObjectType.WarpInBarbaRayRoom = new ObjectType(id++, 640, \"Warp in Barba Ray Room\");\r\n ObjectType.UnknownItem672 = new ObjectType(id++, 672, \"Unknown Item (672)\");\r\n ObjectType.GeeNest = new ObjectType(id++, 688, \"Gee Nest\");\r\n ObjectType.LabComputerConsole = new ObjectType(id++, 689, \"Lab Computer Console\");\r\n ObjectType.LabComputerConsoleGreenScreen = new ObjectType(\r\n id++,\r\n 690,\r\n \"Lab Computer Console (Green Screen)\"\r\n );\r\n ObjectType.ChairYelllowPillow = new ObjectType(id++, 691, \"Chair, Yelllow Pillow\");\r\n ObjectType.OrangeWallWithHoleInMiddle = new ObjectType(\r\n id++,\r\n 692,\r\n \"orange wall with hole in middle\"\r\n );\r\n ObjectType.GreyWallWithHoleInMiddle = new ObjectType(\r\n id++,\r\n 693,\r\n \"grey wall with hole in middle\"\r\n );\r\n ObjectType.LongTable = new ObjectType(id++, 694, \"long table\");\r\n ObjectType.GBAStation = new ObjectType(id++, 695, \"GBA Station\");\r\n ObjectType.TalkLinkToSupport = new ObjectType(id++, 696, \"Talk (link to support)\");\r\n ObjectType.InstaWarp = new ObjectType(id++, 697, \"insta-warp\");\r\n ObjectType.LabInvisibleObject = new ObjectType(id++, 698, \"Lab Invisible Object\");\r\n ObjectType.LabGlassWindowDoor = new ObjectType(id++, 699, \"Lab Glass window Door\");\r\n ObjectType.UnknownItem700 = new ObjectType(id++, 700, \"Unknown Item (700)\");\r\n ObjectType.LabCelingWarp = new ObjectType(id++, 701, \"Lab Celing Warp\");\r\n ObjectType.Ep4LightSource = new ObjectType(id++, 768, \"Ep4 Light Source\");\r\n ObjectType.Cacti = new ObjectType(id++, 769, \"cacti\");\r\n ObjectType.BigBrownRock = new ObjectType(id++, 770, \"Big Brown Rock\");\r\n ObjectType.BreakableBrownRock = new ObjectType(id++, 771, \"Breakable Brown Rock\");\r\n ObjectType.UnknownItem832 = new ObjectType(id++, 832, \"Unknown Item (832)\");\r\n ObjectType.UnknownItem833 = new ObjectType(id++, 833, \"Unknown Item (833)\");\r\n ObjectType.PoisonPlant = new ObjectType(id++, 896, \"Poison Plant\");\r\n ObjectType.UnknownItem897 = new ObjectType(id++, 897, \"Unknown Item (897)\");\r\n ObjectType.UnknownItem898 = new ObjectType(id++, 898, \"Unknown Item (898)\");\r\n ObjectType.OozingDesertPlant = new ObjectType(id++, 899, \"Oozing Desert Plant\");\r\n ObjectType.UnknownItem901 = new ObjectType(id++, 901, \"Unknown Item (901)\");\r\n ObjectType.BigBlackRocks = new ObjectType(id++, 902, \"big black rocks\");\r\n ObjectType.UnknownItem903 = new ObjectType(id++, 903, \"Unknown Item (903)\");\r\n ObjectType.UnknownItem904 = new ObjectType(id++, 904, \"Unknown Item (904)\");\r\n ObjectType.UnknownItem905 = new ObjectType(id++, 905, \"Unknown Item (905)\");\r\n ObjectType.UnknownItem906 = new ObjectType(id++, 906, \"Unknown Item (906)\");\r\n ObjectType.FallingRock = new ObjectType(id++, 907, \"Falling Rock\");\r\n ObjectType.DesertPlantHasCollision = new ObjectType(id++, 908, \"Desert Plant (has collision)\");\r\n ObjectType.DesertFixedTypeBoxBreakableCrystals = new ObjectType(\r\n id++,\r\n 909,\r\n \"Desert Fixed Type Box (Breakable Crystals)\"\r\n );\r\n ObjectType.UnknownItem910 = new ObjectType(id++, 910, \"Unknown Item (910)\");\r\n ObjectType.BeeHive = new ObjectType(id++, 911, \"Bee Hive\");\r\n ObjectType.UnknownItem912 = new ObjectType(id++, 912, \"Unknown Item (912)\");\r\n ObjectType.Heat = new ObjectType(id++, 913, \"Heat\");\r\n ObjectType.TopOfSaintMillionEgg = new ObjectType(id++, 960, \"Top of saint million egg\");\r\n ObjectType.UnknownItem961 = new ObjectType(id++, 961, \"Unknown Item (961)\");\r\n})();\r\n","import { computed, observable } from \"mobx\";\r\nimport { Object3D } from \"three\";\r\nimport { DatNpc, DatObject, DatUnknown } from \"../data_formats/parsing/quest/dat\";\r\nimport { Vec3 } from \"../data_formats/vector\";\r\nimport { enum_values } from \"../enums\";\r\nimport { ItemType } from \"./items\";\r\nimport { NpcType } from \"./NpcType\";\r\nimport { ObjectType } from \"./ObjectType\";\r\n\r\nexport * from \"./items\";\r\nexport * from \"./NpcType\";\r\nexport * from \"./ObjectType\";\r\n\r\nexport const RARE_ENEMY_PROB = 1 / 512;\r\nexport const KONDRIEU_PROB = 1 / 10;\r\n\r\nexport enum Server {\r\n Ephinea = \"Ephinea\",\r\n}\r\n\r\nexport const Servers: Server[] = enum_values(Server);\r\n\r\nexport enum Episode {\r\n I = 1,\r\n II = 2,\r\n IV = 4,\r\n}\r\n\r\nexport const Episodes: Episode[] = enum_values(Episode);\r\n\r\nexport function check_episode(episode: Episode): void {\r\n if (!Episode[episode]) {\r\n throw new Error(`Invalid episode ${episode}.`);\r\n }\r\n}\r\n\r\nexport enum SectionId {\r\n Viridia,\r\n Greenill,\r\n Skyly,\r\n Bluefull,\r\n Purplenum,\r\n Pinkal,\r\n Redria,\r\n Oran,\r\n Yellowboze,\r\n Whitill,\r\n}\r\n\r\nexport const SectionIds: SectionId[] = enum_values(SectionId);\r\n\r\nexport enum Difficulty {\r\n Normal,\r\n Hard,\r\n VHard,\r\n Ultimate,\r\n}\r\n\r\nexport const Difficulties: Difficulty[] = enum_values(Difficulty);\r\n\r\nexport class Section {\r\n readonly id: number;\r\n readonly position: Vec3;\r\n readonly y_axis_rotation: number;\r\n readonly sin_y_axis_rotation: number;\r\n readonly cos_y_axis_rotation: number;\r\n\r\n constructor(id: number, position: Vec3, y_axis_rotation: number) {\r\n if (!Number.isInteger(id) || id < -1)\r\n throw new Error(`Expected id to be an integer greater than or equal to -1, got ${id}.`);\r\n if (!position) throw new Error(\"position is required.\");\r\n if (typeof y_axis_rotation !== \"number\") throw new Error(\"y_axis_rotation is required.\");\r\n\r\n this.id = id;\r\n this.position = position;\r\n this.y_axis_rotation = y_axis_rotation;\r\n this.sin_y_axis_rotation = Math.sin(this.y_axis_rotation);\r\n this.cos_y_axis_rotation = Math.cos(this.y_axis_rotation);\r\n }\r\n}\r\n\r\nexport class Quest {\r\n @observable id?: number;\r\n @observable name: string;\r\n @observable short_description: string;\r\n @observable long_description: string;\r\n @observable episode: Episode;\r\n @observable area_variants: AreaVariant[];\r\n @observable objects: QuestObject[];\r\n @observable npcs: QuestNpc[];\r\n /**\r\n * (Partial) raw DAT data that can't be parsed yet by Phantasmal.\r\n */\r\n dat_unknowns: DatUnknown[];\r\n /**\r\n * (Partial) raw BIN data that can't be parsed yet by Phantasmal.\r\n */\r\n bin_data: ArrayBuffer;\r\n\r\n constructor(\r\n id: number | undefined,\r\n name: string,\r\n short_description: string,\r\n long_description: string,\r\n episode: Episode,\r\n area_variants: AreaVariant[],\r\n objects: QuestObject[],\r\n npcs: QuestNpc[],\r\n dat_unknowns: DatUnknown[],\r\n bin_data: ArrayBuffer\r\n ) {\r\n if (id != null && (!Number.isInteger(id) || id < 0))\r\n throw new Error(\"id should be undefined or a non-negative integer.\");\r\n check_episode(episode);\r\n if (!objects || !(objects instanceof Array)) throw new Error(\"objs is required.\");\r\n if (!npcs || !(npcs instanceof Array)) throw new Error(\"npcs is required.\");\r\n\r\n this.id = id;\r\n this.name = name;\r\n this.short_description = short_description;\r\n this.long_description = long_description;\r\n this.episode = episode;\r\n this.area_variants = area_variants;\r\n this.objects = objects;\r\n this.npcs = npcs;\r\n this.dat_unknowns = dat_unknowns;\r\n this.bin_data = bin_data;\r\n }\r\n}\r\n\r\n/**\r\n * Abstract class from which QuestNpc and QuestObject derive.\r\n */\r\nexport class QuestEntity {\r\n @observable area_id: number;\r\n\r\n private _section_id: number;\r\n\r\n @computed get section_id(): number {\r\n return this.section ? this.section.id : this._section_id;\r\n }\r\n\r\n @observable section?: Section;\r\n\r\n /**\r\n * World position\r\n */\r\n @observable position: Vec3;\r\n\r\n @observable rotation: Vec3;\r\n\r\n /**\r\n * Section-relative position\r\n */\r\n @computed get section_position(): Vec3 {\r\n let { x, y, z } = this.position;\r\n\r\n if (this.section) {\r\n const rel_x = x - this.section.position.x;\r\n const rel_y = y - this.section.position.y;\r\n const rel_z = z - this.section.position.z;\r\n const sin = -this.section.sin_y_axis_rotation;\r\n const cos = this.section.cos_y_axis_rotation;\r\n const rot_x = cos * rel_x + sin * rel_z;\r\n const rot_z = -sin * rel_x + cos * rel_z;\r\n x = rot_x;\r\n y = rel_y;\r\n z = rot_z;\r\n }\r\n\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n set section_position(sec_pos: Vec3) {\r\n let { x: rel_x, y: rel_y, z: rel_z } = sec_pos;\r\n\r\n if (this.section) {\r\n const sin = -this.section.sin_y_axis_rotation;\r\n const cos = this.section.cos_y_axis_rotation;\r\n const rot_x = cos * rel_x - sin * rel_z;\r\n const rot_z = sin * rel_x + cos * rel_z;\r\n const x = rot_x + this.section.position.x;\r\n const y = rel_y + this.section.position.y;\r\n const z = rot_z + this.section.position.z;\r\n this.position = new Vec3(x, y, z);\r\n }\r\n }\r\n\r\n @observable object_3d?: Object3D;\r\n\r\n constructor(area_id: number, section_id: number, position: Vec3, rotation: Vec3) {\r\n if (Object.getPrototypeOf(this) === Object.getPrototypeOf(QuestEntity))\r\n throw new Error(\"Abstract class should not be instantiated directly.\");\r\n if (!Number.isInteger(area_id) || area_id < 0)\r\n throw new Error(`Expected area_id to be a non-negative integer, got ${area_id}.`);\r\n if (!Number.isInteger(section_id) || section_id < 0)\r\n throw new Error(`Expected section_id to be a non-negative integer, got ${section_id}.`);\r\n if (!position) throw new Error(\"position is required.\");\r\n if (!rotation) throw new Error(\"rotation is required.\");\r\n\r\n this.area_id = area_id;\r\n this._section_id = section_id;\r\n this.position = position;\r\n this.rotation = rotation;\r\n }\r\n}\r\n\r\nexport class QuestObject extends QuestEntity {\r\n @observable type: ObjectType;\r\n /**\r\n * The raw data from a DAT file.\r\n */\r\n dat: DatObject;\r\n\r\n constructor(\r\n area_id: number,\r\n section_id: number,\r\n position: Vec3,\r\n rotation: Vec3,\r\n type: ObjectType,\r\n dat: DatObject\r\n ) {\r\n super(area_id, section_id, position, rotation);\r\n\r\n if (!type) throw new Error(\"type is required.\");\r\n\r\n this.type = type;\r\n this.dat = dat;\r\n }\r\n}\r\n\r\nexport class QuestNpc extends QuestEntity {\r\n @observable type: NpcType;\r\n /**\r\n * The raw data from a DAT file.\r\n */\r\n dat: DatNpc;\r\n\r\n constructor(\r\n area_id: number,\r\n section_id: number,\r\n position: Vec3,\r\n rotation: Vec3,\r\n type: NpcType,\r\n dat: DatNpc\r\n ) {\r\n super(area_id, section_id, position, rotation);\r\n\r\n if (!type) throw new Error(\"type is required.\");\r\n\r\n this.type = type;\r\n this.dat = dat;\r\n }\r\n}\r\n\r\nexport class Area {\r\n id: number;\r\n name: string;\r\n order: number;\r\n area_variants: AreaVariant[];\r\n\r\n constructor(id: number, name: string, order: number, area_variants: AreaVariant[]) {\r\n if (!Number.isInteger(id) || id < 0)\r\n throw new Error(`Expected id to be a non-negative integer, got ${id}.`);\r\n if (!name) throw new Error(\"name is required.\");\r\n if (!area_variants) throw new Error(\"area_variants is required.\");\r\n\r\n this.id = id;\r\n this.name = name;\r\n this.order = order;\r\n this.area_variants = area_variants;\r\n }\r\n}\r\n\r\nexport class AreaVariant {\r\n @observable sections: Section[] = [];\r\n\r\n constructor(public id: number, public area: Area) {\r\n if (!Number.isInteger(id) || id < 0)\r\n throw new Error(`Expected id to be a non-negative integer, got ${id}.`);\r\n }\r\n}\r\n\r\ntype ItemDrop = {\r\n item_type: ItemType;\r\n anything_rate: number;\r\n rare_rate: number;\r\n};\r\n\r\nexport class EnemyDrop implements ItemDrop {\r\n readonly rate: number;\r\n\r\n constructor(\r\n readonly difficulty: Difficulty,\r\n readonly section_id: SectionId,\r\n readonly npc_type: NpcType,\r\n readonly item_type: ItemType,\r\n readonly anything_rate: number,\r\n readonly rare_rate: number\r\n ) {\r\n this.rate = anything_rate * rare_rate;\r\n }\r\n}\r\n\r\nexport class HuntMethod {\r\n readonly id: string;\r\n readonly name: string;\r\n readonly episode: Episode;\r\n readonly quest: SimpleQuest;\r\n readonly enemy_counts: Map<NpcType, number>;\r\n /**\r\n * The time it takes to complete the quest in hours.\r\n */\r\n readonly default_time: number;\r\n /**\r\n * The time it takes to complete the quest in hours as specified by the user.\r\n */\r\n @observable user_time?: number;\r\n\r\n @computed get time(): number {\r\n return this.user_time != null ? this.user_time : this.default_time;\r\n }\r\n\r\n constructor(id: string, name: string, quest: SimpleQuest, default_time: number) {\r\n if (!id) throw new Error(\"id is required.\");\r\n if (default_time <= 0) throw new Error(\"default_time must be greater than zero.\");\r\n if (!name) throw new Error(\"name is required.\");\r\n if (!quest) throw new Error(\"quest is required.\");\r\n\r\n this.id = id;\r\n this.name = name;\r\n this.episode = quest.episode;\r\n this.quest = quest;\r\n this.enemy_counts = quest.enemy_counts;\r\n this.default_time = default_time;\r\n }\r\n}\r\n\r\nexport class SimpleQuest {\r\n constructor(\r\n public readonly id: number,\r\n public readonly name: string,\r\n public readonly episode: Episode,\r\n public readonly enemy_counts: Map<NpcType, number>\r\n ) {\r\n if (!id) throw new Error(\"id is required.\");\r\n if (!name) throw new Error(\"name is required.\");\r\n if (!enemy_counts) throw new Error(\"enemyCounts is required.\");\r\n }\r\n}\r\n\r\nexport class PlayerModel {\r\n constructor(\r\n public readonly name: string,\r\n public readonly head_style_count: number,\r\n public readonly hair_styles_count: number,\r\n public readonly hair_styles_with_accessory: Set<number>\r\n ) {}\r\n}\r\n\r\nexport class PlayerAnimation {\r\n constructor(public readonly id: number, public readonly name: string) {}\r\n}\r\n","import { observable, computed } from \"mobx\";\r\nimport { defer } from \"lodash\";\r\n\r\nexport enum LoadableState {\r\n /**\r\n * No attempt has been made to load data.\r\n */\r\n Uninitialized,\r\n\r\n /**\r\n * The first data load is underway.\r\n */\r\n Initializing,\r\n\r\n /**\r\n * Data was loaded at least once. The most recent load was successful.\r\n */\r\n Nominal,\r\n\r\n /**\r\n * Data was loaded at least once. The most recent load failed.\r\n */\r\n Error,\r\n\r\n /**\r\n * Data was loaded at least once. Another data load is underway.\r\n */\r\n Reloading,\r\n}\r\n\r\n/**\r\n * Represents a value that can be loaded asynchronously.\r\n * [state]{@link Loadable#state} represents the current state of this Loadable's value.\r\n */\r\nexport class Loadable<T> {\r\n @observable private _value: T;\r\n @observable private _promise: Promise<T> = new Promise(resolve => resolve(this._value));\r\n @observable private _state = LoadableState.Uninitialized;\r\n private _load?: () => Promise<T>;\r\n @observable private _error?: Error;\r\n\r\n constructor(initial_value: T, load?: () => Promise<T>) {\r\n this._value = initial_value;\r\n this._load = load;\r\n }\r\n\r\n /**\r\n * When this Loadable is uninitialized, a load will be triggered.\r\n * Will return the initial value until a load has succeeded.\r\n */\r\n @computed get value(): T {\r\n // Load value on first use and return initial placeholder value.\r\n if (this._state === LoadableState.Uninitialized) {\r\n // Defer loading value to avoid side effects in computed value.\r\n defer(() => this.load_value());\r\n }\r\n\r\n return this._value;\r\n }\r\n\r\n set value(value: T) {\r\n this._value = value;\r\n }\r\n\r\n /**\r\n * This property returns valid data as soon as possible.\r\n * If the Loadable is uninitialized a data load will be triggered, otherwise the current value will be returned.\r\n */\r\n get promise(): Promise<T> {\r\n // Load value on first use.\r\n if (this._state === LoadableState.Uninitialized) {\r\n return this.load_value();\r\n } else {\r\n return this._promise;\r\n }\r\n }\r\n\r\n @computed get state(): LoadableState {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * @returns true if the initial data load has happened. It may or may not have succeeded.\r\n * Check [error]{@link Loadable#error} to know whether an error occurred.\r\n */\r\n @computed get is_initialized(): boolean {\r\n return this._state !== LoadableState.Uninitialized;\r\n }\r\n\r\n /**\r\n * @returns true if a data load is underway. This may be the initializing load or a later load.\r\n */\r\n @computed get is_loading(): boolean {\r\n switch (this._state) {\r\n case LoadableState.Initializing:\r\n case LoadableState.Reloading:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @returns an {@link Error} if an error occurred during the most recent data load.\r\n */\r\n @computed get error(): Error | undefined {\r\n return this._error;\r\n }\r\n\r\n /**\r\n * Load the data. Initializes the Loadable if it is uninitialized.\r\n */\r\n load(): Promise<T> {\r\n return this.load_value();\r\n }\r\n\r\n private async load_value(): Promise<T> {\r\n if (this.is_loading) return this._promise;\r\n\r\n this._state = LoadableState.Initializing;\r\n\r\n try {\r\n if (this._load) {\r\n this._promise = this._load();\r\n this._value = await this._promise;\r\n }\r\n\r\n this._state = LoadableState.Nominal;\r\n this._error = undefined;\r\n return this._value;\r\n } catch (e) {\r\n this._state = LoadableState.Error;\r\n this._error = e;\r\n throw e;\r\n }\r\n }\r\n}\r\n","import { observable } from \"mobx\";\r\nimport { Server } from \"../domain\";\r\n\r\nclass ApplicationStore {\r\n @observable current_server: Server = Server.Ephinea;\r\n}\r\n\r\nexport const application_store = new ApplicationStore();\r\n","import { computed } from \"mobx\";\r\nimport { Server } from \"../domain\";\r\nimport { application_store } from \"./ApplicationStore\";\r\nimport { EnumMap } from \"../enums\";\r\n\r\n/**\r\n * Map with a guaranteed value per server.\r\n */\r\nexport class ServerMap<V> extends EnumMap<Server, V> {\r\n constructor(initial_value: (server: Server) => V) {\r\n super(Server, initial_value);\r\n }\r\n\r\n /**\r\n * @returns the value for the current server as set in {@link application_store}.\r\n */\r\n @computed get current(): V {\r\n return this.get(application_store.current_server);\r\n }\r\n}\r\n","import { observable } from \"mobx\";\r\nimport {\r\n ItemType,\r\n Server,\r\n WeaponItemType,\r\n ArmorItemType,\r\n ShieldItemType,\r\n ToolItemType,\r\n UnitItemType,\r\n} from \"../domain\";\r\nimport { Loadable } from \"../Loadable\";\r\nimport { ServerMap } from \"./ServerMap\";\r\nimport { ItemTypeDto } from \"../dto\";\r\n\r\nexport class ItemTypeStore {\r\n private id_to_item_type: ItemType[] = [];\r\n\r\n @observable item_types: ItemType[] = [];\r\n\r\n get_by_id(id: number): ItemType | undefined {\r\n return this.id_to_item_type[id];\r\n }\r\n\r\n load = async (server: Server): Promise<ItemTypeStore> => {\r\n const response = await fetch(\r\n `${process.env.PUBLIC_URL}/itemTypes.${Server[server].toLowerCase()}.json`\r\n );\r\n const data: ItemTypeDto[] = await response.json();\r\n\r\n const item_types = new Array<ItemType>();\r\n\r\n for (const item_type_dto of data) {\r\n let item_type: ItemType;\r\n\r\n switch (item_type_dto.class) {\r\n case \"weapon\":\r\n item_type = new WeaponItemType(\r\n item_type_dto.id,\r\n item_type_dto.name,\r\n item_type_dto.minAtp,\r\n item_type_dto.maxAtp,\r\n item_type_dto.ata,\r\n item_type_dto.maxGrind,\r\n item_type_dto.requiredAtp\r\n );\r\n break;\r\n case \"armor\":\r\n item_type = new ArmorItemType(\r\n item_type_dto.id,\r\n item_type_dto.name,\r\n item_type_dto.atp,\r\n item_type_dto.ata,\r\n item_type_dto.minEvp,\r\n item_type_dto.maxEvp,\r\n item_type_dto.minDfp,\r\n item_type_dto.maxDfp,\r\n item_type_dto.mst,\r\n item_type_dto.hp,\r\n item_type_dto.lck\r\n );\r\n break;\r\n case \"shield\":\r\n item_type = new ShieldItemType(\r\n item_type_dto.id,\r\n item_type_dto.name,\r\n item_type_dto.atp,\r\n item_type_dto.ata,\r\n item_type_dto.minEvp,\r\n item_type_dto.maxEvp,\r\n item_type_dto.minDfp,\r\n item_type_dto.maxDfp,\r\n item_type_dto.mst,\r\n item_type_dto.hp,\r\n item_type_dto.lck\r\n );\r\n break;\r\n case \"unit\":\r\n item_type = new UnitItemType(item_type_dto.id, item_type_dto.name);\r\n break;\r\n case \"tool\":\r\n item_type = new ToolItemType(item_type_dto.id, item_type_dto.name);\r\n break;\r\n default:\r\n continue;\r\n }\r\n\r\n this.id_to_item_type[item_type.id] = item_type;\r\n item_types.push(item_type);\r\n }\r\n\r\n this.item_types = item_types;\r\n\r\n return this;\r\n };\r\n}\r\n\r\nexport const item_type_stores: ServerMap<Loadable<ItemTypeStore>> = new ServerMap(server => {\r\n const store = new ItemTypeStore();\r\n return new Loadable(store, () => store.load(server));\r\n});\r\n","import { observable, IObservableArray, computed } from \"mobx\";\r\nimport { WeaponItem, WeaponItemType, ArmorItemType, ShieldItemType } from \"../domain\";\r\nimport { item_type_stores } from \"./ItemTypeStore\";\r\n\r\nconst NORMAL_DAMAGE_FACTOR = 0.2 * 0.9;\r\nconst HEAVY_DAMAGE_FACTOR = NORMAL_DAMAGE_FACTOR * 1.89;\r\n// const SAC_DAMAGE_FACTOR = NORMAL_DAMAGE_FACTOR * 3.32;\r\n// const VJAYA_DAMAGE_FACTOR = NORMAL_DAMAGE_FACTOR * 5.56;\r\n// const CRIT_FACTOR = 1.5;\r\n\r\nclass Weapon {\r\n private readonly store: DpsCalcStore;\r\n readonly item: WeaponItem;\r\n\r\n @computed get shifta_atp(): number {\r\n if (this.item.type.min_atp === this.item.type.max_atp) {\r\n return 0;\r\n } else {\r\n return this.item.type.max_atp * this.store.shifta_factor;\r\n }\r\n }\r\n\r\n @computed get min_atp(): number {\r\n return this.item.type.min_atp + this.item.grind_atp;\r\n }\r\n\r\n @computed get max_atp(): number {\r\n return this.item.type.max_atp + this.item.grind_atp + this.shifta_atp;\r\n }\r\n\r\n @computed get final_min_atp(): number {\r\n return (\r\n this.min_atp +\r\n this.store.armor_atp +\r\n this.store.shield_atp +\r\n this.store.base_atp +\r\n this.store.base_shifta_atp\r\n );\r\n }\r\n\r\n @computed get final_max_atp(): number {\r\n return (\r\n this.max_atp +\r\n this.store.armor_atp +\r\n this.store.shield_atp +\r\n this.store.base_atp +\r\n this.store.base_shifta_atp\r\n );\r\n }\r\n\r\n @computed get min_normal_damage(): number {\r\n return (this.final_min_atp - this.store.enemy_dfp) * NORMAL_DAMAGE_FACTOR;\r\n }\r\n\r\n @computed get max_normal_damage(): number {\r\n return (this.final_max_atp - this.store.enemy_dfp) * NORMAL_DAMAGE_FACTOR;\r\n }\r\n\r\n @computed get avg_normal_damage(): number {\r\n return (this.min_normal_damage + this.max_normal_damage) / 2;\r\n }\r\n\r\n @computed get min_heavy_damage(): number {\r\n return (this.final_min_atp - this.store.enemy_dfp) * HEAVY_DAMAGE_FACTOR;\r\n }\r\n\r\n @computed get max_heavy_damage(): number {\r\n return (this.final_max_atp - this.store.enemy_dfp) * HEAVY_DAMAGE_FACTOR;\r\n }\r\n\r\n @computed get avg_heavy_damage(): number {\r\n return (this.min_heavy_damage + this.max_heavy_damage) / 2;\r\n }\r\n\r\n constructor(store: DpsCalcStore, item: WeaponItem) {\r\n this.store = store;\r\n this.item = item;\r\n }\r\n}\r\n\r\nclass DpsCalcStore {\r\n @computed get weapon_types(): WeaponItemType[] {\r\n return item_type_stores.current.value.item_types.filter(\r\n it => it instanceof WeaponItemType\r\n ) as WeaponItemType[];\r\n }\r\n\r\n @computed get armor_types(): ArmorItemType[] {\r\n return item_type_stores.current.value.item_types.filter(\r\n it => it instanceof ArmorItemType\r\n ) as ArmorItemType[];\r\n }\r\n\r\n @computed get shield_types(): ShieldItemType[] {\r\n return item_type_stores.current.value.item_types.filter(\r\n it => it instanceof ShieldItemType\r\n ) as ShieldItemType[];\r\n }\r\n\r\n //\r\n // Character Details\r\n //\r\n\r\n @observable char_atp: number = 0;\r\n @observable mag_pow: number = 0;\r\n @computed get armor_atp(): number {\r\n return this.armor_type ? this.armor_type.atp : 0;\r\n }\r\n @computed get shield_atp(): number {\r\n return this.shield_type ? this.shield_type.atp : 0;\r\n }\r\n @observable shifta_lvl: number = 0;\r\n\r\n @computed get base_atp(): number {\r\n return this.char_atp + 2 * this.mag_pow;\r\n }\r\n\r\n @computed get shifta_factor(): number {\r\n return this.shifta_lvl ? 0.013 * (this.shifta_lvl - 1) + 0.1 : 0;\r\n }\r\n\r\n @computed get base_shifta_atp(): number {\r\n return this.base_atp * this.shifta_factor;\r\n }\r\n\r\n @observable readonly weapons: IObservableArray<Weapon> = observable.array();\r\n\r\n add_weapon = (type: WeaponItemType) => {\r\n this.weapons.push(new Weapon(this, new WeaponItem(type)));\r\n };\r\n\r\n @observable armor_type?: ArmorItemType;\r\n @observable shield_type?: ShieldItemType;\r\n\r\n //\r\n // Enemy Details\r\n //\r\n\r\n @observable enemy_dfp: number = 0;\r\n}\r\n\r\nexport const dps_calc_store = new DpsCalcStore();\r\n","import React, { PureComponent, ReactNode } from \"react\";\r\nimport {\r\n OptionValues,\r\n ReactAsyncSelectProps,\r\n ReactCreatableSelectProps,\r\n ReactSelectProps,\r\n} from \"react-select\";\r\nimport VirtualizedSelect, { AdditionalVirtualizedSelectProps } from \"react-virtualized-select\";\r\nimport \"./BigSelect.less\";\r\n\r\n/**\r\n * Simply wraps {@link VirtualizedSelect} to provide consistent styling.\r\n */\r\nexport class BigSelect<TValue = OptionValues> extends PureComponent<\r\n VirtualizedSelectProps<TValue>\r\n> {\r\n render(): ReactNode {\r\n return <VirtualizedSelect className=\"BigSelect\" {...this.props} />;\r\n }\r\n}\r\n\r\n// Copied from react-virtualized-select.\r\ntype VirtualizedSelectProps<TValue = OptionValues> =\r\n | (ReactCreatableSelectProps<TValue> &\r\n ReactAsyncSelectProps<TValue> &\r\n AdditionalVirtualizedSelectProps<TValue> & { async: true })\r\n | ReactCreatableSelectProps<TValue> &\r\n ReactSelectProps<TValue> &\r\n AdditionalVirtualizedSelectProps<TValue>;\r\n","import { InputNumber } from \"antd\";\r\nimport { observer } from \"mobx-react\";\r\nimport React, { ReactNode, Component } from \"react\";\r\nimport { WeaponItemType, ArmorItemType, ShieldItemType } from \"../../domain\";\r\nimport { dps_calc_store } from \"../../stores/DpsCalcStore\";\r\nimport { item_type_stores } from \"../../stores/ItemTypeStore\";\r\nimport { BigSelect } from \"../BigSelect\";\r\n\r\n@observer\r\nexport class DpsCalcComponent extends Component {\r\n render(): ReactNode {\r\n return (\r\n <section>\r\n <section>\r\n <div>Weapons:</div>\r\n <BigSelect\r\n placeholder=\"Add a weapon\"\r\n value={undefined}\r\n options={dps_calc_store.weapon_types.map(wt => ({\r\n label: wt.name,\r\n value: wt.id,\r\n }))}\r\n onChange={this.add_weapon}\r\n />\r\n <table>\r\n <thead>\r\n <tr>\r\n <td>Weapon</td>\r\n <td>Min. ATP</td>\r\n <td>Max. ATP</td>\r\n <td>Grind</td>\r\n <td>Grind ATP</td>\r\n <td>Shifta ATP</td>\r\n <td>Final Min. ATP</td>\r\n <td>Final Max. ATP</td>\r\n <td>Min. Normal Damage</td>\r\n <td>Max. Normal Damage</td>\r\n <td>Avg. Normal Damage</td>\r\n <td>Min. Heavy Damage</td>\r\n <td>Max. Heavy Damage</td>\r\n <td>Avg. Heavy Damage</td>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n {dps_calc_store.weapons.map((weapon, i) => (\r\n <tr key={i}>\r\n <td>{weapon.item.type.name}</td>\r\n <td>{weapon.item.type.min_atp}</td>\r\n <td>{weapon.item.type.max_atp}</td>\r\n <td>\r\n <InputNumber\r\n size=\"small\"\r\n value={weapon.item.grind}\r\n min={0}\r\n max={weapon.item.type.max_grind}\r\n step={1}\r\n onChange={value => (weapon.item.grind = value || 0)}\r\n />\r\n </td>\r\n <td>{weapon.item.grind_atp}</td>\r\n <td>{weapon.shifta_atp.toFixed(1)}</td>\r\n <td>{weapon.final_min_atp.toFixed(1)}</td>\r\n <td>{weapon.final_max_atp.toFixed(1)}</td>\r\n <td>{weapon.min_normal_damage.toFixed(1)}</td>\r\n <td>{weapon.max_normal_damage.toFixed(1)}</td>\r\n <td>{weapon.avg_normal_damage.toFixed(1)}</td>\r\n <td>{weapon.min_heavy_damage.toFixed(1)}</td>\r\n <td>{weapon.max_heavy_damage.toFixed(1)}</td>\r\n <td>{weapon.avg_heavy_damage.toFixed(1)}</td>\r\n </tr>\r\n ))}\r\n </tbody>\r\n </table>\r\n <div>Character ATP:</div>\r\n <InputNumber\r\n value={dps_calc_store.char_atp}\r\n min={0}\r\n step={1}\r\n onChange={value => (dps_calc_store.char_atp = value || 0)}\r\n />\r\n <div>MAG POW:</div>\r\n <InputNumber\r\n value={dps_calc_store.mag_pow}\r\n min={0}\r\n max={200}\r\n step={1}\r\n onChange={value => (dps_calc_store.mag_pow = value || 0)}\r\n />\r\n <div>Armor:</div>\r\n <BigSelect\r\n placeholder=\"Choose an armor\"\r\n value={dps_calc_store.armor_type && dps_calc_store.armor_type.id}\r\n options={dps_calc_store.armor_types.map(at => ({\r\n label: at.name,\r\n value: at.id,\r\n }))}\r\n onChange={this.armor_changed}\r\n />\r\n <span>Armor ATP: {dps_calc_store.armor_atp}</span>\r\n <div>Shield:</div>\r\n <BigSelect\r\n placeholder=\"Choose a shield\"\r\n value={dps_calc_store.shield_type && dps_calc_store.shield_type.id}\r\n options={dps_calc_store.shield_types.map(st => ({\r\n label: st.name,\r\n value: st.id,\r\n }))}\r\n onChange={this.shield_changed}\r\n />\r\n <span>Shield ATP: {dps_calc_store.shield_atp}</span>\r\n <div>Shifta level:</div>\r\n <InputNumber\r\n value={dps_calc_store.shifta_lvl}\r\n min={0}\r\n max={30}\r\n step={1}\r\n onChange={value => (dps_calc_store.shifta_lvl = value || 0)}\r\n />\r\n <div>Shifta factor:</div>\r\n <div>{dps_calc_store.shifta_factor.toFixed(3)}</div>\r\n <div>Base shifta ATP:</div>\r\n <div>{dps_calc_store.base_shifta_atp.toFixed(2)}</div>\r\n </section>\r\n </section>\r\n );\r\n }\r\n\r\n private add_weapon = (selected: any) => {\r\n if (selected) {\r\n let type = item_type_stores.current.value.get_by_id(selected.value)!;\r\n dps_calc_store.add_weapon(type as WeaponItemType);\r\n }\r\n };\r\n\r\n private armor_changed = (selected: any) => {\r\n if (selected) {\r\n let item_type = item_type_stores.current.value.get_by_id(selected.value)!;\r\n dps_calc_store.armor_type = item_type as ArmorItemType;\r\n } else {\r\n dps_calc_store.armor_type = undefined;\r\n }\r\n };\r\n\r\n private shield_changed = (selected: any) => {\r\n if (selected) {\r\n let item_type = item_type_stores.current.value.get_by_id(selected.value)!;\r\n dps_calc_store.shield_type = item_type as ShieldItemType;\r\n } else {\r\n dps_calc_store.shield_type = undefined;\r\n }\r\n };\r\n}\r\n","import { Alert } from \"antd\";\r\nimport React, { ReactNode, Component, ComponentType } from \"react\";\r\nimport \"./ErrorBoundary.css\";\r\n\r\ntype State = { has_error: boolean };\r\n\r\nexport class ErrorBoundary extends Component<{}, State> {\r\n state = {\r\n has_error: false,\r\n };\r\n\r\n render(): ReactNode {\r\n if (this.state.has_error) {\r\n return (\r\n <div className=\"ErrorBoundary-error\">\r\n <div>\r\n <Alert type=\"error\" message=\"Something went wrong.\" />\r\n </div>\r\n </div>\r\n );\r\n } else {\r\n return this.props.children;\r\n }\r\n }\r\n\r\n static getDerivedStateFromError(): State {\r\n return { has_error: true };\r\n }\r\n}\r\n\r\nexport function with_error_boundary(Component: ComponentType): ComponentType {\r\n const ComponentErrorBoundary = (): JSX.Element => (\r\n <ErrorBoundary>\r\n <Component />\r\n </ErrorBoundary>\r\n );\r\n ComponentErrorBoundary.displayName = `${Component.displayName}ErrorBoundary`;\r\n return ComponentErrorBoundary;\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { autorun, IReactionDisposer, observable } from \"mobx\";\r\nimport { HuntMethod, NpcType, Server, SimpleQuest } from \"../domain\";\r\nimport { QuestDto } from \"../dto\";\r\nimport { Loadable } from \"../Loadable\";\r\nimport { ServerMap } from \"./ServerMap\";\r\n\r\nconst logger = Logger.get(\"stores/HuntMethodStore\");\r\n\r\nclass HuntMethodStore {\r\n @observable methods: ServerMap<Loadable<HuntMethod[]>> = new ServerMap(\r\n server => new Loadable([], () => this.load_hunt_methods(server))\r\n );\r\n\r\n private storage_disposer?: IReactionDisposer;\r\n\r\n private async load_hunt_methods(server: Server): Promise<HuntMethod[]> {\r\n const response = await fetch(\r\n `${process.env.PUBLIC_URL}/quests.${Server[server].toLowerCase()}.json`\r\n );\r\n const quests = (await response.json()) as QuestDto[];\r\n const methods = new Array<HuntMethod>();\r\n\r\n for (const quest of quests) {\r\n let total_count = 0;\r\n const enemy_counts = new Map<NpcType, number>();\r\n\r\n for (const [code, count] of Object.entries(quest.enemyCounts)) {\r\n const npc_type = NpcType.by_code(code);\r\n\r\n if (!npc_type) {\r\n logger.error(`No NpcType found for code ${code}.`);\r\n } else {\r\n enemy_counts.set(npc_type, count);\r\n total_count += count;\r\n }\r\n }\r\n\r\n // Filter out some quests.\r\n /* eslint-disable no-fallthrough */\r\n switch (quest.id) {\r\n // The following quests are left out because their enemies don't drop anything.\r\n case 31: // Black Paper's Dangerous Deal\r\n case 34: // Black Paper's Dangerous Deal 2\r\n case 1305: // Maximum Attack S (Ep. 1)\r\n case 1306: // Maximum Attack S (Ep. 2)\r\n case 1307: // Maximum Attack S (Ep. 4)\r\n case 313: // Beyond the Horizon\r\n\r\n // MAXIMUM ATTACK 3 Ver2 is filtered out because its actual enemy count depends on the path taken.\r\n // TODO: generate a method per path.\r\n case 314:\r\n continue;\r\n }\r\n\r\n methods.push(\r\n new HuntMethod(\r\n `q${quest.id}`,\r\n quest.name,\r\n new SimpleQuest(quest.id, quest.name, quest.episode, enemy_counts),\r\n /^\\d-\\d.*/.test(quest.name) ? 0.75 : total_count > 400 ? 0.75 : 0.5\r\n )\r\n );\r\n }\r\n\r\n this.load_from_local_storage(methods, server);\r\n return methods;\r\n }\r\n\r\n private load_from_local_storage = (methods: HuntMethod[], server: Server) => {\r\n try {\r\n const method_user_times_json = localStorage.getItem(\r\n `HuntMethodStore.methodUserTimes.${Server[server]}`\r\n );\r\n\r\n if (method_user_times_json) {\r\n const user_times: StoredUserTimes = JSON.parse(method_user_times_json);\r\n\r\n for (const method of methods) {\r\n method.user_time = user_times[method.id];\r\n }\r\n }\r\n\r\n if (this.storage_disposer) {\r\n this.storage_disposer();\r\n }\r\n\r\n this.storage_disposer = autorun(() => this.store_in_local_storage(methods, server));\r\n } catch (e) {\r\n logger.error(e);\r\n }\r\n };\r\n\r\n private store_in_local_storage = (methods: HuntMethod[], server: Server) => {\r\n try {\r\n const user_times: StoredUserTimes = {};\r\n\r\n for (const method of methods) {\r\n if (method.user_time != undefined) {\r\n user_times[method.id] = method.user_time;\r\n }\r\n }\r\n\r\n localStorage.setItem(\r\n `HuntMethodStore.methodUserTimes.${Server[server]}`,\r\n JSON.stringify(user_times)\r\n );\r\n } catch (e) {\r\n logger.error(e);\r\n }\r\n };\r\n}\r\n\r\ntype StoredUserTimes = { [method_id: string]: number };\r\n\r\nexport const hunt_method_store = new HuntMethodStore();\r\n","import { observable } from \"mobx\";\r\nimport {\r\n Difficulties,\r\n Difficulty,\r\n EnemyDrop,\r\n NpcType,\r\n SectionId,\r\n SectionIds,\r\n Server,\r\n} from \"../domain\";\r\nimport { NpcTypes } from \"../domain/NpcType\";\r\nimport { EnemyDropDto } from \"../dto\";\r\nimport { Loadable } from \"../Loadable\";\r\nimport { item_type_stores } from \"./ItemTypeStore\";\r\nimport { ServerMap } from \"./ServerMap\";\r\nimport Logger from \"js-logger\";\r\n\r\nconst logger = Logger.get(\"stores/ItemDropStore\");\r\n\r\nexport class EnemyDropTable {\r\n // Mapping of difficulties to section IDs to NpcTypes to EnemyDrops.\r\n private table: EnemyDrop[] = new Array(\r\n Difficulties.length * SectionIds.length * NpcTypes.length\r\n );\r\n\r\n // Mapping of ItemType ids to EnemyDrops.\r\n private item_type_to_drops: EnemyDrop[][] = [];\r\n\r\n get_drop(\r\n difficulty: Difficulty,\r\n section_id: SectionId,\r\n npc_type: NpcType\r\n ): EnemyDrop | undefined {\r\n return this.table[\r\n difficulty * SectionIds.length * NpcTypes.length +\r\n section_id * NpcTypes.length +\r\n npc_type.id\r\n ];\r\n }\r\n\r\n set_drop(\r\n difficulty: Difficulty,\r\n section_id: SectionId,\r\n npc_type: NpcType,\r\n drop: EnemyDrop\r\n ): void {\r\n this.table[\r\n difficulty * SectionIds.length * NpcTypes.length +\r\n section_id * NpcTypes.length +\r\n npc_type.id\r\n ] = drop;\r\n\r\n let drops = this.item_type_to_drops[drop.item_type.id];\r\n\r\n if (!drops) {\r\n drops = [];\r\n this.item_type_to_drops[drop.item_type.id] = drops;\r\n }\r\n\r\n drops.push(drop);\r\n }\r\n\r\n get_drops_for_item_type(item_type_id: number): EnemyDrop[] {\r\n return this.item_type_to_drops[item_type_id] || [];\r\n }\r\n}\r\n\r\nexport class ItemDropStore {\r\n @observable.ref enemy_drops: EnemyDropTable = new EnemyDropTable();\r\n}\r\n\r\nexport const item_drop_stores: ServerMap<Loadable<ItemDropStore>> = new ServerMap(server => {\r\n const store = new ItemDropStore();\r\n return new Loadable(store, () => load(store, server));\r\n});\r\n\r\nasync function load(store: ItemDropStore, server: Server): Promise<ItemDropStore> {\r\n const item_type_store = await item_type_stores.current.promise;\r\n const response = await fetch(\r\n `${process.env.PUBLIC_URL}/enemyDrops.${Server[server].toLowerCase()}.json`\r\n );\r\n const data: EnemyDropDto[] = await response.json();\r\n\r\n const drops = new EnemyDropTable();\r\n\r\n for (const drop_dto of data) {\r\n const npc_type = NpcType.by_code(drop_dto.enemy);\r\n\r\n if (!npc_type) {\r\n logger.warn(\r\n `Couldn't determine NpcType of episode ${drop_dto.episode} ${drop_dto.enemy}.`\r\n );\r\n continue;\r\n }\r\n\r\n const difficulty = (Difficulty as any)[drop_dto.difficulty];\r\n const item_type = item_type_store.get_by_id(drop_dto.itemTypeId);\r\n\r\n if (!item_type) {\r\n logger.warn(`Couldn't find item kind ${drop_dto.itemTypeId}.`);\r\n continue;\r\n }\r\n\r\n const section_id = (SectionId as any)[drop_dto.sectionId];\r\n\r\n if (section_id == null) {\r\n logger.warn(`Couldn't find section ID ${drop_dto.sectionId}.`);\r\n continue;\r\n }\r\n\r\n drops.set_drop(\r\n difficulty,\r\n section_id,\r\n npc_type,\r\n new EnemyDrop(\r\n difficulty,\r\n section_id,\r\n npc_type,\r\n item_type,\r\n drop_dto.dropRate,\r\n drop_dto.rareRate\r\n )\r\n );\r\n }\r\n\r\n store.enemy_drops = drops;\r\n return store;\r\n}\r\n","import solver from \"javascript-lp-solver\";\r\nimport { autorun, IObservableArray, observable, computed } from \"mobx\";\r\nimport {\r\n Difficulties,\r\n Difficulty,\r\n HuntMethod,\r\n ItemType,\r\n KONDRIEU_PROB,\r\n NpcType,\r\n RARE_ENEMY_PROB,\r\n SectionId,\r\n SectionIds,\r\n Server,\r\n Episode,\r\n} from \"../domain\";\r\nimport { application_store } from \"./ApplicationStore\";\r\nimport { hunt_method_store } from \"./HuntMethodStore\";\r\nimport { item_drop_stores } from \"./ItemDropStore\";\r\nimport { item_type_stores } from \"./ItemTypeStore\";\r\nimport Logger from \"js-logger\";\r\n\r\nconst logger = Logger.get(\"stores/HuntOptimizerStore\");\r\n\r\nexport class WantedItem {\r\n @observable readonly item_type: ItemType;\r\n @observable amount: number;\r\n\r\n constructor(item_type: ItemType, amount: number) {\r\n this.item_type = item_type;\r\n this.amount = amount;\r\n }\r\n}\r\n\r\nexport class OptimalResult {\r\n readonly wanted_items: ItemType[];\r\n readonly optimal_methods: OptimalMethod[];\r\n\r\n constructor(wanted_items: ItemType[], optimal_methods: OptimalMethod[]) {\r\n this.wanted_items = wanted_items;\r\n this.optimal_methods = optimal_methods;\r\n }\r\n}\r\n\r\nexport class OptimalMethod {\r\n readonly difficulty: Difficulty;\r\n readonly section_ids: SectionId[];\r\n readonly method_name: string;\r\n readonly method_episode: Episode;\r\n readonly method_time: number;\r\n readonly runs: number;\r\n readonly total_time: number;\r\n readonly item_counts: Map<ItemType, number>;\r\n\r\n constructor(\r\n difficulty: Difficulty,\r\n section_ids: SectionId[],\r\n method_name: string,\r\n method_episode: Episode,\r\n method_time: number,\r\n runs: number,\r\n item_counts: Map<ItemType, number>\r\n ) {\r\n this.difficulty = difficulty;\r\n this.section_ids = section_ids;\r\n this.method_name = method_name;\r\n this.method_episode = method_episode;\r\n this.method_time = method_time;\r\n this.runs = runs;\r\n this.total_time = runs * method_time;\r\n this.item_counts = item_counts;\r\n }\r\n}\r\n\r\n// TODO: take into account mothmants spawned from mothverts.\r\n// TODO: take into account split slimes.\r\n// TODO: Prefer methods that don't split pan arms over methods that do.\r\n// For some reason this doesn't actually seem to be a problem, should probably investigate.\r\n// TODO: Show expected value or probability per item per method.\r\n// Can be useful when deciding which item to hunt first.\r\n// TODO: boxes.\r\nclass HuntOptimizerStore {\r\n @computed get huntable_item_types(): ItemType[] {\r\n const item_drop_store = item_drop_stores.current.value;\r\n return item_type_stores.current.value.item_types.filter(\r\n i => item_drop_store.enemy_drops.get_drops_for_item_type(i.id).length\r\n );\r\n }\r\n\r\n // TODO: wanted items per server.\r\n @observable readonly wanted_items: IObservableArray<WantedItem> = observable.array();\r\n @observable result?: OptimalResult;\r\n\r\n constructor() {\r\n this.initialize();\r\n }\r\n\r\n optimize = async () => {\r\n if (!this.wanted_items.length) {\r\n this.result = undefined;\r\n return;\r\n }\r\n\r\n // Initialize this set before awaiting data, so user changes don't affect this optimization\r\n // run from this point on.\r\n const wanted_items = new Set(\r\n this.wanted_items.filter(w => w.amount > 0).map(w => w.item_type)\r\n );\r\n\r\n const methods = await hunt_method_store.methods.current.promise;\r\n const drop_table = (await item_drop_stores.current.promise).enemy_drops;\r\n\r\n // Add a constraint per wanted item.\r\n const constraints: { [item_name: string]: { min: number } } = {};\r\n\r\n for (const wanted of this.wanted_items) {\r\n constraints[wanted.item_type.name] = { min: wanted.amount };\r\n }\r\n\r\n // Add a variable to the LP model per method per difficulty per section ID.\r\n // When a method with pan arms is encountered, two variables are added. One for the method\r\n // with migiums and hidooms and one with pan arms.\r\n // Each variable has a time property to minimize and a property per item with the number\r\n // of enemies that drop the item multiplied by the corresponding drop rate as its value.\r\n type Variable = {\r\n time: number;\r\n [item_name: string]: number;\r\n };\r\n const variables: { [method_name: string]: Variable } = {};\r\n\r\n type VariableDetails = {\r\n method: HuntMethod;\r\n difficulty: Difficulty;\r\n section_id: SectionId;\r\n split_pan_arms: boolean;\r\n };\r\n const variable_details: Map<string, VariableDetails> = new Map();\r\n\r\n for (const method of methods) {\r\n // Counts include rare enemies, so they are fractional.\r\n const counts = new Map<NpcType, number>();\r\n\r\n for (const [enemy, count] of method.enemy_counts.entries()) {\r\n const old_count = counts.get(enemy) || 0;\r\n\r\n if (enemy.rare_type == null) {\r\n counts.set(enemy, old_count + count);\r\n } else {\r\n let rate, rare_rate;\r\n\r\n if (enemy.rare_type === NpcType.Kondrieu) {\r\n rate = 1 - KONDRIEU_PROB;\r\n rare_rate = KONDRIEU_PROB;\r\n } else {\r\n rate = 1 - RARE_ENEMY_PROB;\r\n rare_rate = RARE_ENEMY_PROB;\r\n }\r\n\r\n counts.set(enemy, old_count + count * rate);\r\n counts.set(\r\n enemy.rare_type,\r\n (counts.get(enemy.rare_type) || 0) + count * rare_rate\r\n );\r\n }\r\n }\r\n\r\n // Create a secondary counts map if there are any pan arms that can be split into\r\n // migiums and hidooms.\r\n const counts_list: Map<NpcType, number>[] = [counts];\r\n const pan_arms_count = counts.get(NpcType.PanArms);\r\n\r\n if (pan_arms_count) {\r\n const split_counts = new Map(counts);\r\n\r\n split_counts.delete(NpcType.PanArms);\r\n split_counts.set(NpcType.Migium, pan_arms_count);\r\n split_counts.set(NpcType.Hidoom, pan_arms_count);\r\n\r\n counts_list.push(split_counts);\r\n }\r\n\r\n const pan_arms_2_count = counts.get(NpcType.PanArms2);\r\n\r\n if (pan_arms_2_count) {\r\n const split_counts = new Map(counts);\r\n\r\n split_counts.delete(NpcType.PanArms2);\r\n split_counts.set(NpcType.Migium2, pan_arms_2_count);\r\n split_counts.set(NpcType.Hidoom2, pan_arms_2_count);\r\n\r\n counts_list.push(split_counts);\r\n }\r\n\r\n for (let i = 0; i < counts_list.length; i++) {\r\n const counts = counts_list[i];\r\n const split_pan_arms = i === 1;\r\n\r\n for (const difficulty of Difficulties) {\r\n for (const section_id of SectionIds) {\r\n // Will contain an entry per wanted item dropped by enemies in this method/\r\n // difficulty/section ID combo.\r\n const variable: Variable = {\r\n time: method.time,\r\n };\r\n // Only add the variable if the method provides at least 1 item we want.\r\n let add_variable = false;\r\n\r\n for (const [npc_type, count] of counts.entries()) {\r\n const drop = drop_table.get_drop(difficulty, section_id, npc_type);\r\n\r\n if (drop && wanted_items.has(drop.item_type)) {\r\n const value = variable[drop.item_type.name] || 0;\r\n variable[drop.item_type.name] = value + count * drop.rate;\r\n add_variable = true;\r\n }\r\n }\r\n\r\n if (add_variable) {\r\n const name = this.full_method_name(\r\n difficulty,\r\n section_id,\r\n method,\r\n split_pan_arms\r\n );\r\n variables[name] = variable;\r\n variable_details.set(name, {\r\n method,\r\n difficulty,\r\n section_id,\r\n split_pan_arms,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n const result: {\r\n feasible: boolean;\r\n bounded: boolean;\r\n result: number;\r\n /**\r\n * Value will always be a number if result is indexed with an actual method name.\r\n */\r\n [method: string]: number | boolean;\r\n } = solver.Solve({\r\n optimize: \"time\",\r\n opType: \"min\",\r\n constraints,\r\n variables,\r\n });\r\n\r\n if (!result.feasible) {\r\n this.result = undefined;\r\n return;\r\n }\r\n\r\n const optimal_methods: OptimalMethod[] = [];\r\n\r\n // Loop over the entries in result, ignore standard properties that aren't variables.\r\n for (const [variable_name, runs_or_other] of Object.entries(result)) {\r\n const details = variable_details.get(variable_name);\r\n\r\n if (details) {\r\n const { method, difficulty, section_id, split_pan_arms } = details;\r\n const runs = runs_or_other as number;\r\n const variable = variables[variable_name];\r\n\r\n const items = new Map<ItemType, number>();\r\n\r\n for (const [item_name, expected_amount] of Object.entries(variable)) {\r\n for (const item of wanted_items) {\r\n if (item_name === item.name) {\r\n items.set(item, runs * expected_amount);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Find all section IDs that provide the same items with the same expected amount.\r\n // E.g. if you need a spread needle and a bringer's right arm, using either\r\n // purplenum or yellowboze will give you the exact same probabilities.\r\n const section_ids: SectionId[] = [];\r\n\r\n for (const sid of SectionIds) {\r\n let match_found = true;\r\n\r\n if (sid !== section_id) {\r\n const v =\r\n variables[\r\n this.full_method_name(difficulty, sid, method, split_pan_arms)\r\n ];\r\n\r\n if (!v) {\r\n match_found = false;\r\n } else {\r\n for (const item_name of Object.keys(variable)) {\r\n if (variable[item_name] !== v[item_name]) {\r\n match_found = false;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (match_found) {\r\n section_ids.push(sid);\r\n }\r\n }\r\n\r\n optimal_methods.push(\r\n new OptimalMethod(\r\n difficulty,\r\n section_ids,\r\n method.name + (split_pan_arms ? \" (Split Pan Arms)\" : \"\"),\r\n method.episode,\r\n method.time,\r\n runs,\r\n items\r\n )\r\n );\r\n }\r\n }\r\n\r\n this.result = new OptimalResult([...wanted_items], optimal_methods);\r\n };\r\n\r\n private full_method_name(\r\n difficulty: Difficulty,\r\n section_id: SectionId,\r\n method: HuntMethod,\r\n split_pan_arms: boolean\r\n ): string {\r\n let name = `${difficulty}\\t${section_id}\\t${method.id}`;\r\n if (split_pan_arms) name += \"\\tspa\";\r\n return name;\r\n }\r\n\r\n private initialize = async () => {\r\n try {\r\n await this.load_from_local_storage();\r\n autorun(this.store_in_local_storage);\r\n } catch (e) {\r\n logger.error(e);\r\n }\r\n };\r\n\r\n private load_from_local_storage = async () => {\r\n const wanted_items_json = localStorage.getItem(\r\n `HuntOptimizerStore.wantedItems.${Server[application_store.current_server]}`\r\n );\r\n\r\n if (wanted_items_json) {\r\n const item_store = await item_type_stores.current.promise;\r\n const wi: StoredWantedItem[] = JSON.parse(wanted_items_json);\r\n\r\n const wanted_items: WantedItem[] = [];\r\n\r\n for (const { itemTypeId, itemKindId, amount } of wi) {\r\n const item =\r\n itemTypeId != undefined\r\n ? item_store.get_by_id(itemTypeId)\r\n : item_store.get_by_id(itemKindId!);\r\n\r\n if (item) {\r\n wanted_items.push(new WantedItem(item, amount));\r\n }\r\n }\r\n\r\n this.wanted_items.replace(wanted_items);\r\n }\r\n };\r\n\r\n private store_in_local_storage = () => {\r\n try {\r\n localStorage.setItem(\r\n `HuntOptimizerStore.wantedItems.${Server[application_store.current_server]}`,\r\n JSON.stringify(\r\n this.wanted_items.map(\r\n ({ item_type: itemType, amount }): StoredWantedItem => ({\r\n itemTypeId: itemType.id,\r\n amount,\r\n })\r\n )\r\n )\r\n );\r\n } catch (e) {\r\n logger.error(e);\r\n }\r\n };\r\n}\r\n\r\ntype StoredWantedItem = {\r\n itemTypeId?: number; // Should only be undefined if the legacy name is still used.\r\n itemKindId?: number; // Legacy name.\r\n amount: number;\r\n};\r\n\r\nexport const hunt_optimizer_store = new HuntOptimizerStore();\r\n","import { Button, InputNumber, Popover } from \"antd\";\r\nimport { observer } from \"mobx-react\";\r\nimport React, { ReactNode, Component } from \"react\";\r\nimport { AutoSizer, Column, Table, TableCellRenderer } from \"react-virtualized\";\r\nimport { hunt_optimizer_store, WantedItem } from \"../../stores/HuntOptimizerStore\";\r\nimport { item_type_stores } from \"../../stores/ItemTypeStore\";\r\nimport { BigSelect } from \"../BigSelect\";\r\nimport \"./WantedItemsComponent.less\";\r\n\r\n@observer\r\nexport class WantedItemsComponent extends Component {\r\n state = {\r\n help_visible: false,\r\n };\r\n\r\n render(): ReactNode {\r\n // Make sure render is called on updates.\r\n hunt_optimizer_store.wanted_items.slice(0, 0);\r\n\r\n return (\r\n <section className=\"ho-WantedItemsComponent\">\r\n <h3>\r\n Wanted Items\r\n <Popover\r\n content={<Help />}\r\n trigger=\"click\"\r\n visible={this.state.help_visible}\r\n onVisibleChange={this.on_help_visible_change}\r\n >\r\n <Button icon=\"info-circle\" type=\"link\" />\r\n </Popover>\r\n </h3>\r\n <div className=\"ho-WantedItemsComponent-top-bar\">\r\n <BigSelect\r\n placeholder=\"Add an item\"\r\n value={undefined}\r\n style={{ width: 200 }}\r\n options={hunt_optimizer_store.huntable_item_types.map(itemType => ({\r\n label: itemType.name,\r\n value: itemType.id,\r\n }))}\r\n onChange={this.add_wanted}\r\n />\r\n <Button onClick={hunt_optimizer_store.optimize} style={{ marginLeft: 10 }}>\r\n Optimize\r\n </Button>\r\n </div>\r\n <div className=\"ho-WantedItemsComponent-table\">\r\n <AutoSizer>\r\n {({ width, height }) => (\r\n <Table\r\n width={width}\r\n height={height}\r\n headerHeight={30}\r\n rowHeight={30}\r\n rowCount={hunt_optimizer_store.wanted_items.length}\r\n rowGetter={({ index }) => hunt_optimizer_store.wanted_items[index]}\r\n noRowsRenderer={this.no_rows_renderer}\r\n >\r\n <Column\r\n label=\"Amount\"\r\n dataKey=\"amount\"\r\n width={70}\r\n cellRenderer={({ rowData }) => (\r\n <WantedAmountCell wantedItem={rowData} />\r\n )}\r\n />\r\n <Column\r\n label=\"Item\"\r\n dataKey=\"item\"\r\n width={150}\r\n flexGrow={1}\r\n cellDataGetter={({ rowData }) =>\r\n (rowData as WantedItem).item_type.name\r\n }\r\n />\r\n <Column\r\n dataKey=\"remove\"\r\n width={30}\r\n cellRenderer={this.table_remove_cell_renderer}\r\n />\r\n </Table>\r\n )}\r\n </AutoSizer>\r\n </div>\r\n </section>\r\n );\r\n }\r\n\r\n private add_wanted = (selected: any) => {\r\n if (selected) {\r\n let added = hunt_optimizer_store.wanted_items.find(\r\n w => w.item_type.id === selected.value\r\n );\r\n\r\n if (!added) {\r\n const item_type = item_type_stores.current.value.get_by_id(selected.value)!;\r\n hunt_optimizer_store.wanted_items.push(new WantedItem(item_type, 1));\r\n }\r\n }\r\n };\r\n\r\n private remove_wanted = (wanted: WantedItem) => () => {\r\n const i = hunt_optimizer_store.wanted_items.findIndex(w => w === wanted);\r\n\r\n if (i !== -1) {\r\n hunt_optimizer_store.wanted_items.splice(i, 1);\r\n }\r\n };\r\n\r\n private table_remove_cell_renderer: TableCellRenderer = ({ rowData }) => {\r\n return <Button type=\"link\" icon=\"delete\" onClick={this.remove_wanted(rowData)} />;\r\n };\r\n\r\n private no_rows_renderer = () => {\r\n return (\r\n <div className=\"ho-WantedItemsComponent-no-rows\">\r\n <p>\r\n Add some items with the above drop down and click \"Optimize\" to see the result\r\n on the right.\r\n </p>\r\n </div>\r\n );\r\n };\r\n\r\n private on_help_visible_change = (visible: boolean) => {\r\n this.setState({ helpVisible: visible });\r\n };\r\n}\r\n\r\nfunction Help(): JSX.Element {\r\n return (\r\n <div className=\"ho-WantedItemsComponent-help\">\r\n <p>\r\n Add some items with the drop down and click \"Optimize\" to see the optimal\r\n combination of hunt methods on the right.\r\n </p>\r\n <p>\r\n At the moment a method is simply a quest run-through. Partial quest run-throughs are\r\n coming. View the list of methods on the \"Methods\" tab. Each method takes a certain\r\n amount of time, which affects the optimization result. Make sure the times are\r\n correct for you.\r\n </p>\r\n <p>Only enemy drops are considered. Box drops are coming.</p>\r\n <p>\r\n The optimal result is calculated using linear optimization. The optimizer takes rare\r\n enemies and the fact that pan arms can be split in two into account.\r\n </p>\r\n </div>\r\n );\r\n}\r\n\r\n@observer\r\nclass WantedAmountCell extends Component<{ wantedItem: WantedItem }> {\r\n render(): ReactNode {\r\n const wanted = this.props.wantedItem;\r\n\r\n return (\r\n <InputNumber\r\n min={0}\r\n max={10}\r\n value={wanted.amount}\r\n onChange={this.wanted_amount_changed}\r\n size=\"small\"\r\n style={{ width: \"100%\" }}\r\n />\r\n );\r\n }\r\n\r\n private wanted_amount_changed = (value?: number) => {\r\n if (value != null && value >= 0) {\r\n this.props.wantedItem.amount = value;\r\n }\r\n };\r\n}\r\n","import React, { ReactNode, Component } from \"react\";\r\nimport {\r\n GridCellRenderer,\r\n Index,\r\n MultiGrid,\r\n SortDirectionType,\r\n SortDirection,\r\n} from \"react-virtualized\";\r\nimport \"./BigTable.less\";\r\n\r\nexport interface Column<T> {\r\n key?: string;\r\n name: string;\r\n width: number;\r\n cell_renderer: (record: T) => ReactNode;\r\n tooltip?: (record: T) => string;\r\n footer_value?: string;\r\n footer_tooltip?: string;\r\n /**\r\n * \"number\" and \"integrated\" have special meaning.\r\n */\r\n class_name?: string;\r\n sortable?: boolean;\r\n}\r\n\r\nexport type ColumnSort<T> = { column: Column<T>; direction: SortDirectionType };\r\n\r\n/**\r\n * A table with a fixed header. Optionally has fixed columns and a footer.\r\n * Uses windowing to support large amounts of rows and columns.\r\n * TODO: no-content message.\r\n */\r\nexport class BigTable<T> extends Component<{\r\n width: number;\r\n height: number;\r\n row_count: number;\r\n overscan_row_count?: number;\r\n columns: Column<T>[];\r\n fixed_column_count?: number;\r\n overscan_column_count?: number;\r\n record: (index: Index) => T;\r\n footer?: boolean;\r\n /**\r\n * When this changes, the DataTable will re-render.\r\n */\r\n update_trigger?: any;\r\n sort?: (sort_columns: ColumnSort<T>[]) => void;\r\n}> {\r\n private sort_columns = new Array<ColumnSort<T>>();\r\n\r\n render(): ReactNode {\r\n return (\r\n <div\r\n className=\"DataTable\"\r\n style={{ width: this.props.width, height: this.props.height }}\r\n >\r\n <MultiGrid\r\n width={this.props.width}\r\n height={this.props.height}\r\n rowHeight={26}\r\n rowCount={this.props.row_count + 1 + (this.props.footer ? 1 : 0)}\r\n fixedRowCount={1}\r\n overscanRowCount={this.props.overscan_row_count}\r\n columnWidth={this.column_width}\r\n columnCount={this.props.columns.length}\r\n fixedColumnCount={this.props.fixed_column_count}\r\n overscanColumnCount={this.props.overscan_column_count}\r\n cellRenderer={this.cell_renderer}\r\n classNameTopLeftGrid=\"DataTable-header\"\r\n classNameTopRightGrid=\"DataTable-header\"\r\n updateTigger={this.props.update_trigger}\r\n />\r\n </div>\r\n );\r\n }\r\n\r\n private column_width = ({ index }: Index): number => {\r\n return this.props.columns[index].width;\r\n };\r\n\r\n private cell_renderer: GridCellRenderer = ({ columnIndex, rowIndex, style }): ReactNode => {\r\n const column = this.props.columns[columnIndex];\r\n let cell: ReactNode;\r\n let sort_indicator: ReactNode;\r\n let title: string | undefined;\r\n const classes = [\"DataTable-cell\"];\r\n\r\n if (columnIndex === this.props.columns.length - 1) {\r\n classes.push(\"last-in-row\");\r\n }\r\n\r\n if (rowIndex === 0) {\r\n // Header row\r\n cell = title = column.name;\r\n\r\n if (column.sortable) {\r\n classes.push(\"sortable\");\r\n\r\n const sort = this.sort_columns[0];\r\n\r\n if (sort && sort.column === column) {\r\n if (sort.direction === SortDirection.ASC) {\r\n sort_indicator = (\r\n <svg\r\n className=\"DataTable-sort-indictator\"\r\n width=\"18\"\r\n height=\"18\"\r\n viewBox=\"0 0 24 24\"\r\n >\r\n <path d=\"M7 14l5-5 5 5z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n );\r\n } else {\r\n sort_indicator = (\r\n <svg\r\n className=\"DataTable-sort-indictator\"\r\n width=\"18\"\r\n height=\"18\"\r\n viewBox=\"0 0 24 24\"\r\n >\r\n <path d=\"M7 10l5 5 5-5z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n );\r\n }\r\n }\r\n }\r\n } else {\r\n // Record or footer row\r\n if (column.class_name) {\r\n classes.push(column.class_name);\r\n }\r\n\r\n if (this.props.footer && rowIndex === 1 + this.props.row_count) {\r\n // Footer row\r\n classes.push(\"footer-cell\");\r\n cell = column.footer_value == null ? \"\" : column.footer_value;\r\n title = column.footer_tooltip == null ? \"\" : column.footer_tooltip;\r\n } else {\r\n // Record row\r\n const result = this.props.record({ index: rowIndex - 1 });\r\n\r\n cell = column.cell_renderer(result);\r\n\r\n if (column.tooltip) {\r\n title = column.tooltip(result);\r\n }\r\n }\r\n }\r\n\r\n if (typeof cell !== \"string\") {\r\n classes.push(\"custom\");\r\n }\r\n\r\n const on_click =\r\n rowIndex === 0 && column.sortable ? () => this.header_clicked(column) : undefined;\r\n\r\n return (\r\n <div\r\n className={classes.join(\" \")}\r\n key={`${columnIndex}, ${rowIndex}`}\r\n style={style}\r\n title={title}\r\n onClick={on_click}\r\n >\r\n {typeof cell === \"string\" ? (\r\n <span className=\"DataTable-cell-text\">{cell}</span>\r\n ) : (\r\n cell\r\n )}\r\n {sort_indicator}\r\n </div>\r\n );\r\n };\r\n\r\n private header_clicked = (column: Column<T>): void => {\r\n const old_index = this.sort_columns.findIndex(sc => sc.column === column);\r\n let old = old_index === -1 ? undefined : this.sort_columns.splice(old_index, 1)[0];\r\n\r\n const direction =\r\n old_index === 0 && old && old.direction === SortDirection.ASC\r\n ? SortDirection.DESC\r\n : SortDirection.ASC;\r\n\r\n this.sort_columns.unshift({ column, direction });\r\n this.sort_columns.splice(10);\r\n\r\n if (this.props.sort) {\r\n this.props.sort(this.sort_columns);\r\n }\r\n };\r\n}\r\n","import React from \"react\";\r\nimport { SectionId } from \"../domain\";\r\n\r\nexport function SectionIdIcon({\r\n section_id,\r\n size = 28,\r\n title,\r\n}: {\r\n section_id: SectionId;\r\n size?: number;\r\n title?: string;\r\n}): JSX.Element {\r\n return (\r\n <div\r\n title={title}\r\n style={{\r\n display: \"inline-block\",\r\n width: size,\r\n height: size,\r\n backgroundImage: `url(${process.env.PUBLIC_URL}/images/sectionids/${SectionId[section_id]}.png)`,\r\n backgroundSize: size,\r\n }}\r\n />\r\n );\r\n}\r\n","import { computed } from \"mobx\";\r\nimport { observer } from \"mobx-react\";\r\nimport React, { Component, ReactNode } from \"react\";\r\nimport { AutoSizer, Index } from \"react-virtualized\";\r\nimport { Difficulty, Episode, SectionId } from \"../../domain\";\r\nimport { hunt_optimizer_store, OptimalMethod } from \"../../stores/HuntOptimizerStore\";\r\nimport { BigTable, Column } from \"../BigTable\";\r\nimport { SectionIdIcon } from \"../SectionIdIcon\";\r\nimport { hours_to_string } from \"../time\";\r\nimport \"./OptimizationResultComponent.less\";\r\n\r\n@observer\r\nexport class OptimizationResultComponent extends Component {\r\n @computed private get columns(): Column<OptimalMethod>[] {\r\n // Standard columns.\r\n const result = hunt_optimizer_store.result;\r\n const optimal_methods = result ? result.optimal_methods : [];\r\n let total_runs = 0;\r\n let total_time = 0;\r\n\r\n for (const method of optimal_methods) {\r\n total_runs += method.runs;\r\n total_time += method.total_time;\r\n }\r\n\r\n const columns: Column<OptimalMethod>[] = [\r\n {\r\n name: \"Difficulty\",\r\n width: 75,\r\n cell_renderer: result => Difficulty[result.difficulty],\r\n footer_value: \"Totals:\",\r\n },\r\n {\r\n name: \"Method\",\r\n width: 200,\r\n cell_renderer: result => result.method_name,\r\n tooltip: result => result.method_name,\r\n },\r\n {\r\n name: \"Ep.\",\r\n width: 34,\r\n cell_renderer: result => Episode[result.method_episode],\r\n },\r\n {\r\n name: \"Section ID\",\r\n width: 80,\r\n cell_renderer: result => (\r\n <div className=\"ho-OptimizationResultComponent-sid-col\">\r\n {result.section_ids.map(sid => (\r\n <SectionIdIcon section_id={sid} key={sid} size={20} />\r\n ))}\r\n </div>\r\n ),\r\n tooltip: result => result.section_ids.map(sid => SectionId[sid]).join(\", \"),\r\n },\r\n {\r\n name: \"Time/Run\",\r\n width: 80,\r\n cell_renderer: result => hours_to_string(result.method_time),\r\n class_name: \"number\",\r\n },\r\n {\r\n name: \"Runs\",\r\n width: 60,\r\n cell_renderer: result => result.runs.toFixed(1),\r\n tooltip: result => result.runs.toString(),\r\n footer_value: total_runs.toFixed(1),\r\n footer_tooltip: total_runs.toString(),\r\n class_name: \"number\",\r\n },\r\n {\r\n name: \"Total Hours\",\r\n width: 90,\r\n cell_renderer: result => result.total_time.toFixed(1),\r\n tooltip: result => result.total_time.toString(),\r\n footer_value: total_time.toFixed(1),\r\n footer_tooltip: total_time.toString(),\r\n class_name: \"number\",\r\n },\r\n ];\r\n\r\n // Add one column per item.\r\n if (result) {\r\n for (const item of result.wanted_items) {\r\n let totalCount = 0;\r\n\r\n for (const method of optimal_methods) {\r\n totalCount += method.item_counts.get(item) || 0;\r\n }\r\n\r\n columns.push({\r\n name: item.name,\r\n width: 80,\r\n cell_renderer: result => {\r\n const count = result.item_counts.get(item);\r\n return count ? count.toFixed(2) : \"\";\r\n },\r\n tooltip: result => {\r\n const count = result.item_counts.get(item);\r\n return count ? count.toString() : \"\";\r\n },\r\n class_name: \"number\",\r\n footer_value: totalCount.toFixed(2),\r\n footer_tooltip: totalCount.toString(),\r\n });\r\n }\r\n }\r\n\r\n return columns;\r\n }\r\n\r\n // Make sure render is called when result changes.\r\n @computed private get update_trigger(): any {\r\n return hunt_optimizer_store.result;\r\n }\r\n\r\n render(): ReactNode {\r\n this.update_trigger; // eslint-disable-line\r\n const result = hunt_optimizer_store.result;\r\n\r\n return (\r\n <section className=\"ho-OptimizationResultComponent\">\r\n <h3>Optimization Result</h3>\r\n <div className=\"ho-OptimizationResultComponent-table\">\r\n <AutoSizer>\r\n {({ width, height }) => (\r\n <BigTable\r\n width={width}\r\n height={height}\r\n row_count={result ? result.optimal_methods.length : 0}\r\n columns={this.columns}\r\n fixed_column_count={4}\r\n record={this.record}\r\n footer={result != null}\r\n update_trigger={this.update_trigger}\r\n />\r\n )}\r\n </AutoSizer>\r\n </div>\r\n </section>\r\n );\r\n }\r\n\r\n private record = ({ index }: Index): OptimalMethod => {\r\n return hunt_optimizer_store.result!.optimal_methods[index];\r\n };\r\n}\r\n","/**\r\n * @param hours can be fractional.\r\n * @returns a string of the shape ##:##.\r\n */\r\nexport function hours_to_string(hours: number): string {\r\n const h = Math.floor(hours);\r\n const m = Math.round(60 * (hours - h));\r\n return `${h.toString().padStart(2, \"0\")}:${m.toString().padStart(2, \"0\")}`;\r\n}\r\n","import React from \"react\";\r\nimport { WantedItemsComponent } from \"./WantedItemsComponent\";\r\nimport { OptimizationResultComponent } from \"./OptimizationResultComponent\";\r\nimport \"./OptimizerComponent.css\";\r\n\r\nexport function OptimizerComponent(): JSX.Element {\r\n return (\r\n <section className=\"ho-OptimizerComponent\">\r\n <WantedItemsComponent />\r\n <OptimizationResultComponent />\r\n </section>\r\n );\r\n}\r\n","import { TimePicker } from \"antd\";\r\nimport { observer } from \"mobx-react\";\r\nimport moment, { Moment } from \"moment\";\r\nimport React, { ReactNode, Component } from \"react\";\r\nimport { AutoSizer, Index, SortDirection } from \"react-virtualized\";\r\nimport { Episode, HuntMethod } from \"../../domain\";\r\nimport { EnemyNpcTypes, NpcType } from \"../../domain/NpcType\";\r\nimport { hunt_method_store } from \"../../stores/HuntMethodStore\";\r\nimport { BigTable, Column, ColumnSort } from \"../BigTable\";\r\nimport \"./MethodsComponent.css\";\r\n\r\n@observer\r\nexport class MethodsComponent extends Component {\r\n static columns: Column<HuntMethod>[] = (() => {\r\n // Standard columns.\r\n const columns: Column<HuntMethod>[] = [\r\n {\r\n key: \"name\",\r\n name: \"Method\",\r\n width: 250,\r\n cell_renderer: method => method.name,\r\n sortable: true,\r\n },\r\n {\r\n key: \"episode\",\r\n name: \"Ep.\",\r\n width: 34,\r\n cell_renderer: method => Episode[method.episode],\r\n sortable: true,\r\n },\r\n {\r\n key: \"time\",\r\n name: \"Time\",\r\n width: 50,\r\n cell_renderer: method => <TimeComponent method={method} />,\r\n class_name: \"integrated\",\r\n sortable: true,\r\n },\r\n ];\r\n\r\n // One column per enemy type.\r\n for (const enemy of EnemyNpcTypes) {\r\n columns.push({\r\n key: enemy.code,\r\n name: enemy.name,\r\n width: 75,\r\n cell_renderer: method => {\r\n const count = method.enemy_counts.get(enemy);\r\n return count == null ? \"\" : count.toString();\r\n },\r\n class_name: \"number\",\r\n sortable: true,\r\n });\r\n }\r\n\r\n return columns;\r\n })();\r\n\r\n render(): ReactNode {\r\n const methods = hunt_method_store.methods.current.value;\r\n\r\n return (\r\n <section className=\"ho-MethodsComponent\">\r\n <AutoSizer>\r\n {({ width, height }) => (\r\n <BigTable<HuntMethod>\r\n width={width}\r\n height={height}\r\n row_count={methods.length}\r\n columns={MethodsComponent.columns}\r\n fixed_column_count={3}\r\n record={this.record}\r\n sort={this.sort}\r\n update_trigger={hunt_method_store.methods.current.value}\r\n />\r\n )}\r\n </AutoSizer>\r\n </section>\r\n );\r\n }\r\n\r\n private record = ({ index }: Index) => {\r\n return hunt_method_store.methods.current.value[index];\r\n };\r\n\r\n private sort = (sorts: ColumnSort<HuntMethod>[]) => {\r\n const methods = hunt_method_store.methods.current.value.slice();\r\n\r\n methods.sort((a, b) => {\r\n for (const { column, direction } of sorts) {\r\n let cmp = 0;\r\n\r\n if (column.key === \"name\") {\r\n cmp = a.name.localeCompare(b.name);\r\n } else if (column.key === \"episode\") {\r\n cmp = a.episode - b.episode;\r\n } else if (column.key === \"time\") {\r\n cmp = a.time - b.time;\r\n } else if (column.key) {\r\n const type = NpcType.by_code(column.key);\r\n\r\n if (type) {\r\n cmp = (a.enemy_counts.get(type) || 0) - (b.enemy_counts.get(type) || 0);\r\n }\r\n }\r\n\r\n if (cmp !== 0) {\r\n return direction === SortDirection.ASC ? cmp : -cmp;\r\n }\r\n }\r\n\r\n return 0;\r\n });\r\n\r\n hunt_method_store.methods.current.value = methods;\r\n };\r\n}\r\n\r\n@observer\r\nclass TimeComponent extends React.Component<{ method: HuntMethod }> {\r\n render(): ReactNode {\r\n const time = this.props.method.time;\r\n const hour = Math.floor(time);\r\n const minute = Math.round(60 * (time - hour));\r\n\r\n return (\r\n <TimePicker\r\n className=\"ho-MethodsComponent-timepicker\"\r\n value={moment({ hour, minute })}\r\n format=\"HH:mm\"\r\n size=\"small\"\r\n allowClear={false}\r\n suffixIcon={<span />}\r\n onChange={this.change}\r\n />\r\n );\r\n }\r\n\r\n private change = (time: Moment) => {\r\n this.props.method.user_time = time.hour() + time.minute() / 60;\r\n };\r\n}\r\n","import { Tabs } from \"antd\";\r\nimport React from \"react\";\r\nimport \"./HuntOptimizerComponent.css\";\r\nimport { OptimizerComponent } from \"./OptimizerComponent\";\r\nimport { MethodsComponent } from \"./MethodsComponent\";\r\n\r\nconst TabPane = Tabs.TabPane;\r\n\r\nexport function HuntOptimizerComponent(): JSX.Element {\r\n return (\r\n <section className=\"ho-HuntOptimizerComponent\">\r\n <Tabs type=\"card\">\r\n <TabPane tab=\"Optimize\" key=\"optimize\">\r\n <OptimizerComponent />\r\n </TabPane>\r\n <TabPane tab=\"Methods\" key=\"methods\">\r\n <MethodsComponent />\r\n </TabPane>\r\n </Tabs>\r\n </section>\r\n );\r\n}\r\n","export enum Endianness {\r\n Little,\r\n Big,\r\n}\r\n","// TODO: remove dependency on text-encoding because it is no longer maintained.\r\nimport { TextDecoder, TextEncoder } from \"text-encoding\";\r\n\r\nexport const ASCII_DECODER = new TextDecoder(\"ascii\");\r\nexport const UTF_16BE_DECODER = new TextDecoder(\"utf-16be\");\r\nexport const UTF_16LE_DECODER = new TextDecoder(\"utf-16le\");\r\n\r\nexport const ASCII_ENCODER = new TextEncoder(\"ascii\");\r\nexport const UTF_16BE_ENCODER = new TextEncoder(\"utf-16be\");\r\nexport const UTF_16LE_ENCODER = new TextEncoder(\"utf-16le\");\r\n","import {\r\n ASCII_DECODER,\r\n UTF_16BE_DECODER,\r\n UTF_16BE_ENCODER,\r\n UTF_16LE_DECODER,\r\n UTF_16LE_ENCODER,\r\n} from \".\";\r\nimport { Endianness } from \"..\";\r\nimport { Cursor } from \"./Cursor\";\r\nimport { Vec3, Vec2 } from \"../vector\";\r\n\r\n/**\r\n * A cursor for reading from an array buffer or part of an array buffer.\r\n */\r\nexport class ArrayBufferCursor implements Cursor {\r\n get offset(): number {\r\n return this.dv.byteOffset;\r\n }\r\n\r\n get size(): number {\r\n return this.dv.byteLength;\r\n }\r\n\r\n set size(size: number) {\r\n this.dv = new DataView(this.buffer, this.offset, size);\r\n }\r\n\r\n protected _position: number;\r\n\r\n get position(): number {\r\n return this._position;\r\n }\r\n\r\n protected little_endian!: boolean;\r\n\r\n get endianness(): Endianness {\r\n return this.little_endian ? Endianness.Little : Endianness.Big;\r\n }\r\n\r\n set endianness(endianness: Endianness) {\r\n this.little_endian = endianness === Endianness.Little;\r\n this.utf16_decoder = this.little_endian ? UTF_16LE_DECODER : UTF_16BE_DECODER;\r\n this.utf16_encoder = this.little_endian ? UTF_16LE_ENCODER : UTF_16BE_ENCODER;\r\n }\r\n\r\n get bytes_left(): number {\r\n return this.size - this.position;\r\n }\r\n\r\n protected buffer: ArrayBuffer;\r\n protected dv: DataView;\r\n\r\n private utf16_decoder: TextDecoder = UTF_16BE_DECODER;\r\n private utf16_encoder: TextEncoder = UTF_16BE_ENCODER;\r\n\r\n /**\r\n * @param buffer The buffer to read from.\r\n * @param endianness Decides in which byte order multi-byte integers and floats will be interpreted.\r\n * @param offset The start offset of the part that will be read from.\r\n * @param size The size of the part that will be read from.\r\n */\r\n constructor(\r\n buffer: ArrayBuffer,\r\n endianness: Endianness,\r\n offset: number = 0,\r\n size: number = buffer.byteLength\r\n ) {\r\n this.buffer = buffer;\r\n this.dv = new DataView(buffer, offset, size);\r\n this.endianness = endianness;\r\n this._position = 0;\r\n }\r\n\r\n seek(offset: number): this {\r\n return this.seek_start(this.position + offset);\r\n }\r\n\r\n seek_start(offset: number): this {\r\n if (offset < 0 || offset > this.size) {\r\n throw new Error(`Offset ${offset} is out of bounds.`);\r\n }\r\n\r\n this._position = offset;\r\n return this;\r\n }\r\n\r\n seek_end(offset: number): this {\r\n if (offset < 0 || offset > this.size) {\r\n throw new Error(`Offset ${offset} is out of bounds.`);\r\n }\r\n\r\n this._position = this.size - offset;\r\n return this;\r\n }\r\n\r\n u8(): number {\r\n return this.u8_at(this._position++);\r\n }\r\n\r\n u8_at(offset: number): number {\r\n return this.dv.getUint8(offset);\r\n }\r\n\r\n u16(): number {\r\n const r = this.u16_at(this.position);\r\n this._position += 2;\r\n return r;\r\n }\r\n\r\n u16_at(offset: number): number {\r\n return this.dv.getUint16(offset, this.little_endian);\r\n }\r\n\r\n u32(): number {\r\n const r = this.u32_at(this.position);\r\n this._position += 4;\r\n return r;\r\n }\r\n\r\n u32_at(offset: number): number {\r\n return this.dv.getUint32(offset, this.little_endian);\r\n }\r\n\r\n i8(): number {\r\n return this.i8_at(this._position++);\r\n }\r\n\r\n i8_at(offset: number): number {\r\n return this.dv.getInt8(offset);\r\n }\r\n\r\n i16(): number {\r\n const r = this.i16_at(this.position);\r\n this._position += 2;\r\n return r;\r\n }\r\n\r\n i16_at(offset: number): number {\r\n return this.dv.getInt16(offset, this.little_endian);\r\n }\r\n\r\n i32(): number {\r\n const r = this.i32_at(this.position);\r\n this._position += 4;\r\n return r;\r\n }\r\n\r\n i32_at(offset: number): number {\r\n return this.dv.getInt32(offset, this.little_endian);\r\n }\r\n\r\n f32(): number {\r\n const r = this.f32_at(this.position);\r\n this._position += 4;\r\n return r;\r\n }\r\n\r\n f32_at(offset: number): number {\r\n return this.dv.getFloat32(offset, this.little_endian);\r\n }\r\n\r\n u8_array(n: number): number[] {\r\n const array = [];\r\n for (let i = 0; i < n; ++i) array.push(this.dv.getUint8(this._position++));\r\n return array;\r\n }\r\n\r\n u16_array(n: number): number[] {\r\n const array = [];\r\n\r\n for (let i = 0; i < n; ++i) {\r\n array.push(this.dv.getUint16(this.position, this.little_endian));\r\n this._position += 2;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n u32_array(n: number): number[] {\r\n const array = [];\r\n\r\n for (let i = 0; i < n; ++i) {\r\n array.push(this.dv.getUint32(this.position, this.little_endian));\r\n this._position += 4;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n vec2_f32(): Vec2 {\r\n return new Vec2(this.f32(), this.f32());\r\n }\r\n\r\n vec3_f32(): Vec3 {\r\n return new Vec3(this.f32(), this.f32(), this.f32());\r\n }\r\n\r\n take(size: number): ArrayBufferCursor {\r\n const offset = this.offset + this.position;\r\n const wrapper = new ArrayBufferCursor(this.buffer, this.endianness, offset, size);\r\n this._position += size;\r\n return wrapper;\r\n }\r\n\r\n string_ascii(\r\n max_byte_length: number,\r\n null_terminated: boolean,\r\n drop_remaining: boolean\r\n ): string {\r\n const string_length = null_terminated\r\n ? this.index_of_u8(0, max_byte_length) - this.position\r\n : max_byte_length;\r\n\r\n const view = new DataView(this.buffer, this.offset + this.position, string_length);\r\n const r = ASCII_DECODER.decode(view);\r\n\r\n this._position += drop_remaining\r\n ? max_byte_length\r\n : Math.min(string_length + 1, max_byte_length);\r\n\r\n return r;\r\n }\r\n\r\n string_utf16(\r\n max_byte_length: number,\r\n null_terminated: boolean,\r\n drop_remaining: boolean\r\n ): string {\r\n const string_length = null_terminated\r\n ? this.index_of_u16(0, max_byte_length) - this.position\r\n : Math.floor(max_byte_length / 2) * 2;\r\n\r\n const view = new DataView(this.buffer, this.offset + this.position, string_length);\r\n const r = this.utf16_decoder.decode(view);\r\n\r\n this._position += drop_remaining\r\n ? max_byte_length\r\n : Math.min(string_length + 2, max_byte_length);\r\n\r\n return r;\r\n }\r\n\r\n array_buffer(size: number = this.size - this.position): ArrayBuffer {\r\n const r = this.buffer.slice(\r\n this.offset + this.position,\r\n this.offset + this.position + size\r\n );\r\n this._position += size;\r\n return r;\r\n }\r\n\r\n copy_to_uint8_array(array: Uint8Array, size: number = this.size - this.position): this {\r\n array.set(new Uint8Array(this.buffer, this.offset + this.position, size));\r\n this._position += size;\r\n return this;\r\n }\r\n\r\n private index_of_u8(value: number, max_byte_length: number): number {\r\n const max_pos = Math.min(this.position + max_byte_length, this.size);\r\n\r\n for (let i = this.position; i < max_pos; ++i) {\r\n if (this.dv.getUint8(i) === value) {\r\n return i;\r\n }\r\n }\r\n\r\n return this.position + max_byte_length;\r\n }\r\n\r\n private index_of_u16(value: number, max_byte_length: number): number {\r\n const max_pos = Math.min(this.position + max_byte_length, this.size);\r\n\r\n for (let i = this.position; i < max_pos; i += 2) {\r\n if (this.dv.getUint16(i, this.little_endian) === value) {\r\n return i;\r\n }\r\n }\r\n\r\n return this.position + max_byte_length;\r\n }\r\n}\r\n","import { Cursor } from \"../cursor/Cursor\";\r\n\r\nexport type Rel = {\r\n data_offset: number;\r\n index: RelIndexEntry[];\r\n};\r\n\r\nexport type RelIndexEntry = {\r\n offset: number;\r\n size: number;\r\n};\r\n\r\nexport function parse_rel(cursor: Cursor, parse_index: boolean): Rel {\r\n cursor.seek_end(32);\r\n\r\n const index_offset = cursor.u32();\r\n const index_size = cursor.u32();\r\n cursor.seek(8); // Typically 1, 0, 0,...\r\n const data_offset = cursor.u32();\r\n // Typically followed by 12 nul bytes.\r\n\r\n cursor.seek_start(index_offset);\r\n const index = parse_index ? parse_indices(cursor, index_size) : [];\r\n\r\n return { data_offset, index };\r\n}\r\n\r\nfunction parse_indices(cursor: Cursor, index_size: number): RelIndexEntry[] {\r\n const compact_offsets = cursor.u16_array(index_size);\r\n const index: RelIndexEntry[] = [];\r\n let expanded_offset = 0;\r\n\r\n for (const compact_offset of compact_offsets) {\r\n expanded_offset = expanded_offset + 4 * compact_offset;\r\n\r\n // Size is not always present.\r\n cursor.seek_start(expanded_offset - 4);\r\n const size = cursor.u32();\r\n const offset = cursor.u32();\r\n index.push({ offset, size });\r\n }\r\n\r\n return index;\r\n}\r\n","import { Cursor } from \"../cursor/Cursor\";\r\nimport { Vec3 } from \"../vector\";\r\nimport { parse_rel } from \"./rel\";\r\n\r\nexport type CollisionObject = {\r\n meshes: CollisionMesh[];\r\n};\r\n\r\nexport type CollisionMesh = {\r\n vertices: Vec3[];\r\n triangles: CollisionTriangle[];\r\n};\r\n\r\nexport type CollisionTriangle = {\r\n indices: [number, number, number];\r\n flags: number;\r\n normal: Vec3;\r\n};\r\n\r\nexport function parse_area_collision_geometry(cursor: Cursor): CollisionObject {\r\n const { data_offset } = parse_rel(cursor, false);\r\n cursor.seek_start(data_offset);\r\n const main_offset_table_offset = cursor.u32();\r\n cursor.seek_start(main_offset_table_offset);\r\n\r\n const object: CollisionObject = {\r\n meshes: [],\r\n };\r\n\r\n while (cursor.bytes_left) {\r\n const start_pos = cursor.position;\r\n\r\n const block_trailer_offset = cursor.u32();\r\n\r\n if (block_trailer_offset === 0) {\r\n break;\r\n }\r\n\r\n const mesh: CollisionMesh = {\r\n vertices: [],\r\n triangles: [],\r\n };\r\n object.meshes.push(mesh);\r\n\r\n cursor.seek_start(block_trailer_offset);\r\n\r\n const vertex_count = cursor.u32();\r\n const vertex_table_offset = cursor.u32();\r\n const triangle_count = cursor.u32();\r\n const triangle_table_offset = cursor.u32();\r\n\r\n cursor.seek_start(vertex_table_offset);\r\n\r\n for (let i = 0; i < vertex_count; i++) {\r\n const x = cursor.f32();\r\n const y = cursor.f32();\r\n const z = cursor.f32();\r\n\r\n mesh.vertices.push(new Vec3(x, y, z));\r\n }\r\n\r\n cursor.seek_start(triangle_table_offset);\r\n\r\n for (let i = 0; i < triangle_count; i++) {\r\n const v1 = cursor.u16();\r\n const v2 = cursor.u16();\r\n const v3 = cursor.u16();\r\n const flags = cursor.u16();\r\n const n_x = cursor.f32();\r\n const n_y = cursor.f32();\r\n const n_z = cursor.f32();\r\n cursor.seek(16);\r\n\r\n mesh.triangles.push({\r\n indices: [v1, v2, v3],\r\n flags,\r\n normal: new Vec3(n_x, n_y, n_z),\r\n });\r\n }\r\n\r\n cursor.seek_start(start_pos + 24);\r\n }\r\n\r\n return object;\r\n}\r\n","import { Cursor } from \"../cursor/Cursor\";\r\n\r\nexport type IffChunk = {\r\n /**\r\n * 32-bit unsigned integer.\r\n */\r\n type: number;\r\n data: Cursor;\r\n};\r\n\r\n/**\r\n * PSO uses a little endian variant of the IFF format.\r\n * IFF files contain chunks preceded by an 8-byte header.\r\n * The header consists of 4 ASCII characters for the \"Type ID\" and a 32-bit integer specifying the chunk size.\r\n */\r\nexport function parse_iff(cursor: Cursor): IffChunk[] {\r\n const chunks: IffChunk[] = [];\r\n\r\n while (cursor.bytes_left) {\r\n const type = cursor.u32();\r\n const size = cursor.u32();\r\n\r\n if (size > cursor.bytes_left) {\r\n break;\r\n }\r\n\r\n chunks.push({\r\n type,\r\n data: cursor.take(size),\r\n });\r\n }\r\n\r\n return chunks;\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\nimport { Vec2, Vec3 } from \"../../vector\";\r\n\r\nconst logger = Logger.get(\"data_formats/parsing/ninja/njcm\");\r\n\r\n// TODO:\r\n// - colors\r\n// - bump maps\r\n\r\nexport type NjcmModel = {\r\n type: \"njcm\";\r\n /**\r\n * Sparse array of vertices.\r\n */\r\n vertices: NjcmVertex[];\r\n meshes: NjcmTriangleStrip[];\r\n collision_sphere_center: Vec3;\r\n collision_sphere_radius: number;\r\n};\r\n\r\nexport type NjcmVertex = {\r\n position: Vec3;\r\n normal?: Vec3;\r\n bone_weight: number;\r\n bone_weight_status: number;\r\n calc_continue: boolean;\r\n};\r\n\r\nenum NjcmChunkType {\r\n Unknown,\r\n Null,\r\n Bits,\r\n CachePolygonList,\r\n DrawPolygonList,\r\n Tiny,\r\n Material,\r\n Vertex,\r\n Volume,\r\n Strip,\r\n End,\r\n}\r\n\r\ntype NjcmChunk = {\r\n type: NjcmChunkType;\r\n type_id: number;\r\n} & (\r\n | NjcmUnknownChunk\r\n | NjcmNullChunk\r\n | NjcmBitsChunk\r\n | NjcmCachePolygonListChunk\r\n | NjcmDrawPolygonListChunk\r\n | NjcmTinyChunk\r\n | NjcmMaterialChunk\r\n | NjcmVertexChunk\r\n | NjcmVolumeChunk\r\n | NjcmStripChunk\r\n | NjcmEndChunk);\r\n\r\ntype NjcmUnknownChunk = {\r\n type: NjcmChunkType.Unknown;\r\n};\r\n\r\ntype NjcmNullChunk = {\r\n type: NjcmChunkType.Null;\r\n};\r\n\r\ntype NjcmBitsChunk = {\r\n type: NjcmChunkType.Bits;\r\n};\r\n\r\ntype NjcmCachePolygonListChunk = {\r\n type: NjcmChunkType.CachePolygonList;\r\n cache_index: number;\r\n offset: number;\r\n};\r\n\r\ntype NjcmDrawPolygonListChunk = {\r\n type: NjcmChunkType.DrawPolygonList;\r\n cache_index: number;\r\n};\r\n\r\ntype NjcmTinyChunk = {\r\n type: NjcmChunkType.Tiny;\r\n flip_u: boolean;\r\n flip_v: boolean;\r\n clamp_u: boolean;\r\n clamp_v: boolean;\r\n mipmap_d_adjust: number;\r\n filter_mode: number;\r\n super_sample: boolean;\r\n texture_id: number;\r\n};\r\n\r\ntype NjcmMaterialChunk = {\r\n type: NjcmChunkType.Material;\r\n};\r\n\r\ntype NjcmVertexChunk = {\r\n type: NjcmChunkType.Vertex;\r\n vertices: NjcmChunkVertex[];\r\n};\r\n\r\ntype NjcmVolumeChunk = {\r\n type: NjcmChunkType.Volume;\r\n};\r\n\r\ntype NjcmStripChunk = {\r\n type: NjcmChunkType.Strip;\r\n triangle_strips: NjcmTriangleStrip[];\r\n};\r\n\r\ntype NjcmEndChunk = {\r\n type: NjcmChunkType.End;\r\n};\r\n\r\ntype NjcmChunkVertex = {\r\n index: number;\r\n position: Vec3;\r\n normal?: Vec3;\r\n bone_weight: number;\r\n bone_weight_status: number;\r\n calc_continue: boolean;\r\n};\r\n\r\ntype NjcmTriangleStrip = {\r\n ignore_light: boolean;\r\n ignore_specular: boolean;\r\n ignore_ambient: boolean;\r\n use_alpha: boolean;\r\n double_side: boolean;\r\n flat_shading: boolean;\r\n environment_mapping: boolean;\r\n clockwise_winding: boolean;\r\n has_tex_coords: boolean;\r\n has_normal: boolean;\r\n texture_id?: number;\r\n vertices: NjcmMeshVertex[];\r\n};\r\n\r\ntype NjcmMeshVertex = {\r\n index: number;\r\n normal?: Vec3;\r\n tex_coords?: Vec2;\r\n};\r\n\r\nexport function parse_njcm_model(cursor: Cursor, cached_chunk_offsets: number[]): NjcmModel {\r\n const vlist_offset = cursor.u32(); // Vertex list\r\n const plist_offset = cursor.u32(); // Triangle strip index list\r\n const bounding_sphere_center = cursor.vec3_f32();\r\n const bounding_sphere_radius = cursor.f32();\r\n const vertices: NjcmVertex[] = [];\r\n const meshes: NjcmTriangleStrip[] = [];\r\n\r\n if (vlist_offset) {\r\n cursor.seek_start(vlist_offset);\r\n\r\n for (const chunk of parse_chunks(cursor, cached_chunk_offsets, true)) {\r\n if (chunk.type === NjcmChunkType.Vertex) {\r\n for (const vertex of chunk.vertices) {\r\n vertices[vertex.index] = {\r\n position: vertex.position,\r\n normal: vertex.normal,\r\n bone_weight: vertex.bone_weight,\r\n bone_weight_status: vertex.bone_weight_status,\r\n calc_continue: vertex.calc_continue,\r\n };\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (plist_offset) {\r\n cursor.seek_start(plist_offset);\r\n\r\n let texture_id: number | undefined;\r\n\r\n for (const chunk of parse_chunks(cursor, cached_chunk_offsets, false)) {\r\n if (chunk.type === NjcmChunkType.Tiny) {\r\n texture_id = chunk.texture_id;\r\n } else if (chunk.type === NjcmChunkType.Strip) {\r\n for (const strip of chunk.triangle_strips) {\r\n strip.texture_id = texture_id;\r\n }\r\n\r\n meshes.push(...chunk.triangle_strips);\r\n }\r\n }\r\n }\r\n\r\n return {\r\n type: \"njcm\",\r\n vertices,\r\n meshes,\r\n collision_sphere_center: bounding_sphere_center,\r\n collision_sphere_radius: bounding_sphere_radius,\r\n };\r\n}\r\n\r\n// TODO: don't reparse when DrawPolygonList chunk is encountered.\r\nfunction parse_chunks(\r\n cursor: Cursor,\r\n cached_chunk_offsets: number[],\r\n wide_end_chunks: boolean\r\n): NjcmChunk[] {\r\n const chunks: NjcmChunk[] = [];\r\n let loop = true;\r\n\r\n while (loop) {\r\n const type_id = cursor.u8();\r\n const flags = cursor.u8();\r\n const chunk_start_position = cursor.position;\r\n let size = 0;\r\n\r\n if (type_id === 0) {\r\n chunks.push({\r\n type: NjcmChunkType.Null,\r\n type_id,\r\n });\r\n } else if (1 <= type_id && type_id <= 3) {\r\n chunks.push({\r\n type: NjcmChunkType.Bits,\r\n type_id,\r\n });\r\n } else if (type_id === 4) {\r\n const cache_index = flags;\r\n const offset = cursor.position;\r\n chunks.push({\r\n type: NjcmChunkType.CachePolygonList,\r\n type_id,\r\n cache_index,\r\n offset,\r\n });\r\n cached_chunk_offsets[cache_index] = offset;\r\n loop = false;\r\n } else if (type_id === 5) {\r\n const cache_index = flags;\r\n const cached_offset = cached_chunk_offsets[cache_index];\r\n\r\n if (cached_offset != null) {\r\n cursor.seek_start(cached_offset);\r\n chunks.push(...parse_chunks(cursor, cached_chunk_offsets, wide_end_chunks));\r\n }\r\n\r\n chunks.push({\r\n type: NjcmChunkType.DrawPolygonList,\r\n type_id,\r\n cache_index,\r\n });\r\n } else if (8 <= type_id && type_id <= 9) {\r\n size = 2;\r\n const texture_bits_and_id = cursor.u16();\r\n chunks.push({\r\n type: NjcmChunkType.Tiny,\r\n type_id,\r\n flip_u: (type_id & 0x80) !== 0,\r\n flip_v: (type_id & 0x40) !== 0,\r\n clamp_u: (type_id & 0x20) !== 0,\r\n clamp_v: (type_id & 0x10) !== 0,\r\n mipmap_d_adjust: type_id & 0b1111,\r\n filter_mode: texture_bits_and_id >>> 14,\r\n super_sample: (texture_bits_and_id & 0x40) !== 0,\r\n texture_id: texture_bits_and_id & 0x1fff,\r\n });\r\n } else if (17 <= type_id && type_id <= 31) {\r\n size = 2 + 2 * cursor.u16();\r\n chunks.push({\r\n type: NjcmChunkType.Material,\r\n type_id,\r\n });\r\n } else if (32 <= type_id && type_id <= 50) {\r\n size = 2 + 4 * cursor.u16();\r\n chunks.push({\r\n type: NjcmChunkType.Vertex,\r\n type_id,\r\n vertices: parse_vertex_chunk(cursor, type_id, flags),\r\n });\r\n } else if (56 <= type_id && type_id <= 58) {\r\n size = 2 + 2 * cursor.u16();\r\n chunks.push({\r\n type: NjcmChunkType.Volume,\r\n type_id,\r\n });\r\n } else if (64 <= type_id && type_id <= 75) {\r\n size = 2 + 2 * cursor.u16();\r\n chunks.push({\r\n type: NjcmChunkType.Strip,\r\n type_id,\r\n triangle_strips: parse_triangle_strip_chunk(cursor, type_id, flags),\r\n });\r\n } else if (type_id === 255) {\r\n size = wide_end_chunks ? 2 : 0;\r\n chunks.push({\r\n type: NjcmChunkType.End,\r\n type_id,\r\n });\r\n loop = false;\r\n } else {\r\n size = 2 + 2 * cursor.u16();\r\n chunks.push({\r\n type: NjcmChunkType.Unknown,\r\n type_id,\r\n });\r\n logger.warn(`Unknown chunk type ${type_id} at offset ${chunk_start_position}.`);\r\n }\r\n\r\n cursor.seek_start(chunk_start_position + size);\r\n }\r\n\r\n return chunks;\r\n}\r\n\r\nfunction parse_vertex_chunk(\r\n cursor: Cursor,\r\n chunk_type_id: number,\r\n flags: number\r\n): NjcmChunkVertex[] {\r\n if (chunk_type_id < 32 || chunk_type_id > 50) {\r\n logger.warn(`Unknown vertex chunk type ${chunk_type_id}.`);\r\n return [];\r\n }\r\n\r\n const bone_weight_status = flags & 0b11;\r\n const calc_continue = (flags & 0x80) !== 0;\r\n\r\n const index = cursor.u16();\r\n const vertex_count = cursor.u16();\r\n\r\n const vertices: NjcmChunkVertex[] = [];\r\n\r\n for (let i = 0; i < vertex_count; ++i) {\r\n const vertex: NjcmChunkVertex = {\r\n index: index + i,\r\n position: cursor.vec3_f32(),\r\n bone_weight: 1,\r\n bone_weight_status,\r\n calc_continue,\r\n };\r\n\r\n if (chunk_type_id === 32) {\r\n // NJD_CV_SH\r\n cursor.seek(4); // Always 1.0\r\n } else if (chunk_type_id === 33) {\r\n // NJD_CV_VN_SH\r\n cursor.seek(4); // Always 1.0\r\n vertex.normal = cursor.vec3_f32();\r\n cursor.seek(4); // Always 0.0\r\n } else if (35 <= chunk_type_id && chunk_type_id <= 40) {\r\n if (chunk_type_id === 37) {\r\n // NJD_CV_NF\r\n // NinjaFlags32\r\n vertex.index = index + cursor.u16();\r\n vertex.bone_weight = cursor.u16() / 255;\r\n } else {\r\n // Skip user flags and material information.\r\n cursor.seek(4);\r\n }\r\n } else if (41 <= chunk_type_id && chunk_type_id <= 47) {\r\n vertex.normal = cursor.vec3_f32();\r\n\r\n if (chunk_type_id >= 42) {\r\n if (chunk_type_id === 44) {\r\n // NJD_CV_VN_NF\r\n // NinjaFlags32\r\n vertex.index = index + cursor.u16();\r\n vertex.bone_weight = cursor.u16() / 255;\r\n } else {\r\n // Skip user flags and material information.\r\n cursor.seek(4);\r\n }\r\n }\r\n } else if (48 <= chunk_type_id && chunk_type_id <= 50) {\r\n // 32-Bit vertex normal in format: reserved(2)|x(10)|y(10)|z(10)\r\n const normal = cursor.u32();\r\n vertex.normal = new Vec3(\r\n ((normal >> 20) & 0x3ff) / 0x3ff,\r\n ((normal >> 10) & 0x3ff) / 0x3ff,\r\n (normal & 0x3ff) / 0x3ff\r\n );\r\n\r\n if (chunk_type_id >= 49) {\r\n // Skip user flags and material information.\r\n cursor.seek(4);\r\n }\r\n }\r\n\r\n vertices.push(vertex);\r\n }\r\n\r\n return vertices;\r\n}\r\n\r\nfunction parse_triangle_strip_chunk(\r\n cursor: Cursor,\r\n chunk_type_id: number,\r\n flags: number\r\n): NjcmTriangleStrip[] {\r\n const render_flags = {\r\n ignore_light: (flags & 0b1) !== 0,\r\n ignore_specular: (flags & 0b10) !== 0,\r\n ignore_ambient: (flags & 0b100) !== 0,\r\n use_alpha: (flags & 0b1000) !== 0,\r\n double_side: (flags & 0b10000) !== 0,\r\n flat_shading: (flags & 0b100000) !== 0,\r\n environment_mapping: (flags & 0b1000000) !== 0,\r\n };\r\n const user_offset_and_strip_count = cursor.u16();\r\n const user_flags_size = user_offset_and_strip_count >>> 14;\r\n const strip_count = user_offset_and_strip_count & 0x3fff;\r\n\r\n let has_tex_coords = false;\r\n let has_color = false;\r\n let has_normal = false;\r\n let has_double_tex_coords = false;\r\n\r\n switch (chunk_type_id) {\r\n case 64:\r\n break;\r\n case 65:\r\n case 66:\r\n has_tex_coords = true;\r\n break;\r\n case 67:\r\n has_normal = true;\r\n break;\r\n case 68:\r\n case 69:\r\n has_tex_coords = true;\r\n has_normal = true;\r\n break;\r\n case 70:\r\n has_color = true;\r\n break;\r\n case 71:\r\n case 72:\r\n has_tex_coords = true;\r\n has_color = true;\r\n break;\r\n case 73:\r\n break;\r\n case 74:\r\n case 75:\r\n has_double_tex_coords = true;\r\n break;\r\n default:\r\n throw new Error(`Unexpected chunk type ID: ${chunk_type_id}.`);\r\n }\r\n\r\n const strips: NjcmTriangleStrip[] = [];\r\n\r\n for (let i = 0; i < strip_count; ++i) {\r\n const winding_flag_and_index_count = cursor.i16();\r\n const clockwise_winding = winding_flag_and_index_count < 1;\r\n const index_count = Math.abs(winding_flag_and_index_count);\r\n\r\n const vertices: NjcmMeshVertex[] = [];\r\n\r\n for (let j = 0; j < index_count; ++j) {\r\n const vertex: NjcmMeshVertex = {\r\n index: cursor.u16(),\r\n };\r\n vertices.push(vertex);\r\n\r\n if (has_tex_coords) {\r\n vertex.tex_coords = new Vec2(cursor.u16() / 255, cursor.u16() / 255);\r\n }\r\n\r\n // Ignore ARGB8888 color.\r\n if (has_color) {\r\n cursor.seek(4);\r\n }\r\n\r\n if (has_normal) {\r\n vertex.normal = new Vec3(\r\n cursor.u16() / 255,\r\n cursor.u16() / 255,\r\n cursor.u16() / 255\r\n );\r\n }\r\n\r\n // Ignore double texture coordinates (Ua, Vb, Ua, Vb).\r\n if (has_double_tex_coords) {\r\n cursor.seek(8);\r\n }\r\n\r\n // User flags start at the third vertex because they are per-triangle.\r\n if (j >= 2) {\r\n cursor.seek(2 * user_flags_size);\r\n }\r\n }\r\n\r\n strips.push({\r\n ...render_flags,\r\n clockwise_winding,\r\n has_tex_coords,\r\n has_normal,\r\n vertices,\r\n });\r\n }\r\n\r\n return strips;\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\nimport { Vec2, Vec3 } from \"../../vector\";\r\n\r\nconst logger = Logger.get(\"data_formats/parsing/ninja/xj\");\r\n\r\n// TODO:\r\n// - vertex colors\r\n// - bump maps\r\n\r\nexport type XjModel = {\r\n type: \"xj\";\r\n vertices: XjVertex[];\r\n meshes: XjMesh[];\r\n collision_sphere_position: Vec3;\r\n collision_sphere_radius: number;\r\n};\r\n\r\nexport type XjVertex = {\r\n position: Vec3;\r\n normal?: Vec3;\r\n uv?: Vec2;\r\n};\r\n\r\nexport type XjMesh = {\r\n material_properties: XjMaterialProperties;\r\n indices: number[];\r\n};\r\n\r\nexport type XjMaterialProperties = {\r\n alpha_src?: number;\r\n alpha_dst?: number;\r\n texture_id?: number;\r\n diffuse_r?: number;\r\n diffuse_g?: number;\r\n diffuse_b?: number;\r\n diffuse_a?: number;\r\n};\r\n\r\nexport function parse_xj_model(cursor: Cursor): XjModel {\r\n cursor.seek(4); // Flags according to QEdit, seemingly always 0.\r\n const vertex_info_table_offset = cursor.u32();\r\n const vertex_info_count = cursor.u32();\r\n const triangle_strip_table_offset = cursor.u32();\r\n const triangle_strip_count = cursor.u32();\r\n const transparent_triangle_strip_table_offset = cursor.u32();\r\n const transparent_triangle_strip_count = cursor.u32();\r\n const collision_sphere_position = cursor.vec3_f32();\r\n const collision_sphere_radius = cursor.f32();\r\n\r\n const model: XjModel = {\r\n type: \"xj\",\r\n vertices: [],\r\n meshes: [],\r\n collision_sphere_position,\r\n collision_sphere_radius,\r\n };\r\n\r\n if (vertex_info_count >= 1) {\r\n if (vertex_info_count > 1) {\r\n logger.warn(`Vertex info count of ${vertex_info_count} was larger than expected.`);\r\n }\r\n\r\n cursor.seek_start(vertex_info_table_offset);\r\n const vertex_type = cursor.u16();\r\n cursor.seek(2); // Flags?\r\n const vertex_table_offset = cursor.u32();\r\n const vertex_size = cursor.u32();\r\n const vertex_count = cursor.u32();\r\n\r\n for (let i = 0; i < vertex_count; ++i) {\r\n cursor.seek_start(vertex_table_offset + i * vertex_size);\r\n\r\n const position = cursor.vec3_f32();\r\n let normal: Vec3 | undefined;\r\n let uv: Vec2 | undefined;\r\n\r\n switch (vertex_type) {\r\n case 3:\r\n normal = cursor.vec3_f32();\r\n uv = cursor.vec2_f32();\r\n break;\r\n case 4:\r\n // Skip 4 bytes.\r\n break;\r\n case 5:\r\n cursor.seek(4);\r\n uv = cursor.vec2_f32();\r\n break;\r\n case 6:\r\n normal = cursor.vec3_f32();\r\n // Skip 4 bytes.\r\n break;\r\n case 7:\r\n normal = cursor.vec3_f32();\r\n uv = cursor.vec2_f32();\r\n break;\r\n default:\r\n logger.warn(`Unknown vertex type ${vertex_type} with size ${vertex_size}.`);\r\n break;\r\n }\r\n\r\n // if (vertex_size === 28 || vertex_size === 32 || vertex_size === 36) {\r\n // normal = cursor.vec3_f32();\r\n // }\r\n\r\n // if (vertex_size === 24 || vertex_size === 32 || vertex_size === 36) {\r\n // uv = cursor.vec2_f32();\r\n // }\r\n\r\n model.vertices.push({\r\n position,\r\n normal,\r\n uv,\r\n });\r\n }\r\n }\r\n\r\n if (triangle_strip_table_offset) {\r\n model.meshes.push(\r\n ...parse_triangle_strip_table(cursor, triangle_strip_table_offset, triangle_strip_count)\r\n );\r\n }\r\n\r\n if (transparent_triangle_strip_table_offset) {\r\n model.meshes.push(\r\n ...parse_triangle_strip_table(\r\n cursor,\r\n transparent_triangle_strip_table_offset,\r\n transparent_triangle_strip_count\r\n )\r\n );\r\n }\r\n\r\n return model;\r\n}\r\n\r\nfunction parse_triangle_strip_table(\r\n cursor: Cursor,\r\n triangle_strip_list_offset: number,\r\n triangle_strip_count: number\r\n): XjMesh[] {\r\n const strips: XjMesh[] = [];\r\n\r\n for (let i = 0; i < triangle_strip_count; ++i) {\r\n cursor.seek_start(triangle_strip_list_offset + i * 20);\r\n\r\n const material_table_offset = cursor.u32();\r\n const material_table_size = cursor.u32();\r\n const index_list_offset = cursor.u32();\r\n const index_count = cursor.u32();\r\n\r\n const material_properties = parse_triangle_strip_material_properties(\r\n cursor,\r\n material_table_offset,\r\n material_table_size\r\n );\r\n\r\n cursor.seek_start(index_list_offset);\r\n const indices = cursor.u16_array(index_count);\r\n\r\n strips.push({\r\n material_properties,\r\n indices,\r\n });\r\n }\r\n\r\n return strips;\r\n}\r\n\r\nfunction parse_triangle_strip_material_properties(\r\n cursor: Cursor,\r\n offset: number,\r\n size: number\r\n): XjMaterialProperties {\r\n const props: XjMaterialProperties = {};\r\n\r\n for (let i = 0; i < size; ++i) {\r\n cursor.seek_start(offset + i * 16);\r\n\r\n const type = cursor.u32();\r\n\r\n switch (type) {\r\n case 2:\r\n props.alpha_src = cursor.u32();\r\n props.alpha_dst = cursor.u32();\r\n break;\r\n case 3:\r\n props.texture_id = cursor.u32();\r\n break;\r\n case 5:\r\n {\r\n const rgba = cursor.u32();\r\n props.diffuse_r = (rgba & 0xff) / 0xff;\r\n props.diffuse_g = ((rgba >>> 8) & 0xff) / 0xff;\r\n props.diffuse_b = ((rgba >>> 16) & 0xff) / 0xff;\r\n props.diffuse_a = ((rgba >>> 24) & 0xff) / 0xff;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return props;\r\n}\r\n","import { Cursor } from \"../../cursor/Cursor\";\r\nimport { Vec3 } from \"../../vector\";\r\nimport { parse_iff } from \"../iff\";\r\nimport { NjcmModel, parse_njcm_model } from \"./njcm\";\r\nimport { parse_xj_model, XjModel } from \"./xj\";\r\n\r\nexport const ANGLE_TO_RAD = (2 * Math.PI) / 0xffff;\r\n\r\nconst NJCM = 0x4d434a4e;\r\n\r\nexport type NjModel = NjcmModel | XjModel;\r\n\r\nexport function is_njcm_model(model: NjModel): model is NjcmModel {\r\n return model.type === \"njcm\";\r\n}\r\n\r\nexport function is_xj_model(model: NjModel): model is XjModel {\r\n return model.type === \"xj\";\r\n}\r\n\r\nexport class NjObject<M extends NjModel> {\r\n evaluation_flags: NjEvaluationFlags;\r\n model: M | undefined;\r\n position: Vec3;\r\n rotation: Vec3; // Euler angles in radians.\r\n scale: Vec3;\r\n children: NjObject<M>[];\r\n\r\n private bone_cache = new Map<number, NjObject<M> | null>();\r\n private _bone_count = -1;\r\n\r\n constructor(\r\n evaluation_flags: NjEvaluationFlags,\r\n model: M | undefined,\r\n position: Vec3,\r\n rotation: Vec3, // Euler angles in radians.\r\n scale: Vec3,\r\n children: NjObject<M>[]\r\n ) {\r\n this.evaluation_flags = evaluation_flags;\r\n this.model = model;\r\n this.position = position;\r\n this.rotation = rotation;\r\n this.scale = scale;\r\n this.children = children;\r\n }\r\n\r\n bone_count(): number {\r\n if (this._bone_count === -1) {\r\n const id_ref: [number] = [0];\r\n this.get_bone_internal(this, Infinity, id_ref);\r\n this._bone_count = id_ref[0];\r\n }\r\n\r\n return this._bone_count;\r\n }\r\n\r\n get_bone(bone_id: number): NjObject<M> | undefined {\r\n let bone = this.bone_cache.get(bone_id);\r\n\r\n // Strict check because null means there's no bone with this id.\r\n if (bone === undefined) {\r\n bone = this.get_bone_internal(this, bone_id, [0]);\r\n this.bone_cache.set(bone_id, bone || null);\r\n }\r\n\r\n return bone || undefined;\r\n }\r\n\r\n private get_bone_internal(\r\n object: NjObject<M>,\r\n bone_id: number,\r\n id_ref: [number]\r\n ): NjObject<M> | undefined {\r\n if (!object.evaluation_flags.skip) {\r\n const id = id_ref[0]++;\r\n this.bone_cache.set(id, object);\r\n\r\n if (id === bone_id) {\r\n return object;\r\n }\r\n }\r\n\r\n if (!object.evaluation_flags.break_child_trace) {\r\n for (const child of object.children) {\r\n const bone = this.get_bone_internal(child, bone_id, id_ref);\r\n if (bone) return bone;\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport type NjEvaluationFlags = {\r\n no_translate: boolean;\r\n no_rotate: boolean;\r\n no_scale: boolean;\r\n hidden: boolean;\r\n break_child_trace: boolean;\r\n zxy_rotation_order: boolean;\r\n skip: boolean;\r\n shape_skip: boolean;\r\n};\r\n\r\nexport function parse_nj(cursor: Cursor): NjObject<NjcmModel>[] {\r\n return parse_ninja(cursor, parse_njcm_model, []);\r\n}\r\n\r\nexport function parse_xj(cursor: Cursor): NjObject<XjModel>[] {\r\n return parse_ninja(cursor, parse_xj_model, undefined);\r\n}\r\n\r\nfunction parse_ninja<M extends NjModel>(\r\n cursor: Cursor,\r\n parse_model: (cursor: Cursor, context: any) => M,\r\n context: any\r\n): NjObject<M>[] {\r\n // POF0 and other chunks types are ignored.\r\n return parse_iff(cursor)\r\n .filter(chunk => chunk.type === NJCM)\r\n .flatMap(chunk => parse_sibling_objects(chunk.data, parse_model, context));\r\n}\r\n\r\n// TODO: cache model and object offsets so we don't reparse the same data.\r\nfunction parse_sibling_objects<M extends NjModel>(\r\n cursor: Cursor,\r\n parse_model: (cursor: Cursor, context: any) => M,\r\n context: any\r\n): NjObject<M>[] {\r\n const eval_flags = cursor.u32();\r\n const no_translate = (eval_flags & 0b1) !== 0;\r\n const no_rotate = (eval_flags & 0b10) !== 0;\r\n const no_scale = (eval_flags & 0b100) !== 0;\r\n const hidden = (eval_flags & 0b1000) !== 0;\r\n const break_child_trace = (eval_flags & 0b10000) !== 0;\r\n const zxy_rotation_order = (eval_flags & 0b100000) !== 0;\r\n const skip = (eval_flags & 0b1000000) !== 0;\r\n const shape_skip = (eval_flags & 0b10000000) !== 0;\r\n\r\n const model_offset = cursor.u32();\r\n const pos_x = cursor.f32();\r\n const pos_y = cursor.f32();\r\n const pos_z = cursor.f32();\r\n const rotation_x = cursor.i32() * ANGLE_TO_RAD;\r\n const rotation_y = cursor.i32() * ANGLE_TO_RAD;\r\n const rotation_z = cursor.i32() * ANGLE_TO_RAD;\r\n const scale_x = cursor.f32();\r\n const scale_y = cursor.f32();\r\n const scale_z = cursor.f32();\r\n const child_offset = cursor.u32();\r\n const sibling_offset = cursor.u32();\r\n\r\n let model: M | undefined;\r\n let children: NjObject<M>[];\r\n let siblings: NjObject<M>[];\r\n\r\n if (model_offset) {\r\n cursor.seek_start(model_offset);\r\n model = parse_model(cursor, context);\r\n }\r\n\r\n if (child_offset) {\r\n cursor.seek_start(child_offset);\r\n children = parse_sibling_objects(cursor, parse_model, context);\r\n } else {\r\n children = [];\r\n }\r\n\r\n if (sibling_offset) {\r\n cursor.seek_start(sibling_offset);\r\n siblings = parse_sibling_objects(cursor, parse_model, context);\r\n } else {\r\n siblings = [];\r\n }\r\n\r\n const object = new NjObject<M>(\r\n {\r\n no_translate,\r\n no_rotate,\r\n no_scale,\r\n hidden,\r\n break_child_trace,\r\n zxy_rotation_order,\r\n skip,\r\n shape_skip,\r\n },\r\n model,\r\n new Vec3(pos_x, pos_y, pos_z),\r\n new Vec3(rotation_x, rotation_y, rotation_z),\r\n new Vec3(scale_x, scale_y, scale_z),\r\n children\r\n );\r\n\r\n return [object, ...siblings];\r\n}\r\n","import { Cursor } from \"../cursor/Cursor\";\r\nimport { Vec3 } from \"../vector\";\r\nimport { ANGLE_TO_RAD } from \"./ninja\";\r\nimport { parse_xj_model, XjModel } from \"./ninja/xj\";\r\nimport { parse_rel } from \"./rel\";\r\n\r\nexport type RenderObject = {\r\n sections: RenderSection[];\r\n};\r\n\r\nexport type RenderSection = {\r\n id: number;\r\n position: Vec3;\r\n rotation: Vec3;\r\n models: XjModel[];\r\n};\r\n\r\nexport type Vertex = {\r\n position: Vec3;\r\n normal?: Vec3;\r\n};\r\n\r\nexport function parse_area_geometry(cursor: Cursor): RenderObject {\r\n const sections: RenderSection[] = [];\r\n\r\n cursor.seek_end(16);\r\n\r\n const { data_offset } = parse_rel(cursor, false);\r\n cursor.seek_start(data_offset);\r\n cursor.seek(8); // Format \"fmt2\" in UTF-16.\r\n const section_count = cursor.u32();\r\n cursor.seek(4);\r\n const section_table_offset = cursor.u32();\r\n // const texture_name_offset = cursor.u32();\r\n\r\n for (let i = 0; i < section_count; i++) {\r\n cursor.seek_start(section_table_offset + 52 * i);\r\n\r\n const section_id = cursor.i32();\r\n const section_position = cursor.vec3_f32();\r\n const section_rotation = new Vec3(\r\n cursor.u32() * ANGLE_TO_RAD,\r\n cursor.u32() * ANGLE_TO_RAD,\r\n cursor.u32() * ANGLE_TO_RAD\r\n );\r\n\r\n cursor.seek(4);\r\n\r\n const simple_geometry_offset_table_offset = cursor.u32();\r\n // const animated_geometry_offset_table_offset = cursor.u32();\r\n cursor.seek(4);\r\n const simple_geometry_offset_count = cursor.u32();\r\n // const animated_geometry_offset_count = cursor.u32();\r\n // Ignore animated_geometry_offset_count and the last 4 bytes.\r\n\r\n const models = parse_geometry_table(\r\n cursor,\r\n simple_geometry_offset_table_offset,\r\n simple_geometry_offset_count\r\n );\r\n\r\n sections.push({\r\n id: section_id,\r\n position: section_position,\r\n rotation: section_rotation,\r\n models,\r\n });\r\n }\r\n\r\n return { sections };\r\n}\r\n\r\nfunction parse_geometry_table(\r\n cursor: Cursor,\r\n table_offset: number,\r\n table_entry_count: number\r\n): XjModel[] {\r\n const models: XjModel[] = [];\r\n\r\n for (let i = 0; i < table_entry_count; i++) {\r\n cursor.seek_start(table_offset + 16 * i);\r\n\r\n let offset = cursor.u32();\r\n cursor.seek(8);\r\n const flags = cursor.u32();\r\n\r\n if (flags & 0b100) {\r\n offset = cursor.seek_start(offset).u32();\r\n }\r\n\r\n cursor.seek_start(offset + 4);\r\n const geometry_offset = cursor.u32();\r\n\r\n if (geometry_offset > 0) {\r\n cursor.seek_start(geometry_offset);\r\n models.push(parse_xj_model(cursor));\r\n }\r\n }\r\n\r\n return models;\r\n}\r\n","import { Vec3 } from \"../data_formats/vector\";\r\nimport { Vector3 } from \"three\";\r\n\r\nexport function vec3_to_threejs(v: Vec3): Vector3 {\r\n return new Vector3(v.x, v.y, v.z);\r\n}\r\n","import { Matrix3, Matrix4, Vector3 } from \"three\";\r\nimport { vec3_to_threejs } from \".\";\r\nimport { XjModel } from \"../data_formats/parsing/ninja/xj\";\r\nimport { Vec2 } from \"../data_formats/vector\";\r\nimport { VertexGroup } from \"./models\";\r\n\r\nconst DEFAULT_NORMAL = new Vector3(0, 1, 0);\r\nconst DEFAULT_UV = new Vec2(0, 0);\r\n\r\nexport function xj_model_to_geometry(\r\n model: XjModel,\r\n matrix: Matrix4,\r\n positions: number[],\r\n normals: number[],\r\n uvs: number[],\r\n indices: number[],\r\n groups: VertexGroup[]\r\n): void {\r\n const index_offset = positions.length / 3;\r\n const normal_matrix = new Matrix3().getNormalMatrix(matrix);\r\n\r\n for (let { position, normal, uv } of model.vertices) {\r\n const p = vec3_to_threejs(position).applyMatrix4(matrix);\r\n positions.push(p.x, p.y, p.z);\r\n\r\n const local_n = normal ? vec3_to_threejs(normal) : DEFAULT_NORMAL;\r\n const n = local_n.applyMatrix3(normal_matrix);\r\n normals.push(n.x, n.y, n.z);\r\n\r\n const tuv = uv || DEFAULT_UV;\r\n uvs.push(tuv.x, tuv.y);\r\n }\r\n\r\n let current_mat_idx = 0;\r\n\r\n for (const mesh of model.meshes) {\r\n const start_index_count = indices.length;\r\n let clockwise = true;\r\n\r\n for (let j = 2; j < mesh.indices.length; ++j) {\r\n const a = index_offset + mesh.indices[j - 2];\r\n const b = index_offset + mesh.indices[j - 1];\r\n const c = index_offset + mesh.indices[j];\r\n const pa = new Vector3(positions[3 * a], positions[3 * a + 1], positions[3 * a + 2]);\r\n const pb = new Vector3(positions[3 * b], positions[3 * b + 1], positions[3 * b + 2]);\r\n const pc = new Vector3(positions[3 * c], positions[3 * c + 1], positions[3 * c + 2]);\r\n const na = new Vector3(normals[3 * a], normals[3 * a + 1], normals[3 * a + 2]);\r\n const nb = new Vector3(normals[3 * a], normals[3 * a + 1], normals[3 * a + 2]);\r\n const nc = new Vector3(normals[3 * a], normals[3 * a + 1], normals[3 * a + 2]);\r\n\r\n // Calculate a surface normal and reverse the vertex winding if at least 2 of the vertex normals point in the opposite direction.\r\n // This hack fixes the winding for most models.\r\n const normal = pb\r\n .clone()\r\n .sub(pa)\r\n .cross(pc.clone().sub(pa));\r\n\r\n if (clockwise) {\r\n normal.negate();\r\n }\r\n\r\n const opposite_count =\r\n (normal.dot(na) < 0 ? 1 : 0) +\r\n (normal.dot(nb) < 0 ? 1 : 0) +\r\n (normal.dot(nc) < 0 ? 1 : 0);\r\n\r\n if (opposite_count >= 2) {\r\n clockwise = !clockwise;\r\n }\r\n\r\n if (clockwise) {\r\n indices.push(b);\r\n indices.push(a);\r\n indices.push(c);\r\n } else {\r\n indices.push(a);\r\n indices.push(b);\r\n indices.push(c);\r\n }\r\n\r\n clockwise = !clockwise;\r\n }\r\n\r\n const last_group = groups[groups.length - 1];\r\n\r\n if (mesh.material_properties.texture_id != null) {\r\n current_mat_idx = mesh.material_properties.texture_id + 1;\r\n }\r\n\r\n if (last_group && last_group.material_index === current_mat_idx) {\r\n last_group.count += indices.length - start_index_count;\r\n } else {\r\n groups.push({\r\n start: start_index_count,\r\n count: indices.length - start_index_count,\r\n material_index: current_mat_idx,\r\n });\r\n }\r\n }\r\n}\r\n","import {\r\n BufferGeometry,\r\n DoubleSide,\r\n Face3,\r\n Float32BufferAttribute,\r\n Geometry,\r\n Group,\r\n Matrix4,\r\n Mesh,\r\n MeshBasicMaterial,\r\n MeshLambertMaterial,\r\n Object3D,\r\n Uint16BufferAttribute,\r\n Vector3,\r\n} from \"three\";\r\nimport { CollisionObject } from \"../data_formats/parsing/area_collision_geometry\";\r\nimport { RenderObject } from \"../data_formats/parsing/area_geometry\";\r\nimport { Section } from \"../domain\";\r\nimport { xj_model_to_geometry } from \"./xj_model_to_geometry\";\r\n\r\nconst materials = [\r\n // Wall\r\n new MeshBasicMaterial({\r\n color: 0x80c0d0,\r\n transparent: true,\r\n opacity: 0.25,\r\n visible: false,\r\n }),\r\n // Ground\r\n new MeshLambertMaterial({\r\n color: 0xa0a0a0,\r\n side: DoubleSide,\r\n }),\r\n // Vegetation\r\n new MeshLambertMaterial({\r\n color: 0x50b070,\r\n side: DoubleSide,\r\n }),\r\n // Section transition zone\r\n new MeshLambertMaterial({\r\n color: 0x604080,\r\n side: DoubleSide,\r\n }),\r\n];\r\nconst wireframe_materials = [\r\n // Wall\r\n new MeshBasicMaterial({\r\n color: 0x90d0e0,\r\n wireframe: true,\r\n transparent: true,\r\n opacity: 0.3,\r\n visible: false,\r\n }),\r\n // Ground\r\n new MeshBasicMaterial({\r\n color: 0xd0d0d0,\r\n wireframe: true,\r\n }),\r\n // Vegetation\r\n new MeshBasicMaterial({\r\n color: 0x80e0a0,\r\n wireframe: true,\r\n }),\r\n // Section transition zone\r\n new MeshBasicMaterial({\r\n color: 0x9070b0,\r\n wireframe: true,\r\n }),\r\n];\r\n\r\nexport function area_collision_geometry_to_object_3d(object: CollisionObject): Object3D {\r\n const group = new Group();\r\n\r\n for (const collision_mesh of object.meshes) {\r\n // Use Geometry and not BufferGeometry for better raycaster performance.\r\n const geom = new Geometry();\r\n\r\n for (const { x, y, z } of collision_mesh.vertices) {\r\n geom.vertices.push(new Vector3(x, y, z));\r\n }\r\n\r\n for (const { indices, flags, normal } of collision_mesh.triangles) {\r\n const is_section_transition = flags & 0b1000000;\r\n const is_vegetation = flags & 0b10000;\r\n const is_ground = flags & 0b1;\r\n const color_index = is_section_transition ? 3 : is_vegetation ? 2 : is_ground ? 1 : 0;\r\n\r\n geom.faces.push(\r\n new Face3(\r\n indices[0],\r\n indices[1],\r\n indices[2],\r\n new Vector3(normal.x, normal.y, normal.z),\r\n undefined,\r\n color_index\r\n )\r\n );\r\n }\r\n\r\n const mesh = new Mesh(geom, materials);\r\n mesh.renderOrder = 1;\r\n group.add(mesh);\r\n\r\n const wireframe_mesh = new Mesh(geom, wireframe_materials);\r\n wireframe_mesh.renderOrder = 2;\r\n group.add(wireframe_mesh);\r\n }\r\n\r\n return group;\r\n}\r\n\r\nexport function area_geometry_to_sections_and_object_3d(\r\n object: RenderObject\r\n): [Section[], Object3D] {\r\n const sections: Section[] = [];\r\n const group = new Group();\r\n\r\n for (const section of object.sections) {\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const indices: number[] = [];\r\n\r\n for (const model of section.models) {\r\n xj_model_to_geometry(model, new Matrix4(), positions, normals, [], indices, []);\r\n }\r\n\r\n const geometry = new BufferGeometry();\r\n geometry.addAttribute(\"position\", new Float32BufferAttribute(positions, 3));\r\n geometry.addAttribute(\"normal\", new Float32BufferAttribute(normals, 3));\r\n geometry.setIndex(new Uint16BufferAttribute(indices, 1));\r\n\r\n const mesh = new Mesh(\r\n geometry,\r\n new MeshLambertMaterial({\r\n color: 0x44aaff,\r\n transparent: true,\r\n opacity: 0.75,\r\n side: DoubleSide,\r\n })\r\n );\r\n mesh.position.set(section.position.x, section.position.y, section.position.z);\r\n mesh.rotation.set(section.rotation.x, section.rotation.y, section.rotation.z);\r\n group.add(mesh);\r\n\r\n const sec = new Section(section.id, section.position, section.rotation.y);\r\n mesh.userData.section = sec;\r\n sections.push(sec);\r\n }\r\n\r\n return [sections, group];\r\n}\r\n","import { NpcType, ObjectType } from \"../domain\";\r\n\r\nexport enum AssetType {\r\n Geometry,\r\n Texture,\r\n}\r\n\r\nexport function get_area_render_data(\r\n episode: number,\r\n area_id: number,\r\n area_version: number\r\n): Promise<ArrayBuffer> {\r\n return get_area_asset(episode, area_id, area_version, \"render\");\r\n}\r\n\r\nexport function get_area_collision_data(\r\n episode: number,\r\n area_id: number,\r\n area_version: number\r\n): Promise<ArrayBuffer> {\r\n return get_area_asset(episode, area_id, area_version, \"collision\");\r\n}\r\n\r\nexport async function get_npc_data(\r\n npc_type: NpcType,\r\n type: AssetType\r\n): Promise<{ url: string; data: ArrayBuffer }> {\r\n const url = npc_type_to_url(npc_type, type);\r\n const data = await get_asset(url);\r\n return { url, data };\r\n}\r\n\r\nexport async function get_object_data(\r\n object_type: ObjectType,\r\n type: AssetType\r\n): Promise<{ url: string; data: ArrayBuffer }> {\r\n const url = object_type_to_url(object_type, type);\r\n const data = await get_asset(url);\r\n return { url, data };\r\n}\r\n\r\nexport async function get_player_data(\r\n player_class: string,\r\n body_part: string,\r\n no?: number\r\n): Promise<ArrayBuffer> {\r\n return await get_asset(player_class_to_url(player_class, body_part, no));\r\n}\r\n\r\nexport async function get_player_animation_data(animation_id: number): Promise<ArrayBuffer> {\r\n return await get_asset(\r\n `/player/animation/animation_${animation_id.toString().padStart(3, \"0\")}.njm`\r\n );\r\n}\r\n\r\nconst area_base_names = [\r\n [\r\n [\"city00_00\", 1],\r\n [\"forest01\", 1],\r\n [\"forest02\", 1],\r\n [\"cave01_\", 6],\r\n [\"cave02_\", 5],\r\n [\"cave03_\", 6],\r\n [\"machine01_\", 6],\r\n [\"machine02_\", 6],\r\n [\"ancient01_\", 5],\r\n [\"ancient02_\", 5],\r\n [\"ancient03_\", 5],\r\n [\"boss01\", 1],\r\n [\"boss02\", 1],\r\n [\"boss03\", 1],\r\n [\"darkfalz00\", 1],\r\n ],\r\n [\r\n [\"labo00_00\", 1],\r\n [\"ruins01_\", 3],\r\n [\"ruins02_\", 3],\r\n [\"space01_\", 3],\r\n [\"space02_\", 3],\r\n [\"jungle01_00\", 1],\r\n [\"jungle02_00\", 1],\r\n [\"jungle03_00\", 1],\r\n [\"jungle04_\", 3],\r\n [\"jungle05_00\", 1],\r\n [\"seabed01_\", 3],\r\n [\"seabed02_\", 3],\r\n [\"boss05\", 1],\r\n [\"boss06\", 1],\r\n [\"boss07\", 1],\r\n [\"boss08\", 1],\r\n [\"jungle06_00\", 1],\r\n [\"jungle07_\", 5],\r\n ],\r\n [\r\n // Don't remove this empty array, see usage of areaBaseNames in areaVersionToBaseUrl.\r\n ],\r\n [\r\n [\"city02_00\", 1],\r\n [\"wilds01_00\", 1],\r\n [\"wilds01_01\", 1],\r\n [\"wilds01_02\", 1],\r\n [\"wilds01_03\", 1],\r\n [\"crater01_00\", 1],\r\n [\"desert01_\", 3],\r\n [\"desert02_\", 3],\r\n [\"desert03_\", 3],\r\n [\"boss09_00\", 1],\r\n ],\r\n];\r\n\r\nfunction area_version_to_base_url(episode: number, area_id: number, area_variant: number): string {\r\n const episode_base_names = area_base_names[episode - 1];\r\n\r\n if (0 <= area_id && area_id < episode_base_names.length) {\r\n const [base_name, variants] = episode_base_names[area_id];\r\n\r\n if (0 <= area_variant && area_variant < variants) {\r\n let variant: string;\r\n\r\n if (variants === 1) {\r\n variant = \"\";\r\n } else {\r\n variant = String(area_variant);\r\n while (variant.length < 2) variant = \"0\" + variant;\r\n }\r\n\r\n return `/maps/map_${base_name}${variant}`;\r\n } else {\r\n throw new Error(\r\n `Unknown variant ${area_variant} of area ${area_id} in episode ${episode}.`\r\n );\r\n }\r\n } else {\r\n throw new Error(`Unknown episode ${episode} area ${area_id}.`);\r\n }\r\n}\r\n\r\ntype AreaAssetType = \"render\" | \"collision\";\r\n\r\nfunction get_area_asset(\r\n episode: number,\r\n area_id: number,\r\n area_variant: number,\r\n type: AreaAssetType\r\n): Promise<ArrayBuffer> {\r\n try {\r\n const base_url = area_version_to_base_url(episode, area_id, area_variant);\r\n const suffix = type === \"render\" ? \"n.rel\" : \"c.rel\";\r\n return get_asset(base_url + suffix);\r\n } catch (e) {\r\n return Promise.reject(e);\r\n }\r\n}\r\n\r\nfunction npc_type_to_url(npc_type: NpcType, type: AssetType): string {\r\n switch (npc_type) {\r\n // The dubswitch model is in XJ format.\r\n case NpcType.Dubswitch:\r\n return `/npcs/${npc_type.code}.${type === AssetType.Geometry ? \"xj\" : \"xvm\"}`;\r\n\r\n // Episode II VR Temple\r\n\r\n case NpcType.Hildebear2:\r\n return npc_type_to_url(NpcType.Hildebear, type);\r\n case NpcType.Hildeblue2:\r\n return npc_type_to_url(NpcType.Hildeblue, type);\r\n case NpcType.RagRappy2:\r\n return npc_type_to_url(NpcType.RagRappy, type);\r\n case NpcType.Monest2:\r\n return npc_type_to_url(NpcType.Monest, type);\r\n case NpcType.PoisonLily2:\r\n return npc_type_to_url(NpcType.PoisonLily, type);\r\n case NpcType.NarLily2:\r\n return npc_type_to_url(NpcType.NarLily, type);\r\n case NpcType.GrassAssassin2:\r\n return npc_type_to_url(NpcType.GrassAssassin, type);\r\n case NpcType.Dimenian2:\r\n return npc_type_to_url(NpcType.Dimenian, type);\r\n case NpcType.LaDimenian2:\r\n return npc_type_to_url(NpcType.LaDimenian, type);\r\n case NpcType.SoDimenian2:\r\n return npc_type_to_url(NpcType.SoDimenian, type);\r\n case NpcType.DarkBelra2:\r\n return npc_type_to_url(NpcType.DarkBelra, type);\r\n\r\n // Episode II VR Spaceship\r\n\r\n case NpcType.SavageWolf2:\r\n return npc_type_to_url(NpcType.SavageWolf, type);\r\n case NpcType.BarbarousWolf2:\r\n return npc_type_to_url(NpcType.BarbarousWolf, type);\r\n case NpcType.PanArms2:\r\n return npc_type_to_url(NpcType.PanArms, type);\r\n case NpcType.Dubchic2:\r\n return npc_type_to_url(NpcType.Dubchic, type);\r\n case NpcType.Gilchic2:\r\n return npc_type_to_url(NpcType.Gilchic, type);\r\n case NpcType.Garanz2:\r\n return npc_type_to_url(NpcType.Garanz, type);\r\n case NpcType.Dubswitch2:\r\n return npc_type_to_url(NpcType.Dubswitch, type);\r\n case NpcType.Delsaber2:\r\n return npc_type_to_url(NpcType.Delsaber, type);\r\n case NpcType.ChaosSorcerer2:\r\n return npc_type_to_url(NpcType.ChaosSorcerer, type);\r\n\r\n default:\r\n return `/npcs/${npc_type.code}.${type === AssetType.Geometry ? \"nj\" : \"xvm\"}`;\r\n }\r\n}\r\n\r\nfunction object_type_to_url(object_type: ObjectType, type: AssetType): string {\r\n if (type === AssetType.Geometry) {\r\n switch (object_type) {\r\n case ObjectType.EasterEgg:\r\n case ObjectType.ChristmasTree:\r\n case ObjectType.ChristmasWreath:\r\n case ObjectType.TwentyFirstCentury:\r\n case ObjectType.Sonic:\r\n case ObjectType.WelcomeBoard:\r\n case ObjectType.FloatingJelifish:\r\n case ObjectType.RuinsSeal:\r\n case ObjectType.Dolphin:\r\n case ObjectType.Cacti:\r\n case ObjectType.BigBrownRock:\r\n case ObjectType.PoisonPlant:\r\n case ObjectType.BigBlackRocks:\r\n case ObjectType.FallingRock:\r\n case ObjectType.DesertFixedTypeBoxBreakableCrystals:\r\n case ObjectType.BeeHive:\r\n return `/objects/${object_type.pso_id}.nj`;\r\n\r\n default:\r\n return `/objects/${object_type.pso_id}.xj`;\r\n }\r\n } else {\r\n return `/objects/${object_type.pso_id}.xvm`;\r\n }\r\n}\r\n\r\nfunction player_class_to_url(player_class: string, body_part: string, no?: number): string {\r\n return `/player/${player_class}${body_part}${no == null ? \"\" : no}.nj`;\r\n}\r\n\r\nfunction get_asset(url: string): Promise<ArrayBuffer> {\r\n const base_url = process.env.PUBLIC_URL;\r\n const promise = fetch(base_url + url).then(r => r.arrayBuffer());\r\n return promise;\r\n}\r\n","import { Object3D } from \"three\";\r\nimport { Endianness } from \"../data_formats\";\r\nimport { ArrayBufferCursor } from \"../data_formats/cursor/ArrayBufferCursor\";\r\nimport { parse_area_collision_geometry } from \"../data_formats/parsing/area_collision_geometry\";\r\nimport { parse_area_geometry } from \"../data_formats/parsing/area_geometry\";\r\nimport { Area, AreaVariant, Section } from \"../domain\";\r\nimport {\r\n area_collision_geometry_to_object_3d,\r\n area_geometry_to_sections_and_object_3d,\r\n} from \"../rendering/areas\";\r\nimport { get_area_collision_data, get_area_render_data } from \"./binary_assets\";\r\n\r\nfunction area(id: number, name: string, order: number, variants: number): Area {\r\n const area = new Area(id, name, order, []);\r\n const varis = Array(variants)\r\n .fill(null)\r\n .map((_, i) => new AreaVariant(i, area));\r\n area.area_variants.splice(0, 0, ...varis);\r\n return area;\r\n}\r\n\r\nconst sections_cache: Map<string, Promise<Section[]>> = new Map();\r\nconst render_geometry_cache: Map<string, Promise<Object3D>> = new Map();\r\nconst collision_geometry_cache: Map<string, Promise<Object3D>> = new Map();\r\n\r\nclass AreaStore {\r\n areas: Area[][];\r\n\r\n constructor() {\r\n // The IDs match the PSO IDs for areas.\r\n this.areas = [];\r\n let order = 0;\r\n this.areas[1] = [\r\n area(0, \"Pioneer II\", order++, 1),\r\n area(1, \"Forest 1\", order++, 1),\r\n area(2, \"Forest 2\", order++, 1),\r\n area(11, \"Under the Dome\", order++, 1),\r\n area(3, \"Cave 1\", order++, 6),\r\n area(4, \"Cave 2\", order++, 5),\r\n area(5, \"Cave 3\", order++, 6),\r\n area(12, \"Underground Channel\", order++, 1),\r\n area(6, \"Mine 1\", order++, 6),\r\n area(7, \"Mine 2\", order++, 6),\r\n area(13, \"Monitor Room\", order++, 1),\r\n area(8, \"Ruins 1\", order++, 5),\r\n area(9, \"Ruins 2\", order++, 5),\r\n area(10, \"Ruins 3\", order++, 5),\r\n area(14, \"Dark Falz\", order++, 1),\r\n area(15, \"BA Ruins\", order++, 3),\r\n area(16, \"BA Spaceship\", order++, 3),\r\n area(17, \"Lobby\", order++, 15),\r\n ];\r\n order = 0;\r\n this.areas[2] = [\r\n area(0, \"Lab\", order++, 1),\r\n area(1, \"VR Temple Alpha\", order++, 3),\r\n area(2, \"VR Temple Beta\", order++, 3),\r\n area(14, \"VR Temple Final\", order++, 1),\r\n area(3, \"VR Spaceship Alpha\", order++, 3),\r\n area(4, \"VR Spaceship Beta\", order++, 3),\r\n area(15, \"VR Spaceship Final\", order++, 1),\r\n area(5, \"Central Control Area\", order++, 1),\r\n area(6, \"Jungle Area East\", order++, 1),\r\n area(7, \"Jungle Area North\", order++, 1),\r\n area(8, \"Mountain Area\", order++, 3),\r\n area(9, \"Seaside Area\", order++, 1),\r\n area(12, \"Cliffs of Gal Da Val\", order++, 1),\r\n area(10, \"Seabed Upper Levels\", order++, 3),\r\n area(11, \"Seabed Lower Levels\", order++, 3),\r\n area(13, \"Test Subject Disposal Area\", order++, 1),\r\n area(16, \"Seaside Area at Night\", order++, 1),\r\n area(17, \"Control Tower\", order++, 5),\r\n ];\r\n order = 0;\r\n this.areas[4] = [\r\n area(0, \"Pioneer II (Ep. IV)\", order++, 1),\r\n area(1, \"Crater Route 1\", order++, 1),\r\n area(2, \"Crater Route 2\", order++, 1),\r\n area(3, \"Crater Route 3\", order++, 1),\r\n area(4, \"Crater Route 4\", order++, 1),\r\n area(5, \"Crater Interior\", order++, 1),\r\n area(6, \"Subterranean Desert 1\", order++, 3),\r\n area(7, \"Subterranean Desert 2\", order++, 3),\r\n area(8, \"Subterranean Desert 3\", order++, 3),\r\n area(9, \"Meteor Impact Site\", order++, 1),\r\n ];\r\n }\r\n\r\n get_variant(episode: number, area_id: number, variant_id: number): AreaVariant {\r\n if (episode !== 1 && episode !== 2 && episode !== 4)\r\n throw new Error(`Expected episode to be 1, 2 or 4, got ${episode}.`);\r\n\r\n const area = this.areas[episode].find(a => a.id === area_id);\r\n if (!area) throw new Error(`Area id ${area_id} for episode ${episode} is invalid.`);\r\n\r\n const area_variant = area.area_variants[variant_id];\r\n if (!area_variant)\r\n throw new Error(\r\n `Area variant id ${variant_id} for area ${area_id} of episode ${episode} is invalid.`\r\n );\r\n\r\n return area_variant;\r\n }\r\n\r\n async get_area_sections(\r\n episode: number,\r\n area_id: number,\r\n area_variant: number\r\n ): Promise<Section[]> {\r\n const key = `${episode}-${area_id}-${area_variant}`;\r\n let sections = sections_cache.get(key);\r\n\r\n if (!sections) {\r\n this.load_area_sections_and_render_geometry(episode, area_id, area_variant);\r\n sections = sections_cache.get(key)!;\r\n }\r\n\r\n return sections;\r\n }\r\n\r\n async get_area_render_geometry(\r\n episode: number,\r\n area_id: number,\r\n area_variant: number\r\n ): Promise<Object3D> {\r\n const key = `${episode}-${area_id}-${area_variant}`;\r\n let object_3d = render_geometry_cache.get(key);\r\n\r\n if (!object_3d) {\r\n this.load_area_sections_and_render_geometry(episode, area_id, area_variant);\r\n object_3d = render_geometry_cache.get(key)!;\r\n }\r\n\r\n return object_3d;\r\n }\r\n\r\n async get_area_collision_geometry(\r\n episode: number,\r\n area_id: number,\r\n area_variant: number\r\n ): Promise<Object3D> {\r\n const object_3d = collision_geometry_cache.get(`${episode}-${area_id}-${area_variant}`);\r\n\r\n if (object_3d) {\r\n return object_3d;\r\n } else {\r\n const object_3d = get_area_collision_data(episode, area_id, area_variant).then(buffer =>\r\n area_collision_geometry_to_object_3d(\r\n parse_area_collision_geometry(new ArrayBufferCursor(buffer, Endianness.Little))\r\n )\r\n );\r\n collision_geometry_cache.set(`${area_id}-${area_variant}`, object_3d);\r\n return object_3d;\r\n }\r\n }\r\n\r\n private load_area_sections_and_render_geometry(\r\n episode: number,\r\n area_id: number,\r\n area_variant: number\r\n ): void {\r\n const promise = get_area_render_data(episode, area_id, area_variant).then(buffer =>\r\n area_geometry_to_sections_and_object_3d(\r\n parse_area_geometry(new ArrayBufferCursor(buffer, Endianness.Little))\r\n )\r\n );\r\n\r\n sections_cache.set(\r\n `${episode}-${area_id}-${area_variant}`,\r\n promise.then(([sections]) => sections)\r\n );\r\n render_geometry_cache.set(\r\n `${episode}-${area_id}-${area_variant}`,\r\n promise.then(([, object_3d]) => object_3d)\r\n );\r\n }\r\n}\r\n\r\nexport const area_store = new AreaStore();\r\n","import {\r\n UTF_16BE_DECODER,\r\n UTF_16BE_ENCODER,\r\n UTF_16LE_DECODER,\r\n UTF_16LE_ENCODER,\r\n ASCII_DECODER,\r\n} from \".\";\r\nimport { Endianness } from \"..\";\r\nimport { ResizableBuffer } from \"../ResizableBuffer\";\r\nimport { Cursor } from \"./Cursor\";\r\nimport { Vec3, Vec2 } from \"../vector\";\r\n\r\nexport class ResizableBufferCursor implements Cursor {\r\n private _offset: number;\r\n\r\n get offset(): number {\r\n return this._offset;\r\n }\r\n\r\n protected _size: number;\r\n\r\n get size(): number {\r\n return this._size;\r\n }\r\n\r\n protected _position: number;\r\n\r\n get position(): number {\r\n return this._position;\r\n }\r\n\r\n protected little_endian!: boolean;\r\n\r\n get endianness(): Endianness {\r\n return this.little_endian ? Endianness.Little : Endianness.Big;\r\n }\r\n\r\n set endianness(endianness: Endianness) {\r\n this.little_endian = endianness === Endianness.Little;\r\n this.utf16_decoder = this.little_endian ? UTF_16LE_DECODER : UTF_16BE_DECODER;\r\n this.utf16_encoder = this.little_endian ? UTF_16LE_ENCODER : UTF_16BE_ENCODER;\r\n }\r\n\r\n get bytes_left(): number {\r\n return this.size - this.position;\r\n }\r\n\r\n protected buffer: ResizableBuffer;\r\n\r\n protected get dv(): DataView {\r\n return this.buffer.view;\r\n }\r\n\r\n private utf16_decoder: TextDecoder = UTF_16BE_DECODER;\r\n private utf16_encoder: TextEncoder = UTF_16BE_ENCODER;\r\n\r\n /**\r\n * @param buffer The buffer to read from.\r\n * @param endianness Decides in which byte order multi-byte integers and floats will be interpreted.\r\n * @param offset The start offset of the part that will be read from.\r\n * @param size The size of the part that will be read from.\r\n */\r\n constructor(\r\n buffer: ResizableBuffer,\r\n endianness: Endianness,\r\n offset: number = 0,\r\n size: number = buffer.size\r\n ) {\r\n if (offset < 0 || offset > buffer.size) {\r\n throw new Error(`Offset ${offset} is out of bounds.`);\r\n }\r\n\r\n if (size < 0 || offset + size > buffer.size) {\r\n throw new Error(`Size ${size} is out of bounds.`);\r\n }\r\n\r\n this.buffer = buffer;\r\n this.endianness = endianness;\r\n this._offset = offset;\r\n this._size = size;\r\n this._position = 0;\r\n }\r\n\r\n seek(offset: number): this {\r\n return this.seek_start(this.position + offset);\r\n }\r\n\r\n seek_start(offset: number): this {\r\n if (offset < 0 || offset > this.size) {\r\n throw new Error(`Offset ${offset} is out of bounds.`);\r\n }\r\n\r\n this._position = offset;\r\n return this;\r\n }\r\n\r\n seek_end(offset: number): this {\r\n if (offset < 0 || offset > this.size) {\r\n throw new Error(`Offset ${offset} is out of bounds.`);\r\n }\r\n\r\n this._position = this.size - offset;\r\n return this;\r\n }\r\n\r\n u8(): number {\r\n return this.u8_at(this._position++);\r\n }\r\n\r\n u8_at(offset: number): number {\r\n this.check_offset(offset, 1);\r\n return this.dv.getUint8(this.offset + offset);\r\n }\r\n\r\n u16(): number {\r\n const r = this.u16_at(this.position);\r\n this._position += 2;\r\n return r;\r\n }\r\n\r\n u16_at(offset: number): number {\r\n this.check_offset(offset, 2);\r\n return this.dv.getUint16(this.offset + offset, this.little_endian);\r\n }\r\n\r\n u32(): number {\r\n const r = this.u32_at(this.position);\r\n this._position += 4;\r\n return r;\r\n }\r\n\r\n u32_at(offset: number): number {\r\n this.check_offset(offset, 4);\r\n return this.dv.getUint32(this.offset + offset, this.little_endian);\r\n }\r\n\r\n i8(): number {\r\n return this.i8_at(this._position++);\r\n }\r\n\r\n i8_at(offset: number): number {\r\n this.check_offset(offset, 1);\r\n return this.dv.getInt8(this.offset + offset);\r\n }\r\n\r\n i16(): number {\r\n const r = this.i16_at(this.position);\r\n this._position += 2;\r\n return r;\r\n }\r\n\r\n i16_at(offset: number): number {\r\n this.check_offset(offset, 2);\r\n return this.dv.getInt16(this.offset + offset, this.little_endian);\r\n }\r\n\r\n i32(): number {\r\n const r = this.i32_at(this.position);\r\n this._position += 4;\r\n return r;\r\n }\r\n\r\n i32_at(offset: number): number {\r\n this.check_offset(offset, 4);\r\n return this.dv.getInt32(this.offset + offset, this.little_endian);\r\n }\r\n\r\n f32(): number {\r\n const r = this.f32_at(this.position);\r\n this._position += 4;\r\n return r;\r\n }\r\n\r\n f32_at(offset: number): number {\r\n this.check_offset(offset, 4);\r\n return this.dv.getFloat32(this.offset + offset, this.little_endian);\r\n }\r\n\r\n u8_array(n: number): number[] {\r\n this.check_size(\"n\", n, n);\r\n\r\n const array = [];\r\n\r\n for (let i = 0; i < n; ++i) {\r\n array.push(this.dv.getUint8(this.offset + this._position++));\r\n }\r\n\r\n return array;\r\n }\r\n\r\n u16_array(n: number): number[] {\r\n this.check_size(\"n\", n, 2 * n);\r\n\r\n const array = [];\r\n\r\n for (let i = 0; i < n; ++i) {\r\n array.push(this.dv.getUint16(this.offset + this.position, this.little_endian));\r\n this._position += 2;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n u32_array(n: number): number[] {\r\n this.check_size(\"n\", n, 4 * n);\r\n\r\n const array = [];\r\n\r\n for (let i = 0; i < n; ++i) {\r\n array.push(this.dv.getUint32(this.offset + this.position, this.little_endian));\r\n this._position += 4;\r\n }\r\n\r\n return array;\r\n }\r\n\r\n vec2_f32(): Vec2 {\r\n return new Vec2(this.f32(), this.f32());\r\n }\r\n\r\n vec3_f32(): Vec3 {\r\n return new Vec3(this.f32(), this.f32(), this.f32());\r\n }\r\n\r\n take(size: number): ResizableBufferCursor {\r\n this.check_size(\"size\", size, size);\r\n\r\n const offset = this.offset + this.position;\r\n const wrapper = new ResizableBufferCursor(this.buffer, this.endianness, offset, size);\r\n this._position += size;\r\n return wrapper;\r\n }\r\n\r\n string_ascii(\r\n max_byte_length: number,\r\n null_terminated: boolean,\r\n drop_remaining: boolean\r\n ): string {\r\n this.check_size(\"max_byte_length\", max_byte_length, max_byte_length);\r\n\r\n const string_length = null_terminated\r\n ? this.index_of_u8(0, max_byte_length) - this.position\r\n : max_byte_length;\r\n\r\n const view = this.buffer.sub_view(this.offset + this.position, string_length);\r\n const r = ASCII_DECODER.decode(view);\r\n\r\n this._position += drop_remaining\r\n ? max_byte_length\r\n : Math.min(string_length + 1, max_byte_length);\r\n\r\n return r;\r\n }\r\n\r\n string_utf16(\r\n max_byte_length: number,\r\n null_terminated: boolean,\r\n drop_remaining: boolean\r\n ): string {\r\n this.check_size(\"max_byte_length\", max_byte_length, max_byte_length);\r\n\r\n const string_length = null_terminated\r\n ? this.index_of_u16(0, max_byte_length) - this.position\r\n : Math.floor(max_byte_length / 2) * 2;\r\n\r\n const view = this.buffer.sub_view(this.offset + this.position, string_length);\r\n const r = this.utf16_decoder.decode(view);\r\n\r\n this._position += drop_remaining\r\n ? max_byte_length\r\n : Math.min(string_length + 2, max_byte_length);\r\n\r\n return r;\r\n }\r\n\r\n array_buffer(size: number = this.size - this.position): ArrayBuffer {\r\n this.check_size(\"size\", size, size);\r\n const r = this.buffer.backing_buffer.slice(\r\n this.offset + this.position,\r\n this.offset + this.position + size\r\n );\r\n this._position += size;\r\n return r;\r\n }\r\n\r\n copy_to_uint8_array(array: Uint8Array, size: number = this.size - this.position): this {\r\n this.check_size(\"size\", size, size);\r\n array.set(new Uint8Array(this.buffer.backing_buffer, this.offset + this.position, size));\r\n this._position += size;\r\n return this;\r\n }\r\n\r\n private check_size(name: string, value: number, byte_size: number): void {\r\n if (byte_size < 0 || byte_size > this.size - this.position) {\r\n throw new Error(`${name} ${value} is out of bounds.`);\r\n }\r\n }\r\n\r\n /**\r\n * Checks whether we can read size bytes at offset.\r\n */\r\n protected check_offset(offset: number, size: number): void {\r\n if (offset < 0 || offset + size > this.size) {\r\n throw new Error(`Offset ${offset} is out of bounds.`);\r\n }\r\n }\r\n\r\n private index_of_u8(value: number, max_byte_length: number): number {\r\n const max_pos = Math.min(this.position + max_byte_length, this.size);\r\n\r\n for (let i = this.position; i < max_pos; ++i) {\r\n if (this.dv.getUint8(i) === value) {\r\n return i;\r\n }\r\n }\r\n\r\n return this.position + max_byte_length;\r\n }\r\n\r\n private index_of_u16(value: number, max_byte_length: number): number {\r\n const max_pos = Math.min(this.position + max_byte_length, this.size);\r\n\r\n for (let i = this.position; i < max_pos; i += 2) {\r\n if (this.dv.getUint16(i, this.little_endian) === value) {\r\n return i;\r\n }\r\n }\r\n\r\n return this.position + max_byte_length;\r\n }\r\n}\r\n","import { WritableCursor } from \"./WritableCursor\";\r\nimport { ResizableBufferCursor } from \"./ResizableBufferCursor\";\r\nimport { Cursor } from \"./Cursor\";\r\nimport { ASCII_ENCODER } from \".\";\r\n\r\nexport class WritableResizableBufferCursor extends ResizableBufferCursor implements WritableCursor {\r\n get size(): number {\r\n return this._size;\r\n }\r\n\r\n set size(size: number) {\r\n if (size > this._size) {\r\n this.ensure_size(size - this._size);\r\n } else {\r\n this._size = size;\r\n }\r\n }\r\n\r\n write_u8(value: number): this {\r\n this.ensure_size(1);\r\n this.dv.setUint8(this._position++, value);\r\n return this;\r\n }\r\n\r\n write_u16(value: number): this {\r\n this.ensure_size(2);\r\n this.dv.setUint16(this.position, value, this.little_endian);\r\n this._position += 2;\r\n return this;\r\n }\r\n\r\n write_u32(value: number): this {\r\n this.ensure_size(4);\r\n this.dv.setUint32(this.position, value, this.little_endian);\r\n this._position += 4;\r\n return this;\r\n }\r\n\r\n write_i32(value: number): this {\r\n this.ensure_size(4);\r\n this.dv.setInt32(this.position, value, this.little_endian);\r\n this._position += 4;\r\n return this;\r\n }\r\n\r\n write_f32(value: number): this {\r\n this.ensure_size(4);\r\n this.dv.setFloat32(this.position, value, this.little_endian);\r\n this._position += 4;\r\n return this;\r\n }\r\n\r\n write_u8_array(array: number[]): this {\r\n this.ensure_size(array.length);\r\n new Uint8Array(this.buffer.backing_buffer, this.offset + this.position).set(\r\n new Uint8Array(array)\r\n );\r\n this._position += array.length;\r\n return this;\r\n }\r\n\r\n write_cursor(other: Cursor): this {\r\n const size = other.size - other.position;\r\n this.ensure_size(size);\r\n\r\n other.copy_to_uint8_array(\r\n new Uint8Array(this.buffer.backing_buffer, this.offset + this.position, size),\r\n size\r\n );\r\n\r\n this._position += size;\r\n return this;\r\n }\r\n\r\n write_string_ascii(str: string, byte_length: number): this {\r\n this.ensure_size(byte_length);\r\n\r\n let i = 0;\r\n\r\n for (const byte of ASCII_ENCODER.encode(str)) {\r\n if (i < byte_length) {\r\n this.write_u8(byte);\r\n ++i;\r\n }\r\n }\r\n\r\n while (i < byte_length) {\r\n this.write_u8(0);\r\n ++i;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n private ensure_size(size: number): void {\r\n const needed = this.position + size - this._size;\r\n\r\n if (needed > 0) {\r\n this._size += needed;\r\n\r\n if (this.buffer.size < this.offset + this._size) {\r\n this.buffer.size = this.offset + this._size;\r\n }\r\n }\r\n }\r\n}\r\n","/**\r\n * Resizable buffer.\r\n */\r\nexport class ResizableBuffer {\r\n private _size: number = 0;\r\n\r\n get size(): number {\r\n return this._size;\r\n }\r\n\r\n set size(size: number) {\r\n if (size < 0) {\r\n throw new Error(\"Size should be non-negative.\");\r\n }\r\n\r\n this.ensure_capacity(size);\r\n this._size = size;\r\n }\r\n\r\n get capacity(): number {\r\n return this._buffer.byteLength;\r\n }\r\n\r\n private _buffer: ArrayBuffer;\r\n\r\n get backing_buffer(): ArrayBuffer {\r\n return this._buffer;\r\n }\r\n\r\n private _data_view: DataView;\r\n\r\n get view(): DataView {\r\n return this._data_view;\r\n }\r\n\r\n constructor(initial_capacity: number = 8192) {\r\n this._buffer = new ArrayBuffer(initial_capacity);\r\n this._data_view = new DataView(this._buffer);\r\n }\r\n\r\n sub_view(offset: number, size: number): DataView {\r\n return new DataView(this._buffer, offset, size);\r\n }\r\n\r\n /**\r\n * Increases buffer size if necessary.\r\n */\r\n private ensure_capacity(min_new_size: number): void {\r\n if (min_new_size > this.capacity) {\r\n let new_size = this.capacity || min_new_size;\r\n\r\n do {\r\n new_size *= 2;\r\n } while (new_size < min_new_size);\r\n\r\n const new_buffer = new ArrayBuffer(new_size);\r\n new Uint8Array(new_buffer).set(new Uint8Array(this._buffer, 0, this.size));\r\n this._buffer = new_buffer;\r\n this._data_view = new DataView(this._buffer);\r\n }\r\n }\r\n}\r\n","import { Cursor } from \"../../cursor/Cursor\";\r\nimport { WritableCursor } from \"../../cursor/WritableCursor\";\r\nimport { WritableResizableBufferCursor } from \"../../cursor/WritableResizableBufferCursor\";\r\nimport { ResizableBuffer } from \"../../ResizableBuffer\";\r\n\r\nexport function compress(src: Cursor): Cursor {\r\n const ctx = new Context(src);\r\n const hash_table = new HashTable();\r\n\r\n if (ctx.src.size <= 3) {\r\n // Make a literal copy of the input.\r\n while (ctx.src.bytes_left) {\r\n ctx.set_bit(1);\r\n ctx.copy_literal();\r\n }\r\n } else {\r\n // Add the first two \"strings\" to the hash table.\r\n hash_table.put(hash_table.hash(ctx.src), 0);\r\n ctx.src.seek(1);\r\n hash_table.put(hash_table.hash(ctx.src), 1);\r\n ctx.src.seek(-1);\r\n\r\n // Copy the first two bytes as literals.\r\n ctx.set_bit(1);\r\n ctx.copy_literal();\r\n ctx.set_bit(1);\r\n ctx.copy_literal();\r\n\r\n while (ctx.src.bytes_left > 1) {\r\n let [offset, mlen] = ctx.find_longest_match(hash_table, false);\r\n\r\n if (mlen > 0) {\r\n ctx.src.seek(1);\r\n const [offset2, mlen2] = ctx.find_longest_match(hash_table, true);\r\n ctx.src.seek(-1);\r\n\r\n // Did the \"lazy match\" produce something more compressed?\r\n if (mlen2 > mlen) {\r\n let copy_literal = true;\r\n // Check if it is a good idea to switch from a short match to a long one.\r\n if (mlen >= 2 && mlen <= 5 && offset2 < offset) {\r\n if (offset >= -256 && offset2 < -256) {\r\n if (mlen2 - mlen < 3) {\r\n copy_literal = false;\r\n }\r\n }\r\n }\r\n\r\n if (copy_literal) {\r\n ctx.set_bit(1);\r\n ctx.copy_literal();\r\n continue;\r\n }\r\n }\r\n\r\n // What kind of match did we find?\r\n if (mlen >= 2 && mlen <= 5 && offset >= -256) {\r\n // Short match.\r\n ctx.set_bit(0);\r\n ctx.set_bit(0);\r\n ctx.set_bit((mlen - 2) & 0x02);\r\n ctx.set_bit((mlen - 2) & 0x01);\r\n ctx.write_literal(offset & 0xff);\r\n ctx.add_intermediates(hash_table, mlen);\r\n continue;\r\n } else if (mlen >= 3 && mlen <= 9) {\r\n // Long match, short length.\r\n ctx.set_bit(0);\r\n ctx.set_bit(1);\r\n ctx.write_literal(((offset & 0x1f) << 3) | ((mlen - 2) & 0x07));\r\n ctx.write_literal(offset >> 5);\r\n ctx.add_intermediates(hash_table, mlen);\r\n continue;\r\n } else if (mlen > 9) {\r\n // Long match, long length.\r\n if (mlen > 256) {\r\n mlen = 256;\r\n }\r\n\r\n ctx.set_bit(0);\r\n ctx.set_bit(1);\r\n ctx.write_literal((offset & 0x1f) << 3);\r\n ctx.write_literal(offset >> 5);\r\n ctx.write_literal(mlen - 1);\r\n ctx.add_intermediates(hash_table, mlen);\r\n continue;\r\n }\r\n }\r\n\r\n // If we get here, we didn't find a suitable match, so just we just make a literal copy.\r\n ctx.set_bit(1);\r\n ctx.copy_literal();\r\n }\r\n\r\n // If there's a left over byte at the end, make a literal copy.\r\n if (ctx.src.bytes_left) {\r\n ctx.set_bit(1);\r\n ctx.copy_literal();\r\n }\r\n }\r\n\r\n ctx.write_eof();\r\n\r\n return ctx.dst.seek_start(0);\r\n}\r\n\r\nconst MAX_WINDOW = 0x2000;\r\nconst WINDOW_MASK = MAX_WINDOW - 1;\r\nconst HASH_SIZE = 1 << 8;\r\n\r\nclass Context {\r\n src: Cursor;\r\n dst: WritableCursor;\r\n flags: number;\r\n flag_bits_left: number;\r\n flag_offset: number;\r\n\r\n constructor(cursor: Cursor) {\r\n this.src = cursor;\r\n this.dst = new WritableResizableBufferCursor(\r\n new ResizableBuffer(cursor.size),\r\n cursor.endianness\r\n );\r\n this.flags = 0;\r\n this.flag_bits_left = 0;\r\n this.flag_offset = 0;\r\n }\r\n\r\n set_bit(bit: number): void {\r\n if (!this.flag_bits_left--) {\r\n // Write out the flags to their position in the file, and store the next flags byte position.\r\n const pos = this.dst.position;\r\n this.dst\r\n .seek_start(this.flag_offset)\r\n .write_u8(this.flags)\r\n .seek_start(pos)\r\n .write_u8(0); // Placeholder for the next flags byte.\r\n this.flag_offset = pos;\r\n this.flag_bits_left = 7;\r\n }\r\n\r\n this.flags >>>= 1;\r\n\r\n if (bit) {\r\n this.flags |= 0x80;\r\n }\r\n }\r\n\r\n copy_literal(): void {\r\n this.dst.write_u8(this.src.u8());\r\n }\r\n\r\n write_literal(value: number): void {\r\n this.dst.write_u8(value);\r\n }\r\n\r\n write_final_flags(): void {\r\n this.flags >>>= this.flag_bits_left;\r\n const pos = this.dst.position;\r\n this.dst\r\n .seek_start(this.flag_offset)\r\n .write_u8(this.flags)\r\n .seek_start(pos);\r\n }\r\n\r\n write_eof(): void {\r\n this.set_bit(0);\r\n this.set_bit(1);\r\n\r\n this.write_final_flags();\r\n\r\n this.write_literal(0);\r\n this.write_literal(0);\r\n }\r\n\r\n match_length(s2: number): number {\r\n let len = 0;\r\n let s1 = this.src.position;\r\n const size = this.src.size;\r\n\r\n while (s1 < size && this.src.u8_at(s1) === this.src.u8_at(s2)) {\r\n ++len;\r\n ++s1;\r\n ++s2;\r\n }\r\n\r\n return len;\r\n }\r\n\r\n find_longest_match(hash_table: HashTable, lazy: boolean): [number, number] {\r\n if (!this.src.bytes_left) {\r\n return [0, 0];\r\n }\r\n\r\n // Figure out where we're looking.\r\n const hash = hash_table.hash(this.src);\r\n\r\n // If there is nothing in the table at that point, bail out now.\r\n let entry = hash_table.get(hash);\r\n\r\n if (entry === null) {\r\n if (!lazy) {\r\n hash_table.put(hash, this.src.position);\r\n }\r\n\r\n return [0, 0];\r\n }\r\n\r\n // If we'd go outside the window, truncate the hash chain now.\r\n if (this.src.position - entry > MAX_WINDOW) {\r\n hash_table.hash_to_offset[hash] = null;\r\n\r\n if (!lazy) {\r\n hash_table.put(hash, this.src.position);\r\n }\r\n\r\n return [0, 0];\r\n }\r\n\r\n // Ok, we have something in the hash table that matches the hash value.\r\n // Follow the chain to see if we have an actual string match, and find the longest match.\r\n let longest_length = 0;\r\n let longest_match = 0;\r\n\r\n while (entry != null) {\r\n const mlen = this.match_length(entry);\r\n\r\n if (mlen > longest_length || mlen >= 256) {\r\n longest_length = mlen;\r\n longest_match = entry;\r\n }\r\n\r\n // Follow the chain, making sure not to exceed a difference of MAX_WINDOW.\r\n let entry_2 = hash_table.prev(entry);\r\n\r\n if (entry_2 !== null) {\r\n // If we'd go outside the window, truncate the hash chain now.\r\n if (this.src.position - entry_2 > MAX_WINDOW) {\r\n hash_table.set_prev(entry, null);\r\n entry_2 = null;\r\n }\r\n }\r\n\r\n entry = entry_2;\r\n }\r\n\r\n // Add our current string to the hash.\r\n if (!lazy) {\r\n hash_table.put(hash, this.src.position);\r\n }\r\n\r\n // Did we find a match?\r\n const offset = longest_length > 0 ? longest_match - this.src.position : 0;\r\n return [offset, longest_length];\r\n }\r\n\r\n add_intermediates(hash_table: HashTable, len: number): void {\r\n this.src.seek(1);\r\n\r\n for (let i = 1; i < len; ++i) {\r\n const hash = hash_table.hash(this.src);\r\n hash_table.put(hash, this.src.position);\r\n this.src.seek(1);\r\n }\r\n }\r\n}\r\n\r\nclass HashTable {\r\n hash_to_offset: (number | null)[] = new Array(HASH_SIZE).fill(null);\r\n masked_offset_to_prev: (number | null)[] = new Array(MAX_WINDOW).fill(null);\r\n\r\n hash(cursor: Cursor): number {\r\n let hash = cursor.u8();\r\n\r\n if (cursor.bytes_left) {\r\n hash ^= cursor.u8();\r\n cursor.seek(-1);\r\n }\r\n\r\n cursor.seek(-1);\r\n return hash;\r\n }\r\n\r\n get(hash: number): number | null {\r\n return this.hash_to_offset[hash];\r\n }\r\n\r\n put(hash: number, offset: number): void {\r\n this.set_prev(offset, this.hash_to_offset[hash]);\r\n this.hash_to_offset[hash] = offset;\r\n }\r\n\r\n prev(offset: number): number | null {\r\n return this.masked_offset_to_prev[offset & WINDOW_MASK];\r\n }\r\n\r\n set_prev(offset: number, prevOffset: number | null): void {\r\n this.masked_offset_to_prev[offset & WINDOW_MASK] = prevOffset;\r\n }\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\nimport { WritableCursor } from \"../../cursor/WritableCursor\";\r\nimport { WritableResizableBufferCursor } from \"../../cursor/WritableResizableBufferCursor\";\r\nimport { ResizableBuffer } from \"../../ResizableBuffer\";\r\n\r\nconst logger = Logger.get(\"data_formats/compression/prs/decompress\");\r\n\r\nexport function decompress(cursor: Cursor): Cursor {\r\n const ctx = new Context(cursor);\r\n\r\n while (true) {\r\n if (ctx.read_flag_bit() === 1) {\r\n // Single byte copy.\r\n ctx.copy_u8();\r\n } else {\r\n // Multi byte copy.\r\n let length;\r\n let offset;\r\n\r\n if (ctx.read_flag_bit() === 0) {\r\n // Short copy.\r\n length = ctx.read_flag_bit() << 1;\r\n length |= ctx.read_flag_bit();\r\n length += 2;\r\n\r\n offset = ctx.read_u8() - 256;\r\n } else {\r\n // Long copy or end of file.\r\n offset = ctx.read_u16();\r\n\r\n // Two zero bytes implies that this is the end of the file.\r\n if (offset === 0) {\r\n break;\r\n }\r\n\r\n // Do we need to read a length byte, or is it encoded in what we already have?\r\n length = offset & 0b111;\r\n offset >>>= 3;\r\n\r\n if (length === 0) {\r\n length = ctx.read_u8();\r\n length += 1;\r\n } else {\r\n length += 2;\r\n }\r\n\r\n offset -= 8192;\r\n }\r\n\r\n ctx.offset_copy(offset, length);\r\n }\r\n }\r\n\r\n return ctx.dst.seek_start(0);\r\n}\r\n\r\nclass Context {\r\n src: Cursor;\r\n dst: WritableCursor;\r\n flags: number;\r\n flag_bits_left: number;\r\n\r\n constructor(cursor: Cursor) {\r\n this.src = cursor;\r\n this.dst = new WritableResizableBufferCursor(\r\n new ResizableBuffer(Math.floor(1.5 * cursor.size)),\r\n cursor.endianness\r\n );\r\n this.flags = 0;\r\n this.flag_bits_left = 0;\r\n }\r\n\r\n read_flag_bit(): number {\r\n // Fetch a new flag byte when the previous byte has been processed.\r\n if (this.flag_bits_left === 0) {\r\n this.flags = this.read_u8();\r\n this.flag_bits_left = 8;\r\n }\r\n\r\n let bit = this.flags & 1;\r\n this.flags >>>= 1;\r\n this.flag_bits_left -= 1;\r\n return bit;\r\n }\r\n\r\n copy_u8(): void {\r\n this.dst.write_u8(this.read_u8());\r\n }\r\n\r\n read_u8(): number {\r\n return this.src.u8();\r\n }\r\n\r\n read_u16(): number {\r\n return this.src.u16();\r\n }\r\n\r\n offset_copy(offset: number, length: number): void {\r\n if (offset < -8192 || offset > 0) {\r\n logger.error(`offset was ${offset}, should be between -8192 and 0.`);\r\n }\r\n\r\n if (length < 1 || length > 256) {\r\n logger.error(`length was ${length}, should be between 1 and 256.`);\r\n }\r\n\r\n // The length can be larger than -offset, in that case we copy -offset bytes size/-offset times.\r\n const buf_size = Math.min(-offset, length);\r\n\r\n this.dst.seek(offset);\r\n const buf = this.dst.take(buf_size);\r\n this.dst.seek(-offset - buf_size);\r\n\r\n for (let i = 0; i < Math.floor(length / buf_size); ++i) {\r\n this.dst.write_cursor(buf);\r\n buf.seek_start(0);\r\n }\r\n\r\n this.dst.write_cursor(buf.take(length % buf_size));\r\n }\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\n\r\nconst logger = Logger.get(\"data_formats/parsing/quest/bin\");\r\n\r\nexport interface BinFile {\r\n quest_id: number;\r\n language: number;\r\n quest_name: string;\r\n short_description: string;\r\n long_description: string;\r\n function_offsets: number[];\r\n instructions: Instruction[];\r\n data: ArrayBuffer;\r\n}\r\n\r\nexport function parse_bin(cursor: Cursor, lenient: boolean = false): BinFile {\r\n const object_code_offset = cursor.u32();\r\n const function_offset_table_offset = cursor.u32(); // Relative offsets\r\n const size = cursor.u32();\r\n cursor.seek(4); // Always seems to be 0xFFFFFFFF\r\n const quest_id = cursor.u32();\r\n const language = cursor.u32();\r\n const quest_name = cursor.string_utf16(64, true, true);\r\n const short_description = cursor.string_utf16(256, true, true);\r\n const long_description = cursor.string_utf16(576, true, true);\r\n\r\n if (size !== cursor.size) {\r\n logger.warn(`Value ${size} in bin size field does not match actual size ${cursor.size}.`);\r\n }\r\n\r\n const function_offset_count = Math.floor((cursor.size - function_offset_table_offset) / 4);\r\n\r\n cursor.seek_start(function_offset_table_offset);\r\n const function_offsets = [];\r\n\r\n for (let i = 0; i < function_offset_count; ++i) {\r\n function_offsets.push(cursor.i32());\r\n }\r\n\r\n const instructions = parse_object_code(\r\n cursor\r\n .seek_start(object_code_offset)\r\n .take(function_offset_table_offset - object_code_offset),\r\n lenient\r\n );\r\n\r\n return {\r\n quest_id,\r\n language,\r\n quest_name,\r\n short_description,\r\n long_description,\r\n function_offsets,\r\n instructions,\r\n data: cursor.seek_start(0).array_buffer(),\r\n };\r\n}\r\n\r\nexport function write_bin({ data }: { data: ArrayBuffer }): ArrayBuffer {\r\n return data;\r\n}\r\n\r\nexport interface Instruction {\r\n opcode: number;\r\n mnemonic: string;\r\n args: any[];\r\n size: number;\r\n}\r\n\r\nfunction parse_object_code(cursor: Cursor, lenient: boolean): Instruction[] {\r\n const instructions = [];\r\n\r\n try {\r\n while (cursor.bytes_left) {\r\n const main_opcode = cursor.u8();\r\n let opcode;\r\n let opsize;\r\n let list;\r\n\r\n switch (main_opcode) {\r\n case 0xf8:\r\n opcode = cursor.u8();\r\n opsize = 2;\r\n list = f8_opcode_list;\r\n break;\r\n case 0xf9:\r\n opcode = cursor.u8();\r\n opsize = 2;\r\n list = f9_opcode_list;\r\n break;\r\n default:\r\n opcode = main_opcode;\r\n opsize = 1;\r\n list = opcode_list;\r\n break;\r\n }\r\n\r\n let [, mnemonic, mask] = list[opcode];\r\n\r\n if (mask == null) {\r\n let full_opcode = main_opcode;\r\n\r\n if (main_opcode === 0xf8 || main_opcode === 0xf9) {\r\n full_opcode = (full_opcode << 8) | opcode;\r\n }\r\n\r\n logger.warn(\r\n `Parameters unknown for opcode 0x${full_opcode\r\n .toString(16)\r\n .toUpperCase()}, assuming 0.`\r\n );\r\n\r\n instructions.push({\r\n opcode,\r\n mnemonic,\r\n args: [],\r\n size: opsize,\r\n });\r\n } else {\r\n try {\r\n const opargs = parse_instruction_arguments(cursor, mask);\r\n\r\n instructions.push({\r\n opcode,\r\n mnemonic,\r\n args: opargs.args,\r\n size: opsize + opargs.size,\r\n });\r\n } catch (e) {\r\n instructions.push({\r\n opcode,\r\n mnemonic,\r\n args: [],\r\n size: opsize,\r\n });\r\n }\r\n }\r\n }\r\n } catch (e) {\r\n if (lenient) {\r\n logger.error(\"Couldn't fully parse object code.\", e);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n\r\n return instructions;\r\n}\r\n\r\nfunction parse_instruction_arguments(cursor: Cursor, mask: string): { args: any[]; size: number } {\r\n const old_pos = cursor.position;\r\n const args = [];\r\n let args_size: number;\r\n\r\n outer: for (let i = 0; i < mask.length; ++i) {\r\n switch (mask.charAt(i)) {\r\n // Pushes something on the stack\r\n case \"p\":\r\n break;\r\n // Pops the stack (no increments)\r\n case \"a\":\r\n break outer;\r\n\r\n // Unsigned integers\r\n case \"B\":\r\n args.push(cursor.u8());\r\n break;\r\n case \"W\":\r\n args.push(cursor.u16());\r\n break;\r\n case \"L\":\r\n args.push(cursor.u32());\r\n break;\r\n\r\n // Signed integers\r\n case \"I\":\r\n args.push(cursor.i32());\r\n break;\r\n\r\n // Floats\r\n case \"f\":\r\n case \"F\":\r\n args.push(cursor.f32());\r\n break;\r\n\r\n // Registers?\r\n case \"R\":\r\n case \"r\":\r\n cursor.seek(1);\r\n break;\r\n\r\n // Registers with unsigned integers?\r\n case \"b\":\r\n args.push(cursor.u8());\r\n break;\r\n case \"w\":\r\n args.push(cursor.u16());\r\n break;\r\n case \"l\":\r\n args.push(cursor.u32());\r\n break;\r\n\r\n // Registers with signed integers?\r\n case \"i\":\r\n args.push(cursor.i32());\r\n break;\r\n\r\n // Variably sized data?\r\n case \"j\":\r\n case \"J\":\r\n args_size = 2 * cursor.u8();\r\n cursor.seek(args_size);\r\n break;\r\n case \"t\":\r\n case \"T\":\r\n args_size = cursor.u8();\r\n cursor.seek(args_size);\r\n break;\r\n\r\n // Strings\r\n case \"s\":\r\n case \"S\":\r\n while (cursor.u16()) {\r\n // Eat up the entire string.\r\n }\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown mask part ${mask.charAt(i)}.`);\r\n }\r\n }\r\n\r\n return { args, size: cursor.position - old_pos };\r\n}\r\n\r\nconst opcode_list: [number, string, string | null][] = [\r\n [0x00, \"nop\", \"\"],\r\n [0x01, \"ret\", \"\"],\r\n [0x02, \"sync\", \"\"],\r\n [0x03, \"exit\", \"aL\"],\r\n [0x04, \"thread\", \"W\"],\r\n [0x05, \"va_start\", \"\"],\r\n [0x06, \"va_end\", \"\"],\r\n [0x07, \"va_call\", \"W\"],\r\n [0x08, \"let\", \"RR\"],\r\n [0x09, \"leti\", \"RI\"],\r\n [0x0a, \"unknown\", null],\r\n [0x0b, \"unknown\", null],\r\n [0x0c, \"unknown\", null],\r\n [0x0d, \"unknown\", null],\r\n [0x0e, \"unknown\", null],\r\n [0x0f, \"unknown\", null],\r\n [0x10, \"set\", \"R\"],\r\n [0x11, \"clear\", \"R\"],\r\n [0x12, \"rev\", \"R\"],\r\n [0x13, \"gset\", \"w\"],\r\n [0x14, \"gclear\", \"w\"],\r\n [0x15, \"grev\", \"w\"],\r\n [0x16, \"glet\", \"w\"],\r\n [0x17, \"gget\", \"wR\"],\r\n [0x18, \"add\", \"RR\"],\r\n [0x19, \"addi\", \"RI\"],\r\n [0x1a, \"sub\", \"RR\"],\r\n [0x1b, \"subi\", \"RI\"],\r\n [0x1c, \"mul\", \"RR\"],\r\n [0x1d, \"muli\", \"RI\"],\r\n [0x1e, \"div\", \"RR\"],\r\n [0x1f, \"divi\", \"RI\"],\r\n [0x20, \"and\", \"RR\"],\r\n [0x21, \"andi\", \"RI\"],\r\n [0x22, \"or\", \"RR\"],\r\n [0x23, \"ori\", \"RI\"],\r\n [0x24, \"xor\", \"RR\"],\r\n [0x25, \"xori\", \"RI\"],\r\n [0x26, \"mod\", \"RR\"],\r\n [0x27, \"modi\", \"RI\"],\r\n [0x28, \"jmp\", \"W\"],\r\n [0x29, \"call\", \"W\"],\r\n [0x2a, \"jmp_on\", \"Wt\"],\r\n [0x2b, \"jmp_off\", \"Wt\"],\r\n [0x2c, \"jmp_=\", \"RRW\"],\r\n [0x2d, \"jmpi_=\", \"RIW\"],\r\n [0x2e, \"jmp_!=\", \"RRW\"],\r\n [0x2f, \"jmpi_!=\", \"RIW\"],\r\n [0x30, \"ujmp_>\", \"RRW\"],\r\n [0x31, \"ujmpi_>\", \"RLW\"],\r\n [0x32, \"jmp_>\", \"RRW\"],\r\n [0x33, \"jmpi_>\", \"RIW\"],\r\n [0x34, \"ujmp_<\", \"RRW\"],\r\n [0x35, \"ujmpi_<\", \"RLW\"],\r\n [0x36, \"jmp_<\", \"RRW\"],\r\n [0x37, \"jmpi_<\", \"RIW\"],\r\n [0x38, \"ujmp_>=\", \"RRW\"],\r\n [0x39, \"ujmpi_>=\", \"RLW\"],\r\n [0x3a, \"jmp_>=\", \"RRW\"],\r\n [0x3b, \"jmpi_>=\", \"RIW\"],\r\n [0x3c, \"ujmp_<=\", \"RRW\"],\r\n [0x3d, \"ujmpi_<=\", \"RLW\"],\r\n [0x3e, \"jmp_<=\", \"RRW\"],\r\n [0x3f, \"jmpi_<=\", \"RIW\"],\r\n [0x40, \"switch_jmp\", \"Rj\"],\r\n [0x41, \"switch_call\", \"Rj\"],\r\n [0x42, \"stack_push\", \"R\"],\r\n [0x43, \"stack_pop\", \"R\"],\r\n [0x44, \"stack_pushm\", \"RL\"],\r\n [0x45, \"stack_popm\", \"RL\"],\r\n [0x46, \"unknown\", null],\r\n [0x47, \"unknown\", null],\r\n [0x48, \"arg_pushr\", \"pR\"],\r\n [0x49, \"arg_pushl\", \"pI\"],\r\n [0x4a, \"arg_pushb\", \"pB\"],\r\n [0x4b, \"arg_pushw\", \"pW\"],\r\n [0x4c, \"unknown\", null],\r\n [0x4d, \"unknown\", null],\r\n [0x4e, \"arg_pushs\", \"ps\"],\r\n [0x4f, \"unknown4F\", \"RR\"],\r\n [0x50, \"message\", \"aLs\"],\r\n [0x51, \"list\", \"aRs\"],\r\n [0x52, \"fadein\", \"\"],\r\n [0x53, \"fadeout\", \"\"],\r\n [0x54, \"se\", \"aL\"],\r\n [0x55, \"bgm\", \"aL\"],\r\n [0x56, \"unknown\", null],\r\n [0x57, \"unknown\", null],\r\n [0x58, \"enable\", \"aL\"],\r\n [0x59, \"disable\", \"aL\"],\r\n [0x5a, \"window_msg\", \"as\"],\r\n [0x5b, \"add_msg\", \"as\"],\r\n [0x5c, \"mesend\", \"\"],\r\n [0x5d, \"gettime\", \"R\"],\r\n [0x5e, \"winend\", \"\"],\r\n [0x5f, \"unknown\", null],\r\n //[ 0x60, 'npc_crt_V1', null ],\r\n [0x60, \"npc_crt_V3\", \"R\"],\r\n [0x61, \"npc_stop\", \"aR\"],\r\n [0x62, \"npc_play\", \"aL\"],\r\n [0x63, \"npc_kill\", \"aR\"],\r\n [0x64, \"npc_nont\", \"\"],\r\n [0x65, \"npc_talk\", \"\"],\r\n //[ 0x66, 'npc_crp_V1', null ],\r\n [0x66, \"npc_crp_V3\", \"R\"],\r\n [0x67, \"unknown\", null],\r\n [0x68, \"create_pipe\", \"aL\"],\r\n //[ 0x69, 'p_hpstat_V1', null ],\r\n [0x69, \"p_hpstat_V3\", \"aRL\"],\r\n //[ 0x6A, 'p_dead_V1', null ],\r\n [0x6a, \"p_dead_V3\", \"aRL\"],\r\n [0x6b, \"p_disablewarp\", \"\"],\r\n [0x6c, \"p_enablewarp\", \"\"],\r\n //[ 0x6D, 'p_move_V1', null ],\r\n [0x6d, \"p_move_V3\", \"R\"],\r\n [0x6e, \"p_look\", \"aL\"],\r\n [0x6f, \"unknown\", null],\r\n [0x70, \"p_action_disable\", \"\"],\r\n [0x71, \"p_action_enable\", \"\"],\r\n [0x72, \"disable_movement1\", \"aR\"],\r\n [0x73, \"enable_movement1\", \"aR\"],\r\n [0x74, \"p_noncol\", \"\"],\r\n [0x75, \"p_col\", \"\"],\r\n [0x76, \"p_setpos\", \"aRR\"],\r\n [0x77, \"p_return_guild\", \"\"],\r\n [0x78, \"p_talk_guild\", \"aL\"],\r\n //[ 0x79, 'npc_talk_pl_V1', null ],\r\n [0x79, \"npc_talk_pl_V3\", \"R\"],\r\n [0x7a, \"npc_talk_kill\", \"aL\"],\r\n //[ 0x7B, 'npc_crtpk_V1', null ],\r\n [0x7b, \"npc_crtpk_V3\", \"R\"],\r\n //[ 0x7C, 'npc_crppk_V1', null ],\r\n [0x7c, \"npc_crppk_V3\", \"R\"],\r\n //[ 0x7D, 'npc_crptalk_v1', null ],\r\n [0x7d, \"npc_crptalk_v3\", \"R\"],\r\n [0x7e, \"p_look_at_V1\", \"aLL\"],\r\n //[ 0x7F, 'npc_crp_id_V1', null ],\r\n [0x7f, \"npc_crp_id_V3\", \"R\"],\r\n [0x80, \"cam_quake\", \"\"],\r\n [0x81, \"cam_adj\", \"\"],\r\n [0x82, \"cam_zmin\", \"\"],\r\n [0x83, \"cam_zmout\", \"\"],\r\n //[ 0x84, 'cam_pan_V1', null ],\r\n [0x84, \"cam_pan_V3\", \"R\"],\r\n [0x85, \"game_lev_super\", \"\"],\r\n [0x86, \"game_lev_reset\", \"\"],\r\n //[ 0x87, 'pos_pipe_V1', null ],\r\n [0x87, \"pos_pipe_V3\", \"R\"],\r\n [0x88, \"if_zone_clear\", \"RR\"],\r\n [0x89, \"chk_ene_num\", \"R\"],\r\n [0x8a, \"unhide_obj\", \"R\"],\r\n [0x8b, \"unhide_ene\", \"R\"],\r\n [0x8c, \"at_coords_call\", \"R\"],\r\n [0x8d, \"at_coords_talk\", \"R\"],\r\n [0x8e, \"col_npcin\", \"R\"],\r\n [0x8f, \"col_npcinr\", \"R\"],\r\n [0x90, \"switch_on\", \"aL\"],\r\n [0x91, \"switch_off\", \"aL\"],\r\n [0x92, \"playbgm_epi\", \"aL\"],\r\n [0x93, \"set_mainwarp\", \"aL\"],\r\n [0x94, \"set_obj_param\", \"RR\"],\r\n [0x95, \"set_floor_handler\", \"aLW\"],\r\n [0x96, \"clr_floor_handler\", \"aL\"],\r\n [0x97, \"col_plinaw\", \"R\"],\r\n [0x98, \"hud_hide\", \"\"],\r\n [0x99, \"hud_show\", \"\"],\r\n [0x9a, \"cine_enable\", \"\"],\r\n [0x9b, \"cine_disable\", \"\"],\r\n [0x9c, \"unknown\", null],\r\n [0x9d, \"unknown\", null],\r\n [0x9e, \"unknown\", null],\r\n [0x9f, \"unknown\", null],\r\n [0xa0, \"unknown\", null],\r\n [0xa1, \"set_qt_failure\", \"W\"],\r\n [0xa2, \"set_qt_success\", \"W\"],\r\n [0xa3, \"clr_qt_failure\", \"\"],\r\n [0xa4, \"clr_qt_success\", \"\"],\r\n [0xa5, \"set_qt_cancel\", \"W\"],\r\n [0xa6, \"clr_qt_cancel\", \"\"],\r\n [0xa7, \"unknown\", null],\r\n //[ 0xA8, 'pl_walk_V1', null ],\r\n [0xa8, \"pl_walk_V3\", \"R\"],\r\n [0xa9, \"unknown\", null],\r\n [0xaa, \"unknown\", null],\r\n [0xab, \"unknown\", null],\r\n [0xac, \"unknown\", null],\r\n [0xad, \"unknown\", null],\r\n [0xae, \"unknown\", null],\r\n [0xaf, \"unknown\", null],\r\n [0xb0, \"pl_add_meseta\", \"aLL\"],\r\n [0xb1, \"thread_stg\", \"W\"],\r\n [0xb2, \"del_obj_param\", \"R\"],\r\n [0xb3, \"item_create\", \"RR\"],\r\n [0xb4, \"item_create2\", \"RR\"],\r\n [0xb5, \"item_delete\", \"RR\"],\r\n [0xb6, \"item_delete2\", \"RR\"],\r\n [0xb7, \"item_check\", \"RR\"],\r\n [0xb8, \"setevt\", \"aL\"],\r\n [0xb9, \"get_difflvl\", \"R\"],\r\n [0xba, \"set_qt_exit\", \"W\"],\r\n [0xbb, \"clr_qt_exit\", \"\"],\r\n [0xbc, \"unknown\", null],\r\n [0xbd, \"unknown\", null],\r\n [0xbe, \"unknown\", null],\r\n [0xbf, \"unknown\", null],\r\n //[ 0xC0, 'particle_V1', null ],\r\n [0xc0, \"particle_V3\", \"R\"],\r\n [0xc1, \"npc_text\", \"aLs\"],\r\n [0xc2, \"npc_chkwarp\", \"\"],\r\n [0xc3, \"pl_pkoff\", \"\"],\r\n [0xc4, \"map_designate\", \"R\"],\r\n [0xc5, \"masterkey_on\", \"\"],\r\n [0xc6, \"masterkey_off\", \"\"],\r\n [0xc7, \"window_time\", \"\"],\r\n [0xc8, \"winend_time\", \"\"],\r\n [0xc9, \"winset_time\", \"R\"],\r\n [0xca, \"getmtime\", \"R\"],\r\n [0xcb, \"set_quest_board_handler\", \"aLWs\"],\r\n [0xcc, \"clear_quest_board_handler\", \"aL\"],\r\n //[ 0xCD, 'particle_id_V1', null ],\r\n [0xcd, \"particle_id_V3\", \"R\"],\r\n //[ 0xCE, 'npc_crptalk_id_V1', null ],\r\n [0xce, \"npc_crptalk_id_V3\", \"R\"],\r\n [0xcf, \"npc_lang_clean\", \"\"],\r\n [0xd0, \"pl_pkon\", \"\"],\r\n [0xd1, \"pl_chk_item2\", \"RR\"],\r\n [0xd2, \"enable_mainmenu\", \"\"],\r\n [0xd3, \"disable_mainmenu\", \"\"],\r\n [0xd4, \"start_battlebgm\", \"\"],\r\n [0xd5, \"end_battlebgm\", \"\"],\r\n [0xd6, \"disp_msg_qb\", \"as\"],\r\n [0xd7, \"close_msg_qb\", \"\"],\r\n //[ 0xD8, 'set_eventflag_v1', null ],\r\n [0xd8, \"set_eventflag_v3\", \"aLL\"],\r\n [0xd9, \"sync_leti\", null],\r\n [0xda, \"set_returnhunter\", \"\"],\r\n [0xdb, \"set_returncity\", \"\"],\r\n [0xdc, \"load_pvr\", \"\"],\r\n [0xdd, \"load_midi\", \"\"],\r\n [0xde, \"unknown\", null],\r\n //[ 0xDF, 'npc_param_V1', null ],\r\n [0xdf, \"npc_param_V3\", \"aRL\"],\r\n [0xe0, \"pad_dragon\", \"\"],\r\n [0xe1, \"clear_mainwarp\", \"aL\"],\r\n //[ 0xE2, 'pcam_param_V1', null ],\r\n [0xe2, \"pcam_param_V3\", \"R\"],\r\n //[ 0xE3, 'start_setevt_v1', null ],\r\n [0xe3, \"start_setevt_v3\", \"aRL\"],\r\n [0xe4, \"warp_on\", \"\"],\r\n [0xe5, \"warp_off\", \"\"],\r\n [0xe6, \"get_slotnumber\", \"R\"],\r\n [0xe7, \"get_servernumber\", \"R\"],\r\n [0xe8, \"set_eventflag2\", \"aLR\"],\r\n [0xe9, \"res\", \"RR\"],\r\n [0xea, \"unknownEA\", \"RL\"],\r\n [0xeb, \"enable_bgmctrl\", \"aL\"],\r\n [0xec, \"sw_send\", \"R\"],\r\n [0xed, \"create_bgmctrl\", \"\"],\r\n [0xee, \"pl_add_meseta2\", \"aL\"],\r\n //[ 0xEF, 'sync_let', null ],\r\n [0xef, \"sync_register\", \"aRL\"],\r\n [0xf0, \"send_regwork\", null],\r\n //[ 0xF1, 'leti_fixed_camera_V1', null ],\r\n [0xf1, \"leti_fixed_camera_V3\", \"R\"],\r\n [0xf2, \"default_camera_pos1\", \"\"],\r\n [0xf3, \"unknown\", null],\r\n [0xf4, \"unknown\", null],\r\n [0xf5, \"unknown\", null],\r\n [0xf6, \"unknown\", null],\r\n [0xf7, \"unknown\", null],\r\n [0xf8, \"unknownF8\", \"R\"],\r\n [0xf9, \"unknown\", null],\r\n [0xfa, \"get_gc_number\", \"R\"],\r\n [0xfb, \"unknownFB\", \"W\"],\r\n [0xfc, \"unknown\", null],\r\n [0xfd, \"unknown\", null],\r\n [0xfe, \"unknown\", null],\r\n [0xff, \"unknownFF\", \"\"],\r\n];\r\n\r\nconst f8_opcode_list: [number, string, string | null][] = [\r\n [0x00, \"unknown\", null],\r\n [0x01, \"set_chat_callback?\", \"aRs\"],\r\n [0x02, \"unknown\", null],\r\n [0x03, \"unknown\", null],\r\n [0x04, \"unknown\", null],\r\n [0x05, \"unknown\", null],\r\n [0x06, \"unknown\", null],\r\n [0x07, \"unknown\", null],\r\n [0x08, \"get_difficulty_level2\", \"R\"],\r\n [0x09, \"get_number_of_player1\", \"R\"],\r\n [0x0a, \"get_coord_of_player\", \"RR\"],\r\n [0x0b, \"unknownF80B\", \"\"],\r\n [0x0c, \"unknownF80C\", \"\"],\r\n [0x0d, \"map_designate_ex\", \"R\"],\r\n [0x0e, \"unknownF80E\", \"aL\"],\r\n [0x0f, \"unknownF80F\", \"aL\"],\r\n [0x10, \"ba_initial_floor\", \"aL\"],\r\n [0x11, \"set_ba_rules\", \"\"],\r\n [0x12, \"unknownF812\", \"aL\"],\r\n [0x13, \"unknownF813\", \"aL\"],\r\n [0x14, \"unknownF814\", \"aL\"],\r\n [0x15, \"unknownF815\", \"aL\"],\r\n [0x16, \"unknownF816\", \"aL\"],\r\n [0x17, \"unknownF817\", \"aL\"],\r\n [0x18, \"unknownF818\", \"aL\"],\r\n [0x19, \"unknownF819\", \"aL\"],\r\n [0x1a, \"unknownF81A\", \"aL\"],\r\n [0x1b, \"unknownF81B\", \"aL\"],\r\n [0x1c, \"ba_disp_msg\", \"as\"],\r\n [0x1d, \"death_lvl_up\", \"aL\"],\r\n [0x1e, \"death_tech_lvl_up\", \"aL\"],\r\n [0x1f, \"unknown\", null],\r\n [0x20, \"cmode_stage\", \"aL\"],\r\n [0x21, \"unknown\", null],\r\n [0x22, \"unknown\", null],\r\n [0x23, \"unknownF823\", \"aL\"],\r\n [0x24, \"unknownF824\", \"aL\"],\r\n [0x25, \"exp_multiplication\", \"R\"],\r\n [0x26, \"exp_division?\", \"R\"],\r\n [0x27, \"get_user_is_dead?\", \"R\"],\r\n [0x28, \"go_floor\", \"RR\"],\r\n [0x29, \"unknown\", null],\r\n [0x2a, \"unknown\", null],\r\n [0x2b, \"unlock_door2\", \"aLL\"],\r\n [0x2c, \"lock_door2\", \"aLL\"],\r\n [0x2d, \"if_switch_not_pressed\", \"R\"],\r\n [0x2e, \"if_switch_pressed\", \"R\"],\r\n [0x2f, \"unknownF82F\", \"aLL\"],\r\n [0x30, \"control_dragon\", \"R\"],\r\n [0x31, \"release_dragon\", \"\"],\r\n [0x32, \"unknown\", null],\r\n [0x33, \"unknown\", null],\r\n [0x34, \"unknown\", null],\r\n [0x35, \"unknown\", null],\r\n [0x36, \"unknown\", null],\r\n [0x37, \"unknown\", null],\r\n [0x38, \"shrink\", \"R\"],\r\n [0x39, \"unshrink\", \"R\"],\r\n [0x3a, \"unknown\", null],\r\n [0x3b, \"unknown\", null],\r\n [0x3c, \"display_clock2?\", \"R\"],\r\n [0x3d, \"unknownF83D\", \"aL\"],\r\n [0x3e, \"delete_area_title?\", \"aL\"],\r\n [0x3f, \"unknown\", null],\r\n [0x40, \"load_npc_data\", \"\"],\r\n [0x41, \"get_npc_data\", \"W\"],\r\n [0x42, \"unknown\", null],\r\n [0x43, \"unknown\", null],\r\n [0x44, \"unknown\", null],\r\n [0x45, \"unknown\", null],\r\n [0x46, \"unknown\", null],\r\n [0x47, \"unknown\", null],\r\n [0x48, \"give_damage_score\", \"R\"],\r\n [0x49, \"take_damage_score\", \"R\"],\r\n [0x4a, \"unk_score_F84A\", \"R\"],\r\n [0x4b, \"unk_score_F84B\", \"R\"],\r\n [0x4c, \"kill_score\", \"R\"],\r\n [0x4d, \"death_score\", \"R\"],\r\n [0x4e, \"unk_score_F84E\", \"R\"],\r\n [0x4f, \"enemy_death_score\", \"R\"],\r\n [0x50, \"meseta_score\", \"R\"],\r\n [0x51, \"unknownF851\", \"R\"],\r\n [0x52, \"unknownF852\", \"aL\"],\r\n [0x53, \"reverse_warps\", \"\"],\r\n [0x54, \"unreverse_warps\", \"\"],\r\n [0x55, \"set_ult_map\", \"\"],\r\n [0x56, \"unset_ult_map\", \"\"],\r\n [0x57, \"set_area_title\", \"as\"],\r\n [0x58, \"unknownF858\", \"\"],\r\n [0x59, \"unknown\", null],\r\n [0x5a, \"equip_item\", \"R\"],\r\n [0x5b, \"unequip_item\", \"aLL\"],\r\n [0x5c, \"unknown\", null],\r\n [0x5d, \"unknown\", null],\r\n [0x5e, \"unknownF85E\", \"aL\"],\r\n [0x5f, \"unknownF85F\", \"aL\"],\r\n [0x60, \"unknownF860\", \"\"],\r\n [0x61, \"unknownF861\", \"aL\"],\r\n [0x62, \"unknown\", null],\r\n [0x63, \"unknown\", null],\r\n [0x64, \"cmode_rank\", \"aLs\"],\r\n [0x65, \"award_item_name?\", \"\"],\r\n [0x66, \"award_item_select?\", \"\"],\r\n [0x67, \"award_item_give_to?\", \"R\"],\r\n [0x68, \"unknownF868\", \"RR\"],\r\n [0x69, \"unknownF869\", \"RR\"],\r\n [0x6a, \"item_create_cmode\", \"RR\"],\r\n [0x6b, \"unknownF86B\", \"R\"],\r\n [0x6c, \"award_item_ok?\", \"R\"],\r\n [0x6d, \"unknownF86D\", \"\"],\r\n [0x6e, \"unknownF86E\", \"\"],\r\n [0x6f, \"ba_set_lives\", \"aL\"],\r\n [0x70, \"ba_set_tech_lvl\", \"aL\"],\r\n [0x71, \"ba_set_lvl\", \"aL\"],\r\n [0x72, \"ba_set_time_limit\", \"aL\"],\r\n [0x73, \"boss_is_dead?\", \"R\"],\r\n [0x74, \"unknown\", null],\r\n [0x75, \"unknown\", null],\r\n [0x76, \"unknown\", null],\r\n [0x77, \"enable_techs\", \"R\"],\r\n [0x78, \"disable_techs\", \"R\"],\r\n [0x79, \"get_gender\", \"RR\"],\r\n [0x7a, \"get_chara_class\", \"RR\"],\r\n [0x7b, \"take_slot_meseta\", \"RR\"],\r\n [0x7c, \"unknown\", null],\r\n [0x7d, \"unknown\", null],\r\n [0x7e, \"unknown\", null],\r\n [0x7f, \"read_guildcard_flag\", \"RR\"],\r\n [0x80, \"unknownF880\", \"R\"],\r\n [0x81, \"get_pl_name?\", \"R\"],\r\n [0x82, \"unknown\", null],\r\n [0x83, \"unknownF883\", \"RR\"],\r\n [0x84, \"unknown\", null],\r\n [0x85, \"unknown\", null],\r\n [0x86, \"unknown\", null],\r\n [0x87, \"unknown\", null],\r\n [0x88, \"ba_close_msg\", \"\"],\r\n [0x89, \"unknown\", null],\r\n [0x8a, \"get_player_status\", \"RR\"],\r\n [0x8b, \"send_mail\", \"aRs\"],\r\n [0x8c, \"online_check\", \"R\"],\r\n [0x8d, \"chl_set_timerecord?\", \"R\"],\r\n [0x8e, \"chl_get_timerecord?\", \"R\"],\r\n [0x8f, \"unknownF88F\", \"R\"],\r\n [0x90, \"unknownF890\", \"\"],\r\n [0x91, \"load_enemy_data\", \"aL\"],\r\n [0x92, \"get_physical_data\", \"W\"],\r\n [0x93, \"get_attack_data\", \"W\"],\r\n [0x94, \"get_resist_data\", \"W\"],\r\n [0x95, \"get_movement_data\", \"W\"],\r\n [0x96, \"unknown\", null],\r\n [0x97, \"unknown\", null],\r\n [0x98, \"shift_left\", \"RR\"],\r\n [0x99, \"shift_right\", \"RR\"],\r\n [0x9a, \"get_random\", \"RR\"],\r\n [0x9b, \"reset_map\", \"\"],\r\n [0x9c, \"disp_chl_retry_menu\", \"R\"],\r\n [0x9d, \"chl_reverser?\", \"\"],\r\n [0x9e, \"unknownF89E\", \"aL\"],\r\n [0x9f, \"unknownF89F\", \"R\"],\r\n [0xa0, \"unknownF8A0\", \"\"],\r\n [0xa1, \"unknownF8A1\", \"\"],\r\n [0xa2, \"unknown\", null],\r\n [0xa3, \"unknown\", null],\r\n [0xa4, \"unknown\", null],\r\n [0xa5, \"unknown\", null],\r\n [0xa6, \"unknown\", null],\r\n [0xa7, \"unknown\", null],\r\n [0xa8, \"unknownF8A8\", \"aL\"],\r\n [0xa9, \"unknownF8A9\", \"R\"],\r\n [0xaa, \"unknown\", null],\r\n [0xab, \"unknown\", null],\r\n [0xac, \"unknown\", null],\r\n [0xad, \"get_number_of_player2\", \"R\"],\r\n [0xae, \"unknown\", null],\r\n [0xaf, \"unknown\", null],\r\n [0xb0, \"unknown\", null],\r\n [0xb1, \"unknown\", null],\r\n [0xb2, \"unknown\", null],\r\n [0xb3, \"unknown\", null],\r\n [0xb4, \"unknown\", null],\r\n [0xb5, \"unknown\", null],\r\n [0xb6, \"unknown\", null],\r\n [0xb7, \"unknown\", null],\r\n [0xb8, \"unknownF8B8\", \"\"],\r\n [0xb9, \"chl_recovery?\", \"\"],\r\n [0xba, \"unknown\", null],\r\n [0xbb, \"unknown\", null],\r\n [0xbc, \"set_episode\", \"L\"],\r\n [0xbd, \"unknown\", null],\r\n [0xbe, \"unknown\", null],\r\n [0xbf, \"unknown\", null],\r\n [0xc0, \"file_dl_req\", \"aLs\"],\r\n [0xc1, \"get_dl_status\", \"R\"],\r\n [0xc2, \"gba_unknown4?\", \"\"],\r\n [0xc3, \"get_gba_state?\", \"R\"],\r\n [0xc4, \"unknownF8C4\", \"R\"],\r\n [0xc5, \"unknownF8C5\", \"R\"],\r\n [0xc6, \"QEXIT\", \"\"],\r\n [0xc7, \"use_animation\", \"RR\"],\r\n [0xc8, \"stop_animation\", \"R\"],\r\n [0xc9, \"run_to_coord\", \"RR\"],\r\n [0xca, \"set_slot_invincible\", \"RR\"],\r\n [0xcb, \"unknownF8CB\", \"R\"],\r\n [0xcc, \"set_slot_poison\", \"R\"],\r\n [0xcd, \"set_slot_paralyze\", \"R\"],\r\n [0xce, \"set_slot_shock\", \"R\"],\r\n [0xcf, \"set_slot_freeze\", \"R\"],\r\n [0xd0, \"set_slot_slow\", \"R\"],\r\n [0xd1, \"set_slot_confuse\", \"R\"],\r\n [0xd2, \"set_slot_shifta\", \"R\"],\r\n [0xd3, \"set_slot_deband\", \"R\"],\r\n [0xd4, \"set_slot_jellen\", \"R\"],\r\n [0xd5, \"set_slot_zalure\", \"R\"],\r\n [0xd6, \"fleti_fixed_camera\", \"aR\"],\r\n [0xd7, \"fleti_locked_camera\", \"aLR\"],\r\n [0xd8, \"default_camera_pos2\", \"\"],\r\n [0xd9, \"set_motion_blur\", \"\"],\r\n [0xda, \"set_screen_b&w\", \"\"],\r\n [0xdb, \"unknownF8DB\", \"aLLLLRW\"],\r\n [0xdc, \"NPC_action_string\", \"RRW\"],\r\n [0xdd, \"get_pad_cond\", \"RR\"],\r\n [0xde, \"get_button_cond\", \"RR\"],\r\n [0xdf, \"freeze_enemies\", \"\"],\r\n [0xe0, \"unfreeze_enemies\", \"\"],\r\n [0xe1, \"freeze_everything\", \"\"],\r\n [0xe2, \"unfreeze_everything\", \"\"],\r\n [0xe3, \"restore_hp\", \"R\"],\r\n [0xe4, \"restore_tp\", \"R\"],\r\n [0xe5, \"close_chat_bubble\", \"R\"],\r\n [0xe6, \"unknownF8E6\", \"RR\"],\r\n [0xe7, \"unknownF8E7\", \"RR\"],\r\n [0xe8, \"unknownF8E8\", \"RR\"],\r\n [0xe9, \"unknownF8E9\", \"RR\"],\r\n [0xea, \"unknownF8EA\", \"RR\"],\r\n [0xeb, \"unknownF8EB\", \"RR\"],\r\n [0xec, \"unknownF8EC\", \"RR\"],\r\n [0xed, \"animation_check\", \"RR\"],\r\n [0xee, \"call_image_data\", \"aLW\"],\r\n [0xef, \"unknownF8EF\", \"\"],\r\n [0xf0, \"turn_off_bgm_p2\", \"\"],\r\n [0xf1, \"turn_on_bgm_p2\", \"\"],\r\n [0xf2, \"load_unk_data\", \"aLLLLRW\"],\r\n [0xf3, \"particle2\", \"aRLf\"],\r\n [0xf4, \"unknown\", null],\r\n [0xf5, \"unknown\", null],\r\n [0xf6, \"unknown\", null],\r\n [0xf7, \"unknown\", null],\r\n [0xf8, \"unknown\", null],\r\n [0xf9, \"unknown\", null],\r\n [0xfa, \"unknown\", null],\r\n [0xfb, \"unknown\", null],\r\n [0xfc, \"unknown\", null],\r\n [0xfd, \"unknown\", null],\r\n [0xfe, \"unknown\", null],\r\n [0xff, \"unknown\", null],\r\n];\r\n\r\nconst f9_opcode_list: [number, string, string | null][] = [\r\n [0x00, \"unknown\", null],\r\n [0x01, \"dec2float\", \"RR\"],\r\n [0x02, \"float2dec\", \"RR\"],\r\n [0x03, \"flet\", \"RR\"],\r\n [0x04, \"fleti\", \"RF\"],\r\n [0x05, \"unknown\", null],\r\n [0x06, \"unknown\", null],\r\n [0x07, \"unknown\", null],\r\n [0x08, \"fadd\", \"RR\"],\r\n [0x09, \"faddi\", \"RF\"],\r\n [0x0a, \"fsub\", \"RR\"],\r\n [0x0b, \"fsubi\", \"RF\"],\r\n [0x0c, \"fmul\", \"RR\"],\r\n [0x0d, \"fmuli\", \"RF\"],\r\n [0x0e, \"fdiv\", \"RR\"],\r\n [0x0f, \"fdivi\", \"RF\"],\r\n [0x10, \"get_unknown_count?\", \"aLR\"],\r\n [0x11, \"get_stackable_item_count\", \"RR\"],\r\n [0x12, \"freeze_and_hide_equip\", \"\"],\r\n [0x13, \"thaw_and_show_equip\", \"\"],\r\n [0x14, \"set_paletteX_callback\", \"aRW\"],\r\n [0x15, \"activate_paletteX\", \"aR\"],\r\n [0x16, \"enable_paletteX\", \"aR\"],\r\n [0x17, \"restore_paletteX\", \"aL\"],\r\n [0x18, \"disable_paletteX\", \"aL\"],\r\n [0x19, \"get_paletteX_activated\", \"aLR\"],\r\n [0x1a, \"get_unknown_paletteX_status?\", \"aLR\"],\r\n [0x1b, \"disable_movement2\", \"aR\"],\r\n [0x1c, \"enable_movement2\", \"aR\"],\r\n [0x1d, \"get_time_played\", \"R\"],\r\n [0x1e, \"get_guildcard_total\", \"R\"],\r\n [0x1f, \"get_slot_meseta\", \"R\"],\r\n [0x20, \"get_player_level\", \"aLR\"],\r\n [0x21, \"get_Section_ID\", \"aLR\"],\r\n [0x22, \"get_player_hp\", \"aRR\"],\r\n [0x23, \"get_floor_number\", \"aRR\"],\r\n [0x24, \"get_coord_player_detect\", \"RR\"],\r\n [0x25, \"read_global_flag\", \"abR\"],\r\n [0x26, \"write_global_flag\", \"abR\"],\r\n [0x27, \"unknownF927\", \"RR\"],\r\n [0x28, \"floor_player_detect\", \"R\"],\r\n [0x29, \"read_disk_file?\", \"as\"],\r\n [0x2a, \"open_pack_select\", \"\"],\r\n [0x2b, \"item_select\", \"R\"],\r\n [0x2c, \"get_item_id\", \"R\"],\r\n [0x2d, \"color_change\", \"aRRRRR\"],\r\n [0x2e, \"send_statistic?\", \"aLLLLLLLL\"],\r\n [0x2f, \"unknownF92F\", \"aLL\"],\r\n [0x30, \"chat_box\", \"aLLLLLs\"],\r\n [0x31, \"chat_bubble\", \"aLs\"],\r\n [0x32, \"unknown\", null],\r\n [0x33, \"unknownF933\", \"R\"],\r\n [0x34, \"scroll_text\", \"aLLLLLfRs\"],\r\n [0x35, \"gba_unknown1\", \"\"],\r\n [0x36, \"gba_unknown2\", \"\"],\r\n [0x37, \"gba_unknown3\", \"\"],\r\n [0x38, \"add_damage_to?\", \"aLL\"],\r\n [0x39, \"item_delete2\", \"aL\"],\r\n [0x3a, \"get_item_info\", \"aLR\"],\r\n [0x3b, \"item_packing1\", \"aL\"],\r\n [0x3c, \"item_packing2\", \"aLL\"],\r\n [0x3d, \"get_lang_setting?\", \"aR\"],\r\n [0x3e, \"prepare_statistic?\", \"aLWW\"],\r\n [0x3f, \"keyword_detect\", \"\"],\r\n [0x40, \"Keyword\", \"aRLs\"],\r\n [0x41, \"get_guildcard_num\", \"aLR\"],\r\n [0x42, \"unknown\", null],\r\n [0x43, \"unknown\", null],\r\n [0x44, \"get_wrap_status\", \"aLR\"],\r\n [0x45, \"initial_floor\", \"aL\"],\r\n [0x46, \"sin\", \"aRL\"],\r\n [0x47, \"cos\", \"aRL\"],\r\n [0x48, \"unknown\", null],\r\n [0x49, \"unknown\", null],\r\n [0x4a, \"boss_is_dead2?\", \"R\"],\r\n [0x4b, \"unknownF94B\", \"R\"],\r\n [0x4c, \"unknownF94C\", \"R\"],\r\n [0x4d, \"is_there_cardbattle\", \"R\"],\r\n [0x4e, \"unknown\", null],\r\n [0x4f, \"unknown\", null],\r\n [0x50, \"BB_p2_menu\", \"aL\"],\r\n [0x51, \"BB_Map_Designate\", \"BWBB\"],\r\n [0x52, \"BB_get_number_in_pack\", \"R\"],\r\n [0x53, \"BB_swap_item\", \"aLLLLLLWW\"],\r\n [0x54, \"BB_check_wrap\", \"aRR\"],\r\n [0x55, \"BB_exchange_PD_item\", \"aRRRWW\"],\r\n [0x56, \"BB_exchange_PD_srank\", \"aRRRRRWW\"],\r\n [0x57, \"BB_exchange_PD_special\", \"aRRRRRLWW\"],\r\n [0x58, \"BB_exchange_PD_percent\", \"aRRRRRLWW\"],\r\n [0x59, \"unknownF959\", \"aL\"],\r\n [0x5a, \"unknown\", null],\r\n [0x5b, \"unknown\", null],\r\n [0x5c, \"BB_exchange_SLT\", \"aLRWW\"],\r\n [0x5d, \"BB_exchange_PC\", \"\"],\r\n [0x5e, \"BB_box_create_BP\", \"aLff\"],\r\n [0x5f, \"BB_exchange_PT\", \"aRRLWW\"],\r\n [0x60, \"unknownF960\", \"aL\"],\r\n [0x61, \"unknownF961\", \"\"],\r\n [0x62, \"unknown\", null],\r\n [0x63, \"unknown\", null],\r\n [0x64, \"unknown\", null],\r\n [0x65, \"unknown\", null],\r\n [0x66, \"unknown\", null],\r\n [0x67, \"unknown\", null],\r\n [0x68, \"unknown\", null],\r\n [0x69, \"unknown\", null],\r\n [0x6a, \"unknown\", null],\r\n [0x6b, \"unknown\", null],\r\n [0x6c, \"unknown\", null],\r\n [0x6d, \"unknown\", null],\r\n [0x6e, \"unknown\", null],\r\n [0x6f, \"unknown\", null],\r\n [0x70, \"unknown\", null],\r\n [0x71, \"unknown\", null],\r\n [0x72, \"unknown\", null],\r\n [0x73, \"unknown\", null],\r\n [0x74, \"unknown\", null],\r\n [0x75, \"unknown\", null],\r\n [0x76, \"unknown\", null],\r\n [0x77, \"unknown\", null],\r\n [0x78, \"unknown\", null],\r\n [0x79, \"unknown\", null],\r\n [0x7a, \"unknown\", null],\r\n [0x7b, \"unknown\", null],\r\n [0x7c, \"unknown\", null],\r\n [0x7d, \"unknown\", null],\r\n [0x7e, \"unknown\", null],\r\n [0x7f, \"unknown\", null],\r\n [0x80, \"unknown\", null],\r\n [0x81, \"unknown\", null],\r\n [0x82, \"unknown\", null],\r\n [0x83, \"unknown\", null],\r\n [0x84, \"unknown\", null],\r\n [0x85, \"unknown\", null],\r\n [0x86, \"unknown\", null],\r\n [0x87, \"unknown\", null],\r\n [0x88, \"unknown\", null],\r\n [0x89, \"unknown\", null],\r\n [0x8a, \"unknown\", null],\r\n [0x8b, \"unknown\", null],\r\n [0x8c, \"unknown\", null],\r\n [0x8d, \"unknown\", null],\r\n [0x8e, \"unknown\", null],\r\n [0x8f, \"unknown\", null],\r\n [0x90, \"unknown\", null],\r\n [0x91, \"unknown\", null],\r\n [0x92, \"unknown\", null],\r\n [0x93, \"unknown\", null],\r\n [0x94, \"unknown\", null],\r\n [0x95, \"unknown\", null],\r\n [0x96, \"unknown\", null],\r\n [0x97, \"unknown\", null],\r\n [0x98, \"unknown\", null],\r\n [0x99, \"unknown\", null],\r\n [0x9a, \"unknown\", null],\r\n [0x9b, \"unknown\", null],\r\n [0x9c, \"unknown\", null],\r\n [0x9d, \"unknown\", null],\r\n [0x9e, \"unknown\", null],\r\n [0x9f, \"unknown\", null],\r\n [0xa0, \"unknown\", null],\r\n [0xa1, \"unknown\", null],\r\n [0xa2, \"unknown\", null],\r\n [0xa3, \"unknown\", null],\r\n [0xa4, \"unknown\", null],\r\n [0xa5, \"unknown\", null],\r\n [0xa6, \"unknown\", null],\r\n [0xa7, \"unknown\", null],\r\n [0xa8, \"unknown\", null],\r\n [0xa9, \"unknown\", null],\r\n [0xaa, \"unknown\", null],\r\n [0xab, \"unknown\", null],\r\n [0xac, \"unknown\", null],\r\n [0xad, \"unknown\", null],\r\n [0xae, \"unknown\", null],\r\n [0xaf, \"unknown\", null],\r\n [0xb0, \"unknown\", null],\r\n [0xb1, \"unknown\", null],\r\n [0xb2, \"unknown\", null],\r\n [0xb3, \"unknown\", null],\r\n [0xb4, \"unknown\", null],\r\n [0xb5, \"unknown\", null],\r\n [0xb6, \"unknown\", null],\r\n [0xb7, \"unknown\", null],\r\n [0xb8, \"unknown\", null],\r\n [0xb9, \"unknown\", null],\r\n [0xba, \"unknown\", null],\r\n [0xbb, \"unknown\", null],\r\n [0xbc, \"unknown\", null],\r\n [0xbd, \"unknown\", null],\r\n [0xbe, \"unknown\", null],\r\n [0xbf, \"unknown\", null],\r\n [0xc0, \"unknown\", null],\r\n [0xc1, \"unknown\", null],\r\n [0xc2, \"unknown\", null],\r\n [0xc3, \"unknown\", null],\r\n [0xc4, \"unknown\", null],\r\n [0xc5, \"unknown\", null],\r\n [0xc6, \"unknown\", null],\r\n [0xc7, \"unknown\", null],\r\n [0xc8, \"unknown\", null],\r\n [0xc9, \"unknown\", null],\r\n [0xca, \"unknown\", null],\r\n [0xcb, \"unknown\", null],\r\n [0xcc, \"unknown\", null],\r\n [0xcd, \"unknown\", null],\r\n [0xce, \"unknown\", null],\r\n [0xcf, \"unknown\", null],\r\n [0xd0, \"unknown\", null],\r\n [0xd1, \"unknown\", null],\r\n [0xd2, \"unknown\", null],\r\n [0xd3, \"unknown\", null],\r\n [0xd4, \"unknown\", null],\r\n [0xd5, \"unknown\", null],\r\n [0xd6, \"unknown\", null],\r\n [0xd7, \"unknown\", null],\r\n [0xd8, \"unknown\", null],\r\n [0xd9, \"unknown\", null],\r\n [0xda, \"unknown\", null],\r\n [0xdb, \"unknown\", null],\r\n [0xdc, \"unknown\", null],\r\n [0xdd, \"unknown\", null],\r\n [0xde, \"unknown\", null],\r\n [0xdf, \"unknown\", null],\r\n [0xe0, \"unknown\", null],\r\n [0xe1, \"unknown\", null],\r\n [0xe2, \"unknown\", null],\r\n [0xe3, \"unknown\", null],\r\n [0xe4, \"unknown\", null],\r\n [0xe5, \"unknown\", null],\r\n [0xe6, \"unknown\", null],\r\n [0xe7, \"unknown\", null],\r\n [0xe8, \"unknown\", null],\r\n [0xe9, \"unknown\", null],\r\n [0xea, \"unknown\", null],\r\n [0xeb, \"unknown\", null],\r\n [0xec, \"unknown\", null],\r\n [0xed, \"unknown\", null],\r\n [0xee, \"unknown\", null],\r\n [0xef, \"unknown\", null],\r\n [0xf0, \"unknown\", null],\r\n [0xf1, \"unknown\", null],\r\n [0xf2, \"unknown\", null],\r\n [0xf3, \"unknown\", null],\r\n [0xf4, \"unknown\", null],\r\n [0xf5, \"unknown\", null],\r\n [0xf6, \"unknown\", null],\r\n [0xf7, \"unknown\", null],\r\n [0xf8, \"unknown\", null],\r\n [0xf9, \"unknown\", null],\r\n [0xfa, \"unknown\", null],\r\n [0xfb, \"unknown\", null],\r\n [0xfc, \"unknown\", null],\r\n [0xfd, \"unknown\", null],\r\n [0xfe, \"unknown\", null],\r\n [0xff, \"unknown\", null],\r\n];\r\n","import Logger from \"js-logger\";\r\nimport { groupBy } from \"lodash\";\r\nimport { Endianness } from \"../..\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\nimport { WritableResizableBufferCursor } from \"../../cursor/WritableResizableBufferCursor\";\r\nimport { ResizableBuffer } from \"../../ResizableBuffer\";\r\nimport { Vec3 } from \"../../vector\";\r\n\r\nconst logger = Logger.get(\"data_formats/parsing/quest/dat\");\r\n\r\nconst OBJECT_SIZE = 68;\r\nconst NPC_SIZE = 72;\r\n\r\nexport type DatFile = {\r\n objs: DatObject[];\r\n npcs: DatNpc[];\r\n unknowns: DatUnknown[];\r\n};\r\n\r\nexport type DatEntity = {\r\n type_id: number;\r\n section_id: number;\r\n position: Vec3;\r\n rotation: Vec3;\r\n area_id: number;\r\n unknown: number[][];\r\n};\r\n\r\nexport type DatObject = DatEntity;\r\n\r\nexport type DatNpc = DatEntity & {\r\n flags: number;\r\n skin: number;\r\n};\r\n\r\nexport type DatUnknown = {\r\n entity_type: number;\r\n total_size: number;\r\n area_id: number;\r\n entities_size: number;\r\n data: number[];\r\n};\r\n\r\nexport function parse_dat(cursor: Cursor): DatFile {\r\n const objs: DatObject[] = [];\r\n const npcs: DatNpc[] = [];\r\n const unknowns: DatUnknown[] = [];\r\n\r\n while (cursor.bytes_left) {\r\n const entity_type = cursor.u32();\r\n const total_size = cursor.u32();\r\n const area_id = cursor.u32();\r\n const entities_size = cursor.u32();\r\n\r\n if (entity_type === 0) {\r\n break;\r\n } else {\r\n if (entities_size !== total_size - 16) {\r\n throw Error(\r\n `Malformed DAT file. Expected an entities size of ${total_size -\r\n 16}, got ${entities_size}.`\r\n );\r\n }\r\n\r\n if (entity_type === 1) {\r\n // Objects\r\n const object_count = Math.floor(entities_size / OBJECT_SIZE);\r\n const start_position = cursor.position;\r\n\r\n for (let i = 0; i < object_count; ++i) {\r\n const type_id = cursor.u16();\r\n const unknown1 = cursor.u8_array(10);\r\n const section_id = cursor.u16();\r\n const unknown2 = cursor.u8_array(2);\r\n const x = cursor.f32();\r\n const y = cursor.f32();\r\n const z = cursor.f32();\r\n const rotation_x = (cursor.i32() / 0xffff) * 2 * Math.PI;\r\n const rotation_y = (cursor.i32() / 0xffff) * 2 * Math.PI;\r\n const rotation_z = (cursor.i32() / 0xffff) * 2 * Math.PI;\r\n // The next 3 floats seem to be scale values.\r\n const unknown3 = cursor.u8_array(28);\r\n\r\n objs.push({\r\n type_id,\r\n section_id,\r\n position: new Vec3(x, y, z),\r\n rotation: new Vec3(rotation_x, rotation_y, rotation_z),\r\n area_id,\r\n unknown: [unknown1, unknown2, unknown3],\r\n });\r\n }\r\n\r\n const bytes_read = cursor.position - start_position;\r\n\r\n if (bytes_read !== entities_size) {\r\n logger.warn(\r\n `Read ${bytes_read} bytes instead of expected ${entities_size} for entity type ${entity_type} (Object).`\r\n );\r\n cursor.seek(entities_size - bytes_read);\r\n }\r\n } else if (entity_type === 2) {\r\n // NPCs\r\n const npc_count = Math.floor(entities_size / NPC_SIZE);\r\n const start_position = cursor.position;\r\n\r\n for (let i = 0; i < npc_count; ++i) {\r\n const type_id = cursor.u16();\r\n const unknown1 = cursor.u8_array(10);\r\n const section_id = cursor.u16();\r\n const unknown2 = cursor.u8_array(6);\r\n const x = cursor.f32();\r\n const y = cursor.f32();\r\n const z = cursor.f32();\r\n const rotation_x = (cursor.i32() / 0xffff) * 2 * Math.PI;\r\n const rotation_y = (cursor.i32() / 0xffff) * 2 * Math.PI;\r\n const rotation_z = (cursor.i32() / 0xffff) * 2 * Math.PI;\r\n const unknown3 = cursor.u8_array(4);\r\n const flags = cursor.f32();\r\n const unknown4 = cursor.u8_array(12);\r\n const skin = cursor.u32();\r\n const unknown5 = cursor.u8_array(4);\r\n\r\n npcs.push({\r\n type_id,\r\n section_id,\r\n position: new Vec3(x, y, z),\r\n rotation: new Vec3(rotation_x, rotation_y, rotation_z),\r\n skin,\r\n area_id,\r\n flags,\r\n unknown: [unknown1, unknown2, unknown3, unknown4, unknown5],\r\n });\r\n }\r\n\r\n const bytes_read = cursor.position - start_position;\r\n\r\n if (bytes_read !== entities_size) {\r\n logger.warn(\r\n `Read ${bytes_read} bytes instead of expected ${entities_size} for entity type ${entity_type} (NPC).`\r\n );\r\n cursor.seek(entities_size - bytes_read);\r\n }\r\n } else {\r\n // There are also waves (type 3) and unknown entity types 4 and 5.\r\n unknowns.push({\r\n entity_type,\r\n total_size,\r\n area_id,\r\n entities_size,\r\n data: cursor.u8_array(entities_size),\r\n });\r\n }\r\n }\r\n }\r\n\r\n return { objs, npcs, unknowns };\r\n}\r\n\r\nexport function write_dat({ objs, npcs, unknowns }: DatFile): ResizableBuffer {\r\n const buffer = new ResizableBuffer(\r\n objs.length * (16 + OBJECT_SIZE) +\r\n npcs.length * (16 + NPC_SIZE) +\r\n unknowns.reduce((a, b) => a + b.total_size, 0)\r\n );\r\n const cursor = new WritableResizableBufferCursor(buffer, Endianness.Little);\r\n\r\n const grouped_objs = groupBy(objs, obj => obj.area_id);\r\n const obj_area_ids = Object.keys(grouped_objs)\r\n .map(key => parseInt(key, 10))\r\n .sort((a, b) => a - b);\r\n\r\n for (const area_id of obj_area_ids) {\r\n const area_objs = grouped_objs[area_id];\r\n const entities_size = area_objs.length * OBJECT_SIZE;\r\n cursor.write_u32(1); // Entity type\r\n cursor.write_u32(entities_size + 16);\r\n cursor.write_u32(area_id);\r\n cursor.write_u32(entities_size);\r\n\r\n for (const obj of area_objs) {\r\n cursor.write_u16(obj.type_id);\r\n cursor.write_u8_array(obj.unknown[0]);\r\n cursor.write_u16(obj.section_id);\r\n cursor.write_u8_array(obj.unknown[1]);\r\n cursor.write_f32(obj.position.x);\r\n cursor.write_f32(obj.position.y);\r\n cursor.write_f32(obj.position.z);\r\n cursor.write_i32(Math.round((obj.rotation.x / (2 * Math.PI)) * 0xffff));\r\n cursor.write_i32(Math.round((obj.rotation.y / (2 * Math.PI)) * 0xffff));\r\n cursor.write_i32(Math.round((obj.rotation.z / (2 * Math.PI)) * 0xffff));\r\n cursor.write_u8_array(obj.unknown[2]);\r\n }\r\n }\r\n\r\n const grouped_npcs = groupBy(npcs, npc => npc.area_id);\r\n const npc_area_ids = Object.keys(grouped_npcs)\r\n .map(key => parseInt(key, 10))\r\n .sort((a, b) => a - b);\r\n\r\n for (const area_id of npc_area_ids) {\r\n const area_npcs = grouped_npcs[area_id];\r\n const entities_size = area_npcs.length * NPC_SIZE;\r\n cursor.write_u32(2); // Entity type\r\n cursor.write_u32(entities_size + 16);\r\n cursor.write_u32(area_id);\r\n cursor.write_u32(entities_size);\r\n\r\n for (const npc of area_npcs) {\r\n cursor.write_u16(npc.type_id);\r\n cursor.write_u8_array(npc.unknown[0]);\r\n cursor.write_u16(npc.section_id);\r\n cursor.write_u8_array(npc.unknown[1]);\r\n cursor.write_f32(npc.position.x);\r\n cursor.write_f32(npc.position.y);\r\n cursor.write_f32(npc.position.z);\r\n cursor.write_i32(Math.round((npc.rotation.x / (2 * Math.PI)) * 0xffff));\r\n cursor.write_i32(Math.round((npc.rotation.y / (2 * Math.PI)) * 0xffff));\r\n cursor.write_i32(Math.round((npc.rotation.z / (2 * Math.PI)) * 0xffff));\r\n cursor.write_u8_array(npc.unknown[2]);\r\n cursor.write_f32(npc.flags);\r\n cursor.write_u8_array(npc.unknown[3]);\r\n cursor.write_u32(npc.skin);\r\n cursor.write_u8_array(npc.unknown[4]);\r\n }\r\n }\r\n\r\n for (const unknown of unknowns) {\r\n cursor.write_u32(unknown.entity_type);\r\n cursor.write_u32(unknown.total_size);\r\n cursor.write_u32(unknown.area_id);\r\n cursor.write_u32(unknown.entities_size);\r\n cursor.write_u8_array(unknown.data);\r\n }\r\n\r\n // Final header.\r\n cursor.write_u32(0);\r\n cursor.write_u32(0);\r\n cursor.write_u32(0);\r\n cursor.write_u32(0);\r\n\r\n return buffer;\r\n}\r\n","import { ArrayBufferCursor } from \"./ArrayBufferCursor\";\r\nimport { WritableCursor } from \"./WritableCursor\";\r\nimport { ASCII_ENCODER } from \".\";\r\nimport { Cursor } from \"./Cursor\";\r\n\r\n/**\r\n * A cursor for reading and writing from an array buffer or part of an array buffer.\r\n */\r\nexport class WritableArrayBufferCursor extends ArrayBufferCursor implements WritableCursor {\r\n write_u8(value: number): this {\r\n this.dv.setUint8(this._position++, value);\r\n return this;\r\n }\r\n\r\n write_u16(value: number): this {\r\n this.dv.setUint16(this.position, value, this.little_endian);\r\n this._position += 2;\r\n return this;\r\n }\r\n\r\n write_u32(value: number): this {\r\n this.dv.setUint32(this.position, value, this.little_endian);\r\n this._position += 4;\r\n return this;\r\n }\r\n\r\n write_i32(value: number): this {\r\n this.dv.setInt32(this.position, value, this.little_endian);\r\n this._position += 4;\r\n return this;\r\n }\r\n\r\n write_f32(value: number): this {\r\n this.dv.setFloat32(this.position, value, this.little_endian);\r\n this._position += 4;\r\n return this;\r\n }\r\n\r\n write_u8_array(array: number[]): this {\r\n new Uint8Array(this.buffer, this.offset + this.position).set(new Uint8Array(array));\r\n this._position += array.length;\r\n return this;\r\n }\r\n\r\n write_cursor(other: Cursor): this {\r\n const size = other.size - other.position;\r\n other.copy_to_uint8_array(\r\n new Uint8Array(this.buffer, this.offset + this.position, size),\r\n size\r\n );\r\n this._position += size;\r\n return this;\r\n }\r\n\r\n write_string_ascii(str: string, byte_length: number): this {\r\n let i = 0;\r\n\r\n for (const byte of ASCII_ENCODER.encode(str)) {\r\n if (i < byte_length) {\r\n this.write_u8(byte);\r\n ++i;\r\n }\r\n }\r\n\r\n while (i < byte_length) {\r\n this.write_u8(0);\r\n ++i;\r\n }\r\n\r\n return this;\r\n }\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\nimport { WritableArrayBufferCursor } from \"../../cursor/WritableArrayBufferCursor\";\r\nimport { Endianness } from \"../..\";\r\nimport { WritableCursor } from \"../../cursor/WritableCursor\";\r\nimport { WritableResizableBufferCursor } from \"../../cursor/WritableResizableBufferCursor\";\r\nimport { ResizableBuffer } from \"../../ResizableBuffer\";\r\nimport { ArrayBufferCursor } from \"../../cursor/ArrayBufferCursor\";\r\n\r\nconst logger = Logger.get(\"data_formats/parsing/quest/qst\");\r\n\r\nexport type QstContainedFile = {\r\n id?: number;\r\n name: string;\r\n name_2?: string; // Unsure what this is\r\n data: ArrayBuffer;\r\n};\r\n\r\nexport type ParseQstResult = {\r\n version: string;\r\n files: QstContainedFile[];\r\n};\r\n\r\n/**\r\n * Low level parsing function for .qst files.\r\n * Can only read the Blue Burst format.\r\n */\r\nexport function parse_qst(cursor: Cursor): ParseQstResult | undefined {\r\n // A .qst file contains two 88-byte headers that describe the embedded .dat and .bin files.\r\n let version = \"PC\";\r\n\r\n // Detect version.\r\n const version_a = cursor.u8();\r\n cursor.seek(1);\r\n const version_b = cursor.u8();\r\n\r\n if (version_a === 0x44) {\r\n version = \"Dreamcast/GameCube\";\r\n } else if (version_a === 0x58) {\r\n if (version_b === 0x44) {\r\n version = \"Blue Burst\";\r\n }\r\n } else if (version_a === 0xa6) {\r\n version = \"Dreamcast download\";\r\n }\r\n\r\n if (version === \"Blue Burst\") {\r\n // Read headers and contained files.\r\n cursor.seek_start(0);\r\n\r\n const headers = parse_headers(cursor);\r\n\r\n const files = parse_files(cursor, new Map(headers.map(h => [h.file_name, h.size])));\r\n\r\n for (const file of files) {\r\n const header = headers.find(h => h.file_name === file.name);\r\n\r\n if (header) {\r\n file.id = header.quest_id;\r\n file.name_2 = header.file_name_2;\r\n }\r\n }\r\n\r\n return {\r\n version,\r\n files,\r\n };\r\n } else {\r\n logger.error(`Can't parse ${version} QST files.`);\r\n return undefined;\r\n }\r\n}\r\n\r\nexport type QstContainedFileParam = {\r\n id?: number;\r\n name: string;\r\n name_2?: string;\r\n data: ArrayBuffer;\r\n};\r\n\r\nexport type WriteQstParams = {\r\n version?: string;\r\n files: QstContainedFileParam[];\r\n};\r\n\r\n/**\r\n * Always uses Blue Burst format.\r\n */\r\nexport function write_qst(params: WriteQstParams): ArrayBuffer {\r\n const files = params.files;\r\n const total_size = files\r\n .map(f => 88 + Math.ceil(f.data.byteLength / 1024) * 1056)\r\n .reduce((a, b) => a + b);\r\n const buffer = new ArrayBuffer(total_size);\r\n const cursor = new WritableArrayBufferCursor(buffer, Endianness.Little);\r\n\r\n write_file_headers(cursor, files);\r\n write_file_chunks(cursor, files);\r\n\r\n if (cursor.size !== total_size) {\r\n throw new Error(`Expected a final file size of ${total_size}, but got ${cursor.size}.`);\r\n }\r\n\r\n return buffer;\r\n}\r\n\r\ntype QstHeader = {\r\n quest_id: number;\r\n file_name: string;\r\n file_name_2: string;\r\n size: number;\r\n};\r\n\r\n/**\r\n * TODO: Read all headers instead of just the first 2.\r\n */\r\nfunction parse_headers(cursor: Cursor): QstHeader[] {\r\n const headers: QstHeader[] = [];\r\n\r\n for (let i = 0; i < 2; ++i) {\r\n cursor.seek(4);\r\n const quest_id = cursor.u16();\r\n cursor.seek(38);\r\n const file_name = cursor.string_ascii(16, true, true);\r\n const size = cursor.u32();\r\n // Not sure what this is:\r\n const file_name_2 = cursor.string_ascii(24, true, true);\r\n\r\n headers.push({\r\n quest_id,\r\n file_name,\r\n file_name_2,\r\n size,\r\n });\r\n }\r\n\r\n return headers;\r\n}\r\n\r\nfunction parse_files(cursor: Cursor, expected_sizes: Map<string, number>): QstContainedFile[] {\r\n // Files are interleaved in 1056 byte chunks.\r\n // Each chunk has a 24 byte header, 1024 byte data segment and an 8 byte trailer.\r\n const files = new Map<\r\n string,\r\n {\r\n name: string;\r\n expected_size?: number;\r\n cursor: WritableCursor;\r\n chunk_nos: Set<number>;\r\n }\r\n >();\r\n\r\n while (cursor.bytes_left >= 1056) {\r\n const start_position = cursor.position;\r\n\r\n // Read meta data.\r\n const chunk_no = cursor.seek(4).u8();\r\n const file_name = cursor.seek(3).string_ascii(16, true, true);\r\n\r\n let file = files.get(file_name);\r\n\r\n if (!file) {\r\n const expected_size = expected_sizes.get(file_name);\r\n files.set(\r\n file_name,\r\n (file = {\r\n name: file_name,\r\n expected_size,\r\n cursor: new WritableResizableBufferCursor(\r\n new ResizableBuffer(expected_size || 10 * 1024),\r\n Endianness.Little\r\n ),\r\n chunk_nos: new Set(),\r\n })\r\n );\r\n }\r\n\r\n if (file.chunk_nos.has(chunk_no)) {\r\n logger.warn(\r\n `File chunk number ${chunk_no} of file ${file_name} was already encountered, overwriting previous chunk.`\r\n );\r\n } else {\r\n file.chunk_nos.add(chunk_no);\r\n }\r\n\r\n // Read file data.\r\n let size = cursor.seek(1024).u32();\r\n cursor.seek(-1028);\r\n\r\n if (size > 1024) {\r\n logger.warn(\r\n `Data segment size of ${size} is larger than expected maximum size, reading just 1024 bytes.`\r\n );\r\n size = 1024;\r\n }\r\n\r\n const data = cursor.take(size);\r\n const chunk_position = chunk_no * 1024;\r\n file.cursor.size = Math.max(chunk_position + size, file.cursor.size);\r\n file.cursor.seek_start(chunk_position).write_cursor(data);\r\n\r\n // Skip the padding and the trailer.\r\n cursor.seek(1032 - data.size);\r\n\r\n if (cursor.position !== start_position + 1056) {\r\n throw new Error(\r\n `Read ${cursor.position -\r\n start_position} file chunk message bytes instead of expected 1056.`\r\n );\r\n }\r\n }\r\n\r\n if (cursor.bytes_left) {\r\n logger.warn(`${cursor.bytes_left} Bytes left in file.`);\r\n }\r\n\r\n for (const file of files.values()) {\r\n // Clean up file properties.\r\n file.cursor.seek_start(0);\r\n file.chunk_nos = new Set(Array.from(file.chunk_nos.values()).sort((a, b) => a - b));\r\n\r\n // Check whether the expected size was correct.\r\n if (file.expected_size != null && file.cursor.size !== file.expected_size) {\r\n logger.warn(\r\n `File ${file.name} has an actual size of ${file.cursor.size} instead of the expected size ${file.expected_size}.`\r\n );\r\n }\r\n\r\n // Detect missing file chunks.\r\n const actual_size = Math.max(file.cursor.size, file.expected_size || 0);\r\n\r\n for (let chunk_no = 0; chunk_no < Math.ceil(actual_size / 1024); ++chunk_no) {\r\n if (!file.chunk_nos.has(chunk_no)) {\r\n logger.warn(`File ${file.name} is missing chunk ${chunk_no}.`);\r\n }\r\n }\r\n }\r\n\r\n const contained_files: QstContainedFile[] = [];\r\n\r\n for (const file of files.values()) {\r\n contained_files.push({\r\n name: file.name,\r\n data: file.cursor.seek_start(0).array_buffer(),\r\n });\r\n }\r\n\r\n return contained_files;\r\n}\r\n\r\nfunction write_file_headers(cursor: WritableCursor, files: QstContainedFileParam[]): void {\r\n for (const file of files) {\r\n if (file.name.length > 16) {\r\n throw Error(`File ${file.name} has a name longer than 16 characters.`);\r\n }\r\n\r\n cursor.write_u16(88); // Header size.\r\n cursor.write_u16(0x44); // Magic number.\r\n cursor.write_u16(file.id || 0);\r\n\r\n for (let i = 0; i < 38; ++i) {\r\n cursor.write_u8(0);\r\n }\r\n\r\n cursor.write_string_ascii(file.name, 16);\r\n cursor.write_u32(file.data.byteLength);\r\n\r\n let file_name_2: string;\r\n\r\n if (file.name_2 == null) {\r\n // Not sure this makes sense.\r\n const dot_pos = file.name.lastIndexOf(\".\");\r\n file_name_2 =\r\n dot_pos === -1\r\n ? file.name + \"_j\"\r\n : file.name.slice(0, dot_pos) + \"_j\" + file.name.slice(dot_pos);\r\n } else {\r\n file_name_2 = file.name_2;\r\n }\r\n\r\n if (file_name_2.length > 24) {\r\n throw Error(\r\n `File ${file.name} has a file_name_2 length (${file_name_2}) longer than 24 characters.`\r\n );\r\n }\r\n\r\n cursor.write_string_ascii(file_name_2, 24);\r\n }\r\n}\r\n\r\nfunction write_file_chunks(cursor: WritableCursor, files: QstContainedFileParam[]): void {\r\n // Files are interleaved in 1056 byte chunks.\r\n // Each chunk has a 24 byte header, 1024 byte data segment and an 8 byte trailer.\r\n const chunks = files.map(file => ({\r\n no: 0,\r\n data: new ArrayBufferCursor(file.data, Endianness.Little),\r\n name: file.name,\r\n }));\r\n\r\n while (chunks.length) {\r\n let i = 0;\r\n\r\n while (i < chunks.length) {\r\n if (!write_file_chunk(cursor, chunks[i].data, chunks[i].no++, chunks[i].name)) {\r\n // Remove if there are no more chunks to write.\r\n chunks.splice(i, 1);\r\n } else {\r\n ++i;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @returns true if there are bytes left to write in data, false otherwise.\r\n */\r\nfunction write_file_chunk(\r\n cursor: WritableCursor,\r\n data: Cursor,\r\n chunk_no: number,\r\n name: string\r\n): boolean {\r\n cursor.write_u8_array([28, 4, 19, 0]);\r\n cursor.write_u8(chunk_no);\r\n cursor.write_u8_array([0, 0, 0]);\r\n cursor.write_string_ascii(name, 16);\r\n\r\n const size = Math.min(1024, data.bytes_left);\r\n cursor.write_cursor(data.take(size));\r\n\r\n // Padding.\r\n for (let i = size; i < 1024; ++i) {\r\n cursor.write_u8(0);\r\n }\r\n\r\n cursor.write_u32(size);\r\n cursor.write_u32(0);\r\n\r\n return data.bytes_left > 0;\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { Endianness } from \"../..\";\r\nimport { AreaVariant, NpcType, ObjectType, Quest, QuestNpc, QuestObject } from \"../../../domain\";\r\nimport { area_store } from \"../../../stores/AreaStore\";\r\nimport * as prs from \"../../compression/prs\";\r\nimport { ArrayBufferCursor } from \"../../cursor/ArrayBufferCursor\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\nimport { ResizableBufferCursor } from \"../../cursor/ResizableBufferCursor\";\r\nimport { Vec3 } from \"../../vector\";\r\nimport { Instruction, parse_bin, write_bin } from \"./bin\";\r\nimport { DatFile, DatNpc, DatObject, parse_dat, write_dat } from \"./dat\";\r\nimport { parse_qst, QstContainedFile, write_qst } from \"./qst\";\r\n\r\nconst logger = Logger.get(\"data_formats/parsing/quest\");\r\n\r\n/**\r\n * High level parsing function that delegates to lower level parsing functions.\r\n *\r\n * Always delegates to parseQst at the moment.\r\n */\r\nexport function parse_quest(cursor: Cursor, lenient: boolean = false): Quest | undefined {\r\n const qst = parse_qst(cursor);\r\n\r\n if (!qst) {\r\n return;\r\n }\r\n\r\n let dat_file: QstContainedFile | undefined;\r\n let bin_file: QstContainedFile | undefined;\r\n\r\n for (const file of qst.files) {\r\n const file_name = file.name.trim().toLowerCase();\r\n\r\n if (file_name.endsWith(\".dat\")) {\r\n dat_file = file;\r\n } else if (file_name.endsWith(\".bin\")) {\r\n bin_file = file;\r\n }\r\n }\r\n\r\n // TODO: deal with missing/multiple DAT or BIN file.\r\n\r\n if (!dat_file) {\r\n logger.error(\"File contains no DAT file.\");\r\n return;\r\n }\r\n\r\n if (!bin_file) {\r\n logger.error(\"File contains no BIN file.\");\r\n return;\r\n }\r\n\r\n const dat = parse_dat(prs.decompress(new ArrayBufferCursor(dat_file.data, Endianness.Little)));\r\n const bin = parse_bin(\r\n prs.decompress(new ArrayBufferCursor(bin_file.data, Endianness.Little)),\r\n lenient\r\n );\r\n let episode = 1;\r\n let area_variants: AreaVariant[] = [];\r\n\r\n if (bin.function_offsets.length) {\r\n const func_0_ops = get_func_operations(bin.instructions, bin.function_offsets[0]);\r\n\r\n if (func_0_ops) {\r\n episode = get_episode(func_0_ops);\r\n area_variants = get_area_variants(dat, episode, func_0_ops, lenient);\r\n } else {\r\n logger.warn(`Function 0 offset ${bin.function_offsets[0]} is invalid.`);\r\n }\r\n } else {\r\n logger.warn(\"File contains no functions.\");\r\n }\r\n\r\n return new Quest(\r\n dat_file.id,\r\n bin.quest_name,\r\n bin.short_description,\r\n bin.long_description,\r\n episode,\r\n area_variants,\r\n parse_obj_data(dat.objs),\r\n parse_npc_data(episode, dat.npcs),\r\n dat.unknowns,\r\n bin.data\r\n );\r\n}\r\n\r\nexport function write_quest_qst(quest: Quest, file_name: string): ArrayBuffer {\r\n const dat = write_dat({\r\n objs: objects_to_dat_data(quest.objects),\r\n npcs: npcsToDatData(quest.npcs),\r\n unknowns: quest.dat_unknowns,\r\n });\r\n const bin = write_bin({ data: quest.bin_data });\r\n const ext_start = file_name.lastIndexOf(\".\");\r\n const base_file_name = ext_start === -1 ? file_name : file_name.slice(0, ext_start);\r\n\r\n return write_qst({\r\n files: [\r\n {\r\n name: base_file_name + \".dat\",\r\n id: quest.id,\r\n data: prs\r\n .compress(new ResizableBufferCursor(dat, Endianness.Little))\r\n .array_buffer(),\r\n },\r\n {\r\n name: base_file_name + \".bin\",\r\n id: quest.id,\r\n data: prs.compress(new ArrayBufferCursor(bin, Endianness.Little)).array_buffer(),\r\n },\r\n ],\r\n });\r\n}\r\n\r\n/**\r\n * Defaults to episode I.\r\n */\r\nfunction get_episode(func_0_ops: Instruction[]): number {\r\n const set_episode = func_0_ops.find(op => op.mnemonic === \"set_episode\");\r\n\r\n if (set_episode) {\r\n switch (set_episode.args[0]) {\r\n default:\r\n case 0:\r\n return 1;\r\n case 1:\r\n return 2;\r\n case 2:\r\n return 4;\r\n }\r\n } else {\r\n logger.debug(\"Function 0 has no set_episode instruction.\");\r\n return 1;\r\n }\r\n}\r\n\r\nfunction get_area_variants(\r\n dat: DatFile,\r\n episode: number,\r\n func_0_ops: Instruction[],\r\n lenient: boolean\r\n): AreaVariant[] {\r\n // Add area variants that have npcs or objects even if there are no BB_Map_Designate instructions for them.\r\n const area_variants = new Map();\r\n\r\n for (const npc of dat.npcs) {\r\n area_variants.set(npc.area_id, 0);\r\n }\r\n\r\n for (const obj of dat.objs) {\r\n area_variants.set(obj.area_id, 0);\r\n }\r\n\r\n const bb_maps = func_0_ops.filter(op => op.mnemonic === \"BB_Map_Designate\");\r\n\r\n for (const bb_map of bb_maps) {\r\n const area_id = bb_map.args[0];\r\n const variant_id = bb_map.args[2];\r\n area_variants.set(area_id, variant_id);\r\n }\r\n\r\n const area_variants_array = new Array<AreaVariant>();\r\n\r\n for (const [area_id, variant_id] of area_variants.entries()) {\r\n try {\r\n area_variants_array.push(area_store.get_variant(episode, area_id, variant_id));\r\n } catch (e) {\r\n if (lenient) {\r\n logger.error(`Unknown area variant.`, e);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n }\r\n\r\n // Sort by area order and then variant id.\r\n return area_variants_array.sort((a, b) => a.area.order - b.area.order || a.id - b.id);\r\n}\r\n\r\nfunction get_func_operations(\r\n operations: Instruction[],\r\n func_offset: number\r\n): Instruction[] | undefined {\r\n let position = 0;\r\n let func_found = false;\r\n const func_ops: Instruction[] = [];\r\n\r\n for (const operation of operations) {\r\n if (position === func_offset) {\r\n func_found = true;\r\n }\r\n\r\n if (func_found) {\r\n func_ops.push(operation);\r\n\r\n // Break when ret is encountered.\r\n if (operation.opcode === 1) {\r\n break;\r\n }\r\n }\r\n\r\n position += operation.size;\r\n }\r\n\r\n return func_found ? func_ops : undefined;\r\n}\r\n\r\nfunction parse_obj_data(objs: DatObject[]): QuestObject[] {\r\n return objs.map(obj_data => {\r\n const { x, y, z } = obj_data.position;\r\n const rot = obj_data.rotation;\r\n return new QuestObject(\r\n obj_data.area_id,\r\n obj_data.section_id,\r\n new Vec3(x, y, z),\r\n new Vec3(rot.x, rot.y, rot.z),\r\n ObjectType.from_pso_id(obj_data.type_id),\r\n obj_data\r\n );\r\n });\r\n}\r\n\r\nfunction parse_npc_data(episode: number, npcs: DatNpc[]): QuestNpc[] {\r\n return npcs.map(npc_data => {\r\n const { x, y, z } = npc_data.position;\r\n const rot = npc_data.rotation;\r\n return new QuestNpc(\r\n npc_data.area_id,\r\n npc_data.section_id,\r\n new Vec3(x, y, z),\r\n new Vec3(rot.x, rot.y, rot.z),\r\n get_npc_type(episode, npc_data),\r\n npc_data\r\n );\r\n });\r\n}\r\n\r\n// TODO: detect Mothmant, St. Rappy, Hallo Rappy, Egg Rappy, Death Gunner, Bulk and Recon.\r\nfunction get_npc_type(episode: number, { type_id, flags, skin, area_id }: DatNpc): NpcType {\r\n const regular = Math.abs(flags - 1) > 0.00001;\r\n\r\n switch (`${type_id}, ${skin % 3}, ${episode}`) {\r\n case `${0x044}, 0, 1`:\r\n return NpcType.Booma;\r\n case `${0x044}, 1, 1`:\r\n return NpcType.Gobooma;\r\n case `${0x044}, 2, 1`:\r\n return NpcType.Gigobooma;\r\n\r\n case `${0x063}, 0, 1`:\r\n return NpcType.EvilShark;\r\n case `${0x063}, 1, 1`:\r\n return NpcType.PalShark;\r\n case `${0x063}, 2, 1`:\r\n return NpcType.GuilShark;\r\n\r\n case `${0x0a6}, 0, 1`:\r\n return NpcType.Dimenian;\r\n case `${0x0a6}, 0, 2`:\r\n return NpcType.Dimenian2;\r\n case `${0x0a6}, 1, 1`:\r\n return NpcType.LaDimenian;\r\n case `${0x0a6}, 1, 2`:\r\n return NpcType.LaDimenian2;\r\n case `${0x0a6}, 2, 1`:\r\n return NpcType.SoDimenian;\r\n case `${0x0a6}, 2, 2`:\r\n return NpcType.SoDimenian2;\r\n\r\n case `${0x0d6}, 0, 2`:\r\n return NpcType.Mericarol;\r\n case `${0x0d6}, 1, 2`:\r\n return NpcType.Mericus;\r\n case `${0x0d6}, 2, 2`:\r\n return NpcType.Merikle;\r\n\r\n case `${0x115}, 0, 4`:\r\n return NpcType.Boota;\r\n case `${0x115}, 1, 4`:\r\n return NpcType.ZeBoota;\r\n case `${0x115}, 2, 4`:\r\n return NpcType.BaBoota;\r\n case `${0x117}, 0, 4`:\r\n return NpcType.Goran;\r\n case `${0x117}, 1, 4`:\r\n return NpcType.PyroGoran;\r\n case `${0x117}, 2, 4`:\r\n return NpcType.GoranDetonator;\r\n }\r\n\r\n switch (`${type_id}, ${skin % 2}, ${episode}`) {\r\n case `${0x040}, 0, 1`:\r\n return NpcType.Hildebear;\r\n case `${0x040}, 0, 2`:\r\n return NpcType.Hildebear2;\r\n case `${0x040}, 1, 1`:\r\n return NpcType.Hildeblue;\r\n case `${0x040}, 1, 2`:\r\n return NpcType.Hildeblue2;\r\n case `${0x041}, 0, 1`:\r\n return NpcType.RagRappy;\r\n case `${0x041}, 0, 2`:\r\n return NpcType.RagRappy2;\r\n case `${0x041}, 0, 4`:\r\n return NpcType.SandRappy;\r\n case `${0x041}, 1, 1`:\r\n return NpcType.AlRappy;\r\n case `${0x041}, 1, 2`:\r\n return NpcType.LoveRappy;\r\n case `${0x041}, 1, 4`:\r\n return NpcType.DelRappy;\r\n\r\n case `${0x080}, 0, 1`:\r\n return NpcType.Dubchic;\r\n case `${0x080}, 0, 2`:\r\n return NpcType.Dubchic2;\r\n case `${0x080}, 1, 1`:\r\n return NpcType.Gilchic;\r\n case `${0x080}, 1, 2`:\r\n return NpcType.Gilchic2;\r\n\r\n case `${0x0d4}, 0, 2`:\r\n return NpcType.SinowBerill;\r\n case `${0x0d4}, 1, 2`:\r\n return NpcType.SinowSpigell;\r\n case `${0x0d5}, 0, 2`:\r\n return NpcType.Merillia;\r\n case `${0x0d5}, 1, 2`:\r\n return NpcType.Meriltas;\r\n case `${0x0d7}, 0, 2`:\r\n return NpcType.UlGibbon;\r\n case `${0x0d7}, 1, 2`:\r\n return NpcType.ZolGibbon;\r\n\r\n case `${0x0dd}, 0, 2`:\r\n return NpcType.Dolmolm;\r\n case `${0x0dd}, 1, 2`:\r\n return NpcType.Dolmdarl;\r\n case `${0x0e0}, 0, 2`:\r\n return area_id > 15 ? NpcType.Epsilon : NpcType.SinowZoa;\r\n case `${0x0e0}, 1, 2`:\r\n return area_id > 15 ? NpcType.Epsilon : NpcType.SinowZele;\r\n\r\n case `${0x112}, 0, 4`:\r\n return NpcType.MerissaA;\r\n case `${0x112}, 1, 4`:\r\n return NpcType.MerissaAA;\r\n case `${0x114}, 0, 4`:\r\n return NpcType.Zu;\r\n case `${0x114}, 1, 4`:\r\n return NpcType.Pazuzu;\r\n case `${0x116}, 0, 4`:\r\n return NpcType.Dorphon;\r\n case `${0x116}, 1, 4`:\r\n return NpcType.DorphonEclair;\r\n case `${0x119}, 0, 4`:\r\n return regular ? NpcType.SaintMilion : NpcType.Kondrieu;\r\n case `${0x119}, 1, 4`:\r\n return regular ? NpcType.Shambertin : NpcType.Kondrieu;\r\n }\r\n\r\n switch (`${type_id}, ${episode}`) {\r\n case `${0x042}, 1`:\r\n return NpcType.Monest;\r\n case `${0x042}, 2`:\r\n return NpcType.Monest2;\r\n case `${0x043}, 1`:\r\n return regular ? NpcType.SavageWolf : NpcType.BarbarousWolf;\r\n case `${0x043}, 2`:\r\n return regular ? NpcType.SavageWolf2 : NpcType.BarbarousWolf2;\r\n\r\n case `${0x060}, 1`:\r\n return NpcType.GrassAssassin;\r\n case `${0x060}, 2`:\r\n return NpcType.GrassAssassin2;\r\n case `${0x061}, 1`:\r\n return area_id > 15 ? NpcType.DelLily : regular ? NpcType.PoisonLily : NpcType.NarLily;\r\n case `${0x061}, 2`:\r\n return area_id > 15\r\n ? NpcType.DelLily\r\n : regular\r\n ? NpcType.PoisonLily2\r\n : NpcType.NarLily2;\r\n case `${0x062}, 1`:\r\n return NpcType.NanoDragon;\r\n case `${0x064}, 1`:\r\n return regular ? NpcType.PofuillySlime : NpcType.PouillySlime;\r\n case `${0x065}, 1`:\r\n return NpcType.PanArms;\r\n case `${0x065}, 2`:\r\n return NpcType.PanArms2;\r\n\r\n case `${0x081}, 1`:\r\n return NpcType.Garanz;\r\n case `${0x081}, 2`:\r\n return NpcType.Garanz2;\r\n case `${0x082}, 1`:\r\n return regular ? NpcType.SinowBeat : NpcType.SinowGold;\r\n case `${0x083}, 1`:\r\n return NpcType.Canadine;\r\n case `${0x084}, 1`:\r\n return NpcType.Canane;\r\n case `${0x085}, 1`:\r\n return NpcType.Dubswitch;\r\n case `${0x085}, 2`:\r\n return NpcType.Dubswitch2;\r\n\r\n case `${0x0a0}, 1`:\r\n return NpcType.Delsaber;\r\n case `${0x0a0}, 2`:\r\n return NpcType.Delsaber2;\r\n case `${0x0a1}, 1`:\r\n return NpcType.ChaosSorcerer;\r\n case `${0x0a1}, 2`:\r\n return NpcType.ChaosSorcerer2;\r\n case `${0x0a2}, 1`:\r\n return NpcType.DarkGunner;\r\n case `${0x0a4}, 1`:\r\n return NpcType.ChaosBringer;\r\n case `${0x0a5}, 1`:\r\n return NpcType.DarkBelra;\r\n case `${0x0a5}, 2`:\r\n return NpcType.DarkBelra2;\r\n case `${0x0a7}, 1`:\r\n return NpcType.Bulclaw;\r\n case `${0x0a8}, 1`:\r\n return NpcType.Claw;\r\n\r\n case `${0x0c0}, 1`:\r\n return NpcType.Dragon;\r\n case `${0x0c0}, 2`:\r\n return NpcType.GalGryphon;\r\n case `${0x0c1}, 1`:\r\n return NpcType.DeRolLe;\r\n // TODO:\r\n // case `${0x0C2}, 1`: return NpcType.VolOptPart1;\r\n case `${0x0c5}, 1`:\r\n return NpcType.VolOpt;\r\n case `${0x0c8}, 1`:\r\n return NpcType.DarkFalz;\r\n case `${0x0ca}, 2`:\r\n return NpcType.OlgaFlow;\r\n case `${0x0cb}, 2`:\r\n return NpcType.BarbaRay;\r\n case `${0x0cc}, 2`:\r\n return NpcType.GolDragon;\r\n\r\n case `${0x0d8}, 2`:\r\n return NpcType.Gibbles;\r\n case `${0x0d9}, 2`:\r\n return NpcType.Gee;\r\n case `${0x0da}, 2`:\r\n return NpcType.GiGue;\r\n\r\n case `${0x0db}, 2`:\r\n return NpcType.Deldepth;\r\n case `${0x0dc}, 2`:\r\n return NpcType.Delbiter;\r\n case `${0x0de}, 2`:\r\n return NpcType.Morfos;\r\n case `${0x0df}, 2`:\r\n return NpcType.Recobox;\r\n case `${0x0e1}, 2`:\r\n return NpcType.IllGill;\r\n\r\n case `${0x110}, 4`:\r\n return NpcType.Astark;\r\n case `${0x111}, 4`:\r\n return regular ? NpcType.SatelliteLizard : NpcType.Yowie;\r\n case `${0x113}, 4`:\r\n return NpcType.Girtablulu;\r\n }\r\n\r\n switch (type_id) {\r\n case 0x004:\r\n return NpcType.FemaleFat;\r\n case 0x005:\r\n return NpcType.FemaleMacho;\r\n case 0x007:\r\n return NpcType.FemaleTall;\r\n case 0x00a:\r\n return NpcType.MaleDwarf;\r\n case 0x00b:\r\n return NpcType.MaleFat;\r\n case 0x00c:\r\n return NpcType.MaleMacho;\r\n case 0x00d:\r\n return NpcType.MaleOld;\r\n case 0x019:\r\n return NpcType.BlueSoldier;\r\n case 0x01a:\r\n return NpcType.RedSoldier;\r\n case 0x01b:\r\n return NpcType.Principal;\r\n case 0x01c:\r\n return NpcType.Tekker;\r\n case 0x01d:\r\n return NpcType.GuildLady;\r\n case 0x01e:\r\n return NpcType.Scientist;\r\n case 0x01f:\r\n return NpcType.Nurse;\r\n case 0x020:\r\n return NpcType.Irene;\r\n case 0x0f1:\r\n return NpcType.ItemShop;\r\n case 0x0fe:\r\n return NpcType.Nurse2;\r\n }\r\n\r\n return NpcType.Unknown;\r\n}\r\n\r\nfunction objects_to_dat_data(objects: QuestObject[]): DatObject[] {\r\n return objects.map(object => ({\r\n type_id: object.type.pso_id!,\r\n section_id: object.section_id,\r\n position: object.section_position,\r\n rotation: object.rotation,\r\n area_id: object.area_id,\r\n unknown: object.dat.unknown,\r\n }));\r\n}\r\n\r\nfunction npcsToDatData(npcs: QuestNpc[]): DatNpc[] {\r\n return npcs.map(npc => {\r\n // If the type is unknown, typeData will be undefined and we use the raw data from the DAT file.\r\n const type_data = npc_type_to_dat_data(npc.type);\r\n let flags = npc.dat.flags;\r\n\r\n if (type_data) {\r\n flags = (npc.dat.flags & ~0x800000) | (type_data.regular ? 0 : 0x800000);\r\n }\r\n\r\n return {\r\n type_id: type_data ? type_data.type_id : npc.dat.type_id,\r\n section_id: npc.section_id,\r\n position: npc.section_position,\r\n rotation: npc.rotation,\r\n flags,\r\n skin: type_data ? type_data.skin : npc.dat.skin,\r\n area_id: npc.area_id,\r\n unknown: npc.dat.unknown,\r\n };\r\n });\r\n}\r\n\r\nfunction npc_type_to_dat_data(\r\n type: NpcType\r\n): { type_id: number; skin: number; regular: boolean } | undefined {\r\n switch (type) {\r\n default:\r\n throw new Error(`Unexpected type ${type.code}.`);\r\n\r\n case NpcType.Unknown:\r\n return undefined;\r\n\r\n case NpcType.FemaleFat:\r\n return { type_id: 0x004, skin: 0, regular: true };\r\n case NpcType.FemaleMacho:\r\n return { type_id: 0x005, skin: 0, regular: true };\r\n case NpcType.FemaleTall:\r\n return { type_id: 0x007, skin: 0, regular: true };\r\n case NpcType.MaleDwarf:\r\n return { type_id: 0x00a, skin: 0, regular: true };\r\n case NpcType.MaleFat:\r\n return { type_id: 0x00b, skin: 0, regular: true };\r\n case NpcType.MaleMacho:\r\n return { type_id: 0x00c, skin: 0, regular: true };\r\n case NpcType.MaleOld:\r\n return { type_id: 0x00d, skin: 0, regular: true };\r\n case NpcType.BlueSoldier:\r\n return { type_id: 0x019, skin: 0, regular: true };\r\n case NpcType.RedSoldier:\r\n return { type_id: 0x01a, skin: 0, regular: true };\r\n case NpcType.Principal:\r\n return { type_id: 0x01b, skin: 0, regular: true };\r\n case NpcType.Tekker:\r\n return { type_id: 0x01c, skin: 0, regular: true };\r\n case NpcType.GuildLady:\r\n return { type_id: 0x01d, skin: 0, regular: true };\r\n case NpcType.Scientist:\r\n return { type_id: 0x01e, skin: 0, regular: true };\r\n case NpcType.Nurse:\r\n return { type_id: 0x01f, skin: 0, regular: true };\r\n case NpcType.Irene:\r\n return { type_id: 0x020, skin: 0, regular: true };\r\n case NpcType.ItemShop:\r\n return { type_id: 0x0f1, skin: 0, regular: true };\r\n case NpcType.Nurse2:\r\n return { type_id: 0x0fe, skin: 0, regular: true };\r\n\r\n case NpcType.Hildebear:\r\n return { type_id: 0x040, skin: 0, regular: true };\r\n case NpcType.Hildeblue:\r\n return { type_id: 0x040, skin: 1, regular: true };\r\n case NpcType.RagRappy:\r\n return { type_id: 0x041, skin: 0, regular: true };\r\n case NpcType.AlRappy:\r\n return { type_id: 0x041, skin: 1, regular: true };\r\n case NpcType.Monest:\r\n return { type_id: 0x042, skin: 0, regular: true };\r\n case NpcType.SavageWolf:\r\n return { type_id: 0x043, skin: 0, regular: true };\r\n case NpcType.BarbarousWolf:\r\n return { type_id: 0x043, skin: 0, regular: false };\r\n case NpcType.Booma:\r\n return { type_id: 0x044, skin: 0, regular: true };\r\n case NpcType.Gobooma:\r\n return { type_id: 0x044, skin: 1, regular: true };\r\n case NpcType.Gigobooma:\r\n return { type_id: 0x044, skin: 2, regular: true };\r\n case NpcType.Dragon:\r\n return { type_id: 0x0c0, skin: 0, regular: true };\r\n\r\n case NpcType.GrassAssassin:\r\n return { type_id: 0x060, skin: 0, regular: true };\r\n case NpcType.PoisonLily:\r\n return { type_id: 0x061, skin: 0, regular: true };\r\n case NpcType.NarLily:\r\n return { type_id: 0x061, skin: 1, regular: true };\r\n case NpcType.NanoDragon:\r\n return { type_id: 0x062, skin: 0, regular: true };\r\n case NpcType.EvilShark:\r\n return { type_id: 0x063, skin: 0, regular: true };\r\n case NpcType.PalShark:\r\n return { type_id: 0x063, skin: 1, regular: true };\r\n case NpcType.GuilShark:\r\n return { type_id: 0x063, skin: 2, regular: true };\r\n case NpcType.PofuillySlime:\r\n return { type_id: 0x064, skin: 0, regular: true };\r\n case NpcType.PouillySlime:\r\n return { type_id: 0x064, skin: 0, regular: false };\r\n case NpcType.PanArms:\r\n return { type_id: 0x065, skin: 0, regular: true };\r\n case NpcType.DeRolLe:\r\n return { type_id: 0x0c1, skin: 0, regular: true };\r\n\r\n case NpcType.Dubchic:\r\n return { type_id: 0x080, skin: 0, regular: true };\r\n case NpcType.Gilchic:\r\n return { type_id: 0x080, skin: 1, regular: true };\r\n case NpcType.Garanz:\r\n return { type_id: 0x081, skin: 0, regular: true };\r\n case NpcType.SinowBeat:\r\n return { type_id: 0x082, skin: 0, regular: true };\r\n case NpcType.SinowGold:\r\n return { type_id: 0x082, skin: 0, regular: false };\r\n case NpcType.Canadine:\r\n return { type_id: 0x083, skin: 0, regular: true };\r\n case NpcType.Canane:\r\n return { type_id: 0x084, skin: 0, regular: true };\r\n case NpcType.Dubswitch:\r\n return { type_id: 0x085, skin: 0, regular: true };\r\n case NpcType.VolOpt:\r\n return { type_id: 0x0c5, skin: 0, regular: true };\r\n\r\n case NpcType.Delsaber:\r\n return { type_id: 0x0a0, skin: 0, regular: true };\r\n case NpcType.ChaosSorcerer:\r\n return { type_id: 0x0a1, skin: 0, regular: true };\r\n case NpcType.DarkGunner:\r\n return { type_id: 0x0a2, skin: 0, regular: true };\r\n case NpcType.ChaosBringer:\r\n return { type_id: 0x0a4, skin: 0, regular: true };\r\n case NpcType.DarkBelra:\r\n return { type_id: 0x0a5, skin: 0, regular: true };\r\n case NpcType.Dimenian:\r\n return { type_id: 0x0a6, skin: 0, regular: true };\r\n case NpcType.LaDimenian:\r\n return { type_id: 0x0a6, skin: 1, regular: true };\r\n case NpcType.SoDimenian:\r\n return { type_id: 0x0a6, skin: 2, regular: true };\r\n case NpcType.Bulclaw:\r\n return { type_id: 0x0a7, skin: 0, regular: true };\r\n case NpcType.Claw:\r\n return { type_id: 0x0a8, skin: 0, regular: true };\r\n case NpcType.DarkFalz:\r\n return { type_id: 0x0c8, skin: 0, regular: true };\r\n\r\n case NpcType.Hildebear2:\r\n return { type_id: 0x040, skin: 0, regular: true };\r\n case NpcType.Hildeblue2:\r\n return { type_id: 0x040, skin: 1, regular: true };\r\n case NpcType.RagRappy2:\r\n return { type_id: 0x041, skin: 0, regular: true };\r\n case NpcType.LoveRappy:\r\n return { type_id: 0x041, skin: 1, regular: true };\r\n case NpcType.Monest2:\r\n return { type_id: 0x042, skin: 0, regular: true };\r\n case NpcType.PoisonLily2:\r\n return { type_id: 0x061, skin: 0, regular: true };\r\n case NpcType.NarLily2:\r\n return { type_id: 0x061, skin: 1, regular: true };\r\n case NpcType.GrassAssassin2:\r\n return { type_id: 0x060, skin: 0, regular: true };\r\n case NpcType.Dimenian2:\r\n return { type_id: 0x0a6, skin: 0, regular: true };\r\n case NpcType.LaDimenian2:\r\n return { type_id: 0x0a6, skin: 1, regular: true };\r\n case NpcType.SoDimenian2:\r\n return { type_id: 0x0a6, skin: 2, regular: true };\r\n case NpcType.DarkBelra2:\r\n return { type_id: 0x0a5, skin: 0, regular: true };\r\n case NpcType.BarbaRay:\r\n return { type_id: 0x0cb, skin: 0, regular: true };\r\n\r\n case NpcType.SavageWolf2:\r\n return { type_id: 0x043, skin: 0, regular: true };\r\n case NpcType.BarbarousWolf2:\r\n return { type_id: 0x043, skin: 0, regular: false };\r\n case NpcType.PanArms2:\r\n return { type_id: 0x065, skin: 0, regular: true };\r\n case NpcType.Dubchic2:\r\n return { type_id: 0x080, skin: 0, regular: true };\r\n case NpcType.Gilchic2:\r\n return { type_id: 0x080, skin: 1, regular: true };\r\n case NpcType.Garanz2:\r\n return { type_id: 0x081, skin: 0, regular: true };\r\n case NpcType.Dubswitch2:\r\n return { type_id: 0x085, skin: 0, regular: true };\r\n case NpcType.Delsaber2:\r\n return { type_id: 0x0a0, skin: 0, regular: true };\r\n case NpcType.ChaosSorcerer2:\r\n return { type_id: 0x0a1, skin: 0, regular: true };\r\n case NpcType.GolDragon:\r\n return { type_id: 0x0cc, skin: 0, regular: true };\r\n\r\n case NpcType.SinowBerill:\r\n return { type_id: 0x0d4, skin: 0, regular: true };\r\n case NpcType.SinowSpigell:\r\n return { type_id: 0x0d4, skin: 1, regular: true };\r\n case NpcType.Merillia:\r\n return { type_id: 0x0d5, skin: 0, regular: true };\r\n case NpcType.Meriltas:\r\n return { type_id: 0x0d5, skin: 1, regular: true };\r\n case NpcType.Mericarol:\r\n return { type_id: 0x0d6, skin: 0, regular: true };\r\n case NpcType.Mericus:\r\n return { type_id: 0x0d6, skin: 1, regular: true };\r\n case NpcType.Merikle:\r\n return { type_id: 0x0d6, skin: 2, regular: true };\r\n case NpcType.UlGibbon:\r\n return { type_id: 0x0d7, skin: 0, regular: true };\r\n case NpcType.ZolGibbon:\r\n return { type_id: 0x0d7, skin: 1, regular: true };\r\n case NpcType.Gibbles:\r\n return { type_id: 0x0d8, skin: 0, regular: true };\r\n case NpcType.Gee:\r\n return { type_id: 0x0d9, skin: 0, regular: true };\r\n case NpcType.GiGue:\r\n return { type_id: 0x0da, skin: 0, regular: true };\r\n case NpcType.GalGryphon:\r\n return { type_id: 0x0c0, skin: 0, regular: true };\r\n\r\n case NpcType.Deldepth:\r\n return { type_id: 0x0db, skin: 0, regular: true };\r\n case NpcType.Delbiter:\r\n return { type_id: 0x0dc, skin: 0, regular: true };\r\n case NpcType.Dolmolm:\r\n return { type_id: 0x0dd, skin: 0, regular: true };\r\n case NpcType.Dolmdarl:\r\n return { type_id: 0x0dd, skin: 1, regular: true };\r\n case NpcType.Morfos:\r\n return { type_id: 0x0de, skin: 0, regular: true };\r\n case NpcType.Recobox:\r\n return { type_id: 0x0df, skin: 0, regular: true };\r\n case NpcType.Epsilon:\r\n return { type_id: 0x0e0, skin: 0, regular: true };\r\n case NpcType.SinowZoa:\r\n return { type_id: 0x0e0, skin: 0, regular: true };\r\n case NpcType.SinowZele:\r\n return { type_id: 0x0e0, skin: 1, regular: true };\r\n case NpcType.IllGill:\r\n return { type_id: 0x0e1, skin: 0, regular: true };\r\n case NpcType.DelLily:\r\n return { type_id: 0x061, skin: 0, regular: true };\r\n case NpcType.OlgaFlow:\r\n return { type_id: 0x0ca, skin: 0, regular: true };\r\n\r\n case NpcType.SandRappy:\r\n return { type_id: 0x041, skin: 0, regular: true };\r\n case NpcType.DelRappy:\r\n return { type_id: 0x041, skin: 1, regular: true };\r\n case NpcType.Astark:\r\n return { type_id: 0x110, skin: 0, regular: true };\r\n case NpcType.SatelliteLizard:\r\n return { type_id: 0x111, skin: 0, regular: true };\r\n case NpcType.Yowie:\r\n return { type_id: 0x111, skin: 0, regular: false };\r\n case NpcType.MerissaA:\r\n return { type_id: 0x112, skin: 0, regular: true };\r\n case NpcType.MerissaAA:\r\n return { type_id: 0x112, skin: 1, regular: true };\r\n case NpcType.Girtablulu:\r\n return { type_id: 0x113, skin: 0, regular: true };\r\n case NpcType.Zu:\r\n return { type_id: 0x114, skin: 0, regular: true };\r\n case NpcType.Pazuzu:\r\n return { type_id: 0x114, skin: 1, regular: true };\r\n case NpcType.Boota:\r\n return { type_id: 0x115, skin: 0, regular: true };\r\n case NpcType.ZeBoota:\r\n return { type_id: 0x115, skin: 1, regular: true };\r\n case NpcType.BaBoota:\r\n return { type_id: 0x115, skin: 2, regular: true };\r\n case NpcType.Dorphon:\r\n return { type_id: 0x116, skin: 0, regular: true };\r\n case NpcType.DorphonEclair:\r\n return { type_id: 0x116, skin: 1, regular: true };\r\n case NpcType.Goran:\r\n return { type_id: 0x117, skin: 0, regular: true };\r\n case NpcType.PyroGoran:\r\n return { type_id: 0x117, skin: 1, regular: true };\r\n case NpcType.GoranDetonator:\r\n return { type_id: 0x117, skin: 2, regular: true };\r\n case NpcType.SaintMilion:\r\n return { type_id: 0x119, skin: 0, regular: true };\r\n case NpcType.Shambertin:\r\n return { type_id: 0x119, skin: 1, regular: true };\r\n case NpcType.Kondrieu:\r\n return { type_id: 0x119, skin: 0, regular: false };\r\n }\r\n}\r\n","import {\r\n BufferGeometry,\r\n DoubleSide,\r\n Mesh,\r\n MeshBasicMaterial,\r\n MeshLambertMaterial,\r\n Texture,\r\n Material,\r\n} from \"three\";\r\nimport { QuestEntity, QuestNpc, QuestObject } from \"../domain\";\r\n\r\nexport const OBJECT_COLOR = 0xffff00;\r\nexport const OBJECT_HOVER_COLOR = 0xffdf3f;\r\nexport const OBJECT_SELECTED_COLOR = 0xffaa00;\r\nexport const NPC_COLOR = 0xff0000;\r\nexport const NPC_HOVER_COLOR = 0xff3f5f;\r\nexport const NPC_SELECTED_COLOR = 0xff0054;\r\n\r\nexport function create_object_mesh(\r\n object: QuestObject,\r\n geometry: BufferGeometry,\r\n textures: Texture[]\r\n): Mesh {\r\n return create_mesh(object, geometry, textures, OBJECT_COLOR, \"Object\");\r\n}\r\n\r\nexport function create_npc_mesh(\r\n npc: QuestNpc,\r\n geometry: BufferGeometry,\r\n textures: Texture[]\r\n): Mesh {\r\n return create_mesh(npc, geometry, textures, NPC_COLOR, \"NPC\");\r\n}\r\n\r\nfunction create_mesh(\r\n entity: QuestEntity,\r\n geometry: BufferGeometry,\r\n textures: Texture[],\r\n color: number,\r\n type: string\r\n): Mesh {\r\n const max_mat_idx = geometry.groups.reduce((max, g) => Math.max(max, g.materialIndex || 0), 0);\r\n\r\n const materials: Material[] = [\r\n new MeshBasicMaterial({\r\n color,\r\n side: DoubleSide,\r\n }),\r\n ];\r\n\r\n materials.push(\r\n ...textures.map(\r\n tex =>\r\n new MeshLambertMaterial({\r\n map: tex,\r\n side: DoubleSide,\r\n alphaTest: 0.5,\r\n })\r\n )\r\n );\r\n\r\n for (let i = materials.length - 1; i < max_mat_idx; ++i) {\r\n materials.push(\r\n new MeshLambertMaterial({\r\n color,\r\n side: DoubleSide,\r\n })\r\n );\r\n }\r\n\r\n const mesh = new Mesh(geometry, materials);\r\n mesh.name = type;\r\n mesh.userData.entity = entity;\r\n\r\n const { x, y, z } = entity.position;\r\n mesh.position.set(x, y, z);\r\n const rot = entity.rotation;\r\n mesh.rotation.set(rot.x, rot.y, rot.z);\r\n\r\n return mesh;\r\n}\r\n","import {\r\n Bone,\r\n BufferGeometry,\r\n DoubleSide,\r\n Euler,\r\n Float32BufferAttribute,\r\n Material,\r\n Matrix3,\r\n Matrix4,\r\n MeshLambertMaterial,\r\n Quaternion,\r\n Skeleton,\r\n SkinnedMesh,\r\n Uint16BufferAttribute,\r\n Vector3,\r\n MeshBasicMaterial,\r\n Mesh,\r\n} from \"three\";\r\nimport { vec3_to_threejs } from \".\";\r\nimport { is_njcm_model, NjModel, NjObject } from \"../data_formats/parsing/ninja\";\r\nimport { NjcmModel } from \"../data_formats/parsing/ninja/njcm\";\r\nimport { xj_model_to_geometry } from \"./xj_model_to_geometry\";\r\n\r\nconst DUMMY_MATERIAL = new MeshBasicMaterial({\r\n color: 0x00ff00,\r\n side: DoubleSide,\r\n});\r\nconst DEFAULT_MATERIAL = new MeshBasicMaterial({\r\n color: 0xff00ff,\r\n side: DoubleSide,\r\n});\r\nconst DEFAULT_SKINNED_MATERIAL = new MeshLambertMaterial({\r\n skinning: true,\r\n color: 0xff00ff,\r\n side: DoubleSide,\r\n});\r\nconst DEFAULT_NORMAL = new Vector3(0, 1, 0);\r\nconst NO_TRANSLATION = new Vector3(0, 0, 0);\r\nconst NO_ROTATION = new Quaternion(0, 0, 0, 1);\r\nconst NO_SCALE = new Vector3(1, 1, 1);\r\n\r\nexport function ninja_object_to_buffer_geometry(object: NjObject<NjModel>): BufferGeometry {\r\n return new Object3DCreator([]).create_buffer_geometry(object);\r\n}\r\n\r\nexport function ninja_object_to_mesh(object: NjObject<NjModel>, materials: Material[] = []): Mesh {\r\n return new Object3DCreator(materials).create_mesh(object);\r\n}\r\n\r\nexport function ninja_object_to_skinned_mesh(\r\n object: NjObject<NjModel>,\r\n materials: Material[] = []\r\n): SkinnedMesh {\r\n return new Object3DCreator(materials).create_skinned_mesh(object);\r\n}\r\n\r\nexport type VertexGroup = {\r\n /**\r\n * Start index.\r\n */\r\n start: number;\r\n count: number;\r\n material_index: number;\r\n};\r\n\r\ntype Vertex = {\r\n bone_id: number;\r\n position: Vector3;\r\n normal?: Vector3;\r\n bone_weight: number;\r\n bone_weight_status: number;\r\n calc_continue: boolean;\r\n};\r\n\r\nclass VerticesHolder {\r\n private vertices_stack: Vertex[][] = [];\r\n\r\n put(vertices: Vertex[]): void {\r\n this.vertices_stack.push(vertices);\r\n }\r\n\r\n get(index: number): Vertex[] {\r\n const vertices: Vertex[] = [];\r\n\r\n for (let i = this.vertices_stack.length - 1; i >= 0; i--) {\r\n const vertex = this.vertices_stack[i][index];\r\n\r\n if (vertex) {\r\n vertices.push(vertex);\r\n }\r\n }\r\n\r\n return vertices;\r\n }\r\n}\r\n\r\nclass Object3DCreator {\r\n private materials: Material[];\r\n private vertices = new VerticesHolder();\r\n private bone_id: number = 0;\r\n private bones: Bone[] = [];\r\n\r\n private positions: number[] = [];\r\n private normals: number[] = [];\r\n private uvs: number[] = [];\r\n private indices: number[] = [];\r\n private bone_indices: number[] = [];\r\n private bone_weights: number[] = [];\r\n private groups: VertexGroup[] = [];\r\n\r\n constructor(materials: Material[]) {\r\n this.materials = [DUMMY_MATERIAL, ...materials];\r\n }\r\n\r\n create_buffer_geometry(object: NjObject<NjModel>): BufferGeometry {\r\n this.object_to_geometry(object, undefined, new Matrix4());\r\n\r\n const geom = new BufferGeometry();\r\n\r\n geom.addAttribute(\"position\", new Float32BufferAttribute(this.positions, 3));\r\n geom.addAttribute(\"normal\", new Float32BufferAttribute(this.normals, 3));\r\n geom.addAttribute(\"uv\", new Float32BufferAttribute(this.uvs, 2));\r\n\r\n geom.setIndex(new Uint16BufferAttribute(this.indices, 1));\r\n\r\n for (const group of this.groups) {\r\n geom.addGroup(group.start, group.count, group.material_index);\r\n }\r\n\r\n geom.computeBoundingSphere();\r\n geom.computeBoundingBox();\r\n\r\n return geom;\r\n }\r\n\r\n create_mesh(object: NjObject<NjModel>): Mesh {\r\n const geom = this.create_buffer_geometry(object);\r\n\r\n const max_mat_idx = this.groups.reduce((max, g) => Math.max(max, g.material_index), 0);\r\n\r\n for (let i = this.materials.length - 1; i < max_mat_idx; ++i) {\r\n this.materials.push(DEFAULT_MATERIAL);\r\n }\r\n\r\n return new Mesh(geom, this.materials);\r\n }\r\n\r\n create_skinned_mesh(object: NjObject<NjModel>): SkinnedMesh {\r\n const geom = this.create_buffer_geometry(object);\r\n\r\n geom.addAttribute(\"skinIndex\", new Uint16BufferAttribute(this.bone_indices, 4));\r\n geom.addAttribute(\"skinWeight\", new Float32BufferAttribute(this.bone_weights, 4));\r\n\r\n const max_mat_idx = this.groups.reduce((max, g) => Math.max(max, g.material_index), 0);\r\n\r\n for (let i = this.materials.length - 1; i < max_mat_idx; ++i) {\r\n this.materials.push(DEFAULT_SKINNED_MATERIAL);\r\n }\r\n\r\n const mesh = new SkinnedMesh(geom, this.materials);\r\n mesh.add(this.bones[0]);\r\n mesh.bind(new Skeleton(this.bones));\r\n\r\n return mesh;\r\n }\r\n\r\n private object_to_geometry(\r\n object: NjObject<NjModel>,\r\n parent_bone: Bone | undefined,\r\n parent_matrix: Matrix4\r\n ): void {\r\n const {\r\n no_translate,\r\n no_rotate,\r\n no_scale,\r\n hidden,\r\n break_child_trace,\r\n zxy_rotation_order,\r\n skip,\r\n } = object.evaluation_flags;\r\n const { position, rotation, scale } = object;\r\n\r\n const euler = new Euler(\r\n rotation.x,\r\n rotation.y,\r\n rotation.z,\r\n zxy_rotation_order ? \"ZXY\" : \"ZYX\"\r\n );\r\n const matrix = new Matrix4()\r\n .compose(\r\n no_translate ? NO_TRANSLATION : vec3_to_threejs(position),\r\n no_rotate ? NO_ROTATION : new Quaternion().setFromEuler(euler),\r\n no_scale ? NO_SCALE : vec3_to_threejs(scale)\r\n )\r\n .premultiply(parent_matrix);\r\n\r\n let bone: Bone | undefined;\r\n\r\n if (skip) {\r\n bone = parent_bone;\r\n } else {\r\n bone = new Bone();\r\n bone.name = this.bone_id.toString();\r\n\r\n bone.position.set(position.x, position.y, position.z);\r\n bone.setRotationFromEuler(euler);\r\n bone.scale.set(scale.x, scale.y, scale.z);\r\n\r\n this.bones.push(bone);\r\n\r\n if (parent_bone) {\r\n parent_bone.add(bone);\r\n }\r\n }\r\n\r\n if (object.model && !hidden) {\r\n this.model_to_geometry(object.model, matrix);\r\n }\r\n\r\n this.bone_id++;\r\n\r\n if (!break_child_trace) {\r\n for (const child of object.children) {\r\n this.object_to_geometry(child, bone, matrix);\r\n }\r\n }\r\n }\r\n\r\n private model_to_geometry(model: NjModel, matrix: Matrix4): void {\r\n if (is_njcm_model(model)) {\r\n this.njcm_model_to_geometry(model, matrix);\r\n } else {\r\n xj_model_to_geometry(\r\n model,\r\n matrix,\r\n this.positions,\r\n this.normals,\r\n this.uvs,\r\n this.indices,\r\n this.groups\r\n );\r\n }\r\n }\r\n\r\n private njcm_model_to_geometry(model: NjcmModel, matrix: Matrix4): void {\r\n const normal_matrix = new Matrix3().getNormalMatrix(matrix);\r\n\r\n const new_vertices = model.vertices.map(vertex => {\r\n const position = vec3_to_threejs(vertex.position);\r\n const normal = vertex.normal ? vec3_to_threejs(vertex.normal) : DEFAULT_NORMAL;\r\n\r\n position.applyMatrix4(matrix);\r\n normal.applyMatrix3(normal_matrix);\r\n\r\n return {\r\n bone_id: this.bone_id,\r\n position,\r\n normal,\r\n bone_weight: vertex.bone_weight,\r\n bone_weight_status: vertex.bone_weight_status,\r\n calc_continue: vertex.calc_continue,\r\n };\r\n });\r\n\r\n this.vertices.put(new_vertices);\r\n\r\n for (const mesh of model.meshes) {\r\n const start_index_count = this.indices.length;\r\n\r\n for (let i = 0; i < mesh.vertices.length; ++i) {\r\n const mesh_vertex = mesh.vertices[i];\r\n const vertices = this.vertices.get(mesh_vertex.index);\r\n\r\n if (vertices.length) {\r\n const vertex = vertices[0];\r\n const normal = vertex.normal || mesh_vertex.normal || DEFAULT_NORMAL;\r\n const index = this.positions.length / 3;\r\n\r\n this.positions.push(vertex.position.x, vertex.position.y, vertex.position.z);\r\n this.normals.push(normal.x, normal.y, normal.z);\r\n\r\n if (mesh.has_tex_coords) {\r\n this.uvs.push(mesh_vertex.tex_coords!.x, mesh_vertex.tex_coords!.y);\r\n } else {\r\n this.uvs.push(0, 0);\r\n }\r\n\r\n if (i >= 2) {\r\n if (i % 2 === (mesh.clockwise_winding ? 1 : 0)) {\r\n this.indices.push(index - 2);\r\n this.indices.push(index - 1);\r\n this.indices.push(index);\r\n } else {\r\n this.indices.push(index - 2);\r\n this.indices.push(index);\r\n this.indices.push(index - 1);\r\n }\r\n }\r\n\r\n const bone_indices = [0, 0, 0, 0];\r\n const bone_weights = [0, 0, 0, 0];\r\n\r\n for (let j = vertices.length - 1; j >= 0; j--) {\r\n const vertex = vertices[j];\r\n bone_indices[vertex.bone_weight_status] = vertex.bone_id;\r\n bone_weights[vertex.bone_weight_status] = vertex.bone_weight;\r\n }\r\n\r\n this.bone_indices.push(...bone_indices);\r\n this.bone_weights.push(...bone_weights);\r\n }\r\n }\r\n\r\n const last_group = this.groups[this.groups.length - 1];\r\n const mat_idx = mesh.texture_id == null ? 0 : mesh.texture_id + 1;\r\n\r\n if (last_group && last_group.material_index === mat_idx) {\r\n last_group.count += this.indices.length - start_index_count;\r\n } else {\r\n this.groups.push({\r\n start: start_index_count,\r\n count: this.indices.length - start_index_count,\r\n material_index: mat_idx,\r\n });\r\n }\r\n }\r\n }\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\nimport { parse_iff } from \"../iff\";\r\n\r\nconst logger = Logger.get(\"data_formats/parsing/ninja/texture\");\r\n\r\nexport type Xvm = {\r\n textures: XvmTexture[];\r\n};\r\n\r\nexport type XvmTexture = {\r\n id: number;\r\n format: [number, number];\r\n width: number;\r\n height: number;\r\n size: number;\r\n data: ArrayBuffer;\r\n};\r\n\r\ntype Header = {\r\n texture_count: number;\r\n};\r\n\r\nconst XVMH = 0x484d5658;\r\nconst XVRT = 0x54525658;\r\n\r\nexport function parse_xvm(cursor: Cursor): Xvm {\r\n const chunks = parse_iff(cursor);\r\n const header_chunk = chunks.find(chunk => chunk.type === XVMH);\r\n const header = header_chunk && parse_header(header_chunk.data);\r\n\r\n const textures = chunks\r\n .filter(chunk => chunk.type === XVRT)\r\n .map(chunk => parse_texture(chunk.data));\r\n\r\n if (!header) {\r\n logger.warn(\"No header found.\");\r\n } else if (header.texture_count !== textures.length) {\r\n logger.warn(\r\n `Found ${textures.length} textures instead of ${header.texture_count} as defined in the header.`\r\n );\r\n }\r\n\r\n return { textures };\r\n}\r\n\r\nfunction parse_header(cursor: Cursor): Header {\r\n const texture_count = cursor.u16();\r\n return {\r\n texture_count,\r\n };\r\n}\r\n\r\nfunction parse_texture(cursor: Cursor): XvmTexture {\r\n const format_1 = cursor.u32();\r\n const format_2 = cursor.u32();\r\n const id = cursor.u32();\r\n const width = cursor.u16();\r\n const height = cursor.u16();\r\n const size = cursor.u32();\r\n cursor.seek(36);\r\n const data = cursor.array_buffer(size);\r\n return {\r\n id,\r\n format: [format_1, format_2],\r\n width,\r\n height,\r\n size,\r\n data,\r\n };\r\n}\r\n","import {\r\n CompressedTexture,\r\n LinearFilter,\r\n MirroredRepeatWrapping,\r\n RGBA_S3TC_DXT1_Format,\r\n RGBA_S3TC_DXT3_Format,\r\n Texture,\r\n CompressedPixelFormat,\r\n} from \"three\";\r\nimport { Xvm, XvmTexture } from \"../data_formats/parsing/ninja/texture\";\r\n\r\nexport function xvm_to_textures(xvm: Xvm): Texture[] {\r\n return xvm.textures.map(xvm_texture_to_texture);\r\n}\r\n\r\nexport function xvm_texture_to_texture(tex: XvmTexture): Texture {\r\n let format: CompressedPixelFormat;\r\n let data_size: number;\r\n\r\n // Ignore mipmaps.\r\n switch (tex.format[1]) {\r\n case 6:\r\n format = RGBA_S3TC_DXT1_Format;\r\n data_size = (tex.width * tex.height) / 2;\r\n break;\r\n case 7:\r\n format = RGBA_S3TC_DXT3_Format;\r\n data_size = tex.width * tex.height;\r\n break;\r\n default:\r\n throw new Error(`Format ${tex.format.join(\", \")} not supported.`);\r\n }\r\n\r\n const texture_3js = new CompressedTexture(\r\n [\r\n {\r\n data: new Uint8Array(tex.data, 0, data_size) as any,\r\n width: tex.width,\r\n height: tex.height,\r\n },\r\n ],\r\n tex.width,\r\n tex.height,\r\n format\r\n );\r\n\r\n texture_3js.minFilter = LinearFilter;\r\n texture_3js.wrapS = MirroredRepeatWrapping;\r\n texture_3js.wrapT = MirroredRepeatWrapping;\r\n texture_3js.needsUpdate = true;\r\n\r\n return texture_3js;\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { BufferGeometry, CylinderBufferGeometry, Texture } from \"three\";\r\nimport { parse_nj, parse_xj } from \"../data_formats/parsing/ninja\";\r\nimport { NpcType, ObjectType } from \"../domain\";\r\nimport { ninja_object_to_buffer_geometry } from \"../rendering/models\";\r\nimport { get_npc_data, get_object_data, AssetType } from \"./binary_assets\";\r\nimport { Endianness } from \"../data_formats\";\r\nimport { ArrayBufferCursor } from \"../data_formats/cursor/ArrayBufferCursor\";\r\nimport { parse_xvm } from \"../data_formats/parsing/ninja/texture\";\r\nimport { xvm_to_textures } from \"../rendering/textures\";\r\n\r\nconst logger = Logger.get(\"stores/EntityStore\");\r\n\r\nconst DEFAULT_ENTITY = new CylinderBufferGeometry(3, 3, 20);\r\nDEFAULT_ENTITY.translate(0, 10, 0);\r\n\r\nconst DEFAULT_ENTITY_PROMISE: Promise<BufferGeometry> = new Promise(resolve =>\r\n resolve(DEFAULT_ENTITY)\r\n);\r\n\r\nconst DEFAULT_ENTITY_TEX: Texture[] = [];\r\n\r\nconst DEFAULT_ENTITY_TEX_PROMISE: Promise<Texture[]> = new Promise(resolve =>\r\n resolve(DEFAULT_ENTITY_TEX)\r\n);\r\n\r\nconst npc_cache: Map<NpcType, Promise<BufferGeometry>> = new Map();\r\nnpc_cache.set(NpcType.Unknown, DEFAULT_ENTITY_PROMISE);\r\n\r\nconst npc_tex_cache: Map<NpcType, Promise<Texture[]>> = new Map();\r\nnpc_tex_cache.set(NpcType.Unknown, DEFAULT_ENTITY_TEX_PROMISE);\r\n\r\nconst object_cache: Map<ObjectType, Promise<BufferGeometry>> = new Map();\r\nconst object_tex_cache: Map<ObjectType, Promise<Texture[]>> = new Map();\r\n\r\nfor (const type of [\r\n ObjectType.Unknown,\r\n ObjectType.PlayerSet,\r\n ObjectType.FogCollision,\r\n ObjectType.EventCollision,\r\n ObjectType.ObjRoomID,\r\n ObjectType.ScriptCollision,\r\n ObjectType.ItemLight,\r\n ObjectType.FogCollisionSW,\r\n ObjectType.MenuActivation,\r\n ObjectType.BoxDetectObject,\r\n ObjectType.SymbolChatObject,\r\n ObjectType.TouchPlateObject,\r\n ObjectType.TargetableObject,\r\n ObjectType.EffectObject,\r\n ObjectType.CountDownObject,\r\n ObjectType.TelepipeLocation,\r\n ObjectType.Pioneer2InvisibleTouchplate,\r\n ObjectType.TempleMapDetect,\r\n ObjectType.LabInvisibleObject,\r\n]) {\r\n object_cache.set(type, DEFAULT_ENTITY_PROMISE);\r\n object_tex_cache.set(type, DEFAULT_ENTITY_TEX_PROMISE);\r\n}\r\n\r\nclass EntityStore {\r\n async get_npc_geometry(npc_type: NpcType): Promise<BufferGeometry> {\r\n let mesh = npc_cache.get(npc_type);\r\n\r\n if (mesh) {\r\n return mesh;\r\n } else {\r\n mesh = get_npc_data(npc_type, AssetType.Geometry)\r\n .then(({ url, data }) => {\r\n const cursor = new ArrayBufferCursor(data, Endianness.Little);\r\n const nj_objects = url.endsWith(\".nj\") ? parse_nj(cursor) : parse_xj(cursor);\r\n\r\n if (nj_objects.length) {\r\n return ninja_object_to_buffer_geometry(nj_objects[0]);\r\n } else {\r\n logger.warn(`Could not parse ${url}.`);\r\n return DEFAULT_ENTITY;\r\n }\r\n })\r\n .catch(e => {\r\n logger.warn(`Could load geometry file for ${npc_type.code}.`, e);\r\n return DEFAULT_ENTITY;\r\n });\r\n\r\n npc_cache.set(npc_type, mesh);\r\n return mesh;\r\n }\r\n }\r\n\r\n async get_npc_tex(npc_type: NpcType): Promise<Texture[]> {\r\n let tex = npc_tex_cache.get(npc_type);\r\n\r\n if (tex) {\r\n return tex;\r\n } else {\r\n tex = get_npc_data(npc_type, AssetType.Texture)\r\n .then(({ data }) => {\r\n const cursor = new ArrayBufferCursor(data, Endianness.Little);\r\n const xvm = parse_xvm(cursor);\r\n return xvm_to_textures(xvm);\r\n })\r\n .catch(e => {\r\n logger.warn(`Could load texture file for ${npc_type.code}.`, e);\r\n return DEFAULT_ENTITY_TEX;\r\n });\r\n\r\n npc_tex_cache.set(npc_type, tex);\r\n return tex;\r\n }\r\n }\r\n\r\n async get_object_geometry(object_type: ObjectType): Promise<BufferGeometry> {\r\n let geometry = object_cache.get(object_type);\r\n\r\n if (geometry) {\r\n return geometry;\r\n } else {\r\n geometry = get_object_data(object_type, AssetType.Geometry)\r\n .then(({ url, data }) => {\r\n const cursor = new ArrayBufferCursor(data, Endianness.Little);\r\n const nj_objects = url.endsWith(\".nj\") ? parse_nj(cursor) : parse_xj(cursor);\r\n\r\n if (nj_objects.length) {\r\n return ninja_object_to_buffer_geometry(nj_objects[0]);\r\n } else {\r\n logger.warn(`Could not parse ${url} for ${object_type.name}.`);\r\n return DEFAULT_ENTITY;\r\n }\r\n })\r\n .catch(e => {\r\n logger.warn(`Could load geometry file for ${object_type.name}.`, e);\r\n return DEFAULT_ENTITY;\r\n });\r\n\r\n object_cache.set(object_type, geometry);\r\n return geometry;\r\n }\r\n }\r\n\r\n async get_object_tex(object_type: ObjectType): Promise<Texture[]> {\r\n let tex = object_tex_cache.get(object_type);\r\n\r\n if (tex) {\r\n return tex;\r\n } else {\r\n tex = get_object_data(object_type, AssetType.Texture)\r\n .then(({ data }) => {\r\n const cursor = new ArrayBufferCursor(data, Endianness.Little);\r\n const xvm = parse_xvm(cursor);\r\n return xvm_to_textures(xvm);\r\n })\r\n .catch(e => {\r\n logger.warn(`Could load texture file for ${object_type.name}.`, e);\r\n return DEFAULT_ENTITY_TEX;\r\n });\r\n\r\n object_tex_cache.set(object_type, tex);\r\n return tex;\r\n }\r\n }\r\n}\r\n\r\nexport const entity_store = new EntityStore();\r\n","export async function read_file(file: File): Promise<ArrayBuffer> {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader();\r\n\r\n reader.addEventListener(\"loadend\", () => {\r\n if (reader.result instanceof ArrayBuffer) {\r\n resolve(reader.result);\r\n } else {\r\n reject(new Error(\"Couldn't read file.\"));\r\n }\r\n });\r\n\r\n reader.readAsArrayBuffer(file);\r\n });\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { action, observable, runInAction } from \"mobx\";\r\nimport { parse_quest, write_quest_qst } from \"../data_formats/parsing/quest\";\r\nimport { Vec3 } from \"../data_formats/vector\";\r\nimport { Area, Quest, QuestEntity, Section } from \"../domain\";\r\nimport { create_npc_mesh, create_object_mesh } from \"../rendering/entities\";\r\nimport { area_store } from \"./AreaStore\";\r\nimport { entity_store } from \"./EntityStore\";\r\nimport { ArrayBufferCursor } from \"../data_formats/cursor/ArrayBufferCursor\";\r\nimport { Endianness } from \"../data_formats\";\r\nimport { read_file } from \"../read_file\";\r\n\r\nconst logger = Logger.get(\"stores/QuestEditorStore\");\r\n\r\nclass QuestEditorStore {\r\n @observable current_quest?: Quest;\r\n @observable current_area?: Area;\r\n @observable selected_entity?: QuestEntity;\r\n\r\n set_quest = action(\"set_quest\", (quest?: Quest) => {\r\n this.reset_quest_state();\r\n this.current_quest = quest;\r\n\r\n if (quest && quest.area_variants.length) {\r\n this.current_area = quest.area_variants[0].area;\r\n }\r\n });\r\n\r\n private reset_quest_state(): void {\r\n this.current_quest = undefined;\r\n this.current_area = undefined;\r\n this.selected_entity = undefined;\r\n }\r\n\r\n set_selected_entity = (entity?: QuestEntity) => {\r\n this.selected_entity = entity;\r\n };\r\n\r\n set_current_area_id = action(\"set_current_area_id\", (area_id?: number) => {\r\n this.selected_entity = undefined;\r\n\r\n if (area_id == null) {\r\n this.current_area = undefined;\r\n } else if (this.current_quest) {\r\n const area_variant = this.current_quest.area_variants.find(\r\n variant => variant.area.id === area_id\r\n );\r\n this.current_area = area_variant && area_variant.area;\r\n }\r\n });\r\n\r\n // TODO: notify user of problems.\r\n load_file = async (file: File) => {\r\n try {\r\n const buffer = await read_file(file);\r\n const quest = parse_quest(new ArrayBufferCursor(buffer, Endianness.Little));\r\n this.set_quest(quest);\r\n\r\n if (quest) {\r\n // Load section data.\r\n for (const variant of quest.area_variants) {\r\n const sections = await area_store.get_area_sections(\r\n quest.episode,\r\n variant.area.id,\r\n variant.id\r\n );\r\n variant.sections = sections;\r\n\r\n // Generate object geometry.\r\n for (const object of quest.objects.filter(o => o.area_id === variant.area.id)) {\r\n try {\r\n const object_geom = await entity_store.get_object_geometry(object.type);\r\n const object_tex = await entity_store.get_object_tex(object.type);\r\n this.set_section_on_visible_quest_entity(object, sections);\r\n object.object_3d = create_object_mesh(object, object_geom, object_tex);\r\n } catch (e) {\r\n logger.error(e);\r\n }\r\n }\r\n\r\n // Generate NPC geometry.\r\n for (const npc of quest.npcs.filter(npc => npc.area_id === variant.area.id)) {\r\n try {\r\n const npc_geom = await entity_store.get_npc_geometry(npc.type);\r\n const npc_tex = await entity_store.get_npc_tex(npc.type);\r\n this.set_section_on_visible_quest_entity(npc, sections);\r\n npc.object_3d = create_npc_mesh(npc, npc_geom, npc_tex);\r\n } catch (e) {\r\n logger.error(e);\r\n }\r\n }\r\n }\r\n } else {\r\n logger.error(\"Couldn't parse quest file.\");\r\n }\r\n } catch (e) {\r\n logger.error(\"Couldn't read file.\", e);\r\n }\r\n };\r\n\r\n private set_section_on_visible_quest_entity = async (\r\n entity: QuestEntity,\r\n sections: Section[]\r\n ) => {\r\n let { x, y, z } = entity.position;\r\n\r\n const section = sections.find(s => s.id === entity.section_id);\r\n\r\n if (section) {\r\n const { x: sec_x, y: sec_y, z: sec_z } = section.position;\r\n const rot_x = section.cos_y_axis_rotation * x + section.sin_y_axis_rotation * z;\r\n const rot_z = -section.sin_y_axis_rotation * x + section.cos_y_axis_rotation * z;\r\n x = rot_x + sec_x;\r\n y += sec_y;\r\n z = rot_z + sec_z;\r\n } else {\r\n logger.warn(`Section ${entity.section_id} not found.`);\r\n }\r\n\r\n runInAction(() => {\r\n entity.section = section;\r\n entity.position = new Vec3(x, y, z);\r\n });\r\n };\r\n\r\n save_current_quest_to_file = (file_name: string) => {\r\n if (this.current_quest) {\r\n const buffer = write_quest_qst(this.current_quest, file_name);\r\n\r\n if (!file_name.endsWith(\".qst\")) {\r\n file_name += \".qst\";\r\n }\r\n\r\n const a = document.createElement(\"a\");\r\n a.href = URL.createObjectURL(new Blob([buffer], { type: \"application/octet-stream\" }));\r\n a.download = file_name;\r\n document.body.appendChild(a);\r\n a.click();\r\n URL.revokeObjectURL(a.href);\r\n document.body.removeChild(a);\r\n }\r\n };\r\n}\r\n\r\nexport const quest_editor_store = new QuestEditorStore();\r\n","import { InputNumber } from \"antd\";\r\nimport { observer } from \"mobx-react\";\r\nimport React, { ReactNode, Component } from \"react\";\r\nimport { QuestNpc, QuestObject, QuestEntity } from \"../../domain\";\r\nimport \"./EntityInfoComponent.css\";\r\n\r\nexport type Props = {\r\n entity?: QuestEntity;\r\n};\r\n\r\n@observer\r\nexport class EntityInfoComponent extends Component<Props> {\r\n render(): ReactNode {\r\n const entity = this.props.entity;\r\n\r\n if (entity) {\r\n const section_id = entity.section ? entity.section.id : entity.section_id;\r\n let name = null;\r\n\r\n if (entity instanceof QuestObject) {\r\n name = (\r\n <tr>\r\n <td>Object: </td>\r\n <td colSpan={2}>{entity.type.name}</td>\r\n </tr>\r\n );\r\n } else if (entity instanceof QuestNpc) {\r\n name = (\r\n <tr>\r\n <td>NPC: </td>\r\n <td>{entity.type.name}</td>\r\n </tr>\r\n );\r\n }\r\n\r\n return (\r\n <div className=\"EntityInfoComponent-container\">\r\n <table className=\"EntityInfoComponent-table\">\r\n <tbody>\r\n {name}\r\n <tr>\r\n <td>Section: </td>\r\n <td>{section_id}</td>\r\n </tr>\r\n <tr>\r\n <td colSpan={2}>World position: </td>\r\n </tr>\r\n <tr>\r\n <td colSpan={2}>\r\n <table>\r\n <tbody>\r\n <CoordRow\r\n entity={entity}\r\n position_type=\"position\"\r\n coord=\"x\"\r\n />\r\n <CoordRow\r\n entity={entity}\r\n position_type=\"position\"\r\n coord=\"y\"\r\n />\r\n <CoordRow\r\n entity={entity}\r\n position_type=\"position\"\r\n coord=\"z\"\r\n />\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colSpan={2}>Section position: </td>\r\n </tr>\r\n <tr>\r\n <td colSpan={2}>\r\n <table>\r\n <tbody>\r\n <CoordRow\r\n entity={entity}\r\n position_type=\"section_position\"\r\n coord=\"x\"\r\n />\r\n <CoordRow\r\n entity={entity}\r\n position_type=\"section_position\"\r\n coord=\"y\"\r\n />\r\n <CoordRow\r\n entity={entity}\r\n position_type=\"section_position\"\r\n coord=\"z\"\r\n />\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n );\r\n } else {\r\n return <div className=\"EntityInfoComponent-container\" />;\r\n }\r\n }\r\n}\r\n\r\n@observer\r\nclass CoordRow extends Component<{\r\n entity: QuestEntity;\r\n position_type: \"position\" | \"section_position\";\r\n coord: \"x\" | \"y\" | \"z\";\r\n}> {\r\n render(): ReactNode {\r\n const entity = this.props.entity;\r\n const value = entity[this.props.position_type][this.props.coord];\r\n return (\r\n <tr>\r\n <td>{this.props.coord.toUpperCase()}: </td>\r\n <td>\r\n <InputNumber\r\n value={value}\r\n size=\"small\"\r\n precision={3}\r\n className=\"EntityInfoComponent-coord\"\r\n onChange={this.changed}\r\n />\r\n </td>\r\n </tr>\r\n );\r\n }\r\n\r\n private changed = (value?: number) => {\r\n if (value != null) {\r\n const entity = this.props.entity;\r\n const pos_type = this.props.position_type;\r\n const pos = entity[pos_type].clone();\r\n pos[this.props.coord] = value;\r\n entity[pos_type] = pos;\r\n }\r\n };\r\n}\r\n","import React from \"react\";\r\nimport { NpcType, Quest } from \"../../domain\";\r\nimport \"./QuestInfoComponent.css\";\r\n\r\nexport function QuestInfoComponent({ quest }: { quest?: Quest }): JSX.Element {\r\n if (quest) {\r\n const episode = quest.episode === 4 ? \"IV\" : quest.episode === 2 ? \"II\" : \"I\";\r\n const npc_counts = new Map<NpcType, number>();\r\n\r\n for (const npc of quest.npcs) {\r\n const val = npc_counts.get(npc.type) || 0;\r\n npc_counts.set(npc.type, val + 1);\r\n }\r\n\r\n const extra_canadines = (npc_counts.get(NpcType.Canane) || 0) * 8;\r\n\r\n // Sort by type ID.\r\n const sorted_npc_counts = [...npc_counts].sort((a, b) => a[0].id - b[0].id);\r\n\r\n const npc_count_rows = sorted_npc_counts.map(([npc_type, count]) => {\r\n const extra = npc_type === NpcType.Canadine ? extra_canadines : 0;\r\n return (\r\n <tr key={npc_type.id}>\r\n <td>{npc_type.name}:</td>\r\n <td>{count + extra}</td>\r\n </tr>\r\n );\r\n });\r\n\r\n return (\r\n <div className=\"qe-QuestInfoComponent\">\r\n <table>\r\n <tbody>\r\n <tr>\r\n <th>Name:</th>\r\n <td>{quest.name}</td>\r\n </tr>\r\n <tr>\r\n <th>Episode:</th>\r\n <td>{episode}</td>\r\n </tr>\r\n <tr>\r\n <td colSpan={2}>\r\n <pre>{quest.short_description}</pre>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colSpan={2}>\r\n <pre>{quest.long_description}</pre>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <div className=\"qe-QuestInfoComponent-npc-counts-container\">\r\n <table>\r\n <thead>\r\n <tr>\r\n <th colSpan={2}>NPC Counts</th>\r\n </tr>\r\n </thead>\r\n <tbody>{npc_count_rows}</tbody>\r\n </table>\r\n </div>\r\n </div>\r\n );\r\n } else {\r\n return <div className=\"qe-QuestInfoComponent\" />;\r\n }\r\n}\r\n","import { autorun, IReactionDisposer, when, runInAction } from \"mobx\";\r\nimport {\r\n Intersection,\r\n Mesh,\r\n MeshLambertMaterial,\r\n Object3D,\r\n Plane,\r\n Raycaster,\r\n Vector2,\r\n Vector3,\r\n PerspectiveCamera,\r\n} from \"three\";\r\nimport { Vec3 } from \"../data_formats/vector\";\r\nimport { Area, Quest, QuestEntity, QuestNpc, Section } from \"../domain\";\r\nimport { area_store } from \"../stores/AreaStore\";\r\nimport { quest_editor_store } from \"../stores/QuestEditorStore\";\r\nimport {\r\n NPC_COLOR,\r\n NPC_HOVER_COLOR,\r\n NPC_SELECTED_COLOR,\r\n OBJECT_COLOR,\r\n OBJECT_HOVER_COLOR,\r\n OBJECT_SELECTED_COLOR,\r\n} from \"./entities\";\r\nimport { Renderer } from \"./Renderer\";\r\n\r\nlet renderer: QuestRenderer | undefined;\r\n\r\nexport function get_quest_renderer(): QuestRenderer {\r\n if (!renderer) renderer = new QuestRenderer();\r\n return renderer;\r\n}\r\n\r\ntype PickEntityResult = {\r\n object: Mesh;\r\n entity: QuestEntity;\r\n grab_offset: Vector3;\r\n drag_adjust: Vector3;\r\n drag_y: number;\r\n manipulating: boolean;\r\n};\r\n\r\ntype EntityUserData = {\r\n entity: QuestEntity;\r\n};\r\n\r\nexport class QuestRenderer extends Renderer<PerspectiveCamera> {\r\n private raycaster = new Raycaster();\r\n\r\n private quest?: Quest;\r\n private area?: Area;\r\n private entity_reaction_disposers: IReactionDisposer[] = [];\r\n\r\n private collision_geometry = new Object3D();\r\n private render_geometry = new Object3D();\r\n private obj_geometry = new Object3D();\r\n private npc_geometry = new Object3D();\r\n\r\n private hovered_data?: PickEntityResult;\r\n private selected_data?: PickEntityResult;\r\n\r\n constructor() {\r\n super(new PerspectiveCamera(60, 1, 10, 10000));\r\n\r\n this.dom_element.addEventListener(\"mousedown\", this.on_mouse_down);\r\n this.dom_element.addEventListener(\"mouseup\", this.on_mouse_up);\r\n this.dom_element.addEventListener(\"mousemove\", this.on_mouse_move);\r\n\r\n this.scene.add(this.obj_geometry);\r\n this.scene.add(this.npc_geometry);\r\n\r\n autorun(() => {\r\n this.set_quest_and_area(\r\n quest_editor_store.current_quest,\r\n quest_editor_store.current_area\r\n );\r\n });\r\n }\r\n\r\n set_quest_and_area(quest?: Quest, area?: Area): void {\r\n this.area = area;\r\n this.quest = quest;\r\n this.update_geometry();\r\n }\r\n\r\n set_size(width: number, height: number): void {\r\n this.camera.aspect = width / height;\r\n this.camera.updateProjectionMatrix();\r\n super.set_size(width, height);\r\n }\r\n\r\n private async update_geometry(): Promise<void> {\r\n this.dispose_entity_reactions();\r\n\r\n this.scene.remove(this.obj_geometry);\r\n this.scene.remove(this.npc_geometry);\r\n this.obj_geometry = new Object3D();\r\n this.npc_geometry = new Object3D();\r\n this.scene.add(this.obj_geometry);\r\n this.scene.add(this.npc_geometry);\r\n\r\n this.scene.remove(this.collision_geometry);\r\n // this.scene.remove(this.render_geometry);\r\n\r\n if (this.quest && this.area) {\r\n // Add necessary entity geometry when it arrives.\r\n for (const obj of this.quest.objects) {\r\n this.update_entity_geometry(obj, this.obj_geometry);\r\n }\r\n\r\n for (const npc of this.quest.npcs) {\r\n this.update_entity_geometry(npc, this.npc_geometry);\r\n }\r\n\r\n // Load necessary area geometry.\r\n const episode = this.quest.episode;\r\n const area_id = this.area.id;\r\n const variant = this.quest.area_variants.find(v => v.area.id === area_id);\r\n const variant_id = (variant && variant.id) || 0;\r\n\r\n const collision_geometry = await area_store.get_area_collision_geometry(\r\n episode,\r\n area_id,\r\n variant_id\r\n );\r\n\r\n this.scene.remove(this.collision_geometry);\r\n // this.scene.remove(this.render_geometry);\r\n\r\n this.reset_camera(new Vector3(0, 800, 700), new Vector3(0, 0, 0));\r\n\r\n this.collision_geometry = collision_geometry;\r\n this.scene.add(collision_geometry);\r\n\r\n const render_geometry = await area_store.get_area_render_geometry(\r\n episode,\r\n area_id,\r\n variant_id\r\n );\r\n\r\n this.render_geometry = render_geometry;\r\n // this.scene.add(render_geometry);\r\n }\r\n }\r\n\r\n private update_entity_geometry(entity: QuestEntity, entity_geometry: Object3D): void {\r\n if (this.area && entity.area_id === this.area.id) {\r\n this.entity_reaction_disposers.push(\r\n when(\r\n () => entity.object_3d != undefined,\r\n () => {\r\n const object_3d = entity.object_3d!;\r\n entity_geometry.add(object_3d);\r\n\r\n this.entity_reaction_disposers.push(\r\n autorun(() => {\r\n const { x, y, z } = entity.position;\r\n object_3d.position.set(x, y, z);\r\n const rot = entity.rotation;\r\n object_3d.rotation.set(rot.x, rot.y, rot.z);\r\n this.schedule_render();\r\n })\r\n );\r\n\r\n this.schedule_render();\r\n }\r\n )\r\n );\r\n }\r\n }\r\n\r\n private dispose_entity_reactions(): void {\r\n for (const disposer of this.entity_reaction_disposers) {\r\n disposer();\r\n }\r\n }\r\n\r\n private on_mouse_down = (e: MouseEvent) => {\r\n const old_selected_data = this.selected_data;\r\n const data = this.pick_entity(this.pointer_pos_to_device_coords(e));\r\n\r\n // Did we pick a different object than the previously hovered over 3D object?\r\n if (this.hovered_data && (!data || data.object !== this.hovered_data.object)) {\r\n const color = this.get_color(this.hovered_data.entity, \"hover\");\r\n\r\n for (const material of this.hovered_data.object.material as MeshLambertMaterial[]) {\r\n material.color.set(color);\r\n }\r\n }\r\n\r\n // Did we pick a different object than the previously selected 3D object?\r\n if (this.selected_data && (!data || data.object !== this.selected_data.object)) {\r\n const color = this.get_color(this.selected_data.entity, \"normal\");\r\n\r\n for (const material of this.selected_data.object.material as MeshLambertMaterial[]) {\r\n if (material.map) {\r\n material.color.set(0xffffff);\r\n } else {\r\n material.color.set(color);\r\n }\r\n }\r\n\r\n this.selected_data.manipulating = false;\r\n }\r\n\r\n if (data) {\r\n // User selected an entity.\r\n const color = this.get_color(data.entity, \"selected\");\r\n\r\n for (const material of data.object.material as MeshLambertMaterial[]) {\r\n material.color.set(color);\r\n }\r\n\r\n data.manipulating = true;\r\n this.hovered_data = data;\r\n this.selected_data = data;\r\n this.controls.enabled = false;\r\n } else {\r\n // User clicked on terrain or outside of area.\r\n this.hovered_data = undefined;\r\n this.selected_data = undefined;\r\n this.controls.enabled = true;\r\n }\r\n\r\n const selection_changed =\r\n old_selected_data && data\r\n ? old_selected_data.object !== data.object\r\n : old_selected_data !== data;\r\n\r\n if (selection_changed) {\r\n quest_editor_store.set_selected_entity(data && data.entity);\r\n this.schedule_render();\r\n }\r\n };\r\n\r\n private on_mouse_up = () => {\r\n if (this.selected_data) {\r\n this.selected_data.manipulating = false;\r\n this.controls.enabled = true;\r\n this.schedule_render();\r\n }\r\n };\r\n\r\n private on_mouse_move = (e: MouseEvent) => {\r\n const pointer_pos = this.pointer_pos_to_device_coords(e);\r\n\r\n if (this.selected_data && this.selected_data.manipulating) {\r\n if (e.buttons === 1) {\r\n // User is dragging a selected entity.\r\n const data = this.selected_data;\r\n\r\n if (e.shiftKey) {\r\n // Vertical movement.\r\n // We intersect with a plane that's oriented toward the camera and that's coplanar with the point where the entity was grabbed.\r\n this.raycaster.setFromCamera(pointer_pos, this.camera);\r\n const ray = this.raycaster.ray;\r\n const negative_world_dir = this.camera\r\n .getWorldDirection(new Vector3())\r\n .negate();\r\n const plane = new Plane().setFromNormalAndCoplanarPoint(\r\n new Vector3(negative_world_dir.x, 0, negative_world_dir.z).normalize(),\r\n data.object.position.sub(data.grab_offset)\r\n );\r\n const intersection_point = new Vector3();\r\n\r\n if (ray.intersectPlane(plane, intersection_point)) {\r\n const y = intersection_point.y + data.grab_offset.y;\r\n const y_delta = y - data.entity.position.y;\r\n data.drag_y += y_delta;\r\n data.drag_adjust.y -= y_delta;\r\n data.entity.position = new Vec3(\r\n data.entity.position.x,\r\n y,\r\n data.entity.position.z\r\n );\r\n }\r\n } else {\r\n // Horizontal movement accross terrain.\r\n // Cast ray adjusted for dragging entities.\r\n const { intersection, section } = this.pick_terrain(pointer_pos, data);\r\n\r\n if (intersection) {\r\n runInAction(() => {\r\n data.entity.position = new Vec3(\r\n intersection.point.x,\r\n intersection.point.y + data.drag_y,\r\n intersection.point.z\r\n );\r\n data.entity.section = section;\r\n });\r\n } else {\r\n // If the cursor is not over any terrain, we translate the entity accross the horizontal plane in which the entity's origin lies.\r\n this.raycaster.setFromCamera(pointer_pos, this.camera);\r\n const ray = this.raycaster.ray;\r\n // ray.origin.add(data.dragAdjust);\r\n const plane = new Plane(\r\n new Vector3(0, 1, 0),\r\n -data.entity.position.y + data.grab_offset.y\r\n );\r\n const intersection_point = new Vector3();\r\n\r\n if (ray.intersectPlane(plane, intersection_point)) {\r\n data.entity.position = new Vec3(\r\n intersection_point.x + data.grab_offset.x,\r\n data.entity.position.y,\r\n intersection_point.z + data.grab_offset.z\r\n );\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.schedule_render();\r\n } else {\r\n // User is hovering.\r\n const old_data = this.hovered_data;\r\n const data = this.pick_entity(pointer_pos);\r\n\r\n if (old_data && (!data || data.object !== old_data.object)) {\r\n if (!this.selected_data || old_data.object !== this.selected_data.object) {\r\n const color = this.get_color(old_data.entity, \"normal\");\r\n\r\n for (const material of old_data.object.material as MeshLambertMaterial[]) {\r\n if (material.map) {\r\n material.color.set(0xffffff);\r\n } else {\r\n material.color.set(color);\r\n }\r\n }\r\n }\r\n\r\n this.hovered_data = undefined;\r\n this.schedule_render();\r\n }\r\n\r\n if (data && (!old_data || data.object !== old_data.object)) {\r\n if (!this.selected_data || data.object !== this.selected_data.object) {\r\n const color = this.get_color(data.entity, \"hover\");\r\n\r\n for (const material of data.object.material as MeshLambertMaterial[]) {\r\n material.color.set(color);\r\n }\r\n }\r\n\r\n this.hovered_data = data;\r\n this.schedule_render();\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * @param pointer_pos - pointer coordinates in normalized device space\r\n */\r\n private pick_entity(pointer_pos: Vector2): PickEntityResult | undefined {\r\n // Find the nearest object and NPC under the pointer.\r\n this.raycaster.setFromCamera(pointer_pos, this.camera);\r\n const [nearest_object] = this.raycaster.intersectObjects(this.obj_geometry.children);\r\n const [nearest_npc] = this.raycaster.intersectObjects(this.npc_geometry.children);\r\n\r\n if (!nearest_object && !nearest_npc) {\r\n return;\r\n }\r\n\r\n const object_dist = nearest_object ? nearest_object.distance : Infinity;\r\n const npc_dist = nearest_npc ? nearest_npc.distance : Infinity;\r\n const intersection = object_dist < npc_dist ? nearest_object : nearest_npc;\r\n\r\n const entity = (intersection.object.userData as EntityUserData).entity;\r\n // Vector that points from the grabbing point to the model's origin.\r\n const grab_offset = intersection.object.position.clone().sub(intersection.point);\r\n // Vector that points from the grabbing point to the terrain point directly under the model's origin.\r\n const drag_adjust = grab_offset.clone();\r\n // Distance to terrain.\r\n let drag_y = 0;\r\n\r\n // Find vertical distance to terrain.\r\n this.raycaster.set(intersection.object.position, new Vector3(0, -1, 0));\r\n const [terrain] = this.raycaster.intersectObjects(this.collision_geometry.children, true);\r\n\r\n if (terrain) {\r\n drag_adjust.sub(new Vector3(0, terrain.distance, 0));\r\n drag_y += terrain.distance;\r\n }\r\n\r\n return {\r\n object: intersection.object as Mesh,\r\n entity,\r\n grab_offset,\r\n drag_adjust,\r\n drag_y,\r\n manipulating: false,\r\n };\r\n }\r\n\r\n /**\r\n * @param pointer_pos - pointer coordinates in normalized device space\r\n */\r\n private pick_terrain(\r\n pointer_pos: Vector2,\r\n data: PickEntityResult\r\n ): {\r\n intersection?: Intersection;\r\n section?: Section;\r\n } {\r\n this.raycaster.setFromCamera(pointer_pos, this.camera);\r\n this.raycaster.ray.origin.add(data.drag_adjust);\r\n const terrains = this.raycaster.intersectObjects(this.collision_geometry.children, true);\r\n\r\n // Don't allow entities to be placed on very steep terrain.\r\n // E.g. walls.\r\n // TODO: make use of the flags field in the collision data.\r\n for (const terrain of terrains) {\r\n if (terrain.face!.normal.y > 0.75) {\r\n // Find section ID.\r\n this.raycaster.set(terrain.point.clone().setY(1000), new Vector3(0, -1, 0));\r\n const render_terrains = this.raycaster\r\n .intersectObjects(this.render_geometry.children, true)\r\n .filter(rt => rt.object.userData.section.id >= 0);\r\n\r\n return {\r\n intersection: terrain,\r\n section: render_terrains[0] && render_terrains[0].object.userData.section,\r\n };\r\n }\r\n }\r\n\r\n return {};\r\n }\r\n\r\n private get_color(entity: QuestEntity, type: \"normal\" | \"hover\" | \"selected\"): number {\r\n const is_npc = entity instanceof QuestNpc;\r\n\r\n switch (type) {\r\n default:\r\n case \"normal\":\r\n return is_npc ? NPC_COLOR : OBJECT_COLOR;\r\n case \"hover\":\r\n return is_npc ? NPC_HOVER_COLOR : OBJECT_HOVER_COLOR;\r\n case \"selected\":\r\n return is_npc ? NPC_SELECTED_COLOR : OBJECT_SELECTED_COLOR;\r\n }\r\n }\r\n}\r\n","import React, { Component, ReactNode } from \"react\";\r\nimport { Renderer } from \"../rendering/Renderer\";\r\nimport \"./RendererComponent.less\";\r\nimport { Camera } from \"three\";\r\n\r\nexport class RendererComponent extends Component<{\r\n renderer: Renderer<Camera>;\r\n className?: string;\r\n on_will_unmount?: () => void;\r\n}> {\r\n render(): ReactNode {\r\n let className = \"RendererComponent\";\r\n if (this.props.className) className += \" \" + this.props.className;\r\n\r\n return <div className={className} ref={this.modifyDom} />;\r\n }\r\n\r\n componentDidMount(): void {\r\n window.addEventListener(\"resize\", this.onResize);\r\n }\r\n\r\n componentWillUnmount(): void {\r\n window.removeEventListener(\"resize\", this.onResize);\r\n this.props.on_will_unmount && this.props.on_will_unmount();\r\n }\r\n\r\n shouldComponentUpdate(): boolean {\r\n return false;\r\n }\r\n\r\n private modifyDom = (div: HTMLDivElement | null) => {\r\n if (div) {\r\n this.props.renderer.set_size(div.clientWidth, div.clientHeight);\r\n div.appendChild(this.props.renderer.dom_element);\r\n }\r\n };\r\n\r\n private onResize = () => {\r\n const wrapper_div = this.props.renderer.dom_element.parentNode as HTMLDivElement;\r\n this.props.renderer.set_size(wrapper_div.clientWidth, wrapper_div.clientHeight);\r\n };\r\n}\r\n","import * as THREE from \"three\";\r\nimport {\r\n Camera,\r\n Color,\r\n Group,\r\n HemisphereLight,\r\n MOUSE,\r\n Scene,\r\n Vector2,\r\n Vector3,\r\n WebGLRenderer,\r\n} from \"three\";\r\nimport OrbitControlsCreator from \"three-orbit-controls\";\r\n\r\nconst OrbitControls = OrbitControlsCreator(THREE);\r\n\r\nexport class Renderer<C extends Camera> {\r\n protected camera: C;\r\n protected controls: any;\r\n protected scene = new Scene();\r\n protected light_holder = new Group();\r\n\r\n private renderer = new WebGLRenderer({ antialias: true });\r\n private render_scheduled = false;\r\n private light = new HemisphereLight(0xffffff, 0x505050, 1.2);\r\n\r\n constructor(camera: C) {\r\n this.renderer.setPixelRatio(window.devicePixelRatio);\r\n\r\n this.camera = camera;\r\n\r\n this.controls = new OrbitControls(this.camera, this.renderer.domElement);\r\n this.controls.mouseButtons.ORBIT = MOUSE.RIGHT;\r\n this.controls.mouseButtons.PAN = MOUSE.LEFT;\r\n this.controls.addEventListener(\"change\", this.schedule_render);\r\n\r\n this.scene.background = new Color(0x151c21);\r\n\r\n this.light_holder.add(this.light);\r\n this.scene.add(this.light_holder);\r\n }\r\n\r\n get dom_element(): HTMLElement {\r\n return this.renderer.domElement;\r\n }\r\n\r\n set_size(width: number, height: number): void {\r\n this.renderer.setSize(width, height);\r\n this.schedule_render();\r\n }\r\n\r\n protected schedule_render = () => {\r\n if (!this.render_scheduled) {\r\n this.render_scheduled = true;\r\n requestAnimationFrame(this.call_render);\r\n }\r\n };\r\n\r\n protected render(): void {\r\n this.renderer.render(this.scene, this.camera);\r\n }\r\n\r\n protected reset_camera(position: Vector3, look_at: Vector3): void {\r\n this.controls.reset();\r\n this.camera.position.copy(position);\r\n this.camera.lookAt(look_at);\r\n }\r\n\r\n protected pointer_pos_to_device_coords(e: MouseEvent): Vector2 {\r\n const coords = new Vector2();\r\n this.renderer.getSize(coords);\r\n coords.width = (e.offsetX / coords.width) * 2 - 1;\r\n coords.height = (e.offsetY / coords.height) * -2 + 1;\r\n return coords;\r\n }\r\n\r\n private call_render = () => {\r\n this.render_scheduled = false;\r\n this.render();\r\n };\r\n}\r\n","import { ANGLE_TO_RAD } from \".\";\r\nimport { Cursor } from \"../../cursor/Cursor\";\r\nimport { Vec3 } from \"../../vector\";\r\n\r\nconst NMDM = 0x4d444d4e;\r\n\r\nexport type NjMotion = {\r\n motion_data: NjMotionData[];\r\n frame_count: number;\r\n type: number;\r\n interpolation: NjInterpolation;\r\n element_count: number;\r\n};\r\n\r\nexport enum NjInterpolation {\r\n Linear,\r\n Spline,\r\n UserFunction,\r\n}\r\n\r\nexport type NjMotionData = {\r\n tracks: NjKeyframeTrack[];\r\n};\r\n\r\nexport enum NjKeyframeTrackType {\r\n Position,\r\n Rotation,\r\n Scale,\r\n}\r\n\r\nexport type NjKeyframeTrack =\r\n | NjKeyframeTrackPosition\r\n | NjKeyframeTrackRotation\r\n | NjKeyframeTrackScale;\r\n\r\nexport type NjKeyframeTrackPosition = {\r\n type: NjKeyframeTrackType.Position;\r\n keyframes: NjKeyframeF[];\r\n};\r\n\r\nexport type NjKeyframeTrackRotation = {\r\n type: NjKeyframeTrackType.Rotation;\r\n keyframes: NjKeyframeA[];\r\n};\r\n\r\nexport type NjKeyframeTrackScale = {\r\n type: NjKeyframeTrackType.Scale;\r\n keyframes: NjKeyframeF[];\r\n};\r\n\r\nexport type NjKeyframe = NjKeyframeF | NjKeyframeA;\r\n\r\n/**\r\n * Used for parallel motion (POS), scale (SCL) and vector (VEC).\r\n */\r\nexport type NjKeyframeF = {\r\n frame: number;\r\n value: Vec3;\r\n};\r\n\r\n/**\r\n * Used for rotation (ANG).\r\n */\r\nexport type NjKeyframeA = {\r\n frame: number;\r\n value: Vec3; // Euler angles in radians.\r\n};\r\n\r\nexport function parse_njm(cursor: Cursor, bone_count: number): NjMotion {\r\n if (cursor.u32() === NMDM) {\r\n return parse_njm_v2(cursor, bone_count);\r\n } else {\r\n cursor.seek_start(0);\r\n return parse_njm_bb(cursor, bone_count);\r\n }\r\n}\r\n\r\n/**\r\n * Format used by PSO v2 and for the enemies in PSO:BB.\r\n */\r\nfunction parse_njm_v2(cursor: Cursor, bone_count: number): NjMotion {\r\n const chunk_size = cursor.u32();\r\n return parse_motion(cursor.take(chunk_size), bone_count);\r\n}\r\n\r\n/**\r\n * Format used by PSO:BB plymotiondata.rlc.\r\n */\r\nfunction parse_njm_bb(cursor: Cursor, bone_count: number): NjMotion {\r\n cursor.seek_end(16);\r\n const offset1 = cursor.u32();\r\n cursor.seek_start(offset1);\r\n const action_offset = cursor.u32();\r\n cursor.seek_start(action_offset);\r\n return parse_action(cursor, bone_count);\r\n}\r\n\r\nfunction parse_action(cursor: Cursor, bone_count: number): NjMotion {\r\n cursor.seek(4); // Object pointer placeholder.\r\n const motion_offset = cursor.u32();\r\n cursor.seek_start(motion_offset);\r\n return parse_motion(cursor, bone_count);\r\n}\r\n\r\nfunction parse_motion(cursor: Cursor, bone_count: number): NjMotion {\r\n // Points to an array the size of bone_count.\r\n let mdata_offset = cursor.u32();\r\n const frame_count = cursor.u32();\r\n const type = cursor.u16();\r\n const inp_fn = cursor.u16();\r\n // Linear, spline or user function.\r\n const interpolation: NjInterpolation = (inp_fn & 0b11000000) >> 6;\r\n const element_count = inp_fn & 0b1111;\r\n const motion_data_list = [];\r\n\r\n for (let i = 0; i < bone_count; i++) {\r\n cursor.seek_start(mdata_offset);\r\n mdata_offset = mdata_offset += 8 * element_count;\r\n\r\n let motion_data: NjMotionData = {\r\n tracks: [],\r\n };\r\n motion_data_list.push(motion_data);\r\n\r\n const keyframe_offsets: number[] = [];\r\n const keyframe_counts: number[] = [];\r\n\r\n for (let j = 0; j < element_count; j++) {\r\n keyframe_offsets.push(cursor.u32());\r\n }\r\n\r\n for (let j = 0; j < element_count; j++) {\r\n const count = cursor.u32();\r\n keyframe_counts.push(count);\r\n }\r\n\r\n // NJD_MTYPE_POS_0\r\n if (type & (1 << 0)) {\r\n cursor.seek_start(keyframe_offsets.shift()!);\r\n const count = keyframe_counts.shift();\r\n\r\n if (count) {\r\n motion_data.tracks.push({\r\n type: NjKeyframeTrackType.Position,\r\n keyframes: parse_motion_data_f(cursor, count),\r\n });\r\n }\r\n }\r\n\r\n // NJD_MTYPE_ANG_1\r\n if (type & (1 << 1)) {\r\n cursor.seek_start(keyframe_offsets.shift()!);\r\n const count = keyframe_counts.shift();\r\n\r\n if (count) {\r\n motion_data.tracks.push({\r\n type: NjKeyframeTrackType.Rotation,\r\n keyframes: parse_motion_data_a(cursor, count, frame_count),\r\n });\r\n }\r\n }\r\n\r\n // NJD_MTYPE_SCL_2\r\n if (type & (1 << 2)) {\r\n cursor.seek_start(keyframe_offsets.shift()!);\r\n const count = keyframe_counts.shift();\r\n\r\n if (count) {\r\n motion_data.tracks.push({\r\n type: NjKeyframeTrackType.Scale,\r\n keyframes: parse_motion_data_f(cursor, count),\r\n });\r\n }\r\n }\r\n\r\n // TODO: all NJD_MTYPE's\r\n }\r\n\r\n return {\r\n motion_data: motion_data_list,\r\n frame_count,\r\n type,\r\n interpolation,\r\n element_count,\r\n };\r\n}\r\n\r\nfunction parse_motion_data_f(cursor: Cursor, count: number): NjKeyframeF[] {\r\n const frames: NjKeyframeF[] = [];\r\n\r\n for (let i = 0; i < count; ++i) {\r\n frames.push({\r\n frame: cursor.u32(),\r\n value: new Vec3(cursor.f32(), cursor.f32(), cursor.f32()),\r\n });\r\n }\r\n\r\n return frames;\r\n}\r\n\r\nfunction parse_motion_data_a(\r\n cursor: Cursor,\r\n keyframe_count: number,\r\n frame_count: number\r\n): NjKeyframeA[] {\r\n const frames: NjKeyframeA[] = [];\r\n const start_pos = cursor.position;\r\n\r\n for (let i = 0; i < keyframe_count; ++i) {\r\n frames.push({\r\n frame: cursor.u16(),\r\n value: new Vec3(\r\n cursor.u16() * ANGLE_TO_RAD,\r\n cursor.u16() * ANGLE_TO_RAD,\r\n cursor.u16() * ANGLE_TO_RAD\r\n ),\r\n });\r\n }\r\n\r\n let prev = -1;\r\n\r\n for (const { frame } of frames) {\r\n if (frame < prev || frame >= frame_count) {\r\n cursor.seek_start(start_pos);\r\n return parse_motion_data_a_wide(cursor, keyframe_count);\r\n }\r\n\r\n prev = frame;\r\n }\r\n\r\n return frames;\r\n}\r\n\r\nfunction parse_motion_data_a_wide(cursor: Cursor, keyframe_count: number): NjKeyframeA[] {\r\n const frames: NjKeyframeA[] = [];\r\n\r\n for (let i = 0; i < keyframe_count; ++i) {\r\n frames.push({\r\n frame: cursor.u32(),\r\n value: new Vec3(\r\n cursor.i32() * ANGLE_TO_RAD,\r\n cursor.i32() * ANGLE_TO_RAD,\r\n cursor.i32() * ANGLE_TO_RAD\r\n ),\r\n });\r\n }\r\n\r\n return frames;\r\n}\r\n","import { Button, Form, Icon, Input, Modal, Select, Upload } from \"antd\";\r\nimport { UploadChangeParam } from \"antd/lib/upload\";\r\nimport { UploadFile } from \"antd/lib/upload/interface\";\r\nimport { observer } from \"mobx-react\";\r\nimport React, { ChangeEvent, ReactNode, Component } from \"react\";\r\nimport { quest_editor_store } from \"../../stores/QuestEditorStore\";\r\nimport { EntityInfoComponent } from \"./EntityInfoComponent\";\r\nimport \"./QuestEditorComponent.css\";\r\nimport { QuestInfoComponent } from \"./QuestInfoComponent\";\r\nimport { RendererComponent } from \"../RendererComponent\";\r\nimport { get_quest_renderer } from \"../../rendering/QuestRenderer\";\r\n\r\n@observer\r\nexport class QuestEditorComponent extends Component<\r\n {},\r\n {\r\n filename?: string;\r\n save_dialog_open: boolean;\r\n save_dialog_filename: string;\r\n }\r\n> {\r\n state = {\r\n save_dialog_open: false,\r\n save_dialog_filename: \"Untitled\",\r\n };\r\n\r\n render(): ReactNode {\r\n const quest = quest_editor_store.current_quest;\r\n\r\n return (\r\n <div className=\"qe-QuestEditorComponent\">\r\n <Toolbar onSaveAsClicked={this.save_as_clicked} />\r\n <div className=\"qe-QuestEditorComponent-main\">\r\n <QuestInfoComponent quest={quest} />\r\n <RendererComponent renderer={get_quest_renderer()} />\r\n <EntityInfoComponent entity={quest_editor_store.selected_entity} />\r\n </div>\r\n <SaveAsForm\r\n is_open={this.state.save_dialog_open}\r\n filename={this.state.save_dialog_filename}\r\n on_filename_change={this.save_dialog_filename_changed}\r\n on_ok={this.save_dialog_affirmed}\r\n on_cancel={this.save_dialog_cancelled}\r\n />\r\n </div>\r\n );\r\n }\r\n\r\n private save_as_clicked = (filename?: string) => {\r\n const name = filename\r\n ? filename.endsWith(\".qst\")\r\n ? filename.slice(0, -4)\r\n : filename\r\n : this.state.save_dialog_filename;\r\n\r\n this.setState({\r\n save_dialog_open: true,\r\n save_dialog_filename: name,\r\n });\r\n };\r\n\r\n private save_dialog_filename_changed = (filename: string) => {\r\n this.setState({ save_dialog_filename: filename });\r\n };\r\n\r\n private save_dialog_affirmed = () => {\r\n quest_editor_store.save_current_quest_to_file(this.state.save_dialog_filename);\r\n this.setState({ save_dialog_open: false });\r\n };\r\n\r\n private save_dialog_cancelled = () => {\r\n this.setState({ save_dialog_open: false });\r\n };\r\n}\r\n\r\n@observer\r\nclass Toolbar extends Component<{ onSaveAsClicked: (filename?: string) => void }> {\r\n state = {\r\n filename: undefined,\r\n };\r\n\r\n render(): ReactNode {\r\n const quest = quest_editor_store.current_quest;\r\n const areas = quest && Array.from(quest.area_variants).map(a => a.area);\r\n const area = quest_editor_store.current_area;\r\n const area_id = area && area.id;\r\n\r\n return (\r\n <div className=\"qe-QuestEditorComponent-toolbar\">\r\n <Upload\r\n accept=\".qst\"\r\n showUploadList={false}\r\n onChange={this.set_filename}\r\n // Make sure it doesn't do a POST:\r\n customRequest={() => false}\r\n >\r\n <Button icon=\"file\">{this.state.filename || \"Open file...\"}</Button>\r\n </Upload>\r\n {areas && (\r\n <Select\r\n onChange={quest_editor_store.set_current_area_id}\r\n value={area_id}\r\n style={{ width: 200 }}\r\n >\r\n {areas.map(area => (\r\n <Select.Option key={area.id} value={area.id}>\r\n {area.name}\r\n </Select.Option>\r\n ))}\r\n </Select>\r\n )}\r\n {quest && (\r\n <Button icon=\"save\" onClick={this.save_as_clicked}>\r\n Save as...\r\n </Button>\r\n )}\r\n </div>\r\n );\r\n }\r\n\r\n private set_filename = (info: UploadChangeParam<UploadFile>) => {\r\n if (info.file.originFileObj) {\r\n this.setState({ filename: info.file.name });\r\n quest_editor_store.load_file(info.file.originFileObj as File);\r\n }\r\n };\r\n\r\n private save_as_clicked = () => {\r\n this.props.onSaveAsClicked(this.state.filename);\r\n };\r\n}\r\n\r\nclass SaveAsForm extends React.Component<{\r\n is_open: boolean;\r\n filename: string;\r\n on_filename_change: (name: string) => void;\r\n on_ok: () => void;\r\n on_cancel: () => void;\r\n}> {\r\n render(): ReactNode {\r\n return (\r\n <Modal\r\n title={\r\n <>\r\n <Icon type=\"save\" /> Save as...\r\n </>\r\n }\r\n visible={this.props.is_open}\r\n onOk={this.props.on_ok}\r\n onCancel={this.props.on_cancel}\r\n >\r\n <Form layout=\"vertical\">\r\n <Form.Item label=\"Name\">\r\n <Input\r\n autoFocus={true}\r\n maxLength={12}\r\n value={this.props.filename}\r\n onChange={this.name_changed}\r\n />\r\n </Form.Item>\r\n </Form>\r\n </Modal>\r\n );\r\n }\r\n\r\n private name_changed = (e: ChangeEvent<HTMLInputElement>) => {\r\n this.props.on_filename_change(e.currentTarget.value);\r\n };\r\n}\r\n","import {\r\n AnimationClip,\r\n Euler,\r\n InterpolateLinear,\r\n InterpolateSmooth,\r\n KeyframeTrack,\r\n Quaternion,\r\n QuaternionKeyframeTrack,\r\n VectorKeyframeTrack,\r\n} from \"three\";\r\nimport { NjModel, NjObject } from \"../data_formats/parsing/ninja\";\r\nimport {\r\n NjInterpolation,\r\n NjKeyframeTrackType,\r\n NjMotion,\r\n} from \"../data_formats/parsing/ninja/motion\";\r\n\r\nexport const PSO_FRAME_RATE = 30;\r\n\r\nexport function create_animation_clip(\r\n nj_object: NjObject<NjModel>,\r\n nj_motion: NjMotion\r\n): AnimationClip {\r\n const interpolation =\r\n nj_motion.interpolation === NjInterpolation.Spline ? InterpolateSmooth : InterpolateLinear;\r\n\r\n const tracks: KeyframeTrack[] = [];\r\n\r\n nj_motion.motion_data.forEach((motion_data, bone_id) => {\r\n const bone = nj_object.get_bone(bone_id);\r\n if (!bone) return;\r\n\r\n motion_data.tracks.forEach(({ type, keyframes }) => {\r\n const times: number[] = [];\r\n const values: number[] = [];\r\n\r\n for (const keyframe of keyframes) {\r\n times.push(keyframe.frame / PSO_FRAME_RATE);\r\n\r\n if (type === NjKeyframeTrackType.Rotation) {\r\n const order = bone.evaluation_flags.zxy_rotation_order ? \"ZXY\" : \"ZYX\";\r\n const quat = new Quaternion().setFromEuler(\r\n new Euler(keyframe.value.x, keyframe.value.y, keyframe.value.z, order)\r\n );\r\n\r\n values.push(quat.x, quat.y, quat.z, quat.w);\r\n } else {\r\n values.push(keyframe.value.x, keyframe.value.y, keyframe.value.z);\r\n }\r\n }\r\n\r\n if (type === NjKeyframeTrackType.Rotation) {\r\n tracks.push(\r\n new QuaternionKeyframeTrack(\r\n `.bones[${bone_id}].quaternion`,\r\n times,\r\n values,\r\n interpolation\r\n )\r\n );\r\n } else {\r\n const name =\r\n type === NjKeyframeTrackType.Position\r\n ? `.bones[${bone_id}].position`\r\n : `.bones[${bone_id}].scale`;\r\n\r\n tracks.push(new VectorKeyframeTrack(name, times, values, interpolation));\r\n }\r\n });\r\n });\r\n\r\n return new AnimationClip(\r\n \"Animation\",\r\n (nj_motion.frame_count - 1) / PSO_FRAME_RATE,\r\n tracks\r\n ).optimize();\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { action, observable } from \"mobx\";\r\nimport {\r\n AnimationAction,\r\n AnimationClip,\r\n AnimationMixer,\r\n Clock,\r\n DoubleSide,\r\n Mesh,\r\n MeshLambertMaterial,\r\n SkinnedMesh,\r\n Texture,\r\n Vector3,\r\n} from \"three\";\r\nimport { Endianness } from \"../data_formats\";\r\nimport { ArrayBufferCursor } from \"../data_formats/cursor/ArrayBufferCursor\";\r\nimport { NjModel, NjObject, parse_nj, parse_xj } from \"../data_formats/parsing/ninja\";\r\nimport { NjMotion, parse_njm } from \"../data_formats/parsing/ninja/motion\";\r\nimport { parse_xvm } from \"../data_formats/parsing/ninja/texture\";\r\nimport { PlayerAnimation, PlayerModel } from \"../domain\";\r\nimport { read_file } from \"../read_file\";\r\nimport { create_animation_clip, PSO_FRAME_RATE } from \"../rendering/animation\";\r\nimport { ninja_object_to_mesh, ninja_object_to_skinned_mesh } from \"../rendering/models\";\r\nimport { xvm_to_textures } from \"../rendering/textures\";\r\nimport { get_player_animation_data, get_player_data } from \"./binary_assets\";\r\n\r\nconst logger = Logger.get(\"stores/ModelViewerStore\");\r\nconst nj_object_cache: Map<string, Promise<NjObject<NjModel>>> = new Map();\r\nconst nj_motion_cache: Map<number, Promise<NjMotion>> = new Map();\r\n\r\nclass ModelViewerStore {\r\n readonly models: PlayerModel[] = [\r\n new PlayerModel(\"HUmar\", 1, 10, new Set([6])),\r\n new PlayerModel(\"HUnewearl\", 1, 10, new Set()),\r\n new PlayerModel(\"HUcast\", 5, 0, new Set()),\r\n new PlayerModel(\"HUcaseal\", 5, 0, new Set()),\r\n new PlayerModel(\"RAmar\", 1, 10, new Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])),\r\n new PlayerModel(\"RAmarl\", 1, 10, new Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])),\r\n new PlayerModel(\"RAcast\", 5, 0, new Set()),\r\n new PlayerModel(\"RAcaseal\", 5, 0, new Set()),\r\n new PlayerModel(\"FOmar\", 1, 10, new Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])),\r\n new PlayerModel(\"FOmarl\", 1, 10, new Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])),\r\n new PlayerModel(\"FOnewm\", 1, 10, new Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])),\r\n new PlayerModel(\"FOnewearl\", 1, 10, new Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])),\r\n ];\r\n readonly animations: PlayerAnimation[] = new Array(572)\r\n .fill(undefined)\r\n .map((_, i) => new PlayerAnimation(i, `Animation ${i + 1}`));\r\n\r\n readonly clock = new Clock();\r\n\r\n @observable.ref current_player_model?: PlayerModel;\r\n @observable.ref current_model?: NjObject<NjModel>;\r\n @observable.ref current_bone_count: number = 0;\r\n @observable.ref current_obj3d?: Mesh;\r\n\r\n @observable.ref animation?: {\r\n player_animation?: PlayerAnimation;\r\n mixer: AnimationMixer;\r\n clip: AnimationClip;\r\n action: AnimationAction;\r\n };\r\n @observable animation_playing: boolean = false;\r\n @observable animation_frame_rate: number = PSO_FRAME_RATE;\r\n @observable animation_frame: number = 0;\r\n @observable animation_frame_count: number = 0;\r\n\r\n private has_skeleton = false;\r\n @observable show_skeleton: boolean = false;\r\n\r\n set_animation_frame_rate = action(\"set_animation_frame_rate\", (rate: number) => {\r\n if (this.animation) {\r\n this.animation.mixer.timeScale = rate / PSO_FRAME_RATE;\r\n this.animation_frame_rate = rate;\r\n }\r\n });\r\n\r\n set_animation_frame = action(\"set_animation_frame\", (frame: number) => {\r\n if (this.animation) {\r\n const frame_count = this.animation_frame_count;\r\n if (frame > frame_count) frame = 1;\r\n if (frame < 1) frame = frame_count;\r\n this.animation.action.time = (frame - 1) / PSO_FRAME_RATE;\r\n this.animation_frame = frame;\r\n }\r\n });\r\n\r\n load_model = async (model: PlayerModel) => {\r\n const object = await this.get_player_ninja_object(model);\r\n this.set_model(object, true, model);\r\n // Ignore the bones from the head parts.\r\n this.current_bone_count = 64;\r\n };\r\n\r\n load_animation = async (animation: PlayerAnimation) => {\r\n const nj_motion = await this.get_nj_motion(animation);\r\n\r\n if (this.current_model) {\r\n this.set_animation(create_animation_clip(this.current_model, nj_motion), animation);\r\n }\r\n };\r\n\r\n // TODO: notify user of problems.\r\n load_file = async (file: File) => {\r\n try {\r\n const buffer = await read_file(file);\r\n const cursor = new ArrayBufferCursor(buffer, Endianness.Little);\r\n\r\n if (file.name.endsWith(\".nj\")) {\r\n const model = parse_nj(cursor)[0];\r\n this.set_model(model, true);\r\n } else if (file.name.endsWith(\".xj\")) {\r\n const model = parse_xj(cursor)[0];\r\n this.set_model(model, false);\r\n } else if (file.name.endsWith(\".njm\")) {\r\n if (this.current_model) {\r\n const njm = parse_njm(cursor, this.current_bone_count);\r\n this.set_animation(create_animation_clip(this.current_model, njm));\r\n }\r\n } else if (file.name.endsWith(\".xvm\")) {\r\n if (this.current_model) {\r\n const xvm = parse_xvm(cursor);\r\n this.set_textures(xvm_to_textures(xvm));\r\n }\r\n } else {\r\n logger.error(`Unknown file extension in filename \"${file.name}\".`);\r\n }\r\n } catch (e) {\r\n logger.error(\"Couldn't read file.\", e);\r\n }\r\n };\r\n\r\n pause_animation = action(\"pause_animation\", () => {\r\n if (this.animation) {\r\n this.animation.action.paused = true;\r\n this.animation_playing = false;\r\n this.clock.stop();\r\n }\r\n });\r\n\r\n toggle_animation_playing = action(\"toggle_animation_playing\", () => {\r\n if (this.animation) {\r\n this.animation.action.paused = !this.animation.action.paused;\r\n this.animation_playing = !this.animation.action.paused;\r\n\r\n if (this.animation_playing) {\r\n this.clock.start();\r\n } else {\r\n this.clock.stop();\r\n }\r\n }\r\n });\r\n\r\n update_animation_frame = action(\"update_animation_frame\", () => {\r\n if (this.animation && this.animation_playing) {\r\n const time = this.animation.action.time;\r\n this.animation_frame = Math.round(time * PSO_FRAME_RATE) + 1;\r\n }\r\n });\r\n\r\n set_animation = action(\"set_animation\", (clip: AnimationClip, animation?: PlayerAnimation) => {\r\n if (!this.current_obj3d || !(this.current_obj3d instanceof SkinnedMesh)) return;\r\n\r\n let mixer: AnimationMixer;\r\n\r\n if (this.animation) {\r\n this.animation.mixer.stopAllAction();\r\n mixer = this.animation.mixer;\r\n } else {\r\n mixer = new AnimationMixer(this.current_obj3d);\r\n }\r\n\r\n this.animation = {\r\n player_animation: animation,\r\n mixer,\r\n clip,\r\n action: mixer.clipAction(clip),\r\n };\r\n\r\n this.clock.start();\r\n this.animation.action.play();\r\n this.animation_playing = true;\r\n this.animation_frame_count = Math.round(PSO_FRAME_RATE * clip.duration) + 1;\r\n });\r\n\r\n private set_model = action(\r\n \"set_model\",\r\n (model: NjObject<NjModel>, skeleton: boolean, player_model?: PlayerModel) => {\r\n if (this.current_obj3d && this.animation) {\r\n this.animation.mixer.stopAllAction();\r\n this.animation.mixer.uncacheRoot(this.current_obj3d);\r\n this.animation = undefined;\r\n }\r\n\r\n this.current_player_model = player_model;\r\n this.current_model = model;\r\n this.current_bone_count = model.bone_count();\r\n this.has_skeleton = skeleton;\r\n\r\n this.set_obj3d();\r\n }\r\n );\r\n\r\n private add_to_bone(\r\n object: NjObject<NjModel>,\r\n head_part: NjObject<NjModel>,\r\n bone_id: number\r\n ): void {\r\n const bone = object.get_bone(bone_id);\r\n\r\n if (bone) {\r\n bone.evaluation_flags.hidden = false;\r\n bone.evaluation_flags.break_child_trace = false;\r\n bone.children.push(head_part);\r\n }\r\n }\r\n\r\n private async get_player_ninja_object(model: PlayerModel): Promise<NjObject<NjModel>> {\r\n let ninja_object = nj_object_cache.get(model.name);\r\n\r\n if (ninja_object) {\r\n return ninja_object;\r\n } else {\r\n ninja_object = this.get_all_assets(model);\r\n nj_object_cache.set(model.name, ninja_object);\r\n return ninja_object;\r\n }\r\n }\r\n\r\n private async get_all_assets(model: PlayerModel): Promise<NjObject<NjModel>> {\r\n const body_data = await get_player_data(model.name, \"Body\");\r\n const body = parse_nj(new ArrayBufferCursor(body_data, Endianness.Little))[0];\r\n\r\n if (!body) {\r\n throw new Error(`Couldn't parse body for player class ${model.name}.`);\r\n }\r\n\r\n const head_data = await get_player_data(model.name, \"Head\", 0);\r\n const head = parse_nj(new ArrayBufferCursor(head_data, Endianness.Little))[0];\r\n\r\n if (head) {\r\n this.add_to_bone(body, head, 59);\r\n }\r\n\r\n if (model.hair_styles_count > 0) {\r\n const hair_data = await get_player_data(model.name, \"Hair\", 0);\r\n const hair = parse_nj(new ArrayBufferCursor(hair_data, Endianness.Little))[0];\r\n\r\n if (hair) {\r\n this.add_to_bone(body, hair, 59);\r\n }\r\n\r\n if (model.hair_styles_with_accessory.has(0)) {\r\n const accessory_data = await get_player_data(model.name, \"Accessory\", 0);\r\n const accessory = parse_nj(\r\n new ArrayBufferCursor(accessory_data, Endianness.Little)\r\n )[0];\r\n\r\n if (accessory) {\r\n this.add_to_bone(body, accessory, 59);\r\n }\r\n }\r\n }\r\n\r\n return body;\r\n }\r\n\r\n private async get_nj_motion(animation: PlayerAnimation): Promise<NjMotion> {\r\n let nj_motion = nj_motion_cache.get(animation.id);\r\n\r\n if (nj_motion) {\r\n return nj_motion;\r\n } else {\r\n nj_motion = get_player_animation_data(animation.id).then(motion_data =>\r\n parse_njm(\r\n new ArrayBufferCursor(motion_data, Endianness.Little),\r\n this.current_bone_count\r\n )\r\n );\r\n\r\n nj_motion_cache.set(animation.id, nj_motion);\r\n return nj_motion;\r\n }\r\n }\r\n\r\n private set_textures = action(\"set_textures\", (textures: Texture[]) => {\r\n this.set_obj3d(textures);\r\n });\r\n\r\n private set_obj3d = (textures?: Texture[]) => {\r\n if (this.current_model) {\r\n let mesh: Mesh;\r\n let bb_size = new Vector3();\r\n\r\n const materials =\r\n textures &&\r\n textures.map(\r\n tex =>\r\n new MeshLambertMaterial({\r\n skinning: this.has_skeleton,\r\n map: tex,\r\n side: DoubleSide,\r\n alphaTest: 0.5,\r\n })\r\n );\r\n\r\n if (this.has_skeleton) {\r\n mesh = ninja_object_to_skinned_mesh(this.current_model, materials);\r\n } else {\r\n mesh = ninja_object_to_mesh(this.current_model, materials);\r\n }\r\n\r\n mesh.geometry.boundingBox.getSize(bb_size);\r\n mesh.translateY(-bb_size.y / 2);\r\n this.current_obj3d = mesh;\r\n }\r\n };\r\n}\r\n\r\nexport const model_viewer_store = new ModelViewerStore();\r\n","import { autorun } from \"mobx\";\r\nimport { Object3D, PerspectiveCamera, SkeletonHelper, Vector3 } from \"three\";\r\nimport { model_viewer_store } from \"../stores/ModelViewerStore\";\r\nimport { Renderer } from \"./Renderer\";\r\n\r\nlet renderer: ModelRenderer | undefined;\r\n\r\nexport function get_model_renderer(): ModelRenderer {\r\n if (!renderer) renderer = new ModelRenderer();\r\n return renderer;\r\n}\r\n\r\nexport class ModelRenderer extends Renderer<PerspectiveCamera> {\r\n private model?: Object3D;\r\n private skeleton_helper?: SkeletonHelper;\r\n\r\n constructor() {\r\n super(new PerspectiveCamera(75, 1, 1, 200));\r\n\r\n autorun(() => {\r\n this.set_model(model_viewer_store.current_obj3d);\r\n\r\n const show_skeleton = model_viewer_store.show_skeleton;\r\n\r\n if (this.skeleton_helper) {\r\n this.skeleton_helper.visible = show_skeleton;\r\n this.schedule_render();\r\n }\r\n\r\n if (model_viewer_store.animation) {\r\n this.schedule_render();\r\n }\r\n\r\n if (!model_viewer_store.animation_playing) {\r\n // Reference animation_frame here to make sure we render when the user sets the frame manually.\r\n model_viewer_store.animation_frame;\r\n this.schedule_render();\r\n }\r\n });\r\n }\r\n\r\n set_size(width: number, height: number): void {\r\n this.camera.aspect = width / height;\r\n this.camera.updateProjectionMatrix();\r\n super.set_size(width, height);\r\n }\r\n\r\n protected render(): void {\r\n if (model_viewer_store.animation) {\r\n model_viewer_store.animation.mixer.update(model_viewer_store.clock.getDelta());\r\n model_viewer_store.update_animation_frame();\r\n }\r\n\r\n this.light_holder.quaternion.copy(this.camera.quaternion);\r\n super.render();\r\n\r\n if (model_viewer_store.animation && !model_viewer_store.animation.action.paused) {\r\n this.schedule_render();\r\n }\r\n }\r\n\r\n private set_model(model?: Object3D): void {\r\n if (this.model !== model) {\r\n if (this.model) {\r\n this.scene.remove(this.model);\r\n this.scene.remove(this.skeleton_helper!);\r\n this.skeleton_helper = undefined;\r\n }\r\n\r\n if (model) {\r\n this.scene.add(model);\r\n this.skeleton_helper = new SkeletonHelper(model);\r\n this.skeleton_helper.visible = model_viewer_store.show_skeleton;\r\n (this.skeleton_helper.material as any).linewidth = 3;\r\n this.scene.add(this.skeleton_helper);\r\n this.reset_camera(new Vector3(0, 10, 20), new Vector3(0, 0, 0));\r\n }\r\n\r\n this.model = model;\r\n this.schedule_render();\r\n }\r\n }\r\n}\r\n","import React, { Component, ReactNode } from \"react\";\r\nimport { model_viewer_store } from \"../../../stores/ModelViewerStore\";\r\nimport \"./AnimationSelectionComponent.less\";\r\nimport { observer } from \"mobx-react\";\r\n\r\n@observer\r\nexport class AnimationSelectionComponent extends Component {\r\n render(): ReactNode {\r\n return (\r\n <section className=\"v-m-AnimationSelectionComponent\">\r\n <ul>\r\n {model_viewer_store.animations.map(animation => {\r\n const selected =\r\n model_viewer_store.animation &&\r\n model_viewer_store.animation.player_animation &&\r\n model_viewer_store.animation.player_animation.id === animation.id;\r\n\r\n return (\r\n <li\r\n key={animation.id}\r\n className={selected ? \"selected\" : undefined}\r\n onClick={() => model_viewer_store.load_animation(animation)}\r\n >\r\n {animation.name}\r\n </li>\r\n );\r\n })}\r\n </ul>\r\n </section>\r\n );\r\n }\r\n}\r\n","import { List } from \"antd\";\r\nimport React, { Component, ReactNode } from \"react\";\r\nimport { model_viewer_store } from \"../../../stores/ModelViewerStore\";\r\nimport \"./ModelSelectionComponent.less\";\r\n\r\nexport class ModelSelectionComponent extends Component {\r\n render(): ReactNode {\r\n return (\r\n <section className=\"v-m-ModelSelectionComponent\">\r\n <List\r\n itemLayout=\"horizontal\"\r\n dataSource={model_viewer_store.models}\r\n size=\"small\"\r\n renderItem={model => {\r\n const selected = model_viewer_store.current_player_model === model;\r\n\r\n return (\r\n <List.Item onClick={() => model_viewer_store.load_model(model)}>\r\n <List.Item.Meta\r\n title={\r\n <span\r\n className={\r\n \"v-m-ModelSelectionComponent-model\" +\r\n (selected ? \" selected\" : \"\")\r\n }\r\n >\r\n {model.name}\r\n </span>\r\n }\r\n />\r\n </List.Item>\r\n );\r\n }}\r\n />\r\n </section>\r\n );\r\n }\r\n}\r\n","import Logger from \"js-logger\";\r\nimport { autorun } from \"mobx\";\r\nimport {\r\n Mesh,\r\n MeshBasicMaterial,\r\n OrthographicCamera,\r\n PlaneGeometry,\r\n Texture,\r\n Vector2,\r\n Vector3,\r\n} from \"three\";\r\nimport { Xvm } from \"../data_formats/parsing/ninja/texture\";\r\nimport { texture_viewer_store } from \"../stores/TextureViewerStore\";\r\nimport { Renderer } from \"./Renderer\";\r\nimport { xvm_texture_to_texture } from \"./textures\";\r\n\r\nconst logger = Logger.get(\"rendering/TextureRenderer\");\r\n\r\nlet renderer: TextureRenderer | undefined;\r\n\r\nexport function get_texture_renderer(): TextureRenderer {\r\n if (!renderer) renderer = new TextureRenderer();\r\n return renderer;\r\n}\r\n\r\nexport class TextureRenderer extends Renderer<OrthographicCamera> {\r\n private quad_meshes: Mesh[] = [];\r\n\r\n constructor() {\r\n super(new OrthographicCamera(-400, 400, 300, -300, 1, 10));\r\n\r\n this.controls.enableRotate = false;\r\n\r\n autorun(() => {\r\n this.scene.remove(...this.quad_meshes);\r\n\r\n const xvm = texture_viewer_store.current_xvm;\r\n\r\n if (xvm) {\r\n this.render_textures(xvm);\r\n }\r\n\r\n this.reset_camera(new Vector3(0, 0, 5), new Vector3());\r\n this.schedule_render();\r\n });\r\n }\r\n\r\n set_size(width: number, height: number): void {\r\n this.camera.left = -Math.floor(width / 2);\r\n this.camera.right = Math.ceil(width / 2);\r\n this.camera.top = Math.floor(height / 2);\r\n this.camera.bottom = -Math.ceil(height / 2);\r\n this.camera.updateProjectionMatrix();\r\n super.set_size(width, height);\r\n }\r\n\r\n private render_textures = (xvm: Xvm) => {\r\n let total_width = 10 * (xvm.textures.length - 1); // 10px spacing between textures.\r\n let total_height = 0;\r\n\r\n for (const tex of xvm.textures) {\r\n total_width += tex.width;\r\n total_height = Math.max(total_height, tex.height);\r\n }\r\n\r\n let x = -Math.floor(total_width / 2);\r\n const y = -Math.floor(total_height / 2);\r\n\r\n for (const tex of xvm.textures) {\r\n let tex_3js: Texture | undefined;\r\n\r\n try {\r\n tex_3js = xvm_texture_to_texture(tex);\r\n } catch (e) {\r\n logger.warn(\"Couldn't convert XVM texture.\", e);\r\n }\r\n\r\n const quad_mesh = new Mesh(\r\n this.create_quad(\r\n x,\r\n y + Math.floor((total_height - tex.height) / 2),\r\n tex.width,\r\n tex.height\r\n ),\r\n tex_3js\r\n ? new MeshBasicMaterial({\r\n map: tex_3js,\r\n transparent: true,\r\n })\r\n : new MeshBasicMaterial({\r\n color: 0xff00ff,\r\n })\r\n );\r\n\r\n this.quad_meshes.push(quad_mesh);\r\n this.scene.add(quad_mesh);\r\n\r\n x += 10 + tex.width;\r\n }\r\n };\r\n\r\n private create_quad(x: number, y: number, width: number, height: number): PlaneGeometry {\r\n const quad = new PlaneGeometry(width, height, 1, 1);\r\n quad.faceVertexUvs = [\r\n [\r\n [new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 0)],\r\n [new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0)],\r\n ],\r\n ];\r\n quad.translate(x + width / 2, y + height / 2, -5);\r\n return quad;\r\n }\r\n}\r\n","import { Button, InputNumber, Switch, Upload } from \"antd\";\r\nimport { UploadChangeParam } from \"antd/lib/upload\";\r\nimport { UploadFile } from \"antd/lib/upload/interface\";\r\nimport { observer } from \"mobx-react\";\r\nimport React, { Component, ReactNode } from \"react\";\r\nimport { model_viewer_store } from \"../../../stores/ModelViewerStore\";\r\nimport { AnimationSelectionComponent } from \"./AnimationSelectionComponent\";\r\nimport { ModelSelectionComponent } from \"./ModelSelectionComponent\";\r\nimport \"./ModelViewerComponent.less\";\r\nimport { get_model_renderer } from \"../../../rendering/ModelRenderer\";\r\nimport { RendererComponent } from \"../../RendererComponent\";\r\n\r\n@observer\r\nexport class ModelViewerComponent extends Component {\r\n componentDidMount(): void {\r\n if (!model_viewer_store.current_model) {\r\n model_viewer_store.load_model(model_viewer_store.models[5]);\r\n }\r\n }\r\n\r\n render(): ReactNode {\r\n return (\r\n <div className=\"v-m-ModelViewerComponent\">\r\n <Toolbar />\r\n <div className=\"v-m-ModelViewerComponent-main\">\r\n <ModelSelectionComponent />\r\n <AnimationSelectionComponent />\r\n <RendererComponent\r\n renderer={get_model_renderer()}\r\n on_will_unmount={model_viewer_store.pause_animation}\r\n />\r\n </div>\r\n </div>\r\n );\r\n }\r\n}\r\n\r\n@observer\r\nclass Toolbar extends Component {\r\n state = {\r\n filename: undefined,\r\n };\r\n\r\n render(): ReactNode {\r\n return (\r\n <div className=\"v-m-ModelViewerComponent-toolbar\">\r\n <Upload\r\n accept=\".nj, .njm, .xj, .xvm\"\r\n showUploadList={false}\r\n onChange={this.load_file}\r\n // Make sure it doesn't do a POST:\r\n customRequest={() => false}\r\n >\r\n <Button icon=\"file\">{this.state.filename || \"Open file...\"}</Button>\r\n </Upload>\r\n {model_viewer_store.animation && (\r\n <>\r\n <Button\r\n icon={model_viewer_store.animation_playing ? \"pause\" : \"caret-right\"}\r\n onClick={model_viewer_store.toggle_animation_playing}\r\n >\r\n {model_viewer_store.animation_playing\r\n ? \"Pause animation\"\r\n : \"Play animation\"}\r\n </Button>\r\n <div className=\"group\">\r\n <span>Frame rate:</span>\r\n <InputNumber\r\n value={model_viewer_store.animation_frame_rate}\r\n onChange={value =>\r\n model_viewer_store.set_animation_frame_rate(value || 0)\r\n }\r\n min={1}\r\n step={1}\r\n />\r\n </div>\r\n <div className=\"group\">\r\n <span>Frame:</span>\r\n <InputNumber\r\n value={model_viewer_store.animation_frame}\r\n onChange={value =>\r\n model_viewer_store.set_animation_frame(value || 0)\r\n }\r\n step={1}\r\n />\r\n <span>/ {model_viewer_store.animation_frame_count}</span>\r\n </div>\r\n </>\r\n )}\r\n <div className=\"group\">\r\n <span>Show skeleton:</span>\r\n <Switch\r\n checked={model_viewer_store.show_skeleton}\r\n onChange={value => (model_viewer_store.show_skeleton = value)}\r\n />\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n private load_file = (info: UploadChangeParam<UploadFile>) => {\r\n if (info.file.originFileObj) {\r\n this.setState({ filename: info.file.name });\r\n model_viewer_store.load_file(info.file.originFileObj as File);\r\n }\r\n };\r\n}\r\n","import { observable } from \"mobx\";\r\nimport { Xvm, parse_xvm } from \"../data_formats/parsing/ninja/texture\";\r\nimport { ArrayBufferCursor } from \"../data_formats/cursor/ArrayBufferCursor\";\r\nimport { read_file } from \"../read_file\";\r\nimport { Endianness } from \"../data_formats\";\r\nimport Logger from \"js-logger\";\r\n\r\nconst logger = Logger.get(\"stores/TextureViewerStore\");\r\n\r\nclass TextureViewStore {\r\n @observable.ref current_xvm?: Xvm;\r\n\r\n // TODO: notify user of problems.\r\n load_file = async (file: File) => {\r\n try {\r\n const buffer = await read_file(file);\r\n this.current_xvm = parse_xvm(new ArrayBufferCursor(buffer, Endianness.Little));\r\n } catch (e) {\r\n logger.error(\"Couldn't read file.\", e);\r\n }\r\n };\r\n}\r\n\r\nexport const texture_viewer_store = new TextureViewStore();\r\n","import { Button, Upload } from \"antd\";\r\nimport { UploadChangeParam, UploadFile } from \"antd/lib/upload/interface\";\r\nimport { observer } from \"mobx-react\";\r\nimport React, { Component, ReactNode } from \"react\";\r\nimport { get_texture_renderer } from \"../../../rendering/TextureRenderer\";\r\nimport { texture_viewer_store } from \"../../../stores/TextureViewerStore\";\r\nimport { RendererComponent } from \"../../RendererComponent\";\r\nimport \"./TextureViewerComponent.less\";\r\n\r\nexport class TextureViewerComponent extends Component {\r\n render(): ReactNode {\r\n return (\r\n <section className=\"v-t-TextureViewerComponent\">\r\n <Toolbar />\r\n <RendererComponent\r\n renderer={get_texture_renderer()}\r\n className={\"v-t-TextureViewerComponent-renderer\"}\r\n />\r\n </section>\r\n );\r\n }\r\n}\r\n\r\n@observer\r\nclass Toolbar extends Component {\r\n state = {\r\n filename: undefined,\r\n };\r\n\r\n render(): ReactNode {\r\n return (\r\n <div className=\"v-t-TextureViewerComponent-toolbar\">\r\n <Upload\r\n accept=\".xvm\"\r\n showUploadList={false}\r\n onChange={this.load_file}\r\n // Make sure it doesn't do a POST:\r\n customRequest={() => false}\r\n >\r\n <Button icon=\"file\">{this.state.filename || \"Open file...\"}</Button>\r\n </Upload>\r\n </div>\r\n );\r\n }\r\n\r\n private load_file = (info: UploadChangeParam<UploadFile>) => {\r\n if (info.file.originFileObj) {\r\n this.setState({ filename: info.file.name });\r\n texture_viewer_store.load_file(info.file.originFileObj as File);\r\n }\r\n };\r\n}\r\n","import { Menu, Select } from \"antd\";\r\nimport { ClickParam } from \"antd/lib/menu\";\r\nimport { observer } from \"mobx-react\";\r\nimport React, { ReactNode } from \"react\";\r\nimport { Server } from \"../domain\";\r\nimport \"./ApplicationComponent.less\";\r\nimport { DpsCalcComponent } from \"./dps_calc/DpsCalcComponent\";\r\nimport { with_error_boundary } from \"./ErrorBoundary\";\r\nimport { HuntOptimizerComponent } from \"./hunt_optimizer/HuntOptimizerComponent\";\r\nimport { QuestEditorComponent } from \"./quest_editor/QuestEditorComponent\";\r\nimport { ViewerComponent } from \"./viewer/ViewerComponent\";\r\n\r\nconst Viewer = with_error_boundary(ViewerComponent);\r\nconst QuestEditor = with_error_boundary(QuestEditorComponent);\r\nconst HuntOptimizer = with_error_boundary(HuntOptimizerComponent);\r\nconst DpsCalc = with_error_boundary(DpsCalcComponent);\r\n\r\n@observer\r\nexport class ApplicationComponent extends React.Component {\r\n state = { tool: this.init_tool() };\r\n\r\n render(): ReactNode {\r\n let tool_component;\r\n\r\n switch (this.state.tool) {\r\n case \"viewer\":\r\n tool_component = <Viewer />;\r\n break;\r\n case \"quest_editor\":\r\n tool_component = <QuestEditor />;\r\n break;\r\n case \"hunt_optimizer\":\r\n tool_component = <HuntOptimizer />;\r\n break;\r\n case \"dps_calc\":\r\n tool_component = <DpsCalc />;\r\n break;\r\n }\r\n\r\n return (\r\n <div className=\"ApplicationComponent\">\r\n <div className=\"ApplicationComponent-navbar\">\r\n <h1 className=\"ApplicationComponent-heading\">Phantasmal World</h1>\r\n <Menu\r\n className=\"ApplicationComponent-heading-menu\"\r\n onClick={this.menu_clicked}\r\n selectedKeys={[this.state.tool]}\r\n mode=\"horizontal\"\r\n >\r\n <Menu.Item key=\"viewer\">\r\n Viewer<sup className=\"ApplicationComponent-beta\">(Beta)</sup>\r\n </Menu.Item>\r\n <Menu.Item key=\"quest_editor\">\r\n Quest Editor<sup className=\"ApplicationComponent-beta\">(Beta)</sup>\r\n </Menu.Item>\r\n <Menu.Item key=\"hunt_optimizer\">Hunt Optimizer</Menu.Item>\r\n {/* <Menu.Item key=\"dpsCalc\">\r\n DPS Calculator\r\n </Menu.Item> */}\r\n </Menu>\r\n <div className=\"ApplicationComponent-server-select\">\r\n <span>Server:</span>\r\n <Select defaultValue={Server.Ephinea} style={{ width: 120 }}>\r\n <Select.Option value={Server.Ephinea}>{Server.Ephinea}</Select.Option>\r\n </Select>\r\n </div>\r\n </div>\r\n <div className=\"ApplicationComponent-main\">{tool_component}</div>\r\n </div>\r\n );\r\n }\r\n\r\n private menu_clicked = (e: ClickParam) => {\r\n this.setState({ tool: e.key });\r\n };\r\n\r\n private init_tool(): string {\r\n const param = window.location.search\r\n .slice(1)\r\n .split(\"&\")\r\n .find(p => p.startsWith(\"tool=\"));\r\n return param ? param.slice(5) : \"viewer\";\r\n }\r\n}\r\n","import React, { Component, ReactNode } from \"react\";\r\nimport { Tabs } from \"antd\";\r\nimport { ModelViewerComponent } from \"./models/ModelViewerComponent\";\r\nimport \"./ViewerComponent.less\";\r\nimport { TextureViewerComponent } from \"./textures/TextureViewerComponent\";\r\n\r\nexport class ViewerComponent extends Component {\r\n render(): ReactNode {\r\n return (\r\n <section className=\"v-ViewerComponent\">\r\n <Tabs type=\"card\">\r\n <Tabs.TabPane tab=\"Models\" key=\"models\">\r\n <ModelViewerComponent />\r\n </Tabs.TabPane>\r\n <Tabs.TabPane tab=\"Textures\" key=\"textures\">\r\n <TextureViewerComponent />\r\n </Tabs.TabPane>\r\n </Tabs>\r\n </section>\r\n );\r\n }\r\n}\r\n","import React from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport Logger from \"js-logger\";\r\nimport \"./index.less\";\r\nimport { ApplicationComponent } from \"./ui/ApplicationComponent\";\r\nimport \"react-virtualized/styles.css\";\r\nimport \"react-select/dist/react-select.css\";\r\nimport \"react-virtualized-select/styles.css\";\r\n\r\nLogger.useDefaults({\r\n defaultLevel: (Logger as any)[process.env[\"REACT_APP_LOG_LEVEL\"] || \"OFF\"],\r\n});\r\n\r\nReactDOM.render(<ApplicationComponent />, document.getElementById(\"phantasmal-world-root\"));\r\n"],"sourceRoot":""} |